Re: When ploting a differential equation, sigularities cause big ugly vertical lines on the graph - how can I get rid of them? By some magic mathematica incantaion?
- To: mathgroup at smc.vnet.net
- Subject: [mg25178] Re: When ploting a differential equation, sigularities cause big ugly vertical lines on the graph - how can I get rid of them? By some magic mathematica incantaion?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 12 Sep 2000 21:24:22 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <8pklfd$m91@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ed wrote: > > Howdy All! > > When ploting a differential equation, sigularities cause big ugly > vertical lines on the graph. > > For example if I am graphing a family of solutions curves, each of > which decreases exponentially, at least some of them will be treated > as signularities by mathematica, and the place where they become too > funky for mathematica, there is an ugly vertical line. > > I would like to plot a function only within a certain range, and when > it leaves that range I would like mathematica to stop computing the > function. > > Alternatively I could use any possible advice on how to turn off these > vertical lines. Here's an example function with these singularities: > > In[2]:= > Table[NDSolve[{y'[t] == y[t]-y[t]^2/12-4, y[0] == i}, y, {t, > 0,8}],{i,4,20,4}] > > NDSolve::"ndsz": > "At \!\(t\) == \!\(3.62756604743090482`\), step size is > effectively zero; \ > singularity suspected." > NDSolve::"ndsz": > "At \!\(t\) == \!\(7.25517865610478196`\), step size is > effectively zero; \ > singularity suspected." > Out[2]= > {{{y\[Rule]InterpolatingFunction[{{0.,3.62757}},"<>"]}},{{ > y\[Rule]InterpolatingFunction[{{0.,7.25518}},"<>"]}},{{ > y\[Rule]InterpolatingFunction[{{0.,8.}},"<>"]}},{{ > y\[Rule]InterpolatingFunction[{{0.,8.}},"<>"]}},{{ > y\[Rule]InterpolatingFunction[{{0.,8.}},"<>"]}}} > > Here's the plotting command I am using: Hi, res = Table[ NDSolve[{y'[t] == y[t] - y[t]^2/12 - 4, y[0] == i}, y, {t, 0, 8}], {i, 4, 20, 4}]; plst = Plot[Evaluate[Sequence @@ #], DisplayFunction -> Identity, AspectRatio -> 1, PlotRange -> {0, 20}, FrameLabel -> {"Fish Population - Fixed Harvesting", y'[t] == y[t] - y[t]^2/12 - 4}, Frame -> True] & /@ ({#, Prepend[Sequence @@ First[Head[#]], First[#]]} & /@ Flatten[(y[t] /. res)]); Show[plst, DisplayFunction -> $DisplayFunction] will do it. Since plot can only plot multiple functions over a single range, you have to use multiple plot commands for every function. Since your Interpolation[] break somewhere in the interval x in[0,8] you must find the x-range manual. Regards Jens