Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Regular polygons in the upper half model for hyperbolic plane
AUTHORS:
- Javier Honrubia (2016-01) """
#****************************************************************************** # Copyright (C) 2016 Javier Honrubia Gonzalez <jhonrubia6@alumno.uned.es> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ #*****************************************************************************
r""" Primitive class for regular hyberbolic polygon type.
See ``hyperbolic_regular_polygon?`` for information about plotting a hyperbolic regular polygon in the upper complex halfplane.
INPUT:
- ``sides`` -- number of sides of the polygon
- ``i_angle`` -- interior angle of the polygon
- ``center``-- center point as a complex number of the polygon
EXAMPLES:
Note that constructions should use :func:`hyperbolic_regular_polygon`::
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: print(HyperbolicRegularPolygon(5,pi/2,I, {})) Hyperbolic regular polygon (sides=5, i_angle=1/2*pi, center=1.00000000000000*I)
The code verifies is there exists a compact hyperbolic regular polygon with the given data, checking
.. MATH::
A(\mathcal{P}) = \pi(s-2) - s \cdot \alpha > 0,
where `s` is ``sides`` and `\alpha` is ``i_angle`. This raises an error if the ``i_angle`` is less than the minimum to generate a compact polygon::
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: P = HyperbolicRegularPolygon(4, pi/2, I, {}) Traceback (most recent call last): ... ValueError: there exists no hyperbolic regular compact polygon, for sides=4 the interior angle must be less than 1/2*pi
It is an error to give a center outside the upper half plane in this model ::
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: P = HyperbolicRegularPolygon(4, pi/4, 1-I, {}) Traceback (most recent call last): ... ValueError: center: 1.00000000000000 - 1.00000000000000*I is not a valid point in the upper half plane model of the hyperbolic plane
TESTS::
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: P = HyperbolicRegularPolygon(4, -pi/4, I, {}) Traceback (most recent call last): ... ValueError: interior angle -1/4*pi must be in (0, pi) interval
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: P=HyperbolicRegularPolygon(16, 3*pi/2, I, {}) Traceback (most recent call last): ... ValueError: interior angle 3/2*pi must be in (0, pi) interval
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: P = HyperbolicRegularPolygon(2, pi/10, I, {}) Traceback (most recent call last): ... ValueError: degenerated polygons (sides<=2) are not supported """ """ Initialize HyperbolicRegularPolygon.
EXAMPLES::
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: print(HyperbolicRegularPolygon(5,pi/2,I, {})) Hyperbolic regular polygon (sides=5, i_angle=1/2*pi, center=1.00000000000000*I) """ # compute using cosine theorem the radius of the circumscribed circle # using the triangle formed by the radius and the three known angles
# The first point will be always on the imaginary axis limited # to 8 digits for efficiency in the subsequent calculations.
# Compute the dilation isometry used to move the center # from I to the imaginary part of the given center.
# Compute the parabolic isometry to move the center to the # real part of the given center.
else: # Compute with 8 digits to accelerate calculations else:
""" String representation of HyperbolicRegularPolygon.
TESTS::
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: HyperbolicRegularPolygon(5,pi/2,I, {})._repr_() 'Hyperbolic regular polygon (sides=5, i_angle=1/2*pi, center=1.00000000000000*I)' """ % (self.sides, self.i_angle, self.center))
r""" Return the resulting point after applying a hyperbolic rotation centered at `0 + i` and angle ``alpha`` to ``z``.
INPUT:
- ``z``-- point in the upper complex halfplane to which apply the isometry
- ``alpha``-- angle of rotation (radians,counterwise)
OUTPUT:
- rotated point in the upper complex halfplane
TESTS::
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon sage: P = HyperbolicRegularPolygon(4, pi/4, 1+I, {}) sage: P._i_rotation(2+I, pi/2) I - 2 """
linestyle='solid') r""" Return a hyperbolic regular polygon in the upper half model of Hyperbolic plane given the number of sides, interior angle and possibly a center.
Type ``?hyperbolic_regular_polygon`` to see all options.
INPUT:
- ``sides`` -- number of sides of the polygon
- ``i_angle`` -- interior angle of the polygon
- ``center`` -- (default: `i`) hyperbolic center point (complex number) of the polygon
OPTIONS:
- ``alpha`` -- default: 1
- ``fill`` -- default: ``False``
- ``thickness`` -- default: 1
- ``rgbcolor`` -- default: ``'blue'``
- ``linestyle`` -- (default: ``'solid'``) the style of the line, which can be one of the following:
* ``'dashed'`` or ``'--'`` * ``'dotted'`` or ``':'`` * ``'solid'`` or ``'-'`` * ``'dashdot'`` or ``'-.'``
EXAMPLES:
Show a hyperbolic regular polygon with 6 sides and square angles::
sage: g = hyperbolic_regular_polygon(6, pi/2) sage: g.plot() Graphics object consisting of 1 graphics primitive
.. PLOT::
g = hyperbolic_regular_polygon(6, pi/2) sphinx_plot(g.plot())
With more options::
sage: g = hyperbolic_regular_polygon(6, pi/2, center=3+2*I, fill=True, color='red') sage: g.plot() Graphics object consisting of 1 graphics primitive
.. PLOT::
g = hyperbolic_regular_polygon(6, pi/2, center=3+2*I, fill=True, color='red') sphinx_plot(g.plot())
The code verifies is there exists a hyperbolic regular polygon with the given data, checking
.. MATH::
A(\mathcal{P}) = \pi(s-2) - s \cdot \alpha > 0,
where `s` is ``sides`` and `\alpha` is ``i_angle`. This raises an error if the ``i_angle`` is less than the minimum to generate a compact polygon::
sage: hyperbolic_regular_polygon(4, pi/2) Traceback (most recent call last): ... ValueError: there exists no hyperbolic regular compact polygon, for sides=4 the interior angle must be less than 1/2*pi
It is an error to give a center outside the upper half plane in this model::
sage: from sage.plot.hyperbolic_regular_polygon import hyperbolic_regular_polygon sage: hyperbolic_regular_polygon(4, pi/4, 1-I) Traceback (most recent call last): ... ValueError: center: 1.00000000000000 - 1.00000000000000*I is not a valid point in the upper half plane model of the hyperbolic plane """
|