Skip to main content

plotting - Inaccurate plot


Could someone please tell me how I can increase the accuracy of this plot, please? Or is there some other reason the lines are breaking up?


m = 60;
ContourPlot[{Re[Table[BernoulliB[n, (x + I y)], {n, m, m}]],
Im[Table[BernoulliB[n, (x + I y)], {n, m, m}]]}, {x, -5, 6}, {y, -10, 10},

AspectRatio -> Automatic]

enter image description here



Answer



As you already know from the comments, increasing MaxRecursion or PlotPoints helps, where I would prefer the first one.


In the case of your function, you can gain some speed by compiling the expression. Then, you can set MaxRecursion to a higher value and the plot is still reasonable fast. The code below runs in about 3 seconds here


m = 60;
With[{cf = (Compile[{{x, _Real, 0}, {y, _Real, 0}},
#, RuntimeOptions -> "Speed", CompilationTarget -> "C"] & /@


Flatten[{Re[Table[BernoulliB[n, (x + I y)], {n, m, m}]],
Im[Table[BernoulliB[n, (x + I y)], {n, m, m}]]}])},
(#1[args__?NumericQ] := #2[args]) & @@@ Transpose[{{f1, f2}, cf}]
];

ContourPlot[{f1[x, y], f2[x, y]}, {x, -5, 6}, {y, -10, 10},
AspectRatio -> Automatic, MaxRecursion -> 3]

Mathematica graphics


Comments