0
$\begingroup$

I would like to solve the following differential equation with NDSolve:

NDSolve[{(1 + Sqrt[\[Pi] x])*y[x] + x*y'[x] - (x^2)/6*y''[x] == 1, y[0] == 1, y'[0] == 0}, y[x], {x, 0, 2}]

Mathematica says it encounters an infinite expression. I've tried shifting the initial point from 0 to 0.1 or 0.01 and it gives a growing exponential function that I think is nonphysical. This DE is an approximation to another DE that has as a solution MittagLefflerE[q,-x^q] with q = 3/2 here, which is decaying. The approximation should hold for 0 < x < 2.

I also tried coding up the solution using an explicit Euler scheme but it gives the same exponential-type solution. I'm pretty sure the solution is not supposed to be growing but I guess I could be wrong.

Any help with the DE is greatly appreciated!

$\endgroup$

2 Answers 2

0
$\begingroup$

The reason Mathematica says it got division by zero, because your initial conditions are not valid. They produce no solution.

The analytical solution to

$$ \left( 1+\sqrt {\pi\,x} \right) y \left( x \right) +x{\frac {\rm d}{ {\rm d}x}}y \left( x \right) -1/6\,{x}^{2}{\frac {{\rm d}^{2}}{{\rm d} {x}^{2}}}y \left( x \right) =0 $$

Is given by Maple as (DSolve does not seem to be able to solve this, after some time waiting).

$$ y \left( x \right) ={\it \_C1}\,{x}^{7/2+1/2\,\sqrt {73}} {\mbox{$_0$F$_1$}(\ ;\,1+2\,\sqrt {73};\,24\,\sqrt {\pi}\sqrt {x})}+{ \it \_C2}\,{x}^{7/2-1/2\,\sqrt {73}} {\mbox{$_0$F$_1$}(\ ;\,1-2\,\sqrt {73};\,24\,\sqrt {\pi}\sqrt {x})} $$

Where $F_1$ is hypergeom function. Taking derivative of the above gives

$$ {\frac {\rm d}{{\rm d}x}}y \left( x \right) ={\frac {{\it \_C1}\,{x}^{ 7/2+1/2\,\sqrt {73}} \left( 7/2+1/2\,\sqrt {73} \right) {\mbox{$_0$F$_1$}(\ ;\,1+2\,\sqrt {73};\,24\,\sqrt {\pi}\sqrt {x})}}{x }}+12\,{\frac {{\it \_C1}\,{x}^{7/2+1/2\,\sqrt {73}} {\mbox{$_0$F$_1$}(\ ;\,2+2\,\sqrt {73};\,24\,\sqrt {\pi}\sqrt {x})} \sqrt {\pi}}{ \left( 1+2\,\sqrt {73} \right) \sqrt {x}}}+{\frac {{\it \_C2}\,{x}^{7/2-1/2\,\sqrt {73}} \left( 7/2-1/2\,\sqrt {73} \right) {\mbox{$_0$F$_1$}(\ ;\,1-2\,\sqrt {73};\,24\,\sqrt {\pi}\sqrt {x})}}{x }}+12\,{\frac {{\it \_C2}\,{x}^{7/2-1/2\,\sqrt {73}} {\mbox{$_0$F$_1$}(\ ;\,2-2\,\sqrt {73};\,24\,\sqrt {\pi}\sqrt {x})} \sqrt {\pi}}{ \left( 1-2\,\sqrt {73} \right) \sqrt {x}}} $$

You can now see that at $x=0$ there is a division by zero.

So your initial conditions are not valid or something wrong with your equations (may be did not copy it correctly from the book?).

$\endgroup$
1
  • $\begingroup$ What a formidable solution! I see this now. Thank you, I'll mark this as correct. $\endgroup$
    – Buddhapus
    Jun 17, 2017 at 6:57
1
$\begingroup$

The easy way out is to give a starting value to $x$ to be 10^-4 not 0.

NDSolve[{(1 + Sqrt[π x])*y[x] + x*y'[x] - (x^2)/6*y''[x] == 1, y[10^-4] == 1, 
          y'[10^-4] == 0}, y[x], {x, 10^-4, 2}]

Plot[y[x] /. %, {x, 10^-4, 2}]
$\endgroup$
2
  • $\begingroup$ I was able to find this solution before but I'm not sure it's physical. I'm looking for a decaying solution. $\endgroup$
    – Buddhapus
    Jun 16, 2017 at 9:33
  • $\begingroup$ @Buddhapus Then you should check your equation. $\endgroup$
    – zhk
    Jun 16, 2017 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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