Hyperbolic Geometry Utility Functions

Imports

[1]:
from typing import List

import numpy as np
import matplotlib.pyplot as plt

from pyzeta.geometry.sl2r import SL2R
from pyzeta.geometry.visuals import plotFundDom, hypPlaneWave, SLtoSU
from pyzeta.geometry.helpers import HtoD
from pyzeta.core.dynamics.function_systems.implementations import (
    FunnelTorus,
    HyperbolicCylinder,
)
from pyzeta.framework.initialization.initialization_handler import (
    PyZetaInitializationHandler,
)

PyZetaInitializationHandler.initPyZetaServices()

Define the Examples

[2]:
def funnelTorusExample(model: str = "H") -> None:
    "Illustrate fundamental domain plotting with funneled torus."
    torus = FunnelTorus(2.0, 2.0, np.pi / 2.0)
    z0 = 1j

    generators = [SL2R(mat) for mat in torus._phi[:2]]
    if model == "D":
        for i, gen in enumerate(generators):
            generators[i] = SLtoSU(gen)  # type: ignore
        z0 = HtoD(z0)
    plotFundDom(*generators, z0=z0)
    plt.show()


def hyperbolicCylinderExample(model: str = "H") -> None:
    "Illustrate fundamental domain plotting with funneled torus."
    torus = HyperbolicCylinder(3.0, rotate=True)
    z0 = 1j

    generators = [SL2R(mat) for mat in torus._phi[:1]]
    if model == "D":
        for i, gen in enumerate(generators):
            generators[i] = SLtoSU(gen)  # type: ignore
        z0 = HtoD(z0)
    plotFundDom(*generators, z0=z0)
    plt.show()
[3]:
def planeWavesExample1(model: str = "H") -> None:
    "Simple example of hyperbolic plane waves on the upper halfplane."
    # hyperbolic plane waves example1
    realArr = np.linspace(-2.0, 2.0, 1000)
    imagArr = np.linspace(0.0, 4.0, 1000)
    xi: List[complex] = [
        0.0 + 0.0j,
    ]
    k = [
        5.0,
    ]

    wave = hypPlaneWave(realArr, imagArr, xi, k, model="H")
    wave[wave == np.infty] = -1.0
    plt.imshow(
        np.abs(wave),
        cmap="Reds",
        interpolation="nearest",
        origin="lower",
        extent=[-2, 2, 0, 4.0],
    )
    plt.show()

[4]:
def planeWavesExample2(model: str = "H") -> None:
    "More complex example of hyperbolic plane waves on the Poincare disc."
    realArr = np.linspace(-1.0, 1.0, 8000)
    imagArr = np.linspace(-1.0, 1.0, 8000)
    xi = [1.0, -1.0]
    k = [2.0, 3.0]

    wave = hypPlaneWave(realArr, imagArr, xi, k, model="D")
    wave[wave == np.nan] = 0.0
    plt.imshow(
        np.abs(wave),
        cmap="Reds",
        interpolation="nearest",
        origin="lower",
        extent=[-1, 1, -1, 1],
    )
    plt.show()

Run the Examples

[5]:
funnelTorusExample(model="H")
hyperbolicCylinderExample(model="H")
funnelTorusExample(model="D")
hyperbolicCylinderExample(model="D")

../_images/faq_geometry_example_8_0.png
../_images/faq_geometry_example_8_1.png
../_images/faq_geometry_example_8_2.png
../_images/faq_geometry_example_8_3.png
[6]:
planeWavesExample1()

../_images/faq_geometry_example_9_0.png
[7]:
planeWavesExample2()

../_images/faq_geometry_example_10_0.png