Level Sets of Functions of Two Variables
The command plot3d is used to graph a function of two variables. It can also be used to look at some level sets of the function by specifying the option style=patchcontour or style=contour. The axes can be shown by specifying the option axes=normal or axes=boxed. Note that the x and y in the graph are poorly placed making it appear that the axes are reversed.
> plot3d(x^2/4+y^2/9,x=-5..5,y=-5..5,style=patchcontour,axes=normal);
Another option that is helpful is
shading=zhue
. This option gives different colors to different values of z, so that one can pick out the level sets at different levels by color. To view the actual contour map of the graph, one needs to look straight down on the graph as if one were high up on the z-axis. You can do this exactly by clicking on the graph, and then changing the angle
, found in the menu above, to 0, and the angle
to -90. (You will not see these angles displayed above until you click on the graph). You can also set the style, axes, and shading options by choosing from the style, color, and axes menus that appear when you click on the graph. Note that x axis is the horizontal axis and the y axis is the vertical axis in the graph shown below.
> plot3d(x^2/4+y^2/9,x=-5..5,y=-5..5,style=patchcontour,axes=normal,shading=zhue);
Explain why the level sets above are ellipses, and how you can tell which is the x-axis (y-axis). Why are the level sets further apart near the origin as opposed to further from the origin?
Here is another example whose level sets are hyperbolas. You should be able to see why the origin is called a saddle point of this graph.
> plot3d(x^2-y^2,x=-5..5,y=-5..5,style=patchcontour,axes=boxed,shading=zhue);
Here is what the contour map of the above graph looks like.
> plot3d(x^2-y^2,x=-5..5,y=-5..5,style=patchcontour,axes=boxed,shading=zhue);
Explain how you can tell that the x-axis is again the horizontal axis, and the y-axis is the vertical axis by looking at where z is positive and z is negative.
Level Sets of Functions of Three Variables
Graphs of functions of three variables are difficult for us to visualize because they would have to be drawn in four space. However the level sets of a function of three variables are in the domain of the function, and hence in three space. We can use the command implictplot3d from the plots library to view level sets of functions of three variables.
> with(plots);
> implicitplot3d(x^2-y^2+z^2=1,x=-5..5,y=-5..5,z=-5..5,axes=normal);
Note that the resulting graph is somewhat crude as implicit plots tend to be. The graph is called a circular hyperboloid because most sections of it are hyperbolas, but some sections are circles. A somewhat nicer graph results by graphing the upper part of the surface explicitly. The jagged edges result because the domain is circular, and we are trying to graph it on a rectangular grid.
> plot3d(sqrt(1-x^2+y^2),x=-5..5,y=-5..5);
>