NdArray::tan

Compute tangent element-wise.

Description

SciPhp\NdArray NdArray::tan()

Equivalent to $m->sin()->divide($m->cos()).

Parameters

This function has no parameters.

Return Values

The new SciPhp\NdArray The corresponding tangent values.

Examples

Example #1: Compute matrix tangent values

use SciPhp\NumPhp as np;

$x np::ar([
    [
0   M_PI_2 2, - M_PI 4], 
    [
M_PI 4M_PI_2 20   ]
]);

$y $x->tan();

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 ]]

See Also