Re: How to NDSolve the differential equation
- To: mathgroup at smc.vnet.net
- Subject: [mg19638] Re: How to NDSolve the differential equation
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 7 Sep 1999 00:28:35 -0400
- Organization: University of Western Australia
- References: <7qulo3$2r5@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Chee Lim Cheung wrote: > I encountered error messages with the tag Power::infy when I tried to do > the following: > > NDSolve[{x y''[x] + Sin[x] y'[x] + 2 x y[x] == 0,y[0]==0, y'[0]==1}, y, > {x,0,2}] > > Can anyone help me in getting Mathematica to produce an answer? I am using > Mathematica 4.0 & Mathematica 3.0. The error message gives a hint as to the problem -- and the solution. If you divide through by x and replace Sin[x]/x with 1 if x ==0, then NDSolve works fine: NDSolve[{2 y[x] + If[x == 0, 1, Sin[x]/x] y'[x] + y''[x] == 0, y[0] == 0, y'[0] == 1}, y, {x, 0, 2}] ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________