1
$\begingroup$

Possible Slowdown in v11.1

I have a DensityPlot and ContourPlot I would like to speed up in V11.1.1. Is there any way to achieve a speed up in the following examples? Perhaps through parallelization or compilation?

AbsoluteTiming[
ContourPlot[
      Mod[Floor[-5 Im[Log[Log[Sin[Sin[x - I y] + Sin[y + I x]]]]]], 40], 
      {x, -3, 3}, {y, -3, 3}, 
      ContourLines -> False, Frame -> False, Background -> Black, 
      ColorFunction -> (RGBColor[1 - #^1.5, Abs[Sin[2 \[Pi] #]], 
         4 #^2 - 2 # + 3] &), 
      PlotPoints -> 200, Contours -> 45, 
      PerformanceGoal -> "Speed", 
      ContourLabels -> None]
]
(* takes over 20 mins *)

enter image description here

AbsoluteTiming[
   DensityPlot[
   Length[FixedPointList[(# - (Cos[#] + #^2/2)/(-Sin[#] + #)) &, 
     x + I y, 10, SameTest -> (Abs[#1 - #2] < 10^-10 &)]], {x, 5, 
    7}, {y, -4, -3}, Mesh -> False, AspectRatio -> Automatic, 
   Frame -> False, Axes -> False, 
   PlotPoints -> 200, PerformanceGoal -> "Speed",
   ColorFunction -> (If[# >= 1, RGBColor[0, 0, 0], Hue[1 - 2 #]] &)]]

(* takes over 20 mins *)

enter image description here

Note: part of the problem is that I'd like need to the resolution high by fixing the options PlotPoints and Contours.

$\endgroup$
7
  • $\begingroup$ the both take only seconds for me ( first one ~5 sec second one less than 1 second. ) $\endgroup$
    – george2079
    Jun 9, 2017 at 18:44
  • $\begingroup$ @george2079 are you on a supercomputer? that's not possible, can you post the output? $\endgroup$
    – M.R.
    Jun 9, 2017 at 18:47
  • $\begingroup$ I stuck my images in the post.. computer is 3GHz / 32Gb. BTW I tried running without the Speed performance goal and that was taking a long time. $\endgroup$
    – george2079
    Jun 9, 2017 at 19:04
  • $\begingroup$ @george2079 Thanks, and what version of MMA do you have, what are your exact timings? $\endgroup$
    – M.R.
    Jun 9, 2017 at 19:28
  • $\begingroup$ I think most users only have 2.5 GHz/16Gb at most. $\endgroup$
    – M.R.
    Jun 9, 2017 at 19:38

1 Answer 1

1
$\begingroup$

This is I think a better way to do that first plot. The function actually returns only 40 discrete integer values (Which I think is giving ContourPlot issues ) so you are better off to essentially generate a raster image.

(dat = Table[
     Mod[Floor[-5 Im[Log[Log[Sin[Sin[x - I y] + Sin[y + I x]]]]]], 
       40] /. y -> 1, {x, -3, 3, 6/500}, 
      {y, -3, 3, 6/500}]); // AbsoluteTiming

385.829

ArrayPlot[dat, ColorFunction -> "Rainbow"]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.