Re: Error with NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg50956] Re: Error with NDSolve
- From: "Peter Pein" <petsie at arcor.de>
- Date: Wed, 29 Sep 2004 03:15:30 -0400 (EDT)
- References: <cjaru4$nni$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Narasimham G.L." <mathma18 at hotmail.com> schrieb im Newsbeitrag news:cjaru4$nni$1 at smc.vnet.net... > There is error in si[t] even after the interpolating function is > obtained. Thanks for fix. > > NDSolve[ {si2'[t] == 2, si2[0] == 0, > th2'[t] == Sin[si2[t]]/r2[t], th2[0] == 0, r2'[t] == Cos[si2[t]], > r2[0] == 1}, {si2, r2, th2}, {t, 0, 25}]; r [t_] = r2[t] /. First[%]; > th[t_] = th2[t] /. First[%]; > (* error -> *) si[t_] = si2[t] /. First[%]; > Did you have a look at si2'[t] == 2, si2[0] == 0 ? But in general I would suppose to do sth. like: NDSolve[...]; {si,r,th}={si2,r2,th2}/.First[%] or if I were a busy guy: solution=NDSolve[...]//First; si=si2/.solution; r=r2/.solution; and so on Since % gives the last result generated, the assignment of th went wrong because the last generated result was InterpolatingFunction[{0.,25.},"some table"]. So you asked Mathematica to do r[t_]=r2[t]/.{0.,25.} which is correct in syntax but gives no sense (at least to me). -- Peter Pein, Berlin to write to me, start the subject with [