Following examples from here, and here I tried this:
log2(x) := log(x) / log(2);
log2(8), float;
But this doesn't give 3, instead I get log(8)/log(2)
.
You have to simplify radicals:
(%i1) log2(x) := log(x) / log(2);
log(x)
(%o1) log2(x) := ------
log(2)
(%i2) radcan(log2(8));
(%o2)
3
Another way to calculate logarithms in base 10:
You can also write in the command line: load(log10);(enter)
Then for the calculation of the decimal logarithm: log10(100);(Enter) the result is 2, and so on. To exemplify I did some calculations with log10. These results are shown in the picture below