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

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

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?

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

It would help to have a specific case, but you might try to use the
MaxRecursion option instead of increasing PlotPoints too much. You might
also try the PerformanceGoal option. Maybe you could compute the location of
the peak before using graphics.

David Park
XXXX@XXXXX.COM
http://www.yqcomputer.com/ ~djmpark/

From: AES [mailto: XXXX@XXXXX.COM ]

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?