I'm new to Mathematica, and I was wondering how to plot $x^n$ in the complex plane.
Is there a dedicated function for this purpose?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityThis is just for illustrative purpose. The links in the comments cover more in better detail. I post just to allow start:
Manipulate[
GraphicsRow[{ParametricPlot[
Through[{Re, Im}[ (x + I y)]], {x, -2, 2}, {y, -2, 2},
ImageSize -> 200, MeshFunctions -> {#3^2 + #4^2 &, #3 - #4 &},
MeshStyle -> {Directive[Red, Thick], Directive[Orange, Thick]},
Mesh -> {{1, 0.5, 1.5}, {0, 1, -3}}],
ParametricPlot[
Through[{Re, Im}[ (x + I y)^n]], {x, -2, 2}, {y, -2, 2},
MeshFunctions -> {#3^2 + #4^2 &, #3 - #4 &},
Mesh -> {{1, 0.5, 1.5}, {0, 1, -3}},
MeshStyle -> {Directive[Red, Thick], Directive[Orange, Thick]},
ImageSize -> 200],
Plot3D[Re[(x + I y)^n], {x, -2, 2}, {y, -2, 2}, Mesh -> False]},
ImageSize -> {600, 400}], {n, {1, 2, 3, 4, 5}}]
This shows plots of $z^n$: the left plot is coplex plane, second plot is $z^n$ (colored mesh, could play with whatever you wanted) and the final plot the Re[z^n].
The following could be vastly improved but for illustration of transformation:
lin[x_, y_] :=
Table[x + j Normalize@(y - x), {j, 0, Norm[y - x], Norm[y - x]/10}];
fc[x_] := Module[{p, tab},
p = Partition[x, 2, 1, 1];
tab = lin @@ # & /@ p];
cf[x_, n_] := {Re[#], Im[#]} & /@ (#^n & /@ Complex @@@ x)
DynamicModule[
{pts = RandomReal[{-2, 2}, {6, 2}], n},
Column[{
SetterBar[Dynamic@n, {1, 2, 3, 4, 5}],
LocatorPane[Dynamic@pts,
Dynamic@Grid[
{{
Graphics[Polygon[pts], ImageSize -> {200, 200}],
Graphics[Polygon[Join @@ (cf[#, n] & /@ fc[pts])],
ImageSize -> {200, 200}]
}}, Frame -> All]]}]]
yields:
ParametricPlot
$\endgroup$