I want to solve the following differential equation
DSolve[y''[x] == (λ y[x])/Sqrt[-1 + x], y[x],x]
But do not know how to actually solve it. Any suggestion?
Mathematica can also solve this differential equation if you help it with the choice of variable substitution:
Clear[y,λ,x,z,u,v]
eqn = y''[x] == λ y[x]/Sqrt[-1 + x]
(* ==> (y^\[Prime]\[Prime])[x] == (λ y[x])/Sqrt[-1 + x] *)
u[x_] := Sqrt[x - 1]
y[x_] := z[u[x]]
eqn2 = Simplify[eqn /. x -> InverseFunction[u][v], v > 0]
(*
==> 4 v^2 λ z[v] + Derivative[1][z][v] ==
v (z^\[Prime]\[Prime])[v]
*)
zSolution[v_] = z[v] /. First[DSolve[eqn2, z[v], v]]
(*
==> AiryAiPrime[2^(2/3) v λ^(1/3)] C[1] +
AiryBiPrime[2^(2/3) v λ^(1/3)] C[2]
*)
ySolution[x_] = zSolution[u[x]]
(*
==> AiryAiPrime[2^(2/3) Sqrt[-1 + x] λ^(1/3)] C[1] +
AiryBiPrime[2^(2/3) Sqrt[-1 + x] λ^(1/3)] C[2]
*)
Block[{y}, Simplify[eqn /. y -> ySolution]]
(* ==> True *)
All I did here was to define a new function z
through the substitution of variable $u = \sqrt{x-1}$. The original differential equation eqn
is then transformed into the new one, eqn2
, which can be solved analytically with DSolve
. Finally, I also check that the general solution obeys the original equation when substituting back the original independent variable x
.
Edit: an alternate substitution
To get Bessel functions as solutions, instead of derivatives of Airy functions, the only change to the above would be to choose as our new variable $u = (x-1)^{(3/4)}$. This is shown here by repeating the same steps as before with that single change:
Clear[y, λ, x, z, u, v]
eqn = y''[x] == λ y[x]/Sqrt[-1 + x];
u[x_] := (x - 1)^(3/4)
y[x_] := z[u[x]]
eqn2 = Simplify[eqn /. x -> InverseFunction[u][v], v > 0];
zSolution[v_] = z[v] /. First[DSolve[eqn2, z[v], v]];
ySolution[x_] = zSolution[u[x]];
Block[{y = ySolution}, FullSimplify[eqn]]
(* ==> True *)
TeXForm[ySolution[x]]
$$c_1 \sqrt{x-1} J_{\frac{2}{3}}\left(-\frac{4}{3 } i (x-1)^{3/4} \sqrt{\lambda }\right)+c_2 \sqrt{x-1} Y_{\frac{2}{3}}\left(-\frac{4}{3 } i (x-1)^{3/4} \sqrt{\lambda }\right)$$
This is an alternate general solution.
DifferentialRoot
, which means you have a solution but it can't be expressed in terms of special functions. So you then have a solution for ySolution
that can only be evaluated when you give numerical values to the parameters. The integration constants in that DifferentialRoot
can in principle also be eliminated by adding two boundary conditions to eqn2
, e.g. like this: DSolve[eqn2&&z[1]==1&&z'[1]==1,z[v],v]
. The result still needs a numerical value for $\lambda$, though.
$\endgroup$
A simpler direct solution is the following:
Ignoring the -1 for a moment, i.e. replacing Sqrt[x-1] by Sqrt[x], Mathematica solves the resulting ODE easily
sol = DSolve[z''[x] == \[Lambda] z[x]/Sqrt[x], z[x], x]
(*
Out[1]= {{z[x] -> (2/3)^(2/3) Sqrt[x] \[Lambda]^(1/3)
BesselI[-(2/3), 4/3 x^(3/4) Sqrt[\[Lambda]]] C[1] Gamma[1/3] + ((-2)^(
2/3) Sqrt[x] \[Lambda]^(1/3)
BesselI[2/3, 4/3 x^(3/4) Sqrt[\[Lambda]]] C[2] Gamma[5/3])/3^(2/3)}}
*)
Now we restore the -1 and get
y[x_] = z[x] /. sol[[1]] /. x -> x - 1
(*
Out[2]= (2/3)^(2/3) Sqrt[-1 + x] \[Lambda]^(1/3)
BesselI[-(2/3), 4/3 (-1 + x)^(3/4) Sqrt[\[Lambda]]] C[1] Gamma[1/
3] + ((-2)^(2/3) Sqrt[-1 + x] \[Lambda]^(1/3)
BesselI[2/3, 4/3 (-1 + x)^(3/4) Sqrt[\[Lambda]]] C[2] Gamma[5/3])/3^(2/3)
*)
Finally we check that y[x] really solves the original ODE
y''[x]/(\[Lambda] y[x]) // FullSimplify
(*
Out[3]= 1/Sqrt[-1 + x]
*)
Check ok. Done.
This is a Bessel type ODE. So it has solutions in terms of special Bessel functions. This can be done by hand using Frobenius
series method if needed. You might want to do this to verify the solution below.
Here is the solution from Maple and I converted it to Mathematica syntax. The solution contains 2 arbitrary constants of integrations and use BesselI
and BesselY
both implemented in Mathematica. So direct translation was only needed
Translate to Mathematica:
Clear[x, c1, c2, lam]
sol1 = Sqrt[x - 1] BesselJ[2/3, 4/3 Sqrt[-lam] (x - 1)^(3/4)];
sol2 = Sqrt[x - 1] BesselY[2/3, 4/3 Sqrt[-lam] (x - 1)^(3/4)];
fullSolution = c1 sol1 + c2 sol2
for reference here is the direct numerical approach. Obviously you need to specify lambda and initial conditions and a domain.
\[Lambda] = 1;
x0 = 1 + 1*^-4;
x1 = 4;
ySolution[x_] = y[x] /. First@NDSolve[y''[x] == (\[Lambda] y[x])/
Sqrt[-1 + x] && y[x0] == 0 && y'[x0] == 1 , y[x],
{x, x0, x1}]
Plot[ySolution[x], {x, x0, x1}]
I just guessed x==1
is an important point. The equation has a singularity but the solution is well behaved at x==1
, which we can see by setting an initial condition at some small epsilon.
aside, here is how you match those initial conditions using Dr WH analytic solution:
\[Lambda] = 1
sol = DSolve[z''[x] == \[Lambda] z[x]/Sqrt[x], z[x], x];
y[x_] = z[x] /. sol[[1]] /. x -> x - 1
Limit[y[x], x -> 1] -> C[1] (* so C[1] must be zero *)
some handwaving later we find:
C[2] -> real * (1+I Sqrt[3] )
produces a real solution that we can differentiate to match the y'[1]
condition.. sol we have:
yprime1=1
ySolution[x_] =
y[x] /. {C[1] -> 0 ,
C[2] -> - yprime1 Gamma[2/3]/Gamma[5/3]/2/(2/3)^(1/3) (1 + I Sqrt[3])}
Plot[ySolution[x], {x, 1, 4}]
(* same plot *)
NDSolve
and you need to specifylambda
and provide initial/boundary conditions. $\endgroup$