Introduction to Mathematica and
Multivariable Calculus

Basic Calculus Input
Don’t forget to press Shift-Enter (or Enter on the number pad) to execute each part.

Taking a derivative:         D[3x^2 + Sin[x] , x]
Taking an antiderivative: Integrate[3x^2 + Sin[x] , x]
Finding a definite integral: Integrate[3x^2 + Sin[x] , {x, -1, Pi/2}]
Approximate this result: N[%]

Defining a function f (x): f[x_] = 3x^2 + Sin[x]
(Note the underscore "_" after the variable.)

Finding a function’s value: f[Pi]
Combining these ideas: D[f[x] , x]

Basic Vector Input
Define vector v = <-1, 3, 6> by typing v={-1, 3, 6}
Define vector u = <0, -2, 5> the same way.
Multiplication: Type u space v. What happened?
Dot Product: u.v (period)
Cross Product: Cross[u, v] (Note that Cross[v, u] produces the opposite result.)

Getting Started
To assist with the input, load the 3D Parametric Equations Palette that Ms. Brown made.

Select the first button in the palette to load the package and define the "magnitude function."

To see how the palette works, click on {ÿ,ÿ,ÿ} to get the template for a 3D vector. Type in a number for the first component and press Tab to move to the next empty cell. Define v = <2, 4, 6> this way.

Now, find the norm, or magnitude, of v by typing Mag[v] and execute.
Confirm your result.

Type Mag[v/Mag[v]]. What does this mean? What is the result? Why?

Unit Tangent and Unit Normal Example
In this example, we will define a vector-valued function r(t) = t cos t i + t sin t j + t k and have Mathematica calculate T(t), N(t), aT, and aN at t = p/2. We will also generate the graph of r(t) and the line tangent to r at t =p/2.

The Unit Tangent and Unit Normal Vectors

Take the derivative of r(t) by typing D[r[t] , t]
Define wpe1.jpg (1551 bytes).Use T[t_] and the magnitude, Mag[ ].

Yikes! Let’s simplify that: Type Simplify[%] to simplify the most recent output.

Define N(t)* using T(t). Recall: wpe9.jpg (1547 bytes). You will need to simplify it.
*Note: Since N[ ] means finding the numerical approximation, you need to use a different name for your function such as Nm[t_].

Find T(p/2), N(p/2), and a(p/2).
Use these results to find aT, and aN , by definition, when t =p/2.
Recall: aT = a·T and aN = a·N.
Use your results to verify that aT2 + aN2 = ||a||2 for this example at t =p/2.

The Tangent Line

Find the equation of the line tangent to r(t) at t =p/2.
Write your answer in parametric form.
To graph this line on the same graph as r(t):

Graph r(t) again as you did earlier.

You may also want to change the view point.

What does the graph illustrate? Does this make sense?

The Normal Line and Acceleration

If you have time, find the equation of the line normal to r(t) at t = p/2. (Hint: Use copy-and-paste to put long expressions into a new piece of code.) Show it on the same graph as above. Graph the line determined by the acceleration vector. Try to see how your graph illustrates that a lies in the plane determined by T and N. This will happen no matter what value you choose for t. How could you use Mathematica to find curvature?

Want to Learn More?
Go to Ms. Brown’s web site and download another activity. In particular, you may be interested in Quadric Surface Graphing or Solids of Revolution. To learn more of the basics, check out the HTML files at the top of the list.

Return to

Abby Brown - Torrey Pines High School - 2/2002