Re: Manipulate is sluggish?

*To*: mathgroup at smc.vnet.net*Subject*: [mg83767] Re: Manipulate is sluggish?*From*: Tom Burton <news at brahea.com>*Date*: Fri, 30 Nov 2007 05:15:58 -0500 (EST)*References*: <126a33d4-403a-4d35-a746-d22d597b9ee1@w40g2000hsb.googlegroups.com>

With gratitude, I am forwarding a solution to my problem that seems to have reached me but not the rest of the group. When responding, please replace news with my first initial and full last name, as one word. Tom Burton From my first post, "Manipulate is sluggish": > I'll soon need to work in CMYK colors and also will want to use the > new Manipulate expressions to visualize functions of 4 and 5 > variables. I decided to try a bit of both, first defining a > conversion from CMYK to RGB, > > cmyk2rgb[c_,m_,y_,k_]:=(1-k){1-c,1-m,1-y} > > and then comparing the two color systems: > > Manipulate[GraphicsGrid[Table[c=xx/12;m=yy/12;Graphics[{CMYKColor > [c,m,y,k],Disk[{xx,yy},1,{0,\[Pi]}],RGBColor@@cmyk2rgb[c,m,y,k],Disk > [{xx,yy},1,{\[Pi],2\[Pi]}]},ContentSelectable->False],{xx,0,12,2}, > {yy,0,12,2}]],{y,0.0,1,1/6},{k,0.0,1,1/6}] > > .. The resulting dynamic graphic is sluggish. ... Hi Tom, Note that because you reevaluate c and m, Manipulate keeps spinning all the time. Here's a faster version: DynamicModule[{gr, c, m, y, k}, gr = GraphicsGrid[Table[c = xx/12; m = yy/12; Graphics[{CMYKColor @@ Dynamic /@ {c, m, y, k}, Disk[{xx, yy}, 1, {0, Pi}], RGBColor @@ Dynamic /@ cmyk2rgb[c, m, y, k], Disk[{xx, yy}, 1, {Pi, 2 Pi}]}, ContentSelectable -> False], {xx, 0, 12, 2}, {yy, 0, 12, 2}]]; Manipulate @@ {gr, {y, 0.0, 1, 1/6}, {k, 0.0, 1, 1/6}} ] Best regards, Maxim Rytin