Skip to main content

Section 1.2 Sage for GCT

In this section, Sage cells have been provided that help us do the following:

  1. Convert between polar and Cartesian form (GCT Section 2.2)
  2. The angle determined by three points (GCT Section 2.3)
  3. Analyze basic transformations of the plane (GCT Section 3.1)
  4. Analyze Möbius transformations (GCT Sections 3.4,5
  5. Evaluate transformations in \((\mathbb{D},{\cal H})\) (GCT Section 5.1)
  6. Compute the hyperbolic distance between two points (GCT Section 5.3)
  7. 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 user-friendly 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.
  1. Convert the following complex numbers to Polar form: \(z = 2 + 4i\text{,}\) \(w = 4-3i\text{,}\) and \(v = -1-2i\text{.}\)

  2. 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{.}\)

Answer
  1. \(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{.}\)
  2. 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,

\begin{equation*} \angle uvw = \theta = \arg\bigg(\frac{w-v}{u-v}\bigg)\text{.} \end{equation*}
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

\begin{equation*} T(z)=\frac{az+b}{cz+d} \end{equation*}

by specifying values of the constants \(a,b,c\text{,}\) and \(d\text{:}\)

We can determine various features of our Möbius transformation, including:

  1. det\((T)\text{,}\)
  2. the pole of \(T\text{,}\) \(z_\infty\text{,}\) provided \(c \neq 0\)
  3. the inverse pole of \(T\text{,}\) \(w_\infty\text{,}\) provided \(c \neq 0\text{,}\) and
  4. 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.
  1. Determine the cross ratio of the points \(3+i, 2+4i\text{,}\) \(3-i\text{,}\) and \(4\text{.}\)
  2. 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

\begin{equation*} T(z) = \frac{(6+3i)z+(2-3i)}{z+3}\text{,} \end{equation*}

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

\begin{equation*} \frac{T(z)-p}{T(z)-q}=\lambda\frac{z-p}{z-q}\text{.} \end{equation*}

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

\begin{equation*} \frac{1}{T(z) - p} = \frac{1}{z-p} + d\text{.} \end{equation*}

As an example, consider \(T(z) = (7z-12)/(3z-5)\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

\begin{equation*} T(z)=\frac{iz+3i+2}{2iz-4-i}\text{.} \end{equation*}
Solution
Here we go!
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

\begin{equation*} T(z) = e^{i\theta}\frac{z - z_0}{1-\overline{z}_0z}\text{.} \end{equation*}

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

\begin{equation*} T(z) = e^{i\pi/2}\frac{z-1/2}{1-\overline{1/2}z} \end{equation*}

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

\begin{equation*} d_H(p,q) = \ln\left[\frac{|1-\overline{p}q|+|q-p|}{|1-\overline{p}q|-|q-p|}\right]\text{.} \end{equation*}

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

\begin{equation*} d_S(p,q)=~\text{min}\left\{2\arctan\left(\left|\frac{q - p}{1+\overline{p}q}\right|\right), 2\arctan\left(\left|\frac{1+\overline{p}q}{q-p}\right|\right)\right\}\text{.} \end{equation*}

Here are two Sage cells, the first defines the distance function, and the second evaluates distance between two specified points.