Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How can one plot a three-dimensional plot of a differential equation system of the following to show the trajectories in mathematica:

$x' = yz,~ y' = -2xz,~ z' = xy$

I tried using VectorPlot3D and ParametricPlot3D

share|improve this question
    
ParametricPlot3D[] should be fine. What were you expecting that you didn't get? –  J. M. Nov 11 '11 at 4:57
    
J.M.: I would like the trajectories to be displayed along the xyz axis. Parametric places it inside of a volume, (rectangle). –  night owl Nov 11 '11 at 5:04
    
Oh, you want three-dimensional axes to be shown (somewhat like using Axes instead of Frame in the two-dimensional case)? –  J. M. Nov 11 '11 at 5:08
    
As an alternative : Maple command DEplot3d –  pedja Nov 11 '11 at 7:20
    
If you send me all necessary parameters I will try to plot your system... –  pedja Nov 11 '11 at 14:27

1 Answer 1

up vote 2 down vote accepted

How about like so, parameterizing initial conditions by spherical angles $\theta$ and $\phi$:

enter image description here

The copy-paste-ready code:

Traj[\[Theta]_, \[Phi]_, tmax_] := 
 Module[{sol}, {sol} = 
   NDSolve[And @@ {x'[t] == y[t] z[t], y'[t] == -2 x[t] z[t], 
      z'[t] == x[t] y[t], x[0] == Sin[\[Theta]] Cos[\[Phi]], 
      y[0] == Sin[\[Theta]] Sin[\[Phi]], z[0] == Cos[\[Theta]]}, {x, 
     y, z}, {t, 0, tmax}];
  sol]

Show[ParametricPlot3D[{x[t], y[t], z[t]} /. {Traj[Pi/5, Pi/3, 7], 
     Traj[3 Pi/5, Pi/3, 7], Traj[2 Pi/5, Pi/7, 7]}, {t, 0, 7}, 
   PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, Evaluated -> True] /. 
  Line -> Tube, Graphics3D[{Sphere[{0, 0, 0}, 1]}]]
share|improve this answer
    
@nightown Try this Show[ParametricPlot3D[{x[t], y[t], z[t]} /. {Traj[Pi/5, Pi/3, 7], Traj[3 Pi/5, Pi/3, 7], Traj[2 Pi/5, Pi/7, 7]}, {t, 0, 7}, PlotRange -> 1.4 {{-1, 1}, {-1, 1}, {-1, 1}}, Evaluated -> True] /. Line -> Tube, ParametricPlot3D[{Sin[\[Theta]] Cos[\[Phi]], Sin[\[Theta]] Sin[\[Phi]], Cos[\[Theta]]}, {\[Theta], 0, Pi}, {\[Phi], 0, 2 Pi}, PlotStyle -> None, MeshStyle -> LightGray], Boxed -> False, AxesOrigin -> {0, 0, 0}, Ticks -> None] –  Sasha Nov 11 '11 at 18:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.