NumPhp::log10

Return the base 10 logarithm, element-wise.

Description

SciPhp\NdArray NumPhp::log10( array|NdArray $m )

Parameters

$m
An array [1, 2, 3] or a NdArray.

Return Values

A SciPhp\NdArray

Examples

Example #1: Get base-10 logarithm of a vector

use SciPhp\NumPhp as np;

$m np::log10([1101001000]);

echo 
"m\n$m";

The above example will output:

m
[0  1  2  3]

Example #2: Get base-10 logarithm of a matrix

use SciPhp\NumPhp as np;

$m np::ar([110100])->vander();

$r np::log10($m);

echo 
"m\n$m""r\n$r";

The above example will output:

m
[[1      1      1    ]
 [100    10     1    ]
 [10000  100    1    ]]
r
[[0  0  0]
 [2  1  0]
 [4  2  0]]

See Also