Return the natural logarithm, element-wise.
SciPhp\NdArray
NumPhp::log(
array|NdArray
$m
[,
int
$base
])
$m
$base
use SciPhp\NumPhp as np;
$m = np::log([1, M_E, M_E ** 2, M_E ** 3]);
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 = np::log($m);
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 = np::log($m, 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]]