1
$\begingroup$

I want to solve the following differential equation with initial conditions:

ode = (λ x y[x])/Sqrt[1 - x] + y''[x] == 0
ic = {y[1] == 0, y'[1] == 1}
DSolve[{ode, ic}, y[x], x]

But do not know how to actually solve it. Any suggestion?

$\endgroup$
  • $\begingroup$ I don't think Mathematica can find a solution to this problem. Are you sure you've stated it correctly? Please use accepted Mathematica syntax... terms using useless parentheses and asterisks (for multiplication) are quite awkward. Also, use y''[x] to be consistent with your other derivatives. Moreover, your list of arguments for DSolve should not have a sublist of initial conditions... just entries. (See the documentation.) $\endgroup$ – David G. Stork Apr 30 '15 at 15:38
  • $\begingroup$ @ David-G.-Stork there is nothing wrong with (x) here, just additional parentheses, but correct syntax. You are right with the sublist. I think that's the problem here! $\endgroup$ – sacratus Apr 30 '15 at 15:42
2
$\begingroup$

METHOD 1

The easiest and fast way only numerically.

sol = First@
With[{λ = 1}, 
NDSolve[{z''[x] + (λ*x)/Sqrt[1 - x]*z[x] == 0, 
z[999/1000] == 0, z'[999/1000] == 1}, z, {x, -2, 2}]];

METHOD 2

Use by Series.

n = 6;
y = Sum[c[i]*x^i, {i, 0, n}] + O[x]^(n + 1);
ODE = D[y, {x, 2}] + (λ*x)/Sqrt[1 - x]*y == 0;
Y = Normal[y /. Solve[LogicalExpand[ODE], Table[c[i], {i, 1, n}]]] // 
Quiet;
Sol2 = Simplify@
First[Y /. 
Solve[{Y == 0 /. x -> 1, D[Y, x] == 1 /. x -> 1}, {c[0], c[1]}]];
Plot[{z[x] /. sol, Sol2 /. λ -> 1}, {x, -2, 2}, 
PlotLegends -> {"NDSolve", "Series"}, 
PlotStyle -> {Thin, {Thick, Dashed}}] // Quiet

enter image description here

Other way.

sol=First@With[{λ = 1}, 
NDSolve[{z''[x] + (λ*x)/Sqrt[1 - x]*z[x] == 0, 
z[999/1000] == 0, z'[999/1000] == 1}, z, {x, -2, 2}]]; data = 
Table[{x, z[x] /. sol}, {x, -2, 2, 0.01}];
k = 5; Sol = Fit[data, Table[x^n, {n, 0, k}], x]

Plot[{z[x] /. sol, Re@Sol}, {x, -2, 2}, 
PlotLegends -> {"NDSolve", "FitData"}, 
PlotStyle -> {Thin, {Thick, Dashed}}]

enter image description here

METHOD 3

Analytically. $$y''(x)+A(x) y(x)=0 \tag{1}$$,were A(x) is:$$A(x)=\frac{\lambda x}{\sqrt{1-x}} \tag{2}$$ In order to find general solution of Eq.(1) let us introduce new variable: $$y'=y*z \tag{3}$$ derivative of Eq.(3) $$y''=y'*z+y*z' \tag{4}$$ and substitution from Eq.(3) to Eq.(4) and we have: $$y''=y*z^2+y*z' \tag{5}$$ and substitution from Eq.(5) to Eq.(1) and we have Riccati equation first order and with quadratic nonlinearity: $$z'(x)+z(x)^2+A (x)=0 \tag{6}$$ DSolve can't find solution!!! of this Riccati equation.

| improve this answer | |
$\endgroup$
1
$\begingroup$

As David-G.-Stork mentioned, the first argument of DSolve needs to be a flat list.

Try to give equations and initial conditions in one list like this:

eqs = {(λ  x y[x])/Sqrt[1 - x] + y'[x] == 0, y[1] == 0, y'[1] == 1}
DSolve[eqs, y[x], x]

Still not sure if Mathematica can solf this, but now it's at least syntactically correct.

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ The first argument does not need to be a flat list. Consider DSolve[{y''[x] == y[x], {y[0] == 1, y'[0] == 0}}, y, x].... $\endgroup$ – Michael E2 Apr 30 '15 at 18:11
  • $\begingroup$ This is a first order equation and you provide 2 conditions so it only has solutions for specific values of lambda? $\endgroup$ – chris Aug 8 '15 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.