Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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].

share|improve this question
1  
Check the NDSolve docs and examples! –  Szabolcs May 16 '12 at 17:47
    
The examples do not address the situation that at x=0 the y'[x]/x term is undefined. –  adm May 17 '12 at 5:39
    
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. –  Szabolcs May 17 '12 at 7:18
    
y[x] == 0 is a solution to your differential equation. –  Szabolcs May 17 '12 at 7:19
1  
y[Inf]-> 0 does not imply y'[Inf]->0, witness y=Sin[x^2]/x .. –  george2079 Sep 20 '13 at 15:41
show 4 more comments

2 Answers

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.

share|improve this answer
add comment

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?

share|improve this answer
    
similar to this: math.stackexchange.com/questions/482835/…, and I'll say quite annoying to have to resort the y'[eps] hack.. bc. –  george2079 Sep 20 '13 at 15:27
    
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. –  gpap Sep 23 '13 at 11:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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