Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*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 1998

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

Search the Archive

Re: Can't take a value from an InterpolatingFunction.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13638] Re: Can't take a value from an InterpolatingFunction.
  • From: "Allan Hayes" <hay at haystack.demon.cc.uk>
  • Date: Fri, 7 Aug 1998 09:14:05 +0100
  • References: <6qbqv3$a71@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

John:
The following may be relevant

Table[First[y[100] /.
    NDSolve[{x'[t] == y[t],
      y'[t] == -0.01*y[t] - Sin[x[t]],
      x[0] == 0, y[0] == y0}, {x, y}, {t, 0, 100},
     MaxSteps -> 3000]], {y0, 2, 2.5, 0.1}]

{-0.594081,0.438559,1.46045,1.21722,0.449353,-0.834324}

Allan
------------------------------------------------------------- 
Allan Hayes
Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay at haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642

***************
I. Ioannou wrote in message <6qbqv3$a71 at smc.vnet.net>...
>Hi all,
>
>I've set up and solved a system of two differential equations, according
>to the following prescription;
>
>  solution =
>    NDSolve[{r'[t] == .....equation1......,
>             p'[t] == .....equation2......,
>             r[0] == 0.,p[0] == p0}, {r, p}, {t, 0, 0.2},
>             MaxSteps \[Rule] 300000, Method \[Rule] Automatic]
>
>All has worked very nicely. However, I need now to take the value of r
>at t=0.2 and I can't seem to be able to do it.
>
>I should point out that the Book suggestion r[0.2] /. % doesn't work,
>because the above statement is within a For loop and is run many times.
>(to collect various r[0.2] values that come out) So, it's within one
>big cell.
>
>The error reported sais that solution is not a valid lookup table. Well,
>from what I understand, it's a set (?) of two InterpolatingFunctions.
>If I knew what kind of entity solution is, I might be able to figure
>how to instruct Mathematica to let me access r[0.2].
>
>Any help appreciated, thanks, John
>
>--
>      Ioannis   I    Ioannou                   phone: (206)-543-1372
>      g-2 group, Atomic Physics                fax:   (206)-685-0635
>      Department of Physics
>      University of Washington        e-mail: iioannou at u.washington.edu
>



  • Prev by Date: Re: Mathematica dies with bus error---known bug?
  • Next by Date: Re: A couple of curious outputs from Integrate[]
  • Previous by thread: Can't take a value from an InterpolatingFunction.
  • Next by thread: Re: Can't take a value from an InterpolatingFunction.