MathGroup Archive 2008

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

Search the Archive

Re: NDSolve and Parametric Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85450] Re: NDSolve and Parametric Plot
  • From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
  • Date: Mon, 11 Feb 2008 06:05:56 -0500 (EST)
  • References: <fomjh1$hmn$1@smc.vnet.net>

You need to select the first solution by using [[1]]:

repart[t_] := Re[x[t] /. solution[[1]]]
impart[t_] := Im[x[t] /. solution[[1]]]

Stephen Luttrell
West Malvern, UK

"Alex Cloninger" <acloninger at wustl.edu> wrote in message 
news:fomjh1$hmn$1 at smc.vnet.net...
> So I'm trying to run a simple program that will solve this series of 
> differential equations and plot the the x[t] function in the complex 
> plane.  Here's my code.
>
> solution = NDSolve[{x'[t] == 2p[t], x[0] == 2, p'[t] == -2x[t], p[0] == 
> Sqrt[-3]}, {x, p}, {t, 0, 2*Ï?}]
>
> repart[t_] := Re[x[t] /. solution]
> impart[t_] := Im[x[t] /. solution]
>
> ParametricPlot[{repart[t], impart[t]}, {t, 0, 2Ï?}, PlotRange -> {{-2, 2}, 
> {-2,2}}]
>
> For some reason, when I go to plot the curve, I get an error saying
> ParametricPlot::pptr: {repart[t], impart[t]} does not evaluate to a pair 
> of real numbers at t=2.617993877991494`*^-7
>
> What's going on?  Could someone please help me with this?
> 



  • Prev by Date: Re: NDSolve and Parametric Plot
  • Next by Date: Re: more looping trouble
  • Previous by thread: Re: NDSolve and Parametric Plot
  • Next by thread: Re: NDSolve and Parametric Plot