(Thanks to Thomas' Calculus for the problems.)
Read the notes for the background.
We use all the following, which can be replaced by using MTH229
, if that package is installed:
using Plots, SymPy, ForwardDiff, LinearAlgebra
xs_ys(vs) = (A=hcat(vs...); Tuple([A[i,:] for i in eachindex(vs[1])]))
xs_ys(v,vs...) = xs_ys([v, vs...])
xs_ys(r::Function, a, b, n=100) = xs_ys(r.(range(a, stop=b, length=n)))
function arrow!(plt::Plots.Plot, p, v; kwargs...)
if length(p) == 2
quiver!(plt, xs_ys([p])..., quiver=Tuple(xs_ys([v])); kwargs...)
elseif length(p) == 3
# 3d quiver needs support
# https://github.com/JuliaPlots/Plots.jl/issues/319#issue-159652535
# headless arrow instead
plot!(plt, xs_ys(p, p+v)...; kwargs...)
end
end
arrow!(p,v;kwargs...) = arrow!(Plots.current(), p, v; kwargs...)
ForwardDiff.gradient(ex::SymPy.Sym, vars=free_symbols(ex)) = [diff(ex, v) for v in vars]
Make a plot of the surface showing $f(x,y)= x \cdot y \cdot e^{-y^2}$ over the region $[-3,3] \times [-3,3]$.
Does the largest value over this region occur in the interior or on the boundary?
Make a contour plot of $\sin(x/2) - \cos(y) \cdot \sqrt{x^2 + y^2}$ over the region $[-5,5] \times [-5, 5]$.
Are there any closed contours in the region? What does this suggest about where any maximal values might be?
Compute the gradient of the function $f(x,y) = 2y/(y + \cos(x))$. (You can do this symbolically.)
Let $f(x,y) = (x^3 - y^3) \cdot e^{-(x^2 + y^2)}$.
Make a surface plot over the square region $[-5,5] \times [-5,5]$.
Find the gradient. What is $\partial f/ \partial x$?
Compute $f_{xx}$
Let $f(x,t) = \sin(x + c\cdot t)$ show for any $c$ that
Graph the plane through the origin which contains the vectors $\hat{u} = \langle 6, 4, −1\rangle$ and $\hat{v} = \langle −3, 12, 5 \rangle$. On the same graph, plot the cross product, $w = \hat{u} \times \hat{v}$ of these vectors.
Is $w$ perpendicular or parallel to both $\hat{u}$ and $\hat{v}$?
Is $w$ a unit vector?
For $f(x,y) = 2x^3 + 3xy + 2y^3$ find all points where the gradient is the zero vector.
Find the Hessian of $f$
Use the second partials test to say whether these values are a relative maximum, minimum, saddle point. If the second derivative test is inconclusive, say that.
Let $f(x,y) = x^3 \cdot y^3$. Using Lagrange multipliers, find the maximum value of $f$ over the unit disc, $x^2 + y^2 = 1$.