MathGroup Archive 1998

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

Search the Archive

Re: ODEs and phase portraits

Try this one:

de[epsilon_, x0_, v0_, T_] :=
  Module[{eqn, x, y, t},
   eqn = {Derivative[1][Derivative[1][x]][t] +
        epsilon*(x[t]^2 - 1)*
         Derivative[1][x][t] + x[t] == 0,
      x[0] == x0, Derivative[1][x][0] == v0};
    y = x /. NDSolve[eqn, x, {t, 0, T}][[1]];
    ParametricPlot[{y[t], Derivative[1][y][t]},
     {t, 0, T}, PlotStyle -> RGBColor[1, 0, 0],
     Epilog ->
      {RGBColor[0, 0, 1], AbsolutePointSize[5],
       Point[{y[0], Derivative[1][y][0]}]}]; ]

Sample usage:


If you copy the above into a NB, highlight the bracket, and type
Ctl-Shif-N, it will look a lot better.  Anyway, try it.


phantomlord at wrote in message <728kp1$ehc at>...
>I am trying to write a function such that I have the following ODE:
>x''(t)+epsilon*(x(t)^2-1)*x'(t)+x(t)==0  [1] where epsilon is to be one
>of the parameters in the function. I want to beable to draw out the
>phase portraits for the equation for different values of epsilon.
>To deduce the phase portraits in a mathematical procedure I multiply
>equation[1] by dx(t)/dt and integrate w.r.t. t.  To do this in
>Mathematica is trivial, so I'll skip past this - it is the next step
>that I would like assistance with:
>Q:Is there a way that I can decompose the result of the above (I'll call
>it [2]) into the corresponding pair (below) of ODEs to deduce the
>trajectory of the phase portrait?
>x'(t) = y(t)
>y'(t) = f(x,y)
>some f(x,y) function of x and y.
>Perhaps there is a built in function that will allow me to do this? If
>not do, can anybody suggest another way to do this?
>Also after plotting the trajectory is there any way to determine the
>direction of it in Mathematica?
>thanks for you time.
>-----------== Posted via Deja News, The Discussion Network ==----------
>       Search, Read, Discuss, or Start Your Own

  • Prev by Date: Re: Thin Lines in Plots
  • Next by Date: finite difference and tayler series?
  • Previous by thread: Re: ODEs and phase portraits
  • Next by thread: Re: ODEs and phase portraits