Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'plotting several interpolating functions' topicStudent Support Forum > General > Archives > "plotting several interpolating functions"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
03/08/13 9:55pm

If you carefully get rid of every decimal point and use DSolve instead of NDSolve then you might be able to use your original coefficients while avoiding some of the many problems you have with precision.

In[1]:= eq=Gx+Dif n''[x]-Kr (n[x]-n0)==0;
bcs={n'[d]==0,n[0]==n0*Exp[-V]};
d=20*10^-6;Gx=10^19;n0=10^21;Dif=4*10^-9;Kr=31*10^-10;
Show[
Table[
sol=DSolve[{eq,bcs},n[x],x];
Plot[n[x]/.sol,{x,0,d}],
{V,0,7/10,3/10}
]
]

Out[4]= ...ThreeOverlaidPlotsSnipped...

You also might try inserting
Print[Plot[n[x] /. sol, {x, 0, d}]];
Print[Simplify[N[sol]]];
in place of the Plot in the code above.
That should let you inspect each result individually.

When I do that it appears that the difference from one iteration to the next may be little or nothing more than roundoff error. And that may at least partly explain the flood of errors from NDSolve that I found when using your original coefficients.

Please check all this very carefully before depending on it. I don't trust any of this now.

URL: ,

Subject (listing for 'plotting several interpolating functions')
Author Date Posted
plotting several interpolating functions Luka 03/08/13 4:16pm
Re: plotting several interpolating functions Bill Simpson 03/08/13 9:13pm
Re: plotting several interpolating functions Bill Simpson 03/08/13 9:55pm
Re: plotting several interpolating functions Luka 03/09/13 11:58am
Re: plotting several interpolating functions Luka 03/10/13 03:13am
Re: Re: plotting several interpolating functions Bill Simpson 03/11/13 2:30pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic