Re: NDSolve::ndsz question
- To: mathgroup at smc.vnet.net
- Subject: [mg63661] Re: NDSolve::ndsz question
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 9 Jan 2006 04:48:44 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <dpnqoa$6rh$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Flip wrote: > Greetings, I'm trying to solve a differential equation but I'm getting > the following error: > > NDSolve::ndsz: At x == 18.84025621252942`, step size is effectively > zero; \ > singularity or stiff system suspected ^^^^^^^^^^^ Singularity might be a key point here... > I'm not sure how to deal with this--is there a way to allow smaller > step sizes? Here is my complete code: > > k := 400000000; > b := 0.0023; > epsR := 0.024; > solution := NDSolve[ > {y'[x] == -k x^(-0.5) \[ExponentialE]^(-epsR x) (y[x]^2 - (b x^2 > BesselK[2,x])^2), > y[0.1] == b*BesselK[2,0.1]/(0.1)}, y, {x,0.1,5000}] > Evaluate[y[5000] /. solution] > > Any thoughts would be appreciated! Thanks, > Flip > You could try to split your original interval [1/10, 5000] in two such as in input [7]: In[1]:= $Version Out[1]= 5.2 for Microsoft Windows (June 20, 2005) In[2]:= k = 400000000; b = 23/10000; epsR = 3/125; solution = NDSolve[{Derivative[1][y][x] == -((k*(y[x]^2 - (b*x^2*BesselK[2, x])^2))/ (Sqrt[x]*E^(epsR*x))), y[1/10] == (b*BesselK[2, 1/10])/ (1/10)}, y, {x, 1/10, 5000}] Evaluate[y[5000] /. solution] From In[2]:= NDSolve::ndsz: At x == 17.47194662853105`, step size is effectively zero; singularity or stiff system suspected. Out[5]= {{y\[Rule]InterpolatingFunction[{{0.1,17.4719}},<>]}} From In[2]:= InterpolatingFunction::dmval: Input value {5000} lies outside the range of data in the interpolating function. Extrapolation will be used. Out[6]= 49 {-4.51257 10 } In[7]:= k = 400000000; b = 23/10000; epsR = 3/125; solution = NDSolve[{Derivative[1][y][x] == -((k*(y[x]^2 - (b*x^2*BesselK[2, x])^2))/ (Sqrt[x]*E^(epsR*x))), y[18] == (1/18)*b*BesselK[2, 18]}, y, {x, 18, 5000}] Evaluate[y[5000] /. solution] Out[10]= {{y\[Rule]InterpolatingFunction[{{18.,5000.}},<>]}} Out[11]= -10 {1.70862 10 } Hope this helps, /J.M.