Adding tangent (velocity) vectors to a plot of a space curve [duplicate]

This question already has an answer here:

Plotting a set of trajectories (not a vector field) in 3D

3 answers

Finding unit tangent, normal, and binormal vectors for a given r(t)

4 answers

I am just getting started with Mathematica and need help plotting tangential vectors to a 3D parametric function. I know how to do this in 2D but am unsure how to do it in 3D. Maybe I am using the wrong functions? Anyway, here is my attempt :

Clear[t, x, y, z, P];
x[t_] = 2 Sin[t];
y[t_] = 6 Sin[t/2]^2;
z[t_] = 3 Cos[t];
P[t_] = {x[t], y[t], z[t]};

curveplot = ParametricPlot3D[P[t], {t, 1, 6}, PlotStyle -> Thickness[0.01]];

velocity[t_] = {x'[t], y'[t], z'[t]};
velvector[t_] := Vector3D[velocity[t], Tail -> P[t], VectorColor -> Blue];

velocityvectors = Graphics3D[Arrow[{{P[t]}, {velocity[t]}}]];

Show[curveplot,
Table[velocityvectors[t], {t, 1, 6, (6 – 1)/10}],
PlotRange -> All, AxesLabel -> {“x”, “y”, “z”}]

=================

=================

1 Answer
1

=================

Is Vector3D from a package? I don’t know it. Take a look:

Clear[t, x, y, z, P];
x[t_] = 2 Sin[t];
y[t_] = 6 Sin[t/2]^2;
z[t_] = 3 Cos[t];
P[t_] = {x[t], y[t], z[t]};
V[t_] = {x'[t], y'[t], z'[t]};
curveplot = ParametricPlot3D[P[t], {t, 1, 6}, PlotStyle -> Thickness[0.01]]

ar = Table[{P[t], P[t] + V[t]}, {t, 1, 6, .5}];
Show[curveplot,
Graphics3D[{
Arrow[ar],
Red, AbsolutePointSize@12, Point@ar[[ All, 1]]}],
PlotRange -> All, AxesLabel -> {“x”, “y”, “z”}]

  

 

Thanks so much!
– J. Musk
Jun 24 ’13 at 0:54