I found the visualization of a complex number problem very appealing in Tsing-hua University (Top 1 college in PRC) for its Elite student selection exam 2021. I use the geometric interpretation for complex plot and encode the related lines in the graphics with the value of target function with Hue function. The result is flamboyant modern art deco.

Problem

Given a complex number
z
with
|z|=1
, find the extreme values of

2
(z+1)
(z-1)
.

Analysis

We use the geometric interpretation of the complex number with unit length:
z=cos(t)+sin(t)
. If you are only interested in the absolute value of the target function, Plot function is adequate in this case:
In[]:=
Plot[​​Abs[((Cos[t]+Sin[t]*)-2)*((Cos[t]+Sin[t]*)+1)^2],{t,-π,π}]
Out[]=
-3
-2
-1
1
2
3
1
2
3
4
5
AbsArgPlot also shows the phase variation with respect to
t
:
In[]:=
AbsArgPlot[((Cos[t]+Sin[t]*)-2)*((Cos[t]+Sin[t]*)+1)^2,{t,-π,π},PlotLegends->Automatic]
Out[]=
We can define a optimization function friendly function by using the geometric representation of
In[]:=
f[t_]:=EuclideanDistance[{Cos[t],Sin[t]},{2,0}]*EuclideanDistance[{Cos[t],Sin[t]},{-1,0}]^2
Find the exact range of the function:
In[]:=
Maximize[f[t],t]
Out[]=
3
3
,t
π
3

In[]:=
Minimize[f[t],t]
Out[]=
{0,{tπ}}

Animation

Let’s generate one frame first. The black circle indicates the domain for
z
. The color of each line (connecting
z
to -2 and 1 on complex plane) is encoded with the normalized value of
f(t)
defined above plus a shift parameter ( 0.5 in this case):
In[]:=
GraphicsReverse@Table​​Huef[t]3
3
+0.5,​​Line[{{-1,0},{Cos[t],Sin[t]},{2,0}}],{t,Subdivide[-π,π,30]},​​Thick,Circle[]
Out[]=
Changing the shift value in Hue function to create the beautiful animation with more dense lines :
In[]:=
ManipulateGraphicsReverse@TableHuef[t]3
3
+h,Line[{{-1,0},{Cos[t],Sin[t]},{2,0}}],{t,Subdivide[-π,π,120]},​​Thick,Circle[]​​,{{h,0.24},0,0.9},SaveDefinitions->True
Out[]=
​
h

Changing the radius of
z

The value of the target function changes with respect to enlarged circle for
z
:
In[]:=
Plot[​​Evaluate[Table[Abs[(r*(Cos[t]+Sin[t]*)-2)*(r*(Cos[t]+Sin[t]*)+1)^2],{r,1,5,0.5}]],{t,-π,π},PlotLegends->Table[Row[{"r = ",r}],{r,1/2,5,1/2}]]
Out[]=
-3
-2
-1
1
2
3
20
40
60
80
100
120
140
r =
1
2
r = 1
r =
3
2
r = 2
r =
5
2
r = 3
r =
7
2
r = 4
r =
9
2
Or use contour plot to show constant
f(t)
given r and t:
In[]:=
g[t_,r_]:=EuclideanDistance[r*{Cos[t],Sin[t]},{2,0}]*EuclideanDistance[r*{Cos[t],Sin[t]},{-1,0}]^2
In[]:=
ContourPlot[g[t,r],{t,-π,π},{r,1/2,5},FrameLabel->{"t","r"},Contours->36]
Out[]=
Now we can create animation by changing two variables:
In[]:=
Manipulate[​​boundary={FindMaxValue[g[t,r],{t,π/3}],Min[FindMinValue[g[t,r],{t,0}],FindMinValue[g[t,r],{t,π}]]}//Quiet;​​Graphics[{Reverse@Table[{Hue[Rescale[g[t,r],boundary]+h],Line[{{-1,0},r*{Cos[t],Sin[t]},{2,0}}]},{t,Subdivide[-π,π,120]}],​​Thick,Circle[{0,0},r]},ImageSize->{400,400}​​],{r,1/2,4},{h,0,1}]

CITE THIS NOTEBOOK

Visualization of a complex number problem with extreme values​
by Shenghui Yang​
Wolfram Community, STAFF PICKS, May 8 2023
https://community.wolfram.com/groups/-/m/t/2916186