NdArray::sqrt

The non-negative square-root of an array, element-wise.

Description

SciPhp\NdArray NdArray::sqrt()

Parameters

This function has no parameters.

Return Values

The new SciPhp\NdArray

Examples

Example #1: square-root of the matrix

use SciPhp\NumPhp as np;

$m np::vander([149]);

$n $m->sqrt();

echo 
"m=n\n$m""n=m*m\n$n";

The above example will output:

m=n
[[1   1   1 ]
 [16  4   1 ]
 [81  9   1 ]]
n=sqrt(m)
[[1  1  1]
 [4  2  1]
 [9  3  1]]

See Also