## Geometry: Tubes around Spacial Curves

To use program files with Maxima, you should create a directory **user** as a subdirectory
of the home directory of Maxima (named **Maxima-5.9.1** in the Windows ditribution.) When you
copy procgram files into that directory, you can load them without a path name.

To use the code from the previous chapter, copy the file
tubeplot2.mc into the user directory, start MAxima and type

batch(tubeplot2);

Note that you do not use string quotes and that you do not type the file extension.

Maxima executes all statements in the file to be loaded. The following
definitions are read from **tubeplot2**:

rotateLeft, cross, tangent, binormal, normal, tube.

We can now define a spacial curve:

helix(x) := [5*cos(x), 5*sin(x), 2*x];

helix(x) := [5 cos(x), 5 sin(x), 2 x]

and compute a tube with radius 1 around that curve:

tube(helix, 1, t, rho);

2 sin(rho) sin(t)
[----------------- - cos(rho) cos(t) + 5 cos(t),
sqrt(29)
2 sin(rho) cos(t)
- cos(rho) sin(t) + 5 sin(t) - -----------------,
sqrt(29)
5 sin(rho)
2 t + ----------]
sqrt(29)

This is a parametric representation of a surface in space. We can
try to draw it with the function **plot3d**:

plot3d(%, [t,-2*%pi, 2*%pi],[rho,0, 2*%pi], ['grid, 100, 18], [gnuplot_preamble, "unset surface"]);

Regrettably, the **gnuplot** does not produce very good graphics. For
really good graphics it is often better to use other graphic programs. This
image was produced with Squeak and OpenGL: