Curves and Surfaces in (ℜ^3)

This Mathematica file contains the Mathematica commands which created some of the graphics and results in the handout we used to study multivariable calculus.

1. Curves in (ℜ^2)

Figure 2

Plot[x^3 Sin[x^3],{x,0,4},AxesLabel->{"x","y"},AspectRatio->1]

ContourPlot[x^11-y^11+10x^2y^2==1,{x,-2,2},{y,-2,2},AxesLabel->{"x","y"},AspectRatio->1,PlotPoints->100]

ParametricPlot[{Cos[t] - Cos[80t] Sin[t],2 Sin[t]-Sin[80t]},{t,-Pi,Pi},PlotPoints->400,AxesLabel->{"x","y"},AspectRatio->1]

2. Coordinates, Curves and Surfaces in (ℜ^3)

Figure 6

Plot3D[y^2 Cos[x*y]Exp[-y^2],{x,-2,2},{y,-2,2},AspectRatio->1,PlotPoints->40,BaseStyle->Large]

Figure 7

plane[x_]:=ParametricPlot3D[{x,t,s},{t,-2,2},{s,-1/2,1/2}]

plot1=Plot3D[y^2 Cos[x*y]Exp[-y^2],{x,-2,2},{y,-2,2},AspectRatio->1,PlotPoints->40];

Show[plot1,plane[-2],plane[1],plane[0],plane[2-0.1],BaseStyle->Large]

Figure 8

plane[x_]:=ParametricPlot3D[{t,x,s},{t,-2,2},{s,-1,1}]

plot1=Plot3D[y^2 Cos[x*y]Exp[-y^2],{x,-2,2},{y,-2,2},PlotPoints->30];

Show[plot1,plane[-2+0.1],plane[0],plane[2-0.1]]

Figure 9

list=Table[k^2 Cos[x*k]Exp[-k^2],{k,-2,2,1/2}]
Plot[Evaluate[list],{x,-2,2},AxesLabel->{"x","z"}]

list=Table[y^2 Cos[k*y]Exp[-y^2],{k,-4,4}]
Plot[Evaluate[list],{y,-2,2},AxesLabel->{"y","z"}]

Figures 10 and 11

Plot3D[x^2-y^2,{x,-6,6},{y,-6,6},AspectRatio->1,AxesLabel->{"x","y","z     "},PlotPoints->40]

list=Table[k^2-y^2,{k,-10,10}]
Plot[Evaluate[list],{y,-6,6},AxesLabel->{"y","z"}]

list=Table[x^2-k^2,{k,-10,10}]
Plot[Evaluate[list],{x,-6,6},AxesLabel->{"x","z"}]

Figure 12 & 13

plane[x_]:=ParametricPlot3D[{t,s,x},{t,-2,2},{s,-2,2},PlotPoints->30]

plot1=Plot3D[y^2 Cos[x*y]Exp[-y^2],{x,-2,2},{y,-2,2},AspectRatio->1,AxesLabel->{"x","y","z  "},PlotPoints->40];

Show[plot1,plane[-0.15],plane[0],plane[0.25],AspectRatio->1]

ContourPlot[y^2 Cos[x*y]Exp[-y^2],{x,-2,2},{y,-2,2},PlotPoints->40,FrameLabel->{"x","y"}]

ContourPlot[y^2 Cos[x*y]Exp[-y^2],{x,-2,2},{y,-2,2},PlotPoints->40,FrameLabel->{"x","y"},ContourShading->False]

ContourPlot[y^2 Cos[x*y]Exp[-y^2],{x,-2,2},{y,-2,2},ColorFunction->Hue,PlotPoints->40,FrameLabel->{"x","y"}]

Figure 14

ParametricPlot3D[{Cos[t],Sin[t],t},{t,0,5Pi},AspectRatio->1,AxesLabel->{"x","y","z"}]

3. Partial Differentiation

Figure 16

f[x_,y_] = Exp[-x^2-y^2]  y
Plot3D[f[x,y],{x,-2,2},{y,-2,2},AspectRatio->1,AxesLabel->{"x","y","z     "},PlotPoints->20]

ContourPlot[f[x,y],{x,-2,2},{y,-2,2}]

f[1/2,y]
Plot[f[1/2,y],{y,-4,4},AxesLabel->{"y","z"}]

f[x,-1]
Plot[f[x,-1],{x,-4,4},AxesLabel->{"x","z"}]

Example of Partial Derivatives

D[x^3 y - y^2 x,x]
D[x^3 y - y^2 x,y]
D[x^3 y - y^2 x,x,x]
D[x^3 y - y^2 x,y,y]
D[x^3 y - y^2 x,x,y]
D[x^3 y - y^2 x,y,x]

f[x_,y_]=Tan[x/y]
D[f[x,y],x]
D[f[x,y],y]
D[f[x,y],x,x]
D[f[x,y],y,y]
D[f[x,y],x,y]
D[f[x,y],y,x]

4. Extrema in (ℜ^3)

Figure 17

f[x_,y_] =-x^2-y^2 +x-4y+12
Plot3D[f[x,y],{x,-6,6},{y,-6,6},AspectRatio->1,AxesLabel->{"x","y","z     "},PlotPoints->20,BaseStyle->Large]

Here is how we can solve the equations to find the location of the extrema using Mathematica:

eq1=D[f[x,y],x]==0
eq2=D[f[x,y],y]==0
Solve[{eq1,eq2},{x,y}]

Now, we evaluate the function at the solution to find the value of the extrema:

f[-1/2,-2]

The function has a local maximum of 61/4 at x=1/2, y=-2. We kow it is a local maximum by looking at our sketch. We could also use a contour plot to determine that this is a maximum (lighter areas are higher):

ContourPlot[f[x,y],{x,-6,6},{y,-6,6},AspectRatio->1,AxesLabel->{"x","y"},PlotPoints->20]

Example

Plot the surface, then decide if we have a max or a min:

f[x_,y_] =x^4+y^4 -4x y-2y-4x+12
Plot3D[f[x,y],{x,-4,4},{y,-4,4},AspectRatio->1,AxesLabel->{"x","y","z     "},BaseStyle->Large]

This surface has a minimum.

Solve the set of equations that will tell us where the tangent lines are horizontal, which gives the location of the min.

eq1=D[f[x,y],x]==0
eq2=D[f[x,y],y]==0

Solve[{eq1,eq2},{x,y}]

Yuck! Let's try to get numerical solutions.

NSolve[{eq1,eq2},{x,y}]

There is only one real valued solution. The location of the min is x=1.304, y=1.21734. The value of the minimum is 3.08717 since

f[1.304,1.217]