[SciPy-User] [SciPy-user] scipy: integration

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Feb 15 11:52:13 EST 2012


On Tue, Feb 14, 2012 at 10:25 AM, suzana8447 <k-assem84 at hotmail.com> wrote:
>
> Hello every body,
>
> I am a new user of scipy and I am facing some troubles of performing
> numerical integration.
>
> Suppose that we have a function called f(x,a,b) that we are going to
> integrate it from 0 to c.
>
> Note that a, b and c are some arrays.
>
> For example a=array([1., 0.5,3.]) , b=array([0.,1.,4.)]  c=
> array([..,..,...])
>
> By this way, I would expect that the program returns an array whereby each
> value of the array represents the integral at each term of the arrays a,b
> and c.

AFAIK

None of the integrators for functions are vectorized. So this would
always need a loop.

For lower precision, the integrators using samples have an axis
argument if you build an array for different values of the parameters
a and b.
Only cumtrapz (or using ode) can integrate for different limits simultaneously.
http://docs.scipy.org/doc/scipy/reference/integrate.html#integrating-functions-given-fixed-samples

Which version to use depends on your requirements.

Josef

>
> Thanks in advance.
>
> Best regards.
>
> --
> View this message in context: http://old.nabble.com/scipy%3A-integration-tp33322670p33322670.html
> Sent from the Scipy-User mailing list archive at Nabble.com.
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list