4
$\begingroup$

I have an ODE equation which is sort of

y''[x] + 2 y'[x]/x + .0001 (y[x])^3 ==0 

subject to the boundary conditions

y'[0]==0  and y[Infinity]==0

Can anyone please suggest what would be a reliable process for solving this numerically in Mathematica?

y[Infinity] can obviously be truncated down to , say, y[20].

$\endgroup$
9
  • 1
    $\begingroup$ Check the NDSolve docs and examples! $\endgroup$
    – Szabolcs
    Commented May 16, 2012 at 17:47
  • $\begingroup$ The examples do not address the situation that at x=0 the y'[x]/x term is undefined. $\endgroup$
    – adm
    Commented May 17, 2012 at 5:39
  • $\begingroup$ I see what is the difficulty now. Please, next time indicate the problem clearly in the question. Lately there have been several questions where the OP clearly hasn't even looked at the docs. On first read yours sounds like "how do I solve a diff eq numerically", so people will dismiss it without even looking at the ODE. $\endgroup$
    – Szabolcs
    Commented May 17, 2012 at 7:18
  • $\begingroup$ y[x] == 0 is a solution to your differential equation. $\endgroup$
    – Szabolcs
    Commented May 17, 2012 at 7:19
  • 1
    $\begingroup$ y[Inf]-> 0 does not imply y'[Inf]->0, witness y=Sin[x^2]/x .. $\endgroup$
    – george2079
    Commented Sep 20, 2013 at 15:41

2 Answers 2

2
$\begingroup$

The comments by @george2079 are spot on IMO regarding the asymptotic behaviour at infinity and also that the way to solve this is by formulating it as a Cauchy problem. I don't see an issue with replacing zero with $ \epsilon $ however. In any case, changing the boundary value at infinity with a boundary value at "zero" (that is to be tweaked) works:

sol = Table[
  First@NDSolve[{y''[x] + 2 y'[x]/x + .0001 (y[x])^3 == 0, 
     y'[10^(-10)] == 0, y[10^(-10)] == a}, 
    y, {x, 10^(-10), 1000}], {a, -5, 5, .5}];

Plot[Evaluate[y[t] /. sol], {t, 0, 1000}, PlotRange -> All]

asymptotic

i.e. any $ y(0) = a \in \mathbb{R} $ seems to give a solution to the problem.

$\endgroup$
1
$\begingroup$

If $ y(\infty)=0$, and $ y $ has continuous end behaviour, then shouldn't $ y'(\infty)=0 $? Trying the following:

NDSolve[{ y''[x] + 2 y'[x]/x + .0001 (y[x])^3 == 0, y'[10^(-10)] == 0, y[20] == 0}, y, {x, 10^(-10), 20}] 

results in the trivial solution $ y(x) = 0. $ Can you explain why you think that there are other solutions than the trivial one?

$\endgroup$
2
  • $\begingroup$ similar to this: math.stackexchange.com/questions/482835/…, and I'll say quite annoying to have to resort the y'[eps] hack.. bc. $\endgroup$
    – george2079
    Commented Sep 20, 2013 at 15:27
  • $\begingroup$ You're absolutely right! I didn't pay any attention when I posted the community wiki from the comments but this is much easier to solve than the one you link to. $\endgroup$
    – gpap
    Commented Sep 23, 2013 at 11:42

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.