Re: Trying to close some loose plotting
- To: mathgroup at smc.vnet.net
- Subject: [mg124703] Re: Trying to close some loose plotting
- From: Chris Young <cy56 at comcast.net>
- Date: Wed, 1 Feb 2012 03:50:30 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jg5q7i$h4d$1@smc.vnet.net>
On 2012-01-30 10:08:50 +0000, carlos at colorado.edu said: > Hi - I am trying to plot the real roots of a cubic equation as > functions of one parameter called rc, using the code below, on Mathematica 5.2. > The plotted curves, however, show some dead spots that should not be there. > How can I get them to fill up? I tried getting rid of the imaginary > part when its absolute value is less that a given tolerance, but that > trick does not > work. > > Thanks for any suggestions. I'm no expert on any of this, but I had to change a couple of occurrences of "[Mu]" to the Greed letter mu before anything would work. After that I only got plots for the lamda1 curve, not the lambda2 and lambda3 curves. If I could if I could figure out what the original complex polynomial was, I'd plot it using the height-for-modulus, color-for-complex-argument plot at bottom, to see why lambda1 and lambda2 weren't plotting. Or maybe I made a typo when I tried to simplify things a little. Is this based on Cardano's formula for the roots of a cubic? ClearAll[\[Mu], \[Lambda], \[Beta], a, b, rc]; \[ScriptCapitalA] = Sqrt[ 4 (-3 + 2 \[Mu]^2)^3 + (27 rc - 18 \[Mu] + 20 \[Mu]^3)^2]^(1/3) \[Lambda]1 = 2 \[Mu] - (2*2^(1/3)*(-3 + 2*\[Mu]^2))/\[ScriptCapitalA]^(1/3) + 2^(2/3)*\[ScriptCapitalA]/6; \[Lambda]2 = 1/12 (4*\[Mu] + ( 2*2^(1/3)*(1 + I Sqrt[3])*(-3 + 2*\[Mu]^2))/\[ScriptCapitalA]^(1/ 3) + I*2^(2/3)*(I + Sqrt[3])*\[ScriptCapitalA]^(1/3)); \[Lambda]3 = 1/12 (4*\[Mu] + ( 2*2^(1/3)*(1 - Sqrt[3] I)*(-3 + 2*\[Mu]^2))/\[ScriptCapitalA]^(1/ 3) - 2^(2/3)*(1 + Sqrt[3] I)*(\[ScriptCapitalA])^(1/3)); thick = AbsoluteThickness[1.25]; (*rctab={0,0.04,0.08,0.15,0.3,0.5,1,2,-0.04,-0.08,-0.15,-0.3,-0.5,-1,-\ 2};*) rctab2 = {-2, -1, -0.5`, -0.3`, -0.15`, -0.08`, -0.04`, 0, 0.04`, 0.08`, 0.15`, 0.3`, 0.5`, 1, 2}; Np = Length[rctab]; \[Lambda]1tab = Table[\[Lambda]1 /. rc -> rctab2[[i]], {i, 1, Np}]; \[Lambda]2tab = Table[\[Lambda]2 /. rc -> rctab2[[i]], {i, 1, Np}]; \[Lambda]3tab = Table[\[Lambda]3 /. rc -> rctab2[[i]], {i, 1, Np}]; \[Lambda]123 = Flatten[{\[Lambda]1tab, \[Lambda]2tab, \[Lambda]3tab}]; Plot[ (*Evaluate[\[Lambda]123],*) \[Lambda]1tab, {\[Mu], -1, 1}, PlotStyle -> Hue[0.8 (k - 1)/(Np - 1)]~Table~{k, 1, Np}, PlotRange -> {{-1.1, 1.1}, {-0.1, 12}}, AspectRatio -> 1/5 12.1/2.2, Frame -> True, ImageSize -> 300 ] Here's a height-for-modulus plot of a complex cubic with real coefficients: f[a_, b_, c_, d_, z_] := a z^3 + b z^2 + c z + d Manipulate[ Plot3D[ Abs[f[a, b, c, d, x + y I]], {x, -4, 4}, {y, -4, 4}, PlotPoints -> 50, MaxRecursion -> 2, Mesh -> 11, MeshStyle -> AbsoluteThickness[0.01], MeshFunctions -> ({x, y} \[Function] Arg[f[a, b, c, d, x + y I]]), ColorFunctionScaling -> False, ColorFunction -> ({x, y} \[Function] Hue[0.425 \[LeftFloor]12 (Arg[f[a, b, c, d, x + y I]] + \[Pi])/( 2 \[Pi])\[RightFloor]/12, sat, bri]), PlotStyle -> Opacity[opac], AxesLabel -> {"x", "i y", "|f(x + iy)|"}], {{a, -1}, -2, 2}, {{b, 0}, -2, 2}, {{c, 1}, -2, 2}, {{d, 0}, -2, 2}, {{opac, 0.5, "Opacity"}, 0, 1}, {{sat, 0.5, "Saturation"}, 0, 1}, {{bri, 1, "Brightness"}, 0, 1} ]