# Plots are "jagged" for a simple function

I have a weird problem with DensityPlot, ContourPlot, and Plot3D.

The function I want to plot is elementary:

DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R, F} \[Element] Rectangle[{100, 1}, {1000, 5}]]


However, the result is a very jagged one. Same for ContourPlot, and Plot3D.

The way to get smooth plots is to specify the plot region not with Rectangle but with the standard way, like {R, 100, 1000}, {F, 1, 5}.

DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R, 100, 1000}, {F, 1, 5}]


This gives a smooth plot.

What's happening actually under the hood?

Is there any workaround for the problem when you don't have any other way to represent the plot region other than using some region objects, like Rectangle, Disk, Annulus, etc?

Mathematica 13.2.1.0 on Windows11 (64bit)

A usual way to improve a plot by PlotPoints and WorkingPrecision works, though the execution is slow.

DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R, F} \[Element]
Rectangle[{100, 1}, {1000, 5}],WorkingPrecision -> 20, PlotPoints -> 300]


The result of

DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R,   F} \[Element]
RegionConvert[Rectangle[{100, 1}, {1000, 5}], "Parametric"],  PlotPoints -> 200, WorkingPrecision -> 20]


is not better.

• The quality of DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R, F} \[Element] Annulus[{100, 6}, {1, 5}]] also leaves much to be desired. Jun 28 at 16:05
• Far better than the case of Rectangle, but still slightly jagged in the Small F region and weird. I suspect these results stem from some internal procedure about How mathematical plots functions within a given area. Maybe depending on where the first PlotPoints are set on the plot region. I don't know... Jun 30 at 1:42

The main problem seems to be the distorted Rectangle!

Try

DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R, 100,1000}, {F, 1, 5}, PlotPoints -> 100]


• Did you read "The way to get smooth plots is to specify the plot region not with Rectangle but with the standard way, like {R, 100, 1000}, {F, 1, 5}" and "Is there any workaround for the problem when you don't have any other way to represent the plot region other than using some region objects, like Rectangle, Disk, Annulus, etc?" in the question before having posted it? Can you ground your "The main problem seems to be the distorted Rectangle!"? Jun 28 at 10:45
• The result of DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R, F} \[Element] Rectangle[{1, 1}, {10, 5}]] is also bad (compare with DensityPlot[((-1 + 8 F^2 - 4 F Sqrt[-1 + 4 F^2]) R)/(8 F^2), {R, 1, 10}, {F, 1, 5}]) so your speculation does not correspond to reality. Jun 28 at 10:52
• Obviously I didn't read the whole question, but my answer seems to be quite smooth. Otherwise, I refrain from further hopeless discussions Jun 28 at 11:01