From this interesting question How to plot a surface given implicitly by 3 equations in 5 coordinate variables? I have found a subproblem that I would like to clarify:
Often it is advantageous to use ContourPlot3D to solve (visualize) an equation eq[yh,yd,xh]==0
eq = 0 == -1 + (2 (1 + yh))/(xh^2 + (1 + yh)^2) - (
2 xh (1 + yh) ((-3 + xh)^2 + (yd + yh)^2))/((-3 +
xh) (xh^2 + (1 + yh)^2)^2) -
Log[200] - (4 yh (-9 xh + 6 xh^2 - xh^3 + 3 yd - xh yd -
3 xh^2 yd + xh^3 yd + xh yd^2 + 3 yh - 10 xh yh + 3 xh^2 yh +
6 yd yh + xh yd^2 yh + 6 yh^2 - xh yh^2 + 3 yd yh^2 +
xh yd yh^2 +
3 yh^3) Log[-((800 yh^2 (-9 xh + 6 xh^2 - xh^3 + 3 yd -
xh yd - 3 xh^2 yd + xh^3 yd + xh yd^2 + 3 yh -
10 xh yh + 3 xh^2 yh + 6 yd yh + xh yd^2 yh + 6 yh^2 -
xh yh^2 + 3 yd yh^2 + xh yd yh^2 + 3 yh^3))/((-3 +
xh) (yd + yh) (1 + xh^2 + 2 yh + yh^2)^2))])/((-3 +
xh) (yd + yh) (1 + xh^2 + 2 yh + yh^2)^2)
ContourPlot3D shows a smooth solution surface
pic = ContourPlot3D[
Evaluate[ eq ] , {yh, 0, 5}, {yd, 0, 5}, {xh, -2.5, 3 - .01},
ColorFunctionScaling -> False (*MaxRecursion\[Rule]4*) ,
Mesh -> False , PerformanceGoal -> "Quality" ]
pts = pic[[1, 1]][[1]]; (* save points from pic*)
But checking the solution subsequently
ptsF = Select[pts, ! (eq /. Equal -> Subtract /. {yh -> #[[1]], yd -> #[[2]],xh -> #[[3]]})^2 < .01 &];
Show[{pic , ListPointPlot3D[ptsF, PlotStyle -> Red]},AxesLabel -> {yh, yd, xh}]
shows parts (red points) in the solution surface where eq==0 isn't fullfilled. (To be precise, the squared residual error in the red zone is larger than 0.01. )
I know how to improve the quality of ContourPlot3D using options PlotPoints and MaxRecursion but the basic problem remains.
My question:
How can I force better results from ContourPlot3D?
Thanks!




ContourPlot3Dnumerically accurate? – xzczd Jan 03 '24 at 11:41