The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Plotter for complex polynomials (complex coefficients)
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Christopher O. Young

Posts: 182
Registered: 2/13/11
Plotter for complex polynomials (complex coefficients)
Posted: Feb 1, 2012 3:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Not sure if this is done right. Could I speed it up by using Set
instead of SetDelayed in the converter to complex point? If so,
shouldn't I protect the "z" by wrapping the definition in a Module with
"z" as a local variable?

I have the coloring going from green for 0 to red for π and then back
again, so colors are the same for plus and minus arguments (i.e.,
angles) for the complex polynomial. Probably should have some
indication which is which, or a way to toggle it.

Chris Young

{f, \[ScriptCapitalC]},

\[ScriptCapitalC][P_] := P[[1]] + P[[2]] I; (*
Convert 2D point to complex point *)

f[z_] = \[ScriptCapitalC][a] z^3 + \[ScriptCapitalC][
b] z^2 + \[ScriptCapitalC][c] z + \[ScriptCapitalC][ d];

Abs[f[x + y I]], {x, -6, 6}, {y, -6, 6},

PlotPoints -> 100,
MaxRecursion -> 2,

Mesh -> 11,
MeshStyle -> Directive[Gray, AbsoluteThickness[0.01]],
MeshFunctions -> ({x, y} \[Function] (\[Pi] -
Abs[Arg[f[x + I y]]])/\[Pi]),

ColorFunctionScaling -> False,
ColorFunction -> ({x, y} \[Function]
Hue[0.425 \[LeftFloor]12 (\[Pi] -
Abs[Arg[f[x + I y]]])/\[Pi]\[RightFloor]/12, sat, bri]),
PlotStyle -> Opacity[opac],
AxesLabel -> {"x", "i y", "|f(x + iy)|"}]
(*Item["The complex coefficients"],*)
{a, {-2, -2}, {2, 2}},
{b, {-2, -2}, {2, 2}},
{c, {-2, -2}, {2, 2}},
{d, {-2, -2}, {2, 2}},
{{opac, 0.75, "Opacity"}, 0, 1},
{{sat, 0.75, "Saturation"}, 0, 1},
{{bri, 1, "Brightness"}, 0, 1},

ControlPlacement -> {Left, Left, Left, Left, Bottom, Bottom, Bottom}

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.