# Preface

This tutorial was made solely for the purpose of education and it was designed for students taking Applied Math 0340. It is primarily for students who have some experience using *Mathematica*. If you have never used
*Mathematica* before and would like to learn more of the basics for this
computer algebra system, it is strongly recommended looking at the APMA
0330 tutorial. As a friendly reminder, don't forget to clear variables in use and/or the kernel. The *Mathematica* commands in this tutorial are all written in bold black font,
while *Mathematica* output is in normal font.

Finally, you can copy and paste all commands into your *Mathematica* notebook, change the parameters, and run them because the tutorial is under the terms of the GNU General Public License
(GPL). You, as the user, are free to use the scripts for your needs to learn the *Mathematica* program, and have
the right to distribute and refer to this tutorial, as long as
this tutorial is accredited appropriately. The tutorial accompanies the
textbook *Applied Differential Equations.
The Primary Course* by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043

Return to computing page for the first course APMA0330

Return to computing page for the second course APMA0340

Return to Mathematica tutorial for the first course APMA0330

Return to Mathematica tutorial for the second course APMA0340

Return to the main page for the first course APMA0330

Return to the main page for the second course APMA0340

Introduction to Linear Algebra with *Mathematica*

## Glossary

# Introduction: Tubing

Consider a curve in three-dimensional space defined parametrically by

*a*that surrounds this curve, which is a tube that follows the shape of the curve. A point

*P*on the desired surface can be reached by adding two vectors:

**r**(

*t*) that connects the origin with a point on the curve and a vector

**a**(

*u*) that connects that point to a point on the surface. If

**P**denotes the position vector of point

*P*, then

**r**(

*t*) has components \( \left\langle f(t), g(t), h(t) \right\rangle , \) corresponding to the parametrization of the curve, and the second vector has components

*u*is the angle that

**a**(

*u*) makes with cylindrical unit vector \( \hat{\bf e}_{\rho} \) and ϕ is the angle that \( \hat{\bf e}_{\rho} \) makes with the positive ordinate. We need to express coordinates of

*P*as a function of two paramters. Expressing trigonometric functions as functions of

*t*, we get

*Mathematica*. We start with torus:

X[t_, u_, a_] := f[t] (1 + a*Cos[u]/Sqrt[f[t]^2 + g[t]^2])

Y[t_, u_, a_] := g[t] (1 + a*Cos[u]/Sqrt[f[t]^2 + g[t]^2])

Z[t_, u_, a_] := h[t] + a*Sin[u]

ParametricPlot3D[{X[t, u, 1], Y[t, u, 1], Z[t, u, 1]}, {t, 0, 2*Pi}, {u, 0, 2*Pi}, Axes -> False, Boxed -> False]

f[t_] := 5*Cos[t]*Cos[3*t]; g[t_] := 5*Sin[t]*Cos[3*t];

ParametricPlot3D[{X[t, u, 1], Y[t, u, 1], Z[t, u, 1]}, {t, 0, 2*Pi}, {u, 0, 2*Pi}, Axes -> False, Boxed -> False, PlotPoints -> 30]

f[t_] := 4*Cos[t]; g[t_] := 4*Sin[t]; h[t_] := t;

ParametricPlot3D[{X[t, u, 1], Y[t, u, 1], Z[t, u, 1]}, {t, 0, 6*Pi}, {u, 0, 6*Pi}, Axes -> False, Boxed -> False, PlotPoints -> 30]

*f*,

*g*, and

*h*with any other triplet, one can produce a variety of tubes. However, as the figure with clover tube shows, the circular cross sectons are not really circular. A true circular cross section should describe a circle perpendicular to the curve.

To make the circular cross section perpendicular to the curve, we have to choose **a**(*u*) to be of constant length and perpendicular to the curve at the point of contact. This means that **a**(*u*) is to be perpendicular to an element of length d**r** of the curve. Since

**a**(

*u*) must be perpendicular to \( {\bf r}' (t) \equiv \left\langle f' (t) , g' (t) , h' (t) \right\rangle . \) Letting

**a**(

*u*) have components

*s*,

*v*, and

*w*, we have

*Mathematica*as

r'[t] . rp == 0

**rp**for

**a**(

*u*). We need to define an angle

*u*on the circular sross section to measure the direction of

**a**(

*u*). For this, we need a fiducial axis relative to which we measure the angle. This axis must lie on the plane of the circle. A vector that defines such an axis could be taken to be \( \left\langle h' (t) , 0 , -f' (t) \right\rangle . \) Therefore, we get the second equation

Cos[u] == horV . rp / (a*Sqrt[h'[t]^2 + f'[t]^2])

**rp**:

*Mathematica*to solve the above three equations.

**rp**. We want to choose the first one for each, say

**PowerExpand**to the expression.

*s*before, but now we have explicit expressions

*v*and

*w*.

Return to Mathematica page

Return to the main page (APMA0340)

Return to the Part 1 Matrix Algebra

Return to the Part 2 Linear Systems of Ordinary Differential Equations

Return to the Part 3 Non-linear Systems of Ordinary Differential Equations

Return to the Part 4 Numerical Methods

Return to the Part 5 Fourier Series

Return to the Part 6 Partial Differential Equations

Return to the Part 7 Special Functions