NdArray::trapz

Integrate along the given axis using the composite trapezoidal rule.

Description

float|int NdArray::trapz()

Parameters

This function has no parameters.

Return Values

A float|int

Examples

Example #1: Integrate a range

use SciPhp\NumPhp as np;

$m np::arange(05);

$r $m->trapz();

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

The above example will output:

m
[0  1  2  3  4]
r
8

See Also

  • NdArray::prod() - Documentation does NOT exist for this function
  • NdArray::sum() - Sum all elements.