# system of ODE through NDSolve

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]

• 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. Commented Jun 2, 2013 at 19:01

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]


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