CalcIII Home
Mma Notebook
(gzipped; 451KB)

Mma Notebook, no output (14K)

Ma204 Contour and Cross-Section Demo



I'm always naming things similar names, and get tired of Mathematica asking if I've made a spelling error, and so turn off spelling messages before starting:

[Graphics:ccdemogr2.gif][Graphics:ccdemogr1.gif]

This is the function that we'll be working with for the duration of this notebook

[Graphics:ccdemogr2.gif][Graphics:ccdemogr3.gif]

In the following, the sole objective is to generate a bunch of cool 3D pictures to demonstrate contour plots and cross-sections, and how they are related. If you want to jump right to the cool conclusory pictures, see the contour plot graphics, or the cross-section graphics. (The conclusions are put into graphics arrays which don't render quite as large on the Web page -- so if you jump, go back afterwards if you want to see the pictures in a larger format.) Otherwise, read along for the development of the pictures.

A plot of the function with the "conventional" orientation is the following--here "conventional" means that [Graphics:ccdemogr4.gif] goes "out of the page", [Graphics:ccdemogr5.gif] goes "left to right" and [Graphics:ccdemogr6.gif] goes vertically.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr7.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr8.gif]

However, I want to turn it so that it compares nicely with generated contour plots, and so will graph it in the following orientation for the remainder of the notebook.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr9.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr10.gif]

Ok, now for some fun stuff ! Mathematica has a neat-o cool shadowplot function, which I want to use to demonstrate the relationship between the graph and the contours. This is in a separate package, like the "Colors," etc., and so we need a "Needs" command to get access to it.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr11.gif]

Then the shadow plot is

[Graphics:ccdemogr2.gif][Graphics:ccdemogr12.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr13.gif]

and I want to compare this with the contour plot. Because the shadowplot doesn't have contour lines, let's first plot without contour lines.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr14.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr15.gif]

Contour lines are in general nice, though, so it's worth plotting it all with this as well.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr16.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr17.gif]

So far, so good. Now let's graph some planes to slice the 3D surfaces with to further demonstrate where the contours come from. I'm choosing the plane at [Graphics:ccdemogr18.gif] here so that we can see most of the surface above the plane when we combine the graphs--this is the inside-most dark (downward) contour in the contour plot above.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr19.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr20.gif]

If we show this with the surface plot, we see how the plane slices the surface to give the contour.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr21.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr22.gif]

and, as it turns out, this is even better seen with the shadow graphic. I'm not sure why Mathematica selected black for the color of the plane here, but it makes things very clear.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr23.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr24.gif]

Contour Plot Graphics

And, finally, let's show all of these different views all together in one array. The top two pictures are the surface plots of [Graphics:ccdemogr25.gif] and the surface plot with the height of the surface "shadowed" on the bottom plane. Then the middle two graphics show this surface sliced by a plane at [Graphics:ccdemogr26.gif], which corresponds to the innermost dark (downwards, or below [Graphics:ccdemogr27.gif]) contour in the contour plots shown in the bottom row.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr28.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr29.gif]

Next, let's look at cross-sections for [Graphics:ccdemogr30.gif] These are generated by slicing the function with vertical planes--we'll look at [Graphics:ccdemogr31.gif] and [Graphics:ccdemogr32.gif]. The first of these is given in the following. In this case we have to use ParametricPlot3D rather than Plot3D because the figure that we are generating is not technically a function!

[Graphics:ccdemogr2.gif][Graphics:ccdemogr33.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr34.gif]

Showing this together with the surface, we see the slice that is the cross-section nicely.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr35.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr36.gif]

We can plot this slice in two dimensions, too. Here I've played around with the argument of [Graphics:ccdemogr37.gif] and the axis labels so that I could pretend to plot the horizontal variable ([Graphics:ccdemogr38.gif] in this case) from 3 to [Graphics:ccdemogr39.gif] rather than the more conventional [Graphics:ccdemogr40.gif] to 3. This all goes back to having rotated the 3D figure around to be able to compare it with the contour plots earlier.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr41.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr42.gif]

Next, we can generate a plane at [Graphics:ccdemogr43.gif],

[Graphics:ccdemogr2.gif][Graphics:ccdemogr44.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr45.gif]

and combine it with the 3D surface.

[Graphics:ccdemogr2.gif][Graphics:ccdemogr46.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr47.gif]

In this case the cross-section is easy to see, and in 2D is

[Graphics:ccdemogr2.gif][Graphics:ccdemogr48.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr49.gif]

Cross Section Graphics

Putting all of these together, we have the following. The two graphs in the left column show a slice along [Graphics:ccdemogr50.gif], with the corresponding cross-section shown in the bottom row. The scale on the [Graphics:ccdemogr51.gif] (horizontal) axis for that graph has been made to correspond to the orientation of the 3D figure. The right column shows the cross section with [Graphics:ccdemogr52.gif] fixed at [Graphics:ccdemogr53.gif].

[Graphics:ccdemogr2.gif][Graphics:ccdemogr54.gif]
[Graphics:ccdemogr2.gif][Graphics:ccdemogr55.gif]