Building a tube around torus knot I am currently trying to parametrize a surface constructed by thickening a rather complicated curve, defining its normal, binormal and tangent vectors. Even using Mathematica simplification, the resulting vectors are page long expressions and the reason for it is because I have four additional variables in the position vector equation aside from the parameter itself.
I cannot post what I get after computing the vectors because it is too long to make sense but my curve is a torus knot, and it obviously depends on the torus surface on which it dwells, thus its radii (r and R) and the knot integers (p and q). These are the four variables.
What would you recommend to simplify the process? I cannot assign numerical values to these variables since I will have to change them later, so do I have to deal with the original equations or is there a method to somehow group all the variables together?
Thank you.
edit: This is the curve equation. Things get a lot worse after taking the derivative of the normalized tangent vector.

edit2: Here is an applet visualizing what I am doing. It provides the code but I cannot see how it is defined mathematically.
http://demonstrations.wolfram.com/TorusPaths/
 A: Let $0 < r < R$ be real numbers. On the circular torus parametrzed by
$$
X(u, v) = \bigl((R + r\cos u)\sin v, (R + r\cos u)\cos v, r\sin u\bigr),
$$
the coordinate vector fields and their cross product are
\begin{align*}
X_{u}
  &= (-r\sin u \sin v, -r\sin u \cos v, r\cos u) \\
  &= r(-\sin u \sin v, -\sin u \cos v, \cos u), \\
X_{v}
  &= \bigl((R + r\cos u) \cos v, -(R + r\cos u) \sin v, 0\bigr) \\
  &= (R + r\cos u) (\cos v, -\sin v, 0); \\
X_{u} \times X_{v}
  &= r(R + r \cos u)(\cos u \sin v, \cos u \cos v, \sin u).
\end{align*}
The (outward) unit normal at $X(u, v)$ is consequently
$$
n(u, v) = (\cos u \sin v, \cos u \cos v, \sin u).
\tag{1}
$$
The torus knot $r$ is defined by $r(t) = X(pt, qt)$. By the chain rule, its velocity is
$$
r'(t) = p X_{u}(pt, qt) + q X_{v}(pt, qt).
$$
By equation (1), the normal vector to the torus along the curve is
$$
\nu(t) = n(pt, qt)
  = \bigl(\cos(pt) \sin(qt), \cos(pt) \cos(qt), \sin(pt)\bigr).
$$
The normalized cross product
$$
\beta(t) = \frac{\nu(t) \times r'(t)}{\|\nu(t) \times r'(t)\|}
$$
is a unit vector tangent to the torus and orthogonal to the velocity. (The frame $\{r'/\|r'\|, \nu, \beta\}$ is the Darboux frame for the knot embedded in the torus, in case that's of interest.)
Incidentally, the vector fields
$$
e_{1}(u, v) = (-\sin u \sin v, -\sin u \cos v, \cos u),\qquad
e_{2}(u, v) = (\cos v, -\sin v, 0)
$$
constitute an orthonormal frame field on the torus. Since
$$
r'(t) = pr\, e_{1}(pt, qt) + q\bigl(R + r\cos(pt)\bigr)\, e_{2}(pt, qt),
$$
the field $\beta$ is the normalization of
$$
-pr\, e_{2}(pt, qt) + q\bigl(R + r\cos(pt)\bigr)\, e_{1}(pt, qt).
$$
In any case, if $\epsilon$ is sufficiently small, the desired tube is parametrized by
$$
Y_{\epsilon}(u, v) = r(u) + \epsilon\bigl(\nu(u)\cos v + \beta(u)\sin v\bigr).
$$
