Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to force ContourPlot re-check all the points on the each stage of it's recursion algorithm?

Thanks to this excellent analysis of the Plot algorithm by Yaroslav Bulatov, I now understand the reason why Plot3D and ContourPlot fail to draw smoothly functions with breaks and discontinuities.

For example, in the following case ContourPlot fails to draw contour x^2 + y^2 = 1 at all:

ContourPlot[Abs[x^2 + y^2 - 1], {x, -1, 1}, {y, -1, 1}, Contours -> {0}]

It is because the algorithm does not go deeply into the region near x^2 + y^2 = 1. It "drops" this region on an initial stage and does not try to investigate it further. Increasing MaxRecursion does nothing in this sense. And even undocumented option Method -> {Refinement -> {ControlValue -> .01 \[Degree]}} does not help (but makes Plot3D a little bit smoother).

The above function is just a simple example. In real life I'm working with very complicated implicit functions that cannot be solved analytically.

Is there a way to get ContourPlot to go deeply into such regions near breaks and discontinuities?

like image 384
Alexey Popkov Avatar asked Feb 05 '11 07:02

Alexey Popkov


1 Answers

These are the standard Plots .

enter image description here

enter image description here

And the Contour at 10^-20

enter image description here

They are pretty clear for me.

Do you expect something more accurate?

Edit

If you want to use the Contours->{0} Option, you may use:

enter image description here

like image 69
Dr. belisarius Avatar answered Oct 15 '22 03:10

Dr. belisarius