Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Error with NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50951] Re: [mg50917] Error with NDSolve
  • From: DrBob <drbob at bigfoot.com>
  • Date: Wed, 29 Sep 2004 03:15:18 -0400 (EDT)
  • References: <200409280458.AAA23991@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

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[%%]
si[t_] = si2[t] /. First[%%%]

or

solution = First@
     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] /. solution
th[t_] = th2[t] /. solution
si[t_] = si2[t] /. solution

or (better yet):

{r, th, si} = {si2, r2, th2} /. First@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}]

Bobby

On Tue, 28 Sep 2004 00:58:26 -0400 (EDT), Narasimham G.L. <mathma18 at hotmail.com> wrote:

> 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[%];
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Implicit root structures in the Mandelbrot set
  • Next by Date: Re: problem with very slow matrix function
  • Previous by thread: Error with NDSolve
  • Next by thread: Re: Error with NDSolve