Functions of Several Variables

(ℝ^3): w = f(x, y)

Interior and Boundary Points; 
Domains, Ranges; 
Open, Closed

Example w=(Sqrt[y-(x^2)])

f[x_,y_] = (Sqrt[y-(x^2)])
Plot3D[f[x,y],{x,-5,5},{y,-5,5},AxesLabel->{"X","Y","Z"}]

interiorpoints=RegionPlot[y-(x^2)>0,{x,-5,5},{y,-5,5}]

boundarypoints=ContourPlot[y-(x^2)==0,{x,-5,5},{y,-5,5},ContourStyle->{Red,Thick}]

Interior points are where y-(x^2)>0, and boundary points are where y-(x^2)=0.

Show[interiorpoints,boundarypoints]

The domain is  y-(x^2)≥0, and the range is [0,∞). Since the domain contains the boundary points, it is closed.

Example w=ln(x+y-1)

f[x_,y_] = Log[x+y-1]
Plot3D[f[x,y],{x,-5,5},{y,-5,5},AxesLabel->{"X","Y","Z"}]

interiorpoints=RegionPlot[x+y-1>0,{x,-5,5},{y,-5,5}]

There are no boundary points since the logarithm is defined only for x+y-1>0.

The domain is x+y-1>0, and the range is (0,∞). Since the domain does not  contain the boundary points, it is open.

Level Curves

Example

We can visualize functions of two variables using a contour plot (or level curves).  The lines of a contour plot join regions with the same height, or same value for k=f(x,y). The contours are drawn for equally spaced k values. The darker regions correspond to smaller values of k. This is just one of the traces we saw earlier.

ContourPlot[Sin[x]Sin[y]/x/y,{x,-10,10},{y,-10,10}]

Notice that we get a somewhat "choppy" plot from Mathematica so we should increase the number of points used. This is important! This is something you should always check when using Mathematica to plot a fucntion (check that Mathematica is sampling enough points to get a good approximation to the graph).

ContourPlot[Sin[x]Sin[y]/x/y,{x,-10,10},{y,-10,10},PlotPoints->30]

The 3D surface graph of the this unction we plotted contour plots for is:

f[x_,y_] = Sin[x]Sin[y]/x/y
Plot3D[f[x,y],{x,-10,10},{y,-10,10},PlotPoints->50,AxesLabel->{"X","Y","Z"}]

Example with data points

We can also have functions described by data sets. We can plot them using ListPlot3D. Here I will create an artificial data set from a known function (obviously, data sets are rarely contructed this way!), and we can plot it using Mathematica :

data1 = Table[N[ -3y/(x^2+y^2+1)],{x,-Pi,Pi,2Pi/10},{y,-Pi,Pi,2Pi/10}];
TableForm[data1,TableHeadings->{Automatic,Automatic}]
ListPlot3D[data1]

Example

Of course, we can always plot in three dimensions:

f[x_,y_] = -3y/(x^2+y^2+1)
Plot3D[f[x,y],{x,-5,5},{y,-5,5},AxesLabel->{"X","Y","Z"}]

Which has the associated contour plot:

ContourPlot[f[x,y],{x,-5,5},{y,-5,5},PlotPoints->50,Contours->20]

The above graph is an excellent example of how a function is more rapidly changing when the contour lines of the level curves are closely bunched together. Of course, there is an assumption we are making when we say this, and that is that the level curves are drawn for k  values which increase with a constant step size!

(ℝ^4): w = f (x, y,z)

Interior and Boundary Points; 
Domains, Ranges; 
Open, Closed

For the function w = f (x, y,z), the domain will be a region in the (ℝ^3) containing the points (x,y,z) for which the function f is defined. We will have interior and boundary points just like before, and the definition of open and closed is the same.

Example

f[x_,y_,z_]=Cos[x*y*z]Sqrt[(x^2)+(y^2)-(z^2)]

The domain of the above function is (x^2)+(y^2)-(z^2)≥0. Let's plot the domain of the function:

Here are the interior points of the domain. I have used opacity to make it more visible.

interiorpoints=RegionPlot3D[(x^2)+(y^2)-(z^2)>0 ,{x,-2,2},{y,-2,2},{z,-2,2},Mesh->False,PlotStyle->{Opacity[0.5]}]

Notice that the domain is the "outside" of the elliptical cone. Here are the boundary points.

boundarypoints=ContourPlot3D[(x^2)+(y^2)-(z^2)==0,{x,-2,2},{y,-2,2},{z,-2,2}]

Note: This combination below might be slow!

Show[interiorpoints,boundarypoints]

This domain is unbounded, but closed (since it contains the boundary points.

Example

f[x_,y_,z_]=Log[x*y*z]Sqrt[(x^2)-(y^2)-(z^2)]

The domain of the above function is (x^2)-(y^2)-(z^2)≥0 ⋃ x y z >0  . Let's plot the domain of the function:

Here are the interior points of the domain. I have used opacity to make it more visible.

interiorpoints=RegionPlot3D[(x^2)-(y^2)-(z^2)>0 && x y z >0 ,{x,-2,2},{y,-2,2},{z,-2,2},Mesh->False,PlotStyle->{Opacity[0.5]}]

The sketch is a bit choppy, so adding more points can smooth it up (and it will also slow it down!):

interiorpoints=RegionPlot3D[(x^2)-(y^2)-(z^2)>0 && x y z >0 ,{x,-2,2},{y,-2,2},{z,-2,2},Mesh->False,PlotStyle->{Opacity[0.5]},PlotPoints->40]

The condition x y z >0 is what is restricting us the the four particular octants, and so the flat sides of the coordinate planes are NOT part of the domain.

The condition (x^2)-(y^2)-(z^2)≥0gives the inside of the elliptical cone part--and therefore (since we have equality here) the curved sides on the four wedges IS part of the domain.

This is an example of a region that is neither open nor closed (it contains part of it's boundary, but not all). It is also unbounded.

Level Surfaces

Level surfaces are when we have a function of three variables. They are similar in spirit to level curves in 2D, simply in a higher dimension. The surface represents f(x,y,z)=k, a constant. Level surfaces are harder to visualize.

Example

Here we have a number of level surfaces for a function of three variables. You can see that the level surfaces are a family of hyperboloids of one or two sheets (depending on the value of k) which have the y-axis as the axis of symmetry.

Clear[f]
f[x_,y_,z_] = x^2-y^2+z^2;

Manipulate[ContourPlot3D[f[x,y,z] ==k,{x,-5,5},{y,-5,5},{z,-5,5},Axes->True,AxesLabel->{"x-axis","y-axis","z-axis"}],{k,-7,21,28/10}]

Work On

Work on 1

Find the functions domain, range, level curves, and classify the domain as open/closed/neither, bounded/unbounded.

(a) f(x,y)=y-x

(b) f(x,y)=ln((x^2)+(y^2))

(c) f(x,y)=arcsin(y-x)

(d) f(x,y)= (((16-(x^2)-(y^2)))^(-1/2))

Solution (a)

Plot of the surface:

f[x_,y_] = y-x
Plot3D[f[x,y],{x,-5,5},{y,-5,5},AxesLabel->{"x","y","z"}]

Plot of the level curves:

ContourPlot[f[x,y],{x,-10,10},{y,-10,10},FrameLabel->{"x","y"}]

Domain is (ℝ^2)={(x,y)|x,y are real}. Unbounded and Open. Range is (-∞,∞).

Solution (b)

Plot of the surface:

f[x_,y_] =Log[x^2+y^2]
Plot3D[f[x,y],{x,-5,5},{y,-5,5},AxesLabel->{"x","y","z"}]

Plot of the level curves:

ContourPlot[f[x,y],{x,-10,10},{y,-10,10},FrameLabel->{"x","y"}]

The domain is where (x^2)+(y^2)>0, which is everywhere except the origin. The boundary is the single point (0,0), so the domain is open (doesn't contain the boundary) and unbounded. The range is (-∞,∞).

Solution (c)

Plot of the surface:

f[x_,y_] =ArcSin[y-x]
Plot3D[f[x,y],{x,-5,5},{y,-5,5},AxesLabel->{"x","y","z"}]

Plot of the level curves:

ContourPlot[f[x,y],{x,-10,10},{y,-10,10},FrameLabel->{"x","y"}]

The domain is where -1≤ y-x≤ 1. The boundaryare the lines -1=y-x and 1=y-x, so the domain is closed (contains the boundary) and unbounded. The range is (-π/2,π/2).

Here are some plots for this domain:

Interior points are where (x^2)+(y^2)>0 (everywhere except the origin), and boundary points are where (x^2)+(y^2)=0 (the origin).

interiorpoints=RegionPlot[-1≤y-x≤1,{x,-5,5},{y,-5,5}]

boundarypoints=ContourPlot[{y-x==-1,y-x==1},{x,-5,5},{y,-5,5},ContourStyle->{{Red,Thick}}]

Show[interiorpoints,boundarypoints]

Solution (d)

Plot of the surface:

f[x_,y_] = (((16-(x^2)-(y^2)))^(-1/2))
Plot3D[f[x,y],{x,-5,5},{y,-5,5},AxesLabel->{"x","y","z"}]

Plot of the level curves:

ContourPlot[f[x,y],{x,-10,10},{y,-10,10},FrameLabel->{"x","y"}]

The domain is where 16-(x^2)-(y^2)>0. The boundary is the circle (x^2)+(y^2)=(4^2), which is NOT included in the domain, so the domain is open (does not contain the boundary) and bounded. The range is (1/4,∞).

Here are some plots for this domain:

Interior points are where (x^2)+(y^2)<16 (everywhere except the origin), and boundary points are where (x^2)+(y^2)=16 (the circle).

interiorpoints=RegionPlot[(x^2)+(y^2)<16,{x,-5,5},{y,-5,5}]

boundarypoints=ContourPlot[{(x^2)+(y^2)==16},{x,-5,5},{y,-5,5},ContourStyle->{{Red,Thick}}]

Show[interiorpoints,boundarypoints]

Work on 2

Plot the surface f(x,y)=sin x cos y exp(((Sqrt[(x^2)+(y^2)])/8))  over the rectangle 0≤x≤5π and 0≤y≤5π. 
Plot several level curves for the function.
Plot the level curve that passes through the point (4π,4π).

Solution

Plot of the surface:

f[x_,y_] =Sin[x]Cos[y]Exp[(Sqrt[(x^2)+(y^2)])/8]
Plot3D[f[x,y],{x,0,5π},{y,0,5π},AxesLabel->{"x","y","z"}]

Plot of the level curves:

ContourPlot[f[x,y],{x,0,5π},{y,0,5π},FrameLabel->{"x","y"}]

To find the level curve that passes through (4π,4π) do the following:

Solve[f[4π,4π]==z,z]

So the level curve is f(x,y)=0.

ContourPlot[f[x,y]==0,{x,0,5π},{y,0,5π},FrameLabel->{"x","y"}]

Let's put a disk at (4π4π) to make sure we got it right.

Show[%,Graphics[Disk[{4π,4π},0.2]]]