Student Support Forum: 'Non linear differential equation' topicStudent Support Forum > General > "Non linear differential equation"

 < Previous Comment Help | Reply To Comment | Reply To Topic
 Author Comment/Response jf 02/27/12 8:12pm NDSolve has to calculate y''[0] to get started. It delegates the job of separating out y'' to Solve. In[1]:= Solve[ -y''[x]*x^2 - y'[x]*x + x^2*y[x]^3 + (-x^2 + 1)*y[x] == 0 , y''[x] ] Out[1]= {{y''[x] -> y[x] - x^2 y[x] + x^2 y[x]^3 - x y'[x] -------------------------------------------}} x^2 When NDSolve substitutes in x==0, it sees a division by zero. The second message, Infinity::indet: "Indeterminate expression 0. ComplexInfinity encountered." means that the numerator was zero, too. NDSolve does not have a way of canceling zeros. One workaround is to cheat and manually insert a value for y''[0]. Around x=0, the If gives a fixed value for y''. Once x has moved away from 0 by even a small amount, the regular equation takes over. In[6]:= NDSolve[{ -y''[x]== If[x==0.,0.1,(y[x]-x^2 y[x]+x^2 y[x]^3 - x y'[x])/x^2], y[0]==0,y'[0]==1},y,{x,0,10}] Out[6]= {{y->InterpolatingFunction[{{0.,10.}},<>]}} In[7]:= Plot[ y[x]/. %,{x,0,10}] The attached notebook has the code and plot. Attachment: zerodiv27810.nb, URL: ,

 Subject (listing for 'Non linear differential equation') Author Date Posted Non linear differential equation Lorentz 02/25/12 12:29pm Re: Non linear differential equation Nasser M. Ab... 02/26/12 8:56pm Re: Non linear differential equation jf 02/27/12 8:12pm
 < Previous Comment Help | Reply To Comment | Reply To Topic