[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

# 14. Logarithms

 [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

## 14.1 Definitions for Logarithms

Option variable: %e_to_numlog

Default value: `false`

When `true`, `r` some rational number, and `x` some expression, `%e^(r*log(x))` will be simplified into `x^r` . It should be noted that the `radcan` command also does this transformation, and more complicated transformations of this ilk as well. The `logcontract` command "contracts" expressions containing `log`.

Function: li [s] (z)

Represents the polylogarithm function of order s and argument z, defined by the infinite series

 ``` inf ==== k \ z Li (z) = > -- s / s ==== k k = 1 ```

`li ` is `- log (1 - z)`. `li ` and `li ` are the dilogarithm and trilogarithm functions, respectively.

When the order is 1, the polylogarithm simplifies to `- log (1 - z)`, which in turn simplifies to a numerical value if z is a real or complex floating point number or the `numer` evaluation flag is present.

When the order is 2 or 3, the polylogarithm simplifies to a numerical value if z is a real floating point number or the `numer` evaluation flag is present.

Examples:

 ```(%i1) assume (x > 0); (%o1) [x > 0] (%i2) integrate ((log (1 - t)) / t, t, 0, x); (%o2) - li (x) 2 (%i3) li  (7); (%o3) li (7) 2 (%i4) li  (7), numer; (%o4) 1.24827317833392 - 6.113257021832577 %i (%i5) li  (7); (%o5) li (7) 3 (%i6) li  (7), numer; (%o6) 1.24827317833392 - 6.113257021832577 %i (%i7) L : makelist (i / 4.0, i, 0, 8); (%o7) [0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0] (%i8) map (lambda ([x], li  (x)), L); (%o8) [0, .2676526384986274, .5822405249432515, .9784693966661848, 1.64493407, 2.190177004178597 - .7010261407036192 %i, 2.374395264042415 - 1.273806203464065 %i, 2.448686757245154 - 1.758084846201883 %i, 2.467401098097648 - 2.177586087815347 %i] (%i9) map (lambda ([x], li  (x)), L); (%o9) [0, .2584613953442624, 0.537213192678042, .8444258046482203, 1.2020569, 1.642866878950322 - .07821473130035025 %i, 2.060877505514697 - .2582419849982037 %i, 2.433418896388322 - .4919260182322965 %i, 2.762071904015935 - .7546938285978846 %i] ```
Function: log (x)

Represents the natural (base e) logarithm of x.

Maxima does not have a built-in function for the base 10 logarithm or other bases. `log10(x) := log(x) / log(10)` is a useful definition.

Simplification and evaluation of logarithms is governed by several global flags:

`logexpand` - causes `log(a^b)` to become `b*log(a)`. If it is set to `all`, `log(a*b)` will also simplify to `log(a)+log(b)`. If it is set to `super`, then `log(a/b)` will also simplify to `log(a)-log(b)` for rational numbers `a/b`, `a#1`. (`log(1/b)`, for `b` integer, always simplifies.) If it is set to `false`, all of these simplifications will be turned off.

`logsimp` - if `false` then no simplification of `%e` to a power containing `log`'s is done.

`lognumer` - if `true` then negative floating point arguments to `log` will always be converted to their absolute value before the `log` is taken. If `numer` is also `true`, then negative integer arguments to `log` will also be converted to their absolute value.

`lognegint` - if `true` implements the rule `log(-n)` -> `log(n)+%i*%pi` for `n` a positive integer.

`%e_to_numlog` - when `true`, `r` some rational number, and `x` some expression, `%e^(r*log(x))` will be simplified into `x^r` . It should be noted that the `radcan` command also does this transformation, and more complicated transformations of this ilk as well. The `logcontract` command "contracts" expressions containing `log`.

Option variable: logabs

Default value: `false`

When doing indefinite integration where logs are generated, e.g. `integrate(1/x,x)`, the answer is given in terms of `log(abs(...))` if `logabs` is `true`, but in terms of `log(...)` if `logabs` is `false`. For definite integration, the `logabs:true` setting is used, because here "evaluation" of the indefinite integral at the endpoints is often needed.

Option variable: logarc

Default value: `false`

If `true` will cause the inverse circular and hyperbolic functions to be converted into logarithmic form. `logarc(exp)` will cause this conversion for a particular expression exp without setting the switch or having to re-evaluate the expression with `ev`.

Option variable: logconcoeffp

Default value: `false`

Controls which coefficients are contracted when using `logcontract`. It may be set to the name of a predicate function of one argument. E.g. if you like to generate SQRTs, you can do ```logconcoeffp:'logconfun\$ logconfun(m):=featurep(m,integer) or ratnump(m)\$``` . Then `logcontract(1/2*log(x));` will give `log(sqrt(x))`.

Function: logcontract (expr)

Recursively scans the expression expr, transforming subexpressions of the form `a1*log(b1) + a2*log(b2) + c` into `log(ratsimp(b1^a1 * b2^a2)) + c`

 ```(%i1) 2*(a*log(x) + 2*a*log(y))\$ (%i2) logcontract(%); 2 4 (%o2) a log(x y ) ```

If you do `declare(n,integer);` then `logcontract(2*a*n*log(x));` gives `a*log(x^(2*n))`. The coefficients that "contract" in this manner are those such as the 2 and the `n` here which satisfy `featurep(coeff,integer)`. The user can control which coefficients are contracted by setting the option `logconcoeffp` to the name of a predicate function of one argument. E.g. if you like to generate SQRTs, you can do ```logconcoeffp:'logconfun\$ logconfun(m):=featurep(m,integer) or ratnump(m)\$``` . Then `logcontract(1/2*log(x));` will give `log(sqrt(x))`.

Option variable: logexpand

Default value: `true`

Causes `log(a^b)` to become `b*log(a)`. If it is set to `all`, `log(a*b)` will also simplify to `log(a)+log(b)`. If it is set to `super`, then `log(a/b)` will also simplify to `log(a)-log(b)` for rational numbers `a/b`, `a#1`. (`log(1/b)`, for integer `b`, always simplifies.) If it is set to `false`, all of these simplifications will be turned off.

Option variable: lognegint

Default value: `false`

If `true` implements the rule `log(-n)` -> `log(n)+%i*%pi` for `n` a positive integer.

Option variable: lognumer

Default value: `false`

If `true` then negative floating point arguments to `log` will always be converted to their absolute value before the `log` is taken. If `numer` is also `true`, then negative integer arguments to `log` will also be converted to their absolute value.

Option variable: logsimp

Default value: `true`

If `false` then no simplification of `%e` to a power containing `log`'s is done.

Function: plog (x)

Represents the principal branch of the complex-valued natural logarithm with `-%pi` < `carg(x)` <= `+%pi` .

 [ << ] [ >> ] [Top] [Contents] [Index] [ ? ]

This document was generated on March, 19 2006 using texi2html 1.76.