Posts tagged: CDF

Connecting the dots in the complex plane

This will be an attempt at describing the algorithmic procedure used to generate some of the graphics posted here.

  • Start with a line segment of any length L.

  • Now pick any angle A in the range 0° to 180°.

  • Connect another line segment of the same length as the first at the end of the first line so that two create an angle of A between them.

  • Repeat this procedure connecting additional lines of length L at the same angle A to the endpoints of the previous lines.


This shows the procedure repeated several times using an angle of about 20°.


And this shows the pattern that results some 150 lines into the procedure with the same angle of 20°:




Instead, if each additional line segment were to be made slightly smaller than the previous, say 99% of the length of the previous line, then the lines would look something like this where they begin to spiral in towards the center:



Its interesting to observe how these patterns change as the value for the angle A is varied. The closer the values for two different angles are the closer the two patterns will resemble one another. However, for each distinct angle A the resulting pattern is unique.

Here are some animations that show the angle vary through some range while keeping the number of lines in the iteration fixed. Note how relatively small the range is that the angle varies through.

With all lines the same length varying through angles of about 10.7° to 10.4° :



and with each line 99% the length of the previous with an angle variation from 20° to 16° :



This algorithm can be equivalently thought of as taking a certain ordered sequence of points in the plane and then joining them with straight lines—playing connect the dots basically. Different arrangements and sequences of points in the plane would produce different patterns when connected with lines.

Perhaps the most elegant and concise way to mathematically describe this algorithm is by making use of the complex numbers. Due to the way complex numbers multiply, this algorithm can be specified by picking a complex number z and then successively multiplying it by itself to get a sequence of points given by zn, where the resulting complex numbers zn represent the nth point in the sequence. Then the connect the dots routine is performed with this sequence of points.

For instance, the configuration for the first 100 dots corresponding to a particular choice of complex number may look something like this:

Then once all the dots are connected with lines it would look like this:

Performing this procedure with each different point in the complex plane generates a different pattern.

This kind of procedure where a certain transformation is repeated on some elements is considered an iterated function system, which is a class of fractals.

You could imagine all the different possibilities which would result from using different functions.

In fact, all of these images here were generated using similar procedures.

Download an interactive CDF file here where you can control the parameters, view the graphics, and also create numbered dot sequences.

Coordinate Systems - Cartesian and Polar

For the purpose of describing something, sometimes its useful to have a systematic way to label the relevant parts of that thing. In mathematics, things such as curves, surfaces, and abstract spaces in general can be described using what are called coordinate systems.

A familiar example of such a coordinate system may be the standard way points are described in the two-dimensional real plane. This is illustrated in the animation below. Here, an arbitrary point in the plane P (in black) is described as a pair of numbers P = ( x , y ), where x (the point in red) and y (the point in blue) are real numbers which give the lengths of the horizontal and vertical components of the point P, respectively. Thus, any two numbers x and y uniquely determine some point P in the plane. This coordinate system is sometimes referred to as rectangular coordinates or Cartesian coordinates.



Like many things, there isn’t only one correct way to describe them. There may exist different descriptions that accomplish the same thing. The Cartesian coordinate system described above is not the only possible or worthwhile coordinate system.

Another coordinate system that can be used to describe points in the plane is called polar coordinates, which is shown below. In this system, any point in the plane P (in black) is specified by two numbers r and a. Here, r is the distance of the point P to the origin (the length of the red dashed line). The other number a gives the angle the red dashed line makes with respect to the positive horizontal axis, which is measured by the dashed arc in blue (ranging in value from 0 to 360 degrees). Hence, any point P can be specified by how far away it is from the origin and its relative orientation to the horizontal axis.

Although these coordinate systems go about describing the points in the plane differently, they are equivalent in the sense that they both describe the same space. In this case, it is possible to translate data in one coordinate system to the other. That is, given some point P = ( x , y )  in Cartesian coordinates, that same point P can be expressed in polar coordinates where the corresponding numbers r and a can be found in terms of just the x and y. It can be shown using some trigonometric identities and the Pythagorean theorem that this transformation is given by

\[ r = \sqrt{x^2 +y^2} \]
and
\[a =\arctan(y/x) *\]

Likewise, starting in polar coordinates with the two numbers r and a describing some point P, the corresponding Cartesian coordinates ( x , y ) for the same point P are given by

\[ x = r\cos(a) \]
and
\[ y = r\sin(a) \]

Which coordinate system in preferred is largely a matter of context or personal taste. For instance, polar coordinates are useful to describe things that exhibit some kind of circular symmetry because equations may be expressed more naturally and concisely than in other coordinate systems. The examples described here are just two of many other valid coordinate systems that are used. In three dimensions, some other common coordinate systems used to exploit certain symmetries are spherical and cylindrical coordinates.


* As pointed out by isolatedvertex, this equation is not entirely correct due to certain degenerate cases. See here for more of an explanation.


You can move points in the Cartesian and polar coordinate systems around yourself in this interactive document if you have the Wolfram CDF player installed on your computer.

Mathematica code for animations:

Cartesian coordinates;

Manipulate[
Graphics[{
Line[{{0, 0}, pt}],
PointSize[Medium], Point[pt], Style[ Text[P, pt + {.1, .1}], Bold, Larger],
{Red, Dashing[.02], Line[{pt, {Part[pt, 1], 0}}],
PointSize[Medium], Point[{Part[pt, 1], 0}],
Style[Text[x, {Part[pt, 1], 0} + {.1, .1}], Bold, Larger]},
{Blue, Dashing[.02], Line[{pt, {0, Part[pt, 2]}}],
PointSize[Medium], Point[{0, Part[pt, 2]}],
Style[Text[y, {0, Part[pt, 2]} + {.1, .1}], Bold, Larger]}},
Axes -> True, AxesStyle -> Gray, AxesLabel -> {OverHat[x], OverHat[y]},
PlotRange -> {{-2, 2}, {-2, 2}}],
{{pt, {1, 1}}, {-2, -2}, {2, 2}}]

Polar coordinates;

Manipulate[
Graphics[{
PointSize[Medium], Point[pt], Style[ Text[P, pt + {.1, .1}], Bold, Larger],
{Red, Dashing[.02], Line[{{0, 0}, pt}],
Style[Text[r, .5 pt + {-.1, .1}], Bold, Larger]},
{Blue, {Dashed,
Circle[{0, 0}, .4,
{0, If[Part[pt, 2] > 0, ArcTan[Part[pt, 1], Part[pt, 2]], 2 Pi + ArcTan[Part[pt, 1], Part[pt, 2]]]}]},
Style[Text[a,
{.5 Cos[.5*If[Part[pt, 2] > 0, ArcTan[Part[pt, 1], Part[pt, 2]],
2 Pi + ArcTan[Part[pt, 1], Part[pt, 2]]]],
 .5 Sin[.5*If[Part[pt, 2] > 0, ArcTan[Part[pt, 1], Part[pt, 2]],
2 Pi + ArcTan[Part[pt, 1], Part[pt, 2]]]]}],
Bold, Larger]}},
Axes -> True, AxesStyle -> Gray, AxesLabel -> {OverHat[x], OverHat[y]},
PlotRange -> {{-2, 2}, {-2, 2}}],
{{pt, {1, 1}}, {-2, -2}, {2, 2}}]