Create a logarithmic range with a defined number of values.
SciPhp\NdArray
NumPhp::logspace(
mixed
$start
,
mixed
$stop
[,
int
$num = 50
]
[,
bool
$endpoint = true
]
[,
mixed
$base = 10
])
$start
$stop
$num
$endpoint
$base
The new SciPhp\NdArray
use SciPhp\NumPhp as np;
$x = np::logspace(2, 5, 4);
echo $x;
The above example will output:
[100 1000 10000 100000]
use SciPhp\NumPhp as np;
$x = np::logspace(5, 2, 4);
echo $x;
The above example will output:
[100000 10000 1000 100 ]
use SciPhp\NumPhp as np;
$x = np::logspace(2, 5, 4, false);
echo $x;
The above example will output:
[100 562.34132519035 3162.2776601684 17782.794100389]
use SciPhp\NumPhp as np;
$x = np::logspace(2, 5, 4, true, 2);
echo $x;
The above example will output:
[4 8 16 32]