1
$\begingroup$

I am quite puzzled to solve the coupled ode's numerically. Please tell me why it runs for a long time and not giving any output in mathematica. I am using NDsolve. please have a look

NDSolve[{ x'[t] == x[t]/y[t] + x[t]/z[t] - x[t]/z[t]^2, 
          y'[t] == 1 + y[t]/z[t] - (2 y[t])/z[t]^2, 
          z'[t] == -z[t] - z[t]/y[t] - (2 z[t])/y[t]^2,
          x[0] == 2,
          y[0] == 5, 
          z[0] == 7},
        {x, y, z},
        {t, -10, 10},
        MaxSteps -> Infinity]
$\endgroup$
1
  • $\begingroup$ Just a suggestion : you can simplify the system with the change of variable x[t]->Exp[p[t]], z[t]->Exp[q[t]]. Also, the first equation is actually decoupled so you only need to solve the remaining two. $\endgroup$ Commented Jun 2, 2013 at 19:01

1 Answer 1

4
$\begingroup$

It seems there is a singularity in t=-4.64095 and t=2.2479405927739124. You can try:

sol = NDSolve[{Derivative[1][x][t] == 
    x[t]/y[t] + x[t]/z[t] - x[t]/z[t]^2, 
       Derivative[1][y][t] == y[t]/z[t] - (2*y[t])/z[t]^2 + 1, 
   Derivative[1][z][t] == -(z[t]/y[t]) - (2*z[t])/y[t]^2 - z[t], 
       x[0] == 2, y[0] == 5, z[0] == 7}, {x, y, z}, {t, -4.62, 2.23}, 
  MaxSteps -> 1000000]

Plot[Evaluate[{x[t], y[t], z[t]} /. sol], {t, -4.62, 2.23}, 
 Frame -> True, Axes -> None]

enter image description here

$\endgroup$
2
  • $\begingroup$ @Soodeh Z. your solution is very interesting. But how you find the singularity in the time point? $\endgroup$
    – Enter
    Commented Dec 7, 2015 at 1:33
  • $\begingroup$ @Enter NDSolve finds them for you: try NDSolve[sys, {x, y, z}, {t, -10, 10}, MaxSteps -> 10000] $\endgroup$
    – Michael E2
    Commented Oct 15, 2019 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.