Return the natural logarithm, element-wise.
SciPhp\NdArray
NdArray::log(
[
int
$base
])
$base
use SciPhp\NumPhp as np;
$m = np::ar([1, M_E, M_E ** 2, M_E ** 3])->log();
echo "m\n$m";
The above example will output:
m [0 1 2 3]
use SciPhp\NumPhp as np;
$m = np::ar([1, M_E, M_E ** 2])->vander();
$r = $m->log();
echo "m\n$m", "r\n$r";
The above example will output:
m [[1 1 1 ] [7.3890560989306 2.718281828459 1 ] [54.598150033144 7.3890560989306 1 ]] r [[0 0 0] [2 1 0] [4 2 0]]
use SciPhp\NumPhp as np;
$m = np::ar([1, 100, 100 ** 2])->vander();
$r = $m->log(100);
echo "m\n$m", "r\n$r";
The above example will output:
m [[1 1 1 ] [10000 100 1 ] [100000000 10000 1 ]] r [[0 0 0] [2 1 0] [4 2 0]]