[SciPy-user] integrating a system of differential equations

Joshua Stults joshua.stults@gmail....
Wed May 27 10:46:05 CDT 2009


Look at the example in the documentation:

help(scipy.integrate.ode)

That should give you an idea of how to define your system's function,
it returns a vector since you are trying to integrate a system of
ODEs.

The Jacobian is a matrix of partial derivatives of your system
function, call it f, with respect to all of your variables:

J = df_i/dx_j
J = [ df_1/dx_1  df_1/dx_2 ... df_1/dx_n]
     [ df_2/dx_1  df_2/dx_2 ... df_2/dx_n]
     [ ...                                           ... ]
     [ df_n/dx_1  df_n/dx_2 ... df_n/dx_n]

I'm assuming you are integrating something like:

dy/dt = f(x)


On Wed, May 27, 2009 at 11:30 AM, ms <devicerandom@gmail.com> wrote:
> Hi Josh,
>
> Joshua Stults ha scritto:
>> Massimo,
>>
>> If you're having stability problems, usually going to an implicit
>> integration scheme will help.  Looks like the scipy.integrate.ode
>> class lets you choose an integration scheme based on backward
>> difference formulas, which should be unconditionally stable.
>
> Oh, good.
>
>>You'll
>> just need to supply a system function and a Jacobian function.
>
> This is quite unclear to me. That is:
> - A single function should calculate the whole system? This is what is
> done of course, with each dy(j)/dt saved in a vector at index j for
> every j-th equation; but I am not sure it is doable in the way ode wants
> it -because I really don't understand how ode wants stuff.
>
> - As for the Jacobian, I'm lost. If it is the matrix described here:
>
> http://en.wikipedia.org/wiki/Jacobian_matrix
>
> I don't understand, looks redundant -it seems in my case it will be a
> vector of all my derivatives as a function of t (there are no other
> variables I'm integrating) -but isn't it the output of the above
> function? But it is all really new stuff for me, sorry.
>
> thanks,
> m.
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



-- 
Joshua Stults
Website: http://j-stults.blogspot.com


More information about the SciPy-user mailing list