Example 5: Contour Plots

Objective: To create a contour map of a function of two variables in different ways.

Example: Create a contour map of the following function over the indicated range of variables (or viewing box):

z = f(x,y) = (y-2+7xsin(x-y))/(1+x^2+y^2)

for x,y,z all between -3 and 3.

Click here for the .dpg file (in particular, pay attention to the commands view and perspective). The following graph is produced:

DPGraph's method for creating Figure 1 is simple: It draws the 3D surface that is the graph of z = f(x,y), then following the view:=top and perspective:=false commands, it presents the image as if it is being seen directly from above and without any perspective. To see the full surface for comparison, use the arrow keys on the keyboard to rotate the graph, or change the view to "standard" and perspective to "true".

Note the following:

x = 3-[(2/9)*7] = 3-(14/9) = 13/9 = 1.44,
y = -3+[(2/9)*14] = -3+(28/9) = 1/9 = 0.11

Changing the z range can alter the appearence of a contour map. For instance restricting z to the interval [-2,2] gives the diagram in Figure 2 below. The white regions are areas that are cut off by the DPGraph, since the z values are not adequate to cover the higher peaks and lower valleys. The contour diagram in Figure 2 is, therefore, improper since it has lost important information.