# 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] • Have a look at the PlotPoints option – ssch Oct 31 '13 at 17:40
• In addition to PlotPoints, you can increase MaxRecursion too (carefully, increasing it by 1 at a time, as running time depends exponentially on this parameter). Try MaxRecursion -> 3 without touching PlotPoints. – Szabolcs Oct 31 '13 at 17:43
• PlotPoints -> 200 fixes the problem. – bill s Oct 31 '13 at 18:18
• Thank you very much for your help on this :-) – martin Nov 1 '13 at 10:54

## 2 Answers

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] Simple and fast solution

m = 60;
f = Evaluate@N@BernoulliB[m, #] &;

ContourPlot[{Re@f[x + I y], Im@f[x + I y]}, {x, -5, 6}, {y, -10, 10},
AspectRatio -> Automatic, MaxRecursion -> 3] It has the same speed as halirutan's solution with Compile. I think it is because of auto-compilation.