Return the reciprocal of the argument, element-wise.
SciPhp\NdArray
NdArray::reciprocal()
This function has no parameters.
use SciPhp\NumPhp as np;
$m = np::ar([1, 2, 4, 8])->reciprocal();
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 = $m->reciprocal();
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 ]]