What would you like to do?
Jason
--
Jason Grout
How do you do an implicit plot "right"? Scipy has tools for numerical
integration (you mention following derivatives), if that helps.
A quick google search turns up several references to software:
http://geomblog.blogspot.com/2008/01/plotting-implicit-functions-bleg.html
The maple help page may help:
http://www.maplesoft.com/support/help/Maple/view.aspx?path=plots/implicitplot
This issue has come up before on the list (and Josh Kantor gave an
algorithm and a reference):
https://groups.google.com/group/sage-devel/browse_thread/thread/6b1d3d0f06db9c6a
More references and algorithms:
http://www.tangentspace.net/cz/archives/2007/08/implicit-plotting-code-for-mathematica/
Mma also says: ContourPlot initially evaluates f at a grid of equally
spaced sample points specified by PlotPoints. Then it uses an adaptive
algorithm to subdivide at most MaxRecursion times to generate smooth
contours. http://reference.wolfram.com/mathematica/ref/ContourPlot.html
Jason
--
Jason Grout
Nope; but it's a pretty raw wrapper around the matplotlib functionality.
From the documentation of contour_plot (which is what implicit_plot
really is):
- ``cmap`` -- a colormap (default: ``'gray'``), the name of
a predefined colormap, a list of colors or an instance of a
matplotlib
Colormap. Type: ``import matplotlib.cm;
matplotlib.cm.datad.keys()``
for available colormap names.
We only have one cryptic example, though:
sage: f(x,y) = x^2 + y^2
sage: contour_plot(f, (-2, 2), (-2, 2), contours=2, cmap=[(1,0,0),
(0,1,0), (0,0,1)])
A clearer example would be:
sage: contour_plot(f, (-2, 2), (-2, 2), contours=3,fill=False,
cmap=["red", "green","blue"])
There is no mention of this in implicit_plot docs. However, here is an
example:
implicit_plot(x^2+y^2==1, (x,-2, 2), (y,-2, 2), cmap=["red"])
Mathematica doesn't have an implicitplot anymore, deprecating it for
CountourPlot, which now accepts equations. That's one way to unify the
two concepts.
Jason
--
Jason Grout
I don't think it's anywhere in the docs. I knew to try it because I
knew the code to implicit_plot just passed things on to contour_plot,
and I knew the options to contour_plot.
In short, something like this should either be added to implicit_plot,
or preferably, a better, more consistent option like "color=..." should
be added!
Jason
--
Jason Grout
I guess we can do a "better" job than matplotlib, as matplotlib does not
have the function to go off of. In a sense, then, you are describing an
adaptive evaluation of the function (at least, that's how mma seems to
do it). I wonder if matplotlib can draw a contour plot from a
non-rectangular grid.
This sounds like an excellent project for a calc 3 student!
Jason
--
Jason Grout