[SciPy-User] cumtrapz

Nils Wagner nwagner at iam.uni-stuttgart.de
Thu Nov 4 09:29:21 EDT 2010


On Thu, 4 Nov 2010 08:20:27 -0500
  Ryan May <rmay31 at gmail.com> wrote:
> 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
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
  
Hi Ryan,

is there an integration rule in scipy that preserves the 
length of the input array ?

I would to integrate an acceleration signal twice to 
obtain the displacement.

v = \int a dt = \int dv
u = \int v dt  = \int du

Nils



More information about the SciPy-User mailing list