Re: Manipulate not working
- To: mathgroup at smc.vnet.net
- Subject: [mg101570] Re: [mg101458] Manipulate not working
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Fri, 10 Jul 2009 06:46:23 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200907081107.HAA12055@smc.vnet.net>
- Reply-to: murray at math.umass.edu
What do you mean when you say that Manipulate is "choking" on the
Manipulate? I tried this with Mathematica 7.0.1 on a PC with a 3 GHz
Core 2 Duo CPU, 3 GB RAM, and 32-bit Windows XP Professional. AS soon as
I evaluated the Input cell, I could open the output's play controls,
click the Play button, and have the graphics cycle through all the
values of k in approximately 5 seconds.
danny wrote:
> 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]], #1[[2]], 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]], #1[[2]], 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}]
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
- References:
- Manipulate not working
- From: danny <epstiend@gmail.com>
- Manipulate not working