wolframscience.com

A New Kind of Science: The NKS Forum : Powered by vBulletin version 2.3.0 A New Kind of Science: The NKS Forum > Pure NKS > A plotting question
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
Edwin


Registered: May 2006
Posts: 1

A plotting question

I cannot figure out how to produce a parametric plot of the "interpolating function" output resulting from using an NDSolve command. Can anyone help?

I appreciate any suggestions.

Report this post to a moderator | IP: Logged

Old Post 05-25-2006 07:57 PM
Edwin is offline Click Here to See the Profile for Edwin Click here to Send Edwin a Private Message Click Here to Email Edwin Edit/Delete Message Reply w/Quote
Jason Cawley
Wolfram Science Group
Phoenix, AZ USA

Registered: Aug 2003
Posts: 712

First, this forum is meant for New Kind of Science discussions. General Mathematica questions are better directed to Mathgroup, which you can find from here -

http://forums.wolfram.com/mathgroup/

Second, I'm not sure what you are trying to do, but an example might be all you need. If so, here is one -


mysolution = 
 NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2 x[t] - y[t]
   x[0] == y[0] == 1}, {x, y}, {t, 0, 10}]


That returns an interpolating function object, stored in the variable name "mysolution". ParametricPlot needs to be called in a form that gives it an {x,y} value for each value of its parameter variable, which you can get from e.g. -


ParametricPlot[{x[t], y[t]} /. mysolution, {t, 0, 10}, 
 PlotRange -> All]


Note the construction  /.mysolution . Interpolating function objects are effectively rules to replace their LHS variable names with tables of data. "/." means "ReplaceAll", meaning apply the following rules wherever their LHS's occur in the expression preceding.

Occasionally it may help to wrap the function Evaluate around the first argument in that call to ParametricPlot - from {x[t] to the end of mysolution in the line above, inside the brackets of the Evaluate - but it is not necessary in simple cases.

I hope this helps.

Report this post to a moderator | IP: Logged

Old Post 05-25-2006 09:39 PM
Jason Cawley is offline Click Here to See the Profile for Jason Cawley Click here to Send Jason Cawley a Private Message Edit/Delete Message Reply w/Quote
Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread


 

wolframscience.com  |  wolfram atlas  |  NKS online  |  web resources  |  contact us

Forum Sponsored by Wolfram Research

© 2004-14 Wolfram Research, Inc. | Powered by vBulletin 2.3.0 © 2000-2002 Jelsoft Enterprises, Ltd. | Disclaimer | Archives