Re: How to parametric plot deriv of interpolating func?

• To: mathgroup at christensen.cybernetics.net
• Subject: [mg1581] Re: How to parametric plot deriv of interpolating func?
• From: rubin at msu.edu (Paul A. Rubin)
• Date: Sat, 1 Jul 1995 03:48:09 -0400
• Organization: Michigan State University

```In article <3sg42m\$8ji at news0.cybernetics.net>,
"Ronald J. Riegert" <riegerrj at esvax.dnet.dupont.com> wrote:
->	I have recently started working with NDSolve and just
->encountered Mathematica interpolating functions for the first
->time.  The Mathematica book says that these can be dealt with
->just like any other function, but I'm having difficulty using
->their derivatives in parametric plots.
->	In particular, I use NDSolve to solve the second-order
->differential equation diffeq for x[t], and call the result
->soln:
->
->soln=
->   NDSolve[{diffeq,x[0.]==0.,x'[0.]==1.},x,{t,0.,50.}][[1,1]]
->
->This gives the interpolating function:
->
->x -> InterpolatingFunction[ {0.,50.}, <>]
->
->I'm interested in plotting D[x[t],t], so I do:
->
->Plot[Evaluate[D[x[t] /. soln,t]],{t,0.,50.}]
->
->which works fine.  However, I'm really want to use D[x[t],t]
->in a parametric plot, so I test by entering:
->
->ParametricPlot[{t, Evaluate[D[x[t] /. soln,t]]},{t,0.,50.}]
->
->which should give the same graph as the above Plot command.
->Instead, it produces a bunch of error messages.
->	My question, therefore, is how do I go about using the
->derivative of an interpolating function in a parametric plot?
->
->Ronald J. Riegert
->DuPont Experimental Station
->riegerrj at esvax.dnet.dupont.com
->
->
You need to Evaluate the entire first argument:

ParametricPlot[Evaluate[{t, D[x[t] /. soln,t]}],{t,0.,50.}]

ParametricPlot has attribute HoldAll, so Mma hold the first argument, which
is the part enclosed in braces.  Basically, it didn't see your Evaluate
until after substituting 0. for t.  I think.

Paul

**************************************************************************
* Paul A. Rubin                                  Phone: (517) 432-3509   *
* Department of Management                       Fax:   (517) 432-1111   *
* Eli Broad Graduate School of Management        Net:   RUBIN at MSU.EDU    *
* Michigan State University                                              *
* East Lansing, MI  48824-1122  (USA)                                    *
**************************************************************************
Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE

```

• Prev by Date: Re: Mathematica 2.2.4 for OS/2: bad and good news.
• Next by Date: Re: FindMinimum [] more elegantly?
• Previous by thread: Re: Mathematica 2.2.4 for OS/2: bad and good news.
• Next by thread: Re: FindMinimum [] more elegantly?