Re: NDSolve vs. DSolve
- To: mathgroup@smc.vnet.net
- Subject: [mg10931] Re: NDSolve vs. DSolve
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Thu, 12 Feb 1998 20:16:14 -0500
- Organization: University of Western Australia
- References: <6brh2k$ee9@smc.vnet.net>
Students wrote:
> In the following examples the DSolve solves easily while the NDSolve is
> producing the listed error messages. Why is that and how is it bypassed.
>
> DSolve[y'''[x]==-Cos[x],y[0]==0,y[5]==0,y'[0]==0,y[x],x]
>
> NDSolve[y'''[x]==-Cos[x],y[0]==0,y[5]==0,y'[0]==0,y[x],{x,0,5}]
>
> NDSolve::unsol:
> Not possible to initiate boundary value problem with the chasing method
DSolve solves the differential equations and then fits the undetermined
coefficients using the boundary conditions.
For problems of this type you can use the shooting method (replacing
y[5]==0 with y''[0]==a and determining a):
In[1]:= system[a_]:= s=
NDSolve[{y'''[x]==-Cos[x],y[0]==0,y'[0]==0,y''[0]==a},y,{x,0,5}]]//First
In[2]:= gun := y[5] /. system[#1] &
In[3]:= FindRoot[gun[a] == 0, {a, 0, 0.3}] Out[3]= {a -> 0.476715}
In[4]:= y[5] /. s
Out[4]=
-12
9.47337 10
In[5]:= Plot[Evaluate[y[x] /. s], {x, 0, 5}]
Cheers,
Paul
____________________________________________________________________
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@physics.uwa.edu.au AUSTRALIA
http://www.pd.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________