Coloring directions

I. Cnop
Vrije universiteit Brussel
icnop@vub.ac.be

Loading the package

<<Graphics`ArgColors`

Choosing directions

Choose a mynumber of directions in the plane. These can be given by unit vectors or points on the unit circle in the (complex) plane. The standard name is "complex arguments".

mynumber = 48;

If you do not know the following notation, just accept it has shorthand for "direction".

un(
        k_) := (E^(((2 π I k)/mynumber)))

To plot points, we need coordinates. The coordinates of the points are given by  Re  and  Im  respectively. 
Again, this can be introduced as shorthand. We are interested in a plot of the result.

Show[
	Graphics[
		Table[
   			{ArgColor[un[j]],
   				Disk[{Re[un[j]], Im[un[j]]}, 0.06]},
  		 {j, mynumber}]
  		 , AspectRatio -> Automatic
  		]
  	]

Action of a matrix on directions

Clear[A]

a = 0.3;
b = -0.5;
c = 0.5;
d = 0.7;

Build a  2 x 2 matrix with these entries

A=(({{a, b}, {c, d}}));

A // MatrixForm

Det[A]

Action of this matrix on an arbitrary point  (x , y)  is given by

A . {x, y} // MatrixForm

Show[
	Graphics[
		Table[
   			{ArgColor[un[j]],
   				Disk[A.{Re[un[j]], Im[un[j]]}, 0.04]},
  		 {j, mynumber}]
  		 , AspectRatio -> Automatic
  		]
  	]

Showing both in the same picture

With the images slightly bigger to distinguish them from the original points:

Show[
	Graphics[
		{Table[
   			{ArgColor[un[j]],
   				Disk[A.{Re[un[j]], Im[un[j]]}, 0.04]},
  		 {j, mynumber}],
  		 Table[
   			{ArgColor[un[j]],
   				Disk[{Re[un[j]], Im[un[j]]}, 0.03]},
  		 {j, mynumber}]}
  		 , AspectRatio -> Automatic,Axes->True
  		]
  	]

Apply matrix once more

Show[
	Graphics[
		{Table[
   			{ArgColor[un[j]],
   				Disk[A.A.{Re[un[j]], Im[un[j]]}, 0.04]},
  		 {j, mynumber}],
  		 Table[
   			{ArgColor[un[j]],
   				Disk[A.{Re[un[j]], Im[un[j]]}, 0.03]},
  		 {j, mynumber}]}
  		 , AspectRatio -> Automatic,PlotRange->{{-1,1},{-1,1}},Axes->True
  		]
  	]

We can Animate the two graphics to see both images in one picture: select both and choose animate from the menu.

The final image is the same as applying the Dot product of A with itself

A . A // MatrixForm

Repeated action

repeats = 6

B = NestList[Dot[A, #] &, IdentityMatrix[2], repeats];

Do[Show[
	Graphics[
		{Table[
   			{ArgColor[un[j]],
   				Disk[B[[m]].{Re[un[j]], Im[un[j]]}, 0.04]},
  		 {j, mynumber}],
  		 Table[
   			{ArgColor[un[j]],
   				Disk[B[[m]].{Re[un[j]], Im[un[j]]}, 0.03]},
  		 {j, mynumber}]}
  		 , AspectRatio -> Automatic,Axes->True,PlotRange->{{-1,1},{-1,1}}
  		]
  	],{m,repeats+1}]

Doubleclicking on the grouped graphics cell  will animate all.

Use of NestList

We will learn later how we can use NestList to automate the action of increasing powers of a matrix.

Try other matrices

Hint: Copy this notebook and modify your copy

Question: do we always get ellipses?

Question: do the images always shrink?

You will have to select larger plotRanges to handle growing pictures.

Question do you sometimes see the same colour in the image and in the original direction?

We will study this phenomenon later. It is called Eigenvectors.