Search code examples
logarithmmaxima

How to evaluate logarithms in Maxima?


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).


Solution

  • 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