Plotting a Function

197 Views Asked by At

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

1

There are 1 best solutions below

1
On BEST ANSWER

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]}]]