- I-Learn, Class Pictures, Learning Targets, Text Book Practice
- Prep Tasks: Unit 1 - Motion, Unit 2 - Derivatives, Unit 3 - Integration, Unit 4 - Vector Calculus
This is Day 4 in Unit 2.
Brain Gains (Rapid Recall, Jivin' Generation)

- For the function $f(x,y) = \sin(3xy^2)+5x^3$, compute the gradient $\vec \nabla f(x,y)$ and the total derivative $Df(x,y)$.
Solution
The gradient is the vector $$\vec \nabla f(x,y) = \left(15 x^2+3 y^2 \cos \left(3 x y^2\right),6 x y \cos \left(3 x y^2\right)\right).$$ The derivative is the matrix $$D f(x,y) = \begin{bmatrix}15 x^2+3 y^2 \cos \left(3 x y^2\right)& 6 x y \cos \left(3 x y^2\right)\end{bmatrix}.$$
Mathematica treats both of these quantities as the same object.
f[x_, y_] := Sin[3 x y^2] + 5 x^3
D[f[x, y], {{x, y}}]
- For the vector field $\vec F(x,y) = (2x+3y, 4xy^3)$, compute the differential (as a linear combination of partial derivatives), state $\frac{\partial \vec F}{\partial x}$ and $\frac{\partial \vec F}{\partial y}$, and then state the total derivative $D\vec F(x,y)$.
Solution
The differential is $$d\vec F = (2dx+3dy, 4 y^3dx + 12 xy^2 dy) = (2,4y^3)dx+(3,12xy^2)dy.$$ This means the partial derivatives are $$\frac{\partial \vec F}{\partial x}=(2,4y^3), \frac{\partial \vec F}{\partial y}=(3,12xy^2).$$ The total derivative is a matrix where these partials are placed in the columns of the matrix. This gives the total derivative as $$D\vec F = \begin{bmatrix} 2 & 3 \\ 4 y^3 & 12 x y^2 \end{bmatrix}.$$
The Mathematica code remains the same. Mathematica stores matrices as lists of lists, which we can print in human readable form with MatrixForm[].
F[x_, y_] := {2 x + 3 y, 4 x y^3}
D[F[x, y], {{x, y}}]
% // MatrixForm
- For the function $f(x,y) = x^2+4y^2$, graph the level curves that pass through the points $(0,1)$ and $(0,2)$.
Solution
We'll draw this in class. The graphs are two ellipses. Here is a solution with Mathematica.
f[x_, y_] := x^2 + 4 y^2
p1 = ContourPlot[f[x, y], {x, -5, 5}, {y, -5, 5},
Contours -> {f[0, 1], f[0, 2]}, ContourShading -> None]
- To your plot above, add the gradient of $\vec f$ at the points $(0,1)$ and $(0,2)$, as well as at a few other points along the curves you drew.
Solution
The gradient is $\vec \nabla f(x,y) = (2x,8y)$. This means $\vec \nabla f(0,1) = (0,8)$ and $\vec \nabla f(0,2) = (0,16)$. These vectors are quite long. Notice that they point straight up. The vector $\vec \nabla f(1,0) = (2,0)$ points straight right (normal to the level curve).
With Mathematica, we can plot the gradient at lots of points.
gradf = D[f[x, y], {{x, y}}];
p2 = VectorPlot[gradf, {x, -5, 5}, {y, -5, 5}];
Show[p1, p2]
We can also use some options in VectorPlot to get the gradient between the level curves.
VectorPlot[gradf, {x, -5, 5}, {y, -5, 5},
RegionFunction -> Function[{x, y, vx, vy, n}, f[0, 1] <= f[x, y] <= f[0, 2]]]
Group Problems
- Let $f(x,y,z) = 9x-4yz^3+3xz - y^2$.
- Compute $f_x$, $D_y f$ and $\frac{\partial f}{\partial z}$.
- State the vector $\vec \nabla f(x,y,z)$ and matrix $Df(x,y,z)$.
- Check with Mathematica.
- Let $f(x,y) = x^2-9$.
- Construct a contour plot of $f$. (The contour corresponding to $f=0$ is a great start. Would $f=5$ or $f=-5$ be simpler to add to your plot? You get to pick values for the output that help. )
- At various points $P$ in your plot, add the gradient $\vec \nabla f(P)$.
- Construct a surface plot of $f$.
- Check with Mathematica.
- Let $f(x,y) = 4-4x^2-y^2$.
- Construct a contour plot of $f$. (Contours corresponding to $f=0$ and $f=4$ are a good start. )
- At various points $P$ in your plot, add the gradient $\vec f(P)$.
- Construct a surface plot of $f$.
- Check with Mathematica.
|
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
