NumPhp::exp

Calculate the exponential of all elements 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::exp([01M_E]);

echo 
"m\n$m";

The above example will output:

m
[1                2.718281828459   15.154262241479]

Example #2: Exponential of a matrix

use SciPhp\NumPhp as np;

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

$r np::exp($m);

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

The above example will output:

m
[[0  0  0  0]
 [0  1  0  0]
 [0  0  2  0]
 [0  0  0  3]]
r
[[1                1                1                1              ]
 [1                2.718281828459   1                1              ]
 [1                1                7.3890560989307  1              ]
 [1                1                1                20.085536923188]]

See Also