[SciPy-User] cumtrapz
Ryan May
rmay31 at gmail.com
Thu Nov 4 09:20:27 EDT 2010
On Thu, Nov 4, 2010 at 3:42 AM, Nils Wagner
<nwagner at 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