Compute tangent element-wise.
SciPhp\NdArray
NdArray::tan(
array|NdArray
$m
)
$m
The new SciPhp\NdArray The tangent values of each element of m. This is a scalar if m is a scalar.
use SciPhp\NumPhp as np;
$x = np::ar([
[0 , M_PI_2 / 2, - M_PI / 4],
[M_PI / 4, M_PI_2 / 2, 0 ]
]);
$y = np::tan($x);
echo "x=\n$x", "y=\n$y";
The above example will output:
x= [[0 0.78539816339745 -0.78539816339745] [0.78539816339745 0.78539816339745 0 ]] y= [[0 1 -1] [1 1 0 ]]