Section 1.2 Sage for GCT
In this section, Sage cells have been provided that help us do the following:
 Convert between polar and Cartesian form (GCT Section 2.2)
 The angle determined by three points (GCT Section 2.3)
 Analyze basic transformations of the plane (GCT Section 3.1)
 Analyze Möbius transformations (GCT Sections 3.4,5
 Evaluate transformations in \((\mathbb{D},{\cal H})\) (GCT Section 5.1)
 Compute the hyperbolic distance between two points (GCT Section 5.3)
 Compute the elliptic distance between two points (GCT Section 6.3)
You may alter them to your purposes as you work through the homewok.
Example 1.2.1. Cartesian and Polar Form of a complex expression.
We can encourage Sage to produce userfriendly output, such as in the following example, where we aim to produces the polar form of \(z = 1 + 3i\text{.}\)
If you would like to describe this angle in degrees as a decimal approximation, you can.
Checkpoint 1.2.2.

Convert the following complex numbers to Polar form: \(z = 2 + 4i\text{,}\) \(w = 43i\text{,}\) and \(v = 12i\text{.}\)

Convert the following complex numbers to Cartesian form: \(z= 2e^{i\pi/4}\text{,}\) \(w = 5e^{i5\pi/6}\text{,}\) and \(v = 2e^{3}\text{.}\)
 \(z= 2\sqrt{5}e^{i\arctan(2)}\text{,}\) \(w = 5e^{i\arctan(3/4)} \text{,}\) and \(v = \sqrt{5}e^{i(\pi+\arctan(2)}\text{.}\)

By default, Sage outputs a complex expression in Cartesian form, so we need only enter and evaluate the polar form expression to do this conversion.
\(z= \sqrt{2}(1+i)\text{,}\) \(w = \frac{5}{2}(\sqrt{3}i)\text{,}\) \(v = 2e^3\) (this is a real number!)
Example 1.2.3. The angle determined by three points.
Recall from Section 2.3, if \(u,v,\) and \(w\) are three complex numbers, we let \(\angle uvw\) denote the angle \(\theta\) from ray \(\overrightarrow{vu}\) to \(\overrightarrow{vw}\text{.}\) In particular,
Example 1.2.4. General Linear Transformations of \(\mathbb{C}\).
We may define and compose compositions in order to describe a desired transformation of the plane.
Example 1.2.5. Möbius transformations.
We can define the Möbius transformation
by specifying values of the constants \(a,b,c\text{,}\) and \(d\text{:}\)
We can determine various features of our Möbius transformation, including:
 det\((T)\text{,}\)
 the pole of \(T\text{,}\) \(z_\infty\text{,}\) provided \(c \neq 0\)
 the inverse pole of \(T\text{,}\) \(w_\infty\text{,}\) provided \(c \neq 0\text{,}\) and
 the fixed points of \(T\)
. Note: If \(c = 0\text{,}\) the Möbius transformation \(T\) is a general linear transformation, and in this case \(T(\infty)=\infty\text{.}\)
Checkpoint 1.2.6.
 Determine the cross ratio of the points \(3+i, 2+4i\text{,}\) \(3i\text{,}\) and \(4\text{.}\)
 Define the Möbius transformation that sends \(z_1 = 3+i\) to 1, \(z_2 = i\) to 0, and \(z_3 = 3\) to \(\infty\text{.}\) Where does this Möbius transformation send \(2i\text{?}\)
Example 1.2.7. Normal form of a of Möbius transformation, 2 fixed points.
We can determine the normal form of \(T\text{,}\) after we have determined its fixed point(s). Here we tackle the case of 2 fixed points.
Consider the Möbius transformation
which has two fixed points: \(p=i\) and \(q = 3 + 2i\text{.}\) In the cell below we let L
denote \(\lambda\) in the normal form
Our goal is to determine \(L\text{,}\) which we can do by asking Sage to solve the normal form equation for \(L\) after plugging in some value for \(z\text{.}\) We choose \(z = 0\text{,}\) but any \(z \neq p,q\) would work.
Example 1.2.8. Normal form of a of Möbius transformation, 1 fixed point.
In this case the normal form is
As an example, consider \(T(z) = (7z12)/(3z5)\text{,}\) which fixes one point, \(p=2\text{.}\) To find the normal form we find the complex constant \(d\text{.}\)
Checkpoint 1.2.9.
Use Sage cells to find the Normal form of
Example 1.2.10. The Fundamental Theorem of Möbius transformations.
Determine the Möbius transformation that sends the unique points \(z_1, z_2\text{,}\) and \(z_3\) to \(w_1, w_2\text{,}\) and \(w_3\text{,}\) respectively.
The output gives the unique Möbius transformation that sends \(z_1 \mapsto w_1\text{,}\) \(z_2 \mapsto w_2\text{,}\) and \(z_3 \mapsto w_3\text{.}\) In this example, the map fixes 0, sends 1 to \(i\) and \(i\) to \(1\text{,}\) and it makes sense that the Sage cell produced rotation about the origin by \(90^\circ\text{:}\) \(z \mapsto iz\text{.}\)
Example 1.2.11. Transformations of \((\mathbb{D},{\cal H})\).
A transformation in \(\cal H\) has the form
Sage can evaluate such functions for us. Note that a map in \(\cal H\) is characterized by two constants, \(\theta\) and \(z_0\text{,}\) the point that gets sent to 0. So we specify these values in the Sage cell. In the example below, we consider
and find \(T(\frac{1}{2}i) = \frac{2}{17}(3+5i)\text{.}\)
Example 1.2.12. Distance between points in \((\mathbb{D},{\cal H})\).
The shortest path between points \(p\) and \(q\) in \((\mathbb{D},{\cal H})\) is along the hyperbolic segement joining them, and we derive this distance, \(d_H(p,q)\text{,}\) in Section 5.3 to be
Here are two Sage cells, the first defines the distance function, and the second evaluates distance between two specified points.
Example 1.2.13. Exercise 5.4.6.
If two sides of a hyperbolic triangle are Euclidean segments, then the included angle can be calculated using TODO. For instance, the angle at 0 is \(45^\circ\text{.}\)
To find the angle at another corner, we first transform the triangle so that the corner is moved to the origin. A Sage cell is handy here. To move \(\frac{1}{2}\) to the origin, we use the following Sage cell to build such a map in \(\cal H\) and track the image of the other two points.
Example 1.2.14. Distance between points in \((\mathbb{P}^2,{\cal S})\).
The shortest path between points \(p\) and \(q\) in \((\mathbb{P}^2,{\cal S})\) is along the elliptic segement joining them, and we derive this distance, \(d_S(p,q)\text{,}\) in Section 6.3 to be
Here are two Sage cells, the first defines the distance function, and the second evaluates distance between two specified points.