Trying to solve the following ODE:

solw = NDSolve[{0.75 (w[t] w''[t] - w'[t]^2) + w[t]^3 == 1/2 (1 + Tanh[100 t]), 
    w[0] == 0, w'[0] == 0}, w, {t, 0, 2}, Method -> "MethodOfLines"];
wsol[t_] := Evaluate[w[t] /. solw]

However, NDSolve gives an error:

Power::infy: Infinite expression 1/0. encountered.

I can't figure out why this happens and how to overcome this. Any idea will be appreciated.

Reviewed some related questions like this question or this question, but this does not help.

  • 1
    $\begingroup$ It's due to your initial conditions. Can you start at a different point? $\endgroup$ Commented Apr 2, 2018 at 8:07
  • $\begingroup$ I start from t=0.0001, it gies the same error. I also try to alter w[0] and try with w[0]=0.0001, but the solution is highly oscillating. This should not be the case. $\endgroup$ Commented Apr 2, 2018 at 8:12
  • $\begingroup$ You need to change the left endpoint in {t, 0, 2} as well if you're doing the perturbation. This is a known limitation of NDSolve[]. May I suggest using $MachineEpsilon instead of 0? $\endgroup$ Commented Apr 2, 2018 at 8:16
  • $\begingroup$ Tried with $MachineEpsilon, but the solution amplitude becomes 10^106. $\endgroup$ Commented Apr 2, 2018 at 8:21
  • $\begingroup$ Speaking of... your code did not provide the definition for f[t]; please edit your question to include it. $\endgroup$ Commented Apr 2, 2018 at 8:24

1 Answer 1


Your initial conditions do not satisfy the ODE:

eqn = 0.75 (w[t] w''[t]-w'[t]^2)+w[t]^3==1/2 (1+Tanh[100 t]);
eqn /. t->0 /. {w[0]->0, w'[0]->0}


The only way your initial conditions can satisfy the ODE is if $$\lim_{t\to 0} w(t) w''(t) = \frac{2}{3}$$ which means that $$\lim_{t\to 0} w''(t) \to \infty$$

This is why NDSolve is unable to compute a solution, and why you get Power::infy messages. If you choose initial conditions that can satisfy the ODE, then NDSolve has no problems:

solw = NDSolveValue[{eqn, w[0] == (1/2)^(1/3), w'[0] == 0}, w, {t, 0, 2}];

Plot[solw[t], {t, 0, 2}]



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.