next up previous
Next: About this document ... Up: No Title Previous: No Title

Subsections


MA 1024 Laboratory 2: Maple procedures for curve computations

Purpose

The purpose of this lab is to give you practice using Maple to compute curvature, cross products, and other vector operations.

Background

Maple has several useful functions for working with vectors. This lab provides a brief introduction to the most basic such commands. All of the commands used in this lab come from the Maple linalg and the CalcP packages, which must be loaded before any of the commands can be used.

Here is a list of the Maple functions we will be using from the linalg package. Note that these functions form only a small subset of the package, which is designed primarily for linear algebra. Examples for some of the commands are given below, more examples can be found in the help screens for each command. Several of these commands appeared in the previous lab, so you might want to refer back to it.

vector
Used to define a vector.
add
Adds two vectors or two matrices together.
scalarmul
Multiplies a vector by a scalar or a matrix by a scalar.
innerprod
Computes the dot product of two vectors.
crossprod
Computes the cross product of two vectors.
evalm
Evaluates expressions involving vectors.
norm
Computes the norm, or magnitude, of a vector. For reasons explained below, the use of this command is not recommended. A better alternative for our purposes is to use the square root of the inner product of a vector with itself. Examples appear below.

This is a list of the commands from the CalcP package that are appropriate for this lab. Several should be familiar from the previous lab.

VDiff
Differentiates vector-valued functions.
VPlot
Plots vector-valued functions in two and three dimensions.
VMag
Computes the magnitude of a vector.
ParamPlot
Animates parametric curves in two dimensions.
ParamPlot3D
Animates parametric curves in three dimensions.
unitvect
Computes the unit vector associated with a vector ${\bf v}$..
Curvature
Computes the curvature, $\kappa (t)$, for a vector-valued function ${\bf r}(t)$.

The first set of examples below demonstrates how to compute linear combinations of vectors, dot and cross products, magnitudes, and vector components for fixed vectors.

  > with(linalg):
Warning: new definition for   norm
Warning: new definition for   trace

  > a := vector([2,13,-6]);

\begin{maplelatex}
\begin{displaymath}
{a} := [\,2\,13\,-6\,]\end{displaymath}\end{maplelatex}
  > b := vector([5,-4,17]);

\begin{maplelatex}
\begin{displaymath}
{b} := [\,5\,-4\,17\,]\end{displaymath}\end{maplelatex}
  > add(a,b);

\begin{maplelatex}
\begin{displaymath}[\,7\,9\,11\,]\end{displaymath}\end{maplelatex}
  > evalm(5*a-2*b);

\begin{maplelatex}
\begin{displaymath}[\,0\,73\,-64\,]\end{displaymath}\end{maplelatex}
  > innerprod(a,b);

\begin{maplelatex}
\begin{displaymath}
-144\end{displaymath}\end{maplelatex}
  > crossprod(a,b);

\begin{maplelatex}
\begin{displaymath}[\,197\,-64\,-73\,]\end{displaymath}\end{maplelatex}
  > crossprod(b,a);

\begin{maplelatex}
\begin{displaymath}[\,-197\,64\,73\,]\end{displaymath}\end{maplelatex}
  > innerprod(a,crossprod(a,b));

\begin{maplelatex}
\begin{displaymath}
0\end{displaymath}\end{maplelatex}

The next two commands show two different ways to compute the magnitude of a vector. The first way uses the norm command. Note the 2 as the second argument of the command. This 2 has to be there, or else Maple uses a different norm than the one we want. The second way, using the fact that $\parallel
{\bf u} \parallel = \sqrt{{\bf u} \cdot {\bf u}}$, is probably the preferred one.

  > norm(a,2);

\begin{maplelatex}
\begin{displaymath}
\sqrt {209}\end{displaymath}\end{maplelatex}
  > sqrt(innerprod(a,a));

\begin{maplelatex}
\begin{displaymath}
\sqrt {209}\end{displaymath}\end{maplelatex}

As we've seen in class, computing the curvature, $\kappa$, and the unit normal and tangent vectors is a tedious process, even for the simplest of curves. Fortunately, Maple procedures can be written to do these calculations and this lab will introduce you to the ones that we have written here at WPI as part of the CalcP package. As usual, before you can use any of these commands, you must load the package with the following command. Since some of the commands use the linalg package, it is probably a good idea to load it as well.

  > with(linalg):
Warning: new definition for   norm
Warning: new definition for   trace

  > with(CalcP):

The next few commands deal with a simple example of a curve known as a helix. In one of the exercises, you will be investigating a more general version of a helix, so you are encouraged to pay close attention to the following examples. Note the use of the axes option in the VPlot command. Including axes in a plot is often helpful in visualizing a curve in three dimensions. Also, recall that if you click on a plot, controls appear in the context bar that allow you to modify the plot, including changing the axes style and rotating the plot. If you have trouble doing this, ask your TA for help.

Note also that we've used the linalg command vector to define the function $\mathbf{h}(t)$ instead of the simpler list notation we used in the previous lab. The commands in the CalcP package can handle either notation, but the commands in the linalg package require you to use the vector command to define fixed vectors or vector-valued functions.

  > h := t -> vector([cos(t),sin(t),t]);

\begin{maplelatex}
\begin{displaymath}
{h} := {t} \rightarrow {\rm vector}(\,[\,{\rm cos}(\,{t}\,), 
{\rm sin}(\,{t}\,), {t}\,]\,)\end{displaymath}\end{maplelatex}
  > VPlot(h(t),t=0..4*Pi,axes=NORMAL);
  > ParamPlot3D(h(t),t=0..4*Pi);

  > Curvature(h(t),t);

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac {1}{2}}\end{displaymath}\end{maplelatex}

Exercises

1.
Use Maple to compute the following, given that ${\bf a} =
\langle -2, 4,
8 \rangle$, ${\bf b} = \langle 0, -5, 3 \rangle$, and ${\bf c} =
\langle 7, 2, 4 \rangle$.
(a)
$(2 \mathbf{a}-\mathbf{b}) \cdot \mathbf{c}$.
(b)
$\mathbf{a} \times ( \mathbf{b} \times \mathbf{c})$.
(c)
$\displaystyle \mathbf{a} - \left( \frac{\mathbf{a} \cdot
\mathbf{b}}{\mathbf{b} \cdot \mathbf{b}}\right) \mathbf{b} $
(d)
Explain why the vector you computed in the previous part of this exercise is perpendicular to $\mathbf{b}$.
2.
As discussed in the text, the curve associated with a function of the form

\begin{displaymath}
\mathbf{r}(t) = a t \mathbf{i} + b \cos(t) \mathbf{j} + b\sin(t)
\mathbf{k} \end{displaymath}

where b is a positive constant and a is an arbitrary constant, is called a circular helix.
(a)
Compute the speed. Is it independent of the parameter t?
(b)
Compute the curvature. Is it independent of the parameter t?
(c)
Compute the normal and tangential components of the acceleration.
(d)
Find values of a and b that give a speed of 5 and a radius of curvature of 6.25. Include a plot of the resulting curve.

3.
In the old days, students at WPI used to do projects in calculus as well as labs. One such project called for students to design a loop for a roller coaster. Pete Coppenrath, Matt Dunn, and Rob Roy from the class of `95 came up with the following design.

\begin{displaymath}
\mathbf{r}(t) = 3t \mathbf{i} + 25 \int_0^t \cos(1.685w+w^2/...
 ...mathbf{j} + 25 \int_0^t \sin(1.685w+w^2/10) \, dw \, \mathbf{k}\end{displaymath}

Here $\mathbf{r}(t)$ is the position in units of meters of the car on the loop and t is the time in seconds.
(a)
Plot the position for $0 \leq t \leq 3.2$. The best way to view the loop is probably looking in along the x axis. How high (approximately) is the top of the loop, in meters?
(b)
Find the speed of the car and convert it to units of miles per hour or kilometers per hour. Does it seem reasonable for a roller coaster?
(c)
Plot the curvature of the loop for $0 \leq t \leq 3.2$.
(d)
What is the radius of curvature of the loop at t=0? At t=3.2?
(e)
Plot the normal acceleration of the loop for $0 \leq t \leq 3.2$. To put it in perspective, you might want to plot the normal acceleration divided by 9.8, the acceleration due to gravity in units of meters per second squared.
(f)
Based on your results, do you think this would be a fun loop to go on?

4.
In the roller coaster project, the students were asked to design a loop whose curvature increased linearly with distance measured along the loop. To get an idea of how the students obtained the formula for their loop, consider the following curve in two dimensions.

\begin{displaymath}
\mathbf{r}(t) = \int_0^t \cos(au+bu^2) \, du \, \mathbf{i} + \int_0^t
\sin(au+bu^2) \, du \, \mathbf{j} \end{displaymath}

where a and b are positive constants and t is a parameter with $t\geq 0$.
(a)
Show that the speed is constant and equal to 1. Explain why this means that the parameter t is the same as the arc length.
(b)
Show that the curvature is given by $\kappa(t) = \mid a+2bt
\mid$. Note that the assumptions on a, b, and t mean that $\kappa(t) = a+2bt$.
(c)
Use your results from the previous exercise to find a formula for a curve in $\mathbf{R}^2$ whose curvature is given by $\kappa(t) =
1/20+t/50$ for $t\geq 0$.

next up previous
Next: About this document ... Up: No Title Previous: No Title

William W. Farr
1/24/2000