0
$\begingroup$

I want to solve a differential equation of second order with complex initial conditions.

u''[τ[t]] = -f[t]u[τ[t]]
u[27] == Exp[-I*k55*τ[27]]/Sqrt[2*k55]
u'[27] == -I*k55*Exp[-I*k55*τ[27]]/Sqrt[2*k55]

Although I have written all the code in detail, I am still facing some problems I might want to review here. The code is as follows:

sol = NDSolve[{x''[t] + 3 x'[t] Sqrt[(x'[t])^2/6 + (1 - Exp[-x[t] Sqrt[2/3]])^2/4] + 
Sqrt[3/2] Exp[-x[t] Sqrt[2/3]] (1 - Exp[-x[t] Sqrt[2/3]]) == 0, 
a'[t]/a[t] == Sqrt[(x'[t])^2/6 + (1 - Exp[-x[t] Sqrt[2/3]])^2/4],
τ'[t] == 1/a[t],
x'[0] == -0.008226306418212731,
x[0] == 5.630991866033891,
a[0] == 1,
τ[149.4517772937791] == 0},
{x, τ, a},
{t, 0, 500}]
a = a[t] /. sol;
τ = τ[t] /. sol;
x = x[t] /. sol;
xt = x'[t] /. sol;
att = a''[t] /. sol;
tEnd = t /. FindRoot[(att == 0), {t, 0, 150}]
aEnd = a /. t -> tEnd;
H = Sqrt[(xt)^2/6 + (1 - Exp[-x*Sqrt[2/3]])^2/4];
V = 3/4 (1 - Exp[-Sqrt[2/3] x])^2;
Vt = Sqrt[3/2] Exp[-x Sqrt[2/3]] (1 - Exp[-x Sqrt[2/3]]);
Vtt = -Exp[-2 Sqrt[2/3]*x]*(Exp[Sqrt[2/3]*x] - 2);
t55 = t /. FindRoot[(aEnd/a == E^55), {t, 0, 150}];
τ55 = τ /. t -> t55;
a55 = a /. t -> t55;
eps1 = (1/2) (Vt/V)^2;
eta = Vtt/V;
eps2 = -4 eps1 + 2 eta;
k55 = a55*(H /. t -> t55);
ν = 3/2 + eps1 + 1/2*eps2;
f = k55^2 - (ν^2 - 1/4)/(τ^2);
solu = NDSolve[{u''[t] == -u[t]*f, u[27] == Exp[I*k55*τ[27]]/Sqrt[2*k55], u'[27] 
== -I*k55*Exp[I*k55*τ[27]]/(a55*Sqrt[2*k55])}, u[t], {t, 27, 40}]

My problem here is that when trying to get solu (run the NDSolve for u(τ(t)) ), it does give a solution but for a minimal interval (t=27 to t=27.015097919331026642336'20) when the desired interval goes from t=27 to t=40.

How do I solve it?

I took the anzats $u(t)=e^{\int v(t)dt}$, therefore, I got that $v'+v^2+f=0$. I got $v$ using

solv = NDSolve[{v'[t] + (v[t])^2 + f == 0, v[0] == -I*k55*Exp[-I*k55*τ[27]]}, v[t], {t, 27, 40}]

However, it has the same problems as the solution for $u$. The solution for either $v$ of $u$ has to go from $t=27$ to $t=40$ approximately. Even when trying to solve the systems with f at first order with FindRoot[f, {t, 36}][[1, 2]]; Series[f, {t, %, 1}] // Normal, it does not give any satisfactory solution to the problem. It highly oscillates.

NDSolveValue::mxst: Maximum number of 1000000 steps reached at the point t == 27.01283361800840725823760157657196543473`20.

Update:

I am using new initial conditions

solu = NDSolve[{u''[t] == -f*u[t], 
u[tEnd] == Exp[-I*kEnd*\[Tau]End]/Sqrt[2*kEnd], 
u'[tEnd] == -I*kEnd*Exp[-I*kEnd*\[Tau]End]/(aEnd*Sqrt[2*kEnd])}, 
u, {t, 0, tEnd}, WorkingPrecision -> 20, MaxSteps -> 1000000];

And even though I get a solution, I cannot plot it because, for example, if I do

LogLinearPlot[Re[H/(a*xt) (u[t] /. solu)], {t, 60, tEnd}]

It shows

InterpolatingFunction::dmval: Input value {60.0011} lies outside 
the range of data in the interpolating function. Extrapolation 
will be used.

It happens with any initial value for $t$ to begin the Plotting, replace 60.0011 with any general number you may think of. Why does it happen?

Edit:

Now I understand it happens because the solution runs backwards, so I only have a solution from t=149.467... to t=tEnd. How can I get the entire solution? I know it seems complicated, but my initial conditions come from $u_k(\tau)=\lim_{k\gg aH}\frac{e^{-ik\tau}}{\sqrt{2k}}$, where $aH=k_{55}$, and when $t\rightarrow\infty$, it gives a stable limit value.

$\endgroup$
3
  • 2
    $\begingroup$ Is this the same as mathematica.stackexchange.com/questions/297063/…? Is the principal difference the initial condition? $\endgroup$
    – Goofy
    Commented Feb 2 at 1:23
  • $\begingroup$ HEEEEEEEEEEEELP $\endgroup$ Commented Feb 2 at 3:45
  • 1
    $\begingroup$ As I explained in mathematica.stackexchange.com/q/296808/1063, which is very similar to your two questions, there is no way to solve the ODE numerically without making approximations, because the scale lengths of the shortest and longest variations in the solution differ by many orders of magnitude. You can, however, obtain a good approximate solution by using the WKB approximation. $\endgroup$
    – bbgodfrey
    Commented Feb 2 at 15:57

0