如何计算 Maxima 中的对数?

How to evaluate logarithms in Maxima?

下面的示例来自 here, and here 我试过这个:

log2(x) := log(x) / log(2);
log2(8), float;

但这并没有给出 3,而是我得到了 log(8)/log(2)

你必须简化部首:

(%i1) log2(x) := log(x) / log(2);
                                          log(x)
(%o1)                          log2(x) := ------
                                          log(2)
(%i2) radcan(log2(8));
(%o2) 

                             3

或使用浮点数:

float(log(8)/log(2));

给出:

2.999999999999999