Re: Problems with ImplicitPlot
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1250] Re: Problems with ImplicitPlot
- From: rubin at msu.edu (Paul A. Rubin)
- Date: Fri, 26 May 1995 07:10:34 -0400
- Organization: Michigan State University
In article <3q14jp$725 at news0.cybernetics.net>, Mats Jirstrand <matsj at isy.liu.se> wrote: ->I have a problem with the function ImplicitPlot in the ->Graphics package! -> ->Why does Mathematica generate a plot of the unit circle ->for the first of the below commands but not for the second? -> ->ImplicitPlot[x^2+y^2-1==0, {x, -2, 2}] -> ->ImplicitPlot[(x^2+y^2-1)^2==0, {x, -2, 2}] -> -> -> ->I have also tried the ContourPlot function with the same result: -> ->ContourPlot[x^2+y^2-1, {x, -2, 2},{y, -2, 2}, -> Contours -> {0}, -> ContourShading -> False] -> ->Plots the unitcircle! -> -> ->ContourPlot[(x^2+y^2-1)^2, {x, -2, 2},{y, -2, 2}, -> Contours -> {0}, -> ContourShading -> False] -> ->An empty plot! -> -> ->~~Mats -> It looks like ContourPlot is running into some numerical (rounding) problems. Change Contours->{0} to Contours->{1}, and you get a correct plot (circle with radius 2); change it to Contours->{0.01} and you get a plot that's not empty, but also not what you would expect. According to the documentation, ImplicitPlot with two arguments uses ContourPlot, so you get the same behavior with ImplicitPlot. Long ago, I wrote my own routine to implicitly plot functions. It's pretty crude (in fact, it doesn't actually do the plotting - you need ListPlot to graph the results), and it's written to an older version of Mathematica. I tried it on your example, though, and it works. If this is an on-going problem for you (as opposed to intellectual curiousity), and if the tech folks at WRI can't suggest a way to boost the precision of ContourPlot, send me e-mail and I'll mail you my package. (I must say ImplicitPlot is better when it works, though.) Paul ************************************************************************** * Paul A. Rubin Phone: (517) 432-3509 * * Department of Management Fax: (517) 432-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE