Prev Next logn

Logarithm to an Arbitrary Base
Syntax y = logn(x, Nbase)
Include: include spt\logn.oms
See Also

ARGUMENTS:
   INPUTS:
      Nbase = SCALAR, any numerical type, N>=2. Coerced to DOUBLE.
      x     = MATRIX, any numerical type, non-negative.
   RETURN: MATRIX, log base Nbase, double precision.

Description

Returns the element-by-element base-N logarithm of MATRIX input. Input x may be any positive-valued numerical type; inputs are coerced to DOUBLE before local processing. Nbase may be any positive numerical SCALAR, N>=2 Non-positive inputs will produce errors.

Example

For vectors:

O>x = {.5,1,5,10}
O>Nbase = 3
O>logn(x,Nbase)
{
-0.63093
0
1.46497
2.0959
}

For matrices:

O>A = {[.1,2],[7,11]}
O>Nbase = 3
O>logn(A,Nbase)
{
[ -2.0959 , 0.63093 ]
[ 1.77124 , 2.18266 ]
}