Tangent Vectors

A visualization on the helix

In this notebook I plot a helix with its unit tangent vectors at a collection of points.

The "standard" parametrization of the helix, $\mathbf{r}(t) = \langle \cos t, \sin t, t \rangle$, is used on the interval $[-4\pi,4\pi]$. Python functions are defined to compute the component-wise derivatives and unit tangent vectors at a given point. Finally, the tangent vectors are plotted at 10 points along the curve.

This was all done using SageMath (http://sagemath.org) in a web-based Jupyter notebook (http://jupyter.org).

In [1]:
version()
Out[1]:
'SageMath version 7.5.1, Release Date: 2017-01-15'
In [2]:
%display latex

Define the helix with the standard parametrization from above:

In [3]:
t = var('t');
r = [cos(t),sin(t),t];
r
Out[3]:

Plot four periods of the helix in a reasonable window:

In [4]:
helix = parametric_plot3d(r,(-4*pi,4*pi),aspect_ratio=(1,1,1/(2*pi)),plot_points=1000,viewer='tachyon')
In [5]:
show(helix)

Define python functions that will compute component-wise derivatives, vector lengths (or norms), and the unit tangent vectors at given points.

In [6]:
def ceval(vf,pt):
    n = len(vf);
    out = [None]*n;
    for i in range(n):
        out[i] = vf[i](t = pt).full_simplify();
    return out
In [7]:
def cder(vf,pt):
    n = len(vf);
    vfd = [None]*n;
    out = [None]*n;
    for i in range(n):
        vfd[i] = vf[i].diff()
    out = ceval(vfd,pt)
    return out
In [8]:
def norm(vf):
    n = len(vf);
    A = sum(vf[i]**2 for i in range(n));
    nm = sqrt(A);
    return nm.full_simplify()
In [9]:
def tang(vf,pt):
    n = len(vf);
    tn = [None]*n;
    tt = cder(vf,pt);
    ttt = norm(tt);
    for i in range(n):
        tn[i] = tt[i]/ttt.full_simplify();
    return tn

Choose some points on the helix:

In [10]:
pts = [None]*10;
for i in range(10):
    pts[i] = -4*pi + i*8*pi/9;
In [11]:
ppts = sum(plot(vector(tang(r,pts[j])),start=ceval(r,pts[j]),color='red',viewer='tachyon') for j in range(10));
In [12]:
show(helix + ppts)