ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 19 Dec 2013 04:11:32 +0100solve complex ODE (like f'(x) = I*f(x)) numericallyhttps://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/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) = I*f(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 Fri, 27 Sep 2013 15:59:49 +0200https://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/Answer by fmonegaglia for <p>Hi!</p>
<p>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<em>%i" in my equations, but also in the more simple one in the title.
I can solve the equation f'(x) = I</em>f(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.</p>
<p>Thank you for helping,</p>
<p>Max </p>
https://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/?answer=15843#post-id-15843python'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/reference/generated/scipy.integrate.ode.html.
you can easily integrate your sage function in pythonThu, 19 Dec 2013 04:11:32 +0100https://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/?answer=15843#post-id-15843Answer by tmonteil for <p>Hi!</p>
<p>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<em>%i" in my equations, but also in the more simple one in the title.
I can solve the equation f'(x) = I</em>f(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.</p>
<p>Thank you for helping,</p>
<p>Max </p>
https://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/?answer=15495#post-id-15495I can reproduce the error you got.
According to [this question](http://ask.sagemath.org/question/1156/ode_solver-unable-to-convert-to-float), it seems that the best solution is to transform your complex functions into 2 real functions.
Fri, 27 Sep 2013 18:29:07 +0200https://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/?answer=15495#post-id-15495Comment by max for <p>I can reproduce the error you got.</p>
<p>According to <a href="http://ask.sagemath.org/question/1156/ode_solver-unable-to-convert-to-float">this question</a>, it seems that the best solution is to transform your complex functions into 2 real functions.</p>
https://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/?comment=16977#post-id-16977Thank 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. Sat, 28 Sep 2013 17:04:20 +0200https://ask.sagemath.org/question/10568/solve-complex-ode-like-fx-ifx-numerically/?comment=16977#post-id-16977