Return the reciprocal of the argument, element-wise.
SciPhp\NdArray
NumPhp::reciprocal(
array|NdArray
$m
)
Return the reciprocal of the argument, element-wise.
$m
use SciPhp\NumPhp as np;
$m = np::reciprocal([1, 2, 4, 8]);
echo "m\n$m";
The above example will output:
m [1 0.5 0.25 0.125]
use SciPhp\NumPhp as np;
$m = np::ar([1, 2, 4])->vander();
$r = np::reciprocal($m);
echo "m\n$m", "r\n$r";
The above example will output:
m [[1 1 1 ] [4 2 1 ] [16 4 1 ]] r [[1 1 1 ] [0.25 0.5 1 ] [0.0625 0.25 1 ]]