[SciPy-User] cumtrapz

Ryan May rmay31@gmail....
Thu Nov 4 08:20:27 CDT 2010


On Thu, Nov 4, 2010 at 3:42 AM, Nils Wagner
<nwagner@iam.uni-stuttgart.de> wrote:
> Hi all,
>
> cumtrapz can be used to compute the antiderivative.
>
> x = linspace(0,2*pi,200)
> y = 2*cos(2*x)
> Y = cumtrapz(y,x)
>
>
>
> len(y) = 200
> len(Y) = 199
>
> The length of the arrays y and Y differ by one. For what
> reason ?

Because when integrating using the trapezoid rule, you are forming N-1
trapezoids from N datapoints.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma


More information about the SciPy-User mailing list