I try to solve:

eq[t_] := ddf[t] + a'[t]/a[t] df[t] + 6 f[t] - 3  a[t]^2  f[t]^2 


    f[t_] := Exp[(1/2)*(-2*(Derivative[1][a][t]/a[t]) +
 Sqrt[4*(Derivative[1][a][t]^2/a[t]^2) - 4*a[t]^2*k[t]^2])*t]

df[t_] := D[f[t], t]

ddf[t_] := D[f[t], {t,2}]


k[t_] := Sqrt[(3 t Derivative[1][a][t]^2 + a[t] (Derivative[1][a][t] - 
       t (a^\[Prime]\[Prime])[t])) (-t Derivative[1][a][t]^2 + 
    a[t] (Derivative[1][a][t] + t (a^\[Prime]\[Prime])[t]))]/Sqrt[
 a[t]^4 (a[t] + t Derivative[1][a][t])^2]

I try to solve numerically by NDSolve :

NDSolve[{eq[t]==0,a[0] == 1, a'[1] == 1, a'[1] == 1, a[1] == 1}, {a[t]}, {t, 1, 10}, 
 PrecisionGoal -> 5 ]

The initial conditions are so arbitrary and can be changed.

However NDSolve stuck and the MA code hangs. I tried to use AsymptoticDSolveValue but no output as well.

I know that after all the substitution the eq[t] is somehow complicated and has $a[t]^3$ terms, so that I use four constrains, but I hope to find a way it can be solved by MA.

Any help is appreciated!

  • $\begingroup$ you do not have df[t] defined. You do not have ddf[t] defined. Your ode seems to be second order. Yet, you are giving 4 initial/BC, and one of them is second order. This is wrong. $\endgroup$
    – Nasser
    Commented Jan 10 at 10:49
  • $\begingroup$ I added the functions definitions. Also I modified the initial conditions. Thanks @Nasser $\endgroup$
    – Dr. phy
    Commented Jan 10 at 10:56
  • $\begingroup$ actually your ode is 4th order. But it was hidden. $\endgroup$
    – Nasser
    Commented Jan 10 at 11:05

1 Answer 1


The initial conditions are so arbitrary and can be changed.

If you make your IC's start at the start of the domain, it works. You are integrating the ode from 1 on, but you had an IC at zero. This makes life harder for NDSolve.

NDSolve[{ode, ic}, a, {t, 1, 2}, Method -> {"StiffnessSwitching"}]

Mathematica graphics

I changed your IC's to the following: (since you have 4th order ode)


Your eq[t] is too complicated, so will not copy your code here again :)

Trying to solve for larger domain than 2.2 gives

enter image description here

Additional changes to options for NDSolve might help with this issue.

V 14.0 on windows.


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.