2
$\begingroup$

Given the following complex numbers (defined as the values of two functions f and g defined only on the points 0 and 1):

f[0] := (1 + 0 I)
f[1] := 0.5 E^(I \[Pi]/4)
g[0] := (0 + 1 I)
g[1] := 2 E^(I (\[Pi]/2 + \[Pi]/2 + \[Pi]/2))

is there a way to plot each of f[0], f[1], g[0], and g[0] as "arrow vectors" on the complex plane? Something analogous to the following:

enter image description here

except that (i) each of the complex numbers is labeled f[0], f[1], g[0], g[1] and (ii) the two f complex numbers are colored green while the two g complex numbers are colored blue.

$\endgroup$
  • $\begingroup$ There are many posts on plotting complex numbers, e.g. Plotting complex numbers as an Argand Diagram. And there are many posts on plotting arrows (see e.g. this). If you read both your question will be slightly simpler to answer. $\endgroup$ – Artes Jun 10 at 17:07
3
$\begingroup$

You can use ComplexListPlot as follows:

data = Join[Thread[{0, f /@ {0, 1}}], Thread[{0, g /@ {0, 1}}]];
colors = {Red, Green, Blue, Orange};

clp1 = ComplexListPlot[data,  
     PlotStyle -> (Directive[Arrowheads[Large], AbsoluteThickness[3], #] & /@ colors),
     Joined -> True, Mesh -> All, AxesLabel -> {"Re", "Im"}, 
     AxesOrigin -> {-.3, 0}, PlotRange -> All] /. {Point -> Nothing, Line -> Arrow};

clp2 = ComplexListPlot[Join[Callout[f @ #, HoldForm[f @ #]] & /@ {0, 1}, 
    Callout[g @ #, HoldForm[g @ #]] & /@ {0, 1}]] /. Point -> Nothing;

Show[clp1, clp2]

enter image description here

$\endgroup$
  • $\begingroup$ This is great. Is there a way to specify a color for each of the arrows? $\endgroup$ – George Jun 10 at 22:26
  • $\begingroup$ @George, you can try something like PlotStyle -> (Directive[Arrowheads[Large], AbsolutePointSize[0], AbsoluteThickness[3], #]&/@ {Red, Green, Blue, Orange}) $\endgroup$ – kglr Jun 10 at 22:35
  • $\begingroup$ Last question: is there a way to add the labels "f[0]", "f[1]", etc to the arrows, and expand the axis so that all arrows are guaranteed to be visible? $\endgroup$ – George Jun 10 at 22:51
  • $\begingroup$ @George, please see the update. $\endgroup$ – kglr Jun 10 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.