       Manipulate not working

• To: mathgroup at smc.vnet.net
• Subject: [mg101458] Manipulate not working
• From: danny <epstiend at gmail.com>
• Date: Wed, 8 Jul 2009 07:07:59 -0400 (EDT)

```Hi, I'd like to illustrate the placement of (complex) roots of f(z)=z^2-4z+k in the complex plane along with the real surface of the function, a contour of the parabola, level contours where the real and complex components are zero, and two red dots showing the zeros as k ranges from -5 to 5.  The code works ok separately, but Manipulate chokes.  Perhaps it's too CPU intensive to work with Manipulate.  Can someone suggest ways of speeding it up.  Here's the code:

Manipulate[f[z_] := z^2 - 4*z + k;
rpts = Graphics3D[{PointSize[0.02], Red,
Point @@ {({Re[#1], Im[#1], 0} & ) /@
(z /. Solve[f[z] == 0, z])}}];
p1 = ParametricPlot3D[{Re[z], Im[z], Re[f[z]]} /. z -> x,
{x, 0, 4}, PlotStyle -> {Thickness[0.008], Yellow}];
p2 = Plot3D[Re[f[z]] /. z -> x + I*y, {x, 0, 4},
{y, -4, 4}, PlotRange -> {{0, 4}, {-2, 2}, {-5, 5}},
PlotStyle -> {LightPurple}];
cp1 = ContourPlot[Re[f[x + I*y]] == 0, {x, 0, 4},
{y, -2, 2}]; lns = Cases[Normal[First[cp1]],
Line[pts_] :> ({#1[], #1[], 0} & ) /@ pts,
{0, Infinity}]; realcontour =
Show[Graphics3D[{Thickness[0.008], Purple,
Line @@ {lns}}], PlotRange -> {{0, 4}, {-2, 2},
{-5, 5}}]; cp2 = ContourPlot[Im[f[x + I*y]] == 0,
{x, 0, 4}, {y, -2, 2}]; lns = Cases[Normal[First[cp2]],
Line[pts_] :> ({#1[], #1[], 0} & ) /@ pts,
{0, Infinity}]; imagcontour =
Show[Graphics3D[{Thickness[0.008], Green,
Line @@ {lns}}], PlotRange -> {{0, 4}, {-2, 2},
{-5, 5}}]; realdiagram =
Show[{p2, p1, realcontour, imagcontour, rpts},
PlotRange -> {{0, 4}, {-2, 2}, {-5, 5}},
Lighting -> "Neutral", BoxRatios -> {1, 1, 1},
AxesLabel -> {Style["x", 20], Style["y", 20],
Style["Re", 20]}, AxesEdge -> {{-1, -1}, {1, -1},
{1, 1}}, ImageSize -> {500, 500}], {k, -5, 5, 1}]

```

• Prev by Date: Re: Pattern matching / subsequence matching, question on
• Next by Date: Re: put some elements to zero
• Previous by thread: Re: Animate parametric plot of two lists?
• Next by thread: Re: Manipulate not working