NdArray::expm1

Calculate exp(element) - 1 in the input array.

Description

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

Parameters

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

Return Values

A SciPhp\NdArray

Examples

Example #1: Exponential of a vector

use SciPhp\NumPhp as np;

$m np::ar([0.00010.000010.000001])->expm1();

echo 
"m\n$m";

The above example will output:

m
[0.00010000500016667  1.0000050000167E-5   1.0000005000002E-6 ]

Example #2: Exponential of a matrix

use SciPhp\NumPhp as np;

$m np::diag([0.010.050.001]);

$r $m->expm1();

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

The above example will output:

m
[[0.1   0     0   ]
 [0     0.05  0   ]
 [0     0     0.01]]
r
[[0.10517091807565   0                  0                ]
 [0                  0.051271096376024  0                ]
 [0                  0                  0.010050167084168]]

See Also