NdArray::exp

Calculate the exponential of all elements in the array.

Description

SciPhp\NdArray NdArray::exp()

Parameters

This function has no parameters.

Return Values

A SciPhp\NdArray

Examples

Example #1: Exponential of a vector

use SciPhp\NumPhp as np;

$m np::ar([01M_E])->exp();

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 $m->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