Question: does Maple have trapz like function (as in Matlab)

I know it is not hard to write such a function, but can be tricky for all options. For 1D and uniform grid, it is straight forward to code it. The formula is here  https://en.wikipedia.org/wiki/Trapezoidal_rule#Uniform_grid

I was looking to see if Maple has this build-in. This is the equivalent of Matlab's trapz

I know about Student:-Calculus1:-ApproximateInt with option trapezoid. But this is not exactly the same. Matlab's trapz can accept just a list of numbers directly (the y values), or a a matrix of numbers (2D function), and applies trapezoidal rule. The default is unit spacing.

It is a simplified version of Student:-Calculus1:-ApproximateInt in a way, but I found trapz easier to use, if one has list of numbers generated before, (i.e. function values) and want to applies trapezoidal rule on it as is. It is more more convenient that way.

Here is an example from Matlab's help. Given

Y = [1 4 9 16 25];
Q = trapz(Y)

it gives 42.

One does not need to define f(x) or x=from..to  as in the case with Maple's ApproximateInt.

Matlab's trapz also supports Matrix as input not just 1D list of numbers.

Does Maple have something similar?

 

 

 

Please Wait...