       How does Mathematica create contour plots (or density plots)?

• To: mathgroup at smc.vnet.net
• Subject: [mg112398] How does Mathematica create contour plots (or density plots)?
• From: AES <siegman at stanford.edu>
• Date: Tue, 14 Sep 2010 05:13:20 -0400 (EDT)

```How does Mathematica create contour plots (or density plots)?

More specifically, suppose I want a contour plot (with maybe 10 contour
lines) or a density plot of a function that has just one primary peak
located somewhere in an otherwise vast and featureless (i.e., flat)
plane with value z=0.  (Or maybe a narrow ridge running diagonally
across the plane.)  But:

*  I don't know in advance where this peak is --  or, it moves with
time, and I want to make multiple plots and follow its motion.

*  The function it represents is somewhat costly to calculate.

*  And I'd like to get a moderately detailed (but maybe not super
resolved) portrayal of the substructure within that peak.

*  And all this with reasonably fast response (e.g., inside a
Manipulate).

To obtain this, does Mathematica have to calculate a cast array of
finely spaced pixel values covering the entire plane, then derive the
contours from this?

Or does it use some kind of smart algorithm that does a (random?) search
for non-zero points, then rapidly homes in on areas of interest?

Or, is there some way I can help it find the regions of interest?

```

• Prev by Date: Word wrap and page breaks in printed notebooks?
• Next by Date: Re: polynomial long division using Series[] and changing polynomial
• Previous by thread: Re: Word wrap and page breaks in printed notebooks?
• Next by thread: Re: How does Mathematica create contour plots (or density plots)?