# [SciPy-user] odeint for calculating trajectories

Ryan May rmay31@gmail....
Tue Feb 17 11:43:04 CST 2009

```On Thu, Feb 12, 2009 at 12:16 PM, Rob Clewley <rob.clewley@gmail.com> wrote:

> > Is there a good way to use scipy.integrate.odeint to calculate
> trajectories
> > from an observed velocity field? I know you can do this when you have an
> > analytic expression for dx/dt, but in this case I have a spatial grid of
> > values for dx/dt.  The only way I've come up with is to make the function
> > passed to odeint something that will interpolate fromt the grid to the
> given
> > point.
>
>
> I don't think odeint is the right tool for this job - there is no ODE
> integration to do if you do not have an explicit function for the
> vector field. You should think of it purely as an interpolation
> problem. You have (t,x) values and (t, dx/dt) values, so this defines
> a piecewise quadratic function which has continuous *second*
> derivative everywhere (i.e. the trajectory smoothly agrees at your
> mesh points). I would use the polynomial interpolation classes that
> were recently added to scipy by Anne Archibald (search this list for
> details about it). You pass it your arrays of values and you get back
> a function that smoothly interpolates through your points. This is the
> most accurate trajectory that you can derive from this finite mesh
> vector-field.
>

I understand the idea of the curve fitting.  But I'm having trouble seeing
how to take the krogh_interpolator in scipy and apply it to a 2, or better
yet, 3 dimensional problem.  Any pointers?

Ryan

--
Ryan May