[SciPy-User] odeint

Neil Martinsen-Burrell nmb at wartburg.edu
Fri Nov 5 10:20:01 EDT 2010


On 2010-11-04 04:41 , Nils Wagner wrote:
> Is it possible to solve a dynamical system
>
> x ' = A x + r(t)             x \in R^n    x(0) = 0
>
> by odeint where the excitation r(t) is given in s a m p l
> e d form ?
>
> Should I use splrep to determine a smooth spline
> approximation before ?
>
> Any pointer would be appreciated.

That's what I would do.  You essentially want a callable object that 
approximates r(t) so you can use it in your RHS function that you pass 
to odeint.  Even something as simple as a linear interpolant should give 
adequate results.

Another possibility, depending on how well sampled your function is, is 
to do the integration at the points where you have data on r(t). 
Without getting into the details of their stability properties, linear 
multi-step methods such as Adams-Bashforth can be easily implemented to 
give high-order accurate integrations.

-Neil



More information about the SciPy-User mailing list