Create a range of values based on a step.
SciPhp\NdArray
NumPhp::arange(
mixed
$start
[,
mixed
$stop
]
[,
mixed
$step = 1
])
This range does not contain the maximum value.
$start
$stop
$step
The new SciPhp\NdArray
use SciPhp\NumPhp as np;
$x = np::arange(1, 5);
echo $x;
The above example will output:
[1 2 3 4]
use SciPhp\NumPhp as np;
$x1 = np::arange(5);
$x2 = np::arange(-5);
echo "x1\n$x1", "x2\n$x2";
The above example will output:
x1 [0 1 2 3 4] x2 [-5 -4 -3 -2 -1]
use SciPhp\NumPhp as np;
$x = np::arange(1, 2, 0.2);
echo $x;
The above example will output:
[1 1.2 1.4 1.6 1.8]
use SciPhp\NumPhp as np;
$x = np::arange(2, 1, 0.2);
echo $x;
The above example will output:
[2 1.8 1.6 1.4 1.2]