# Showing trajectory of a dynamics on the unit ball

I have a unit ball and a vector with r0x, r0y and r0z ,the x,y,z components at initial time which evolves to r2x, r2y and r2z as function of time. I want to show the trajectory as in the attached figure here.

density2={{0.75, 0.25 - 0.25 I}, {0.25 + 0.25 I, 0.25}};

density2t = {{0.75,0.5 (0.5 (1. E^(0.2 t) Cos[0.1 t]-1. E^(0.2 t) Sin[0.1 t])-(0. +0.5 I) (1. E^(0.2 t) Cos[0.1 t]+1. E^(0.2 t) Sin[0.1 t]))},{0.5 (0.5 (1. E^(0.2 t) Cos[0.1 t]-1. E^(0.2 t) Sin[0.1 t])+(0. +0.5 I) (1. E^(0.2 t) Cos[0.1 t]+1. E^(0.2 t) Sin[0.1 t])),0.25}};

r0x = Tr[density2.PauliMatrix[1]]//FullSimplify
r0y = Tr[density2.PauliMatrix[2]]//FullSimplify
r0z = Tr[density2.PauliMatrix[3]]//FullSimplify

r2x = Tr[density2t.PauliMatrix[1]] // FullSimplify
r2y = Tr[density2t.PauliMatrix[2]] // FullSimplify
r2z = Tr[density2t.PauliMatrix[3]] // FullSimplify
• {r2x, r2y, r2z} is a vector with real components as a function of time. However, {r0x, r0y, r0z} have a real and complex part. I think you need an intial vector that has only real components. The way it is written, r2z has a constant value of 0.5, is that what you intended? Oct 18, 2017 at 15:45
• @Jack LaVigne, What you say is wrong. {r0x,r0y,r0z} has only real component. All are equal to 0.5. Just by looking at density2, how can you say this? Evaluate and see.
– ABCD
Oct 19, 2017 at 6:24
• It is true in a sense that, for example, r0x is real because the imaginary component is zero. However, if you execute Head[r0x], Mathematica returns Complex. I wouldn't worry about it, your comment makes it clear that 0.5 for the value is your intent. I have further questions which I have placed in the extended comment below. Oct 19, 2017 at 23:37
• Jyothi, why did you remove the figure? Oct 24, 2017 at 2:29

As I now understand the question you are not so much interested in the curve, but rather how to plot a curved line with a unit sphere mesh of circles in the Z-axis.

You will have to use a new curve for the example because if you allow two rotations at the current frequency of 0.1 t (i.e, t = 40 π) the magnitude of the vector is way beyond the unit sphere.

Norm[{r2x, r2y, r2z} /. t -> 40 π]
(* 5.81428*10^10 *)

## Example curve

So I will define an example curve as follows:

b=2.5;
t0=1;

r2x = Exp[b (t - t0)] (0.5 Cos[4 π t] - 0.5 Sin[4 π t]);
r2y = Exp[b (t - t0)] (0.5 Cos[4 π t] + 0.5 Sin[4 π t]);
r2z = 0.0;

Next we define some graphics to plot it.

Create the curve.

vectorPath = ParametricPlot3D[
{r2x, r2y, r2z},
{t, 0, 1.15},
PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}, {-1.2, 1.2}},
PlotStyle -> Black,
PlotPoints -> 100,
Axes -> False,
Boxed -> False,
BoxRatios -> {1, 1, 1}
]

the axes

axes = Graphics3D[
{
Thin,
Arrow[{{0, 0, 0}, {1.1, 0, 0}}],
Arrow[{{0, 0, 0}, {0, 1.1, 0}}],
Arrow[{{0, 0, -1}, {0, 0, 1.1}}],
Text[Style["x", 14], {1.1, 0, -0.1}],
Text[Style["y", 14], {0.1, 1.1, 0}],
Text[Style["z", 14], {0.1, 0, 1.1}]
}
]

The unit sphere is the item of interest. We set Mesh to a list of {11,0} to get uniformly spaced horizontal mesh and no vertical mesh. A light gray is used for the Mesh and the Opacity set to zero.

unitSphere = ParametricPlot3D[
{Sin[θ] Cos[ϕ], Sin[θ] Sin[ϕ],
Cos[θ]},
{θ, 0, Pi},
{ϕ, 0, 2 Pi},
PlotRange -> 1,
PlotStyle -> Directive[Opacity[0]],
Mesh -> {11, 0},
MeshStyle -> GrayLevel[0.7],
BoxRatios -> {1, 1, 1}
]

Now we put all this together using Show to plot it.

Show[
vectorPath,
axes,
unitSphere
]

• The pink circles have no particular significance. I am using ParametricPlot3D[{Sin[[Theta]] Cos[[Phi]], Sin[[Theta]] Sin[[Phi]], Cos[[Theta]]}, {[Theta], 0, [Pi]}, {[Phi], 0, 2 [Pi]}, PlotRange -> 1, PlotStyle -> Directive[Opacity[0]], Mesh -> 11, BoxRatios -> {1, 1, 1}]; to create the unit ball with a mesh appearance, that's all. The black curve is the solution of a trajectory obtained by solving an equation. I shall update the question with the details of the equation asap. Many thanks, once again.
– ABCD
Oct 20, 2017 at 7:08
• Many thanks. Is it possible to indicate the initial(starting point) of the trajectory by a red dot or something like that?
– ABCD
Oct 23, 2017 at 6:29
• Create point = Graphics3D[ { PointSize[0.025], Red, Point[{r2x, r2y, r2z} /. t -> 0] } ] and add it to the Show Oct 24, 2017 at 10:04
• Many thanks for the idea.
– ABCD
Oct 24, 2017 at 10:10