Derivatives

Multivariable Calculus, Carleton College Math 211, Spring 2017, Prof. Joshua R. Davis

How to use this notebook

In each section of this notebook, there is a demonstration followed by a problem for you to solve using Mathematica. Do them all, asking questions as you like.

Arc length

Here’s a little example of computing the arc length of a parametrized curve. After executing the code cell, read each line of code to understand exactly what it does.

Clear[t]
r = {Cos[t], Sin[t], t}
ParametricPlot3D[r, {t, 0, 4 Pi}]
v = D[r, t]
speed = Sqrt[Dot[v, v]]
s = Integrate[speed, {t, 0, 4 Pi}]

Here’s another example. What goes wrong? How do you fix it? (Hint: You need two ideas from our introductory Mathematica tutorial.)

Clear[t]
r = {Log[t^2 + 2], Cosh[Sin[t]], ArcTan[t]}
ParametricPlot3D[r, {t, 0, 1}]
v = D[r, t]
speed = Sqrt[Dot[v, v]]
s = Integrate[speed, {t, 0, 1}]

Frenet-Serret frame

This section deals with the Frenet-Serret frame of a parametrized curve: the unit tangent, normal, and binormal vectors. I’ve written a little bit of Mathematica code to compute this frame numerically, for any curve r at any chosen time t0. You are not expected to be able to write code like this, but you should read it and try to guess what each line does.

Clear[frame, t]
frame[r_, t0_] :=
	Module[{v, tangent, normal, binormal},
		v = D[r, t];
		tangent = Simplify[v / Norm[v], Element[t, Reals]];
		normal = D[tangent, t] / Norm[D[tangent, t]];
		tangent = N[tangent /. {t -> t0}];
		normal = N[normal /. {t -> t0}];
		binormal = Cross[tangent, normal];
		{tangent, normal, binormal}];

Now let’s revisit an old example of a helix winding around a torus. We saw this curve in class a few days ago.

Clear[t]
k = 10
r = {(2 + Cos[k t]) Cos[t], (2 + Cos[k t]) Sin[t], Sin[k t]}
ParametricPlot3D[r, {t, 0, 2 Pi}]
frame[r, 0.37]

Here is an interactive animation of the Frenet-Serret frame moving along that curve. Depending on how fast your computer is, you might have to move the slider very slowly, to get a smooth response.

Manipulate[
	Show[
		ParametricPlot3D[r, {t, 0, 2 Pi}],
		ParametricPlot3D[
			{(r /. {t -> t0}), (r /. {t -> t0}), (r /. {t -> t0})} + u frame[r, t0], 
			{u, 0, 1}, PlotStyle->Thick]],
	{t0, 0, 2 Pi}]

By copying and pasting and editing, construct a similar example for the twisted cubic r = (t, t^2, t^3), for t running between -1 and 1. View the curve from multiple directions, to understand how it is shaped. Watch the Frenet-Serret frame move along the curve. Where is the torsion of the curve greatest?

Limits

As we learned in our introductory tutorial, Mathematica knows a lot about calculus. In fact, its Limit function is pretty good at computing single-variable limits. But Limit doesn’t even try to handle multivariable functions. That’s a sign of how subtle limits are in multiple dimensions. Here’s a non-example, using a recent example from class.

Clear[x, y]
Limit[Sin[x] / x, x -> 0]
Limit[x y^2 / (x^2 + y^2), x -> 0, y -> 0]
Limit[x y^2 / (x^2 + y^2), {x, y} -> {0,0}]

Partial derivatives

The heat equation (which comes up in thermodynamics, groundwater modeling, and other diffusion processes) for a function u = u(x, t) is du/dt = d/dx du/dx. One solution is u = E^(-x^2 / (4 t)) / (2 Sqrt[Pi t]). Here is an animation of that solution over time.

Clear[x, t]
Manipulate[
	Plot[E^(-x^2 / (4 t)) / (2 Sqrt[Pi t]), {x, -1, 1}, PlotRange->{0, 3}],
	{t, 0.01, 1}]

Use Mathematica to verify that the u given above really does satisfy the heat equation. Also verify that, for any integer n, u = sin(n x) E^(-n^2 / t) is a solution. Also make an animation of that solution.

Differentiability

Here’s an example from class.

Clear[x, y]
f = Max[-Abs[x], -Abs[y]];
Plot3D[f, {x, -1, 1}, {y, -1, 1}]

Does df/dx exist at (0, 0)? Does df/dy exist there? Answer these questions using your own intuition, and using Mathematica. Why does Mathematica give the answers it does? And is f differentiable at (0, 0)?