# solve complex ODE (like f'(x) = I*f(x)) numerically

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi!

i want so solve several complex valued (non-linear) ode's. I tried desolve_rk4. I got the error "Expecting a number when the initial state is replaced in the equations, but instead found: 0.5%i" in my equations, but also in the more simple one in the title. I can solve the equation f'(x) = If(x) symbolically, of course, but the equations i am interested in i want to solve numerically. So my question is (and i did not find an answer by reading the documentation or the google-results): Is it me how cannot pose the problem in a way that sage can solve it, or is it sage that cannot solve the problem.

Thank you for helping,

Max

edit retag close merge delete

Sort by ยป oldest newest most voted

I can reproduce the error you got.

According to this question, it seems that the best solution is to transform your complex functions into 2 real functions.

more

Thank you very much for your answer. The link you posted shows me how it should be possible to solve my problem. When/if i solve it i will post my solution here.

( 2013-09-28 17:04:20 +0200 )edit

This post is a wiki. Anyone with karma >750 is welcome to improve it.

python's scipy.integrate.ode handles solution of variable coefficient complex valued ODE systems by means of the zvode fortran routine. see http://docs.scipy.org/doc/scipy/refer.... you can easily integrate your sage function in python

more