passagemath-plot 10.6.31rc3__cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-plot might be problematic. Click here for more details.
- passagemath_plot-10.6.31rc3.dist-info/METADATA +172 -0
- passagemath_plot-10.6.31rc3.dist-info/RECORD +82 -0
- passagemath_plot-10.6.31rc3.dist-info/WHEEL +6 -0
- passagemath_plot-10.6.31rc3.dist-info/top_level.txt +2 -0
- passagemath_plot.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
- passagemath_plot.libs/libgsl-cda90e79.so.28.0.0 +0 -0
- passagemath_plot.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
- passagemath_plot.libs/libquadmath-2284e583.so.0.0.0 +0 -0
- sage/all__sagemath_plot.py +15 -0
- sage/ext_data/threejs/animation.css +195 -0
- sage/ext_data/threejs/animation.html +85 -0
- sage/ext_data/threejs/animation.js +273 -0
- sage/ext_data/threejs/fat_lines.js +48 -0
- sage/ext_data/threejs/threejs-version.txt +1 -0
- sage/ext_data/threejs/threejs_template.html +597 -0
- sage/interfaces/all__sagemath_plot.py +1 -0
- sage/interfaces/gnuplot.py +196 -0
- sage/interfaces/jmoldata.py +208 -0
- sage/interfaces/povray.py +56 -0
- sage/plot/all.py +42 -0
- sage/plot/animate.py +1796 -0
- sage/plot/arc.py +504 -0
- sage/plot/arrow.py +671 -0
- sage/plot/bar_chart.py +205 -0
- sage/plot/bezier_path.py +400 -0
- sage/plot/circle.py +435 -0
- sage/plot/colors.py +1606 -0
- sage/plot/complex_plot.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/plot/complex_plot.pyx +1446 -0
- sage/plot/contour_plot.py +1792 -0
- sage/plot/density_plot.py +318 -0
- sage/plot/disk.py +373 -0
- sage/plot/ellipse.py +375 -0
- sage/plot/graphics.py +3580 -0
- sage/plot/histogram.py +354 -0
- sage/plot/hyperbolic_arc.py +404 -0
- sage/plot/hyperbolic_polygon.py +416 -0
- sage/plot/hyperbolic_regular_polygon.py +296 -0
- sage/plot/line.py +626 -0
- sage/plot/matrix_plot.py +629 -0
- sage/plot/misc.py +509 -0
- sage/plot/multigraphics.py +1294 -0
- sage/plot/plot.py +4183 -0
- sage/plot/plot3d/all.py +23 -0
- sage/plot/plot3d/base.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/plot/plot3d/base.pxd +12 -0
- sage/plot/plot3d/base.pyx +3378 -0
- sage/plot/plot3d/implicit_plot3d.py +659 -0
- sage/plot/plot3d/implicit_surface.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/plot/plot3d/implicit_surface.pyx +1453 -0
- sage/plot/plot3d/index_face_set.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/plot/plot3d/index_face_set.pxd +32 -0
- sage/plot/plot3d/index_face_set.pyx +1873 -0
- sage/plot/plot3d/introduction.py +131 -0
- sage/plot/plot3d/list_plot3d.py +649 -0
- sage/plot/plot3d/parametric_plot3d.py +1130 -0
- sage/plot/plot3d/parametric_surface.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/plot/plot3d/parametric_surface.pxd +12 -0
- sage/plot/plot3d/parametric_surface.pyx +893 -0
- sage/plot/plot3d/platonic.py +601 -0
- sage/plot/plot3d/plot3d.py +1442 -0
- sage/plot/plot3d/plot_field3d.py +162 -0
- sage/plot/plot3d/point_c.pxi +148 -0
- sage/plot/plot3d/revolution_plot3d.py +309 -0
- sage/plot/plot3d/shapes.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/plot/plot3d/shapes.pxd +22 -0
- sage/plot/plot3d/shapes.pyx +1382 -0
- sage/plot/plot3d/shapes2.py +1512 -0
- sage/plot/plot3d/tachyon.py +1779 -0
- sage/plot/plot3d/texture.py +453 -0
- sage/plot/plot3d/transform.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/plot/plot3d/transform.pxd +21 -0
- sage/plot/plot3d/transform.pyx +268 -0
- sage/plot/plot3d/tri_plot.py +589 -0
- sage/plot/plot_field.py +362 -0
- sage/plot/point.py +624 -0
- sage/plot/polygon.py +562 -0
- sage/plot/primitive.py +249 -0
- sage/plot/scatter_plot.py +199 -0
- sage/plot/step.py +85 -0
- sage/plot/streamline_plot.py +328 -0
- sage/plot/text.py +432 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-plot
|
|
2
|
+
# sage.doctest: needs sage.symbolic
|
|
3
|
+
"""
|
|
4
|
+
Regular polygons in the upper half model for hyperbolic plane
|
|
5
|
+
|
|
6
|
+
AUTHORS:
|
|
7
|
+
|
|
8
|
+
- Javier Honrubia (2016-01)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
#******************************************************************************
|
|
12
|
+
# Copyright (C) 2016 Javier Honrubia Gonzalez <jhonrubia6@alumno.uned.es>
|
|
13
|
+
#
|
|
14
|
+
# This program is free software: you can redistribute it and/or modify
|
|
15
|
+
# it under the terms of the GNU General Public License as published by
|
|
16
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
17
|
+
# (at your option) any later version.
|
|
18
|
+
# https://www.gnu.org/licenses/
|
|
19
|
+
#*****************************************************************************
|
|
20
|
+
|
|
21
|
+
from sage.matrix.constructor import matrix
|
|
22
|
+
from sage.misc.decorators import options, rename_keyword
|
|
23
|
+
from sage.misc.functional import is_odd
|
|
24
|
+
from sage.misc.lazy_import import lazy_import
|
|
25
|
+
from sage.plot.hyperbolic_polygon import HyperbolicPolygon
|
|
26
|
+
from sage.plot.plot import Graphics
|
|
27
|
+
from sage.rings.cc import CC
|
|
28
|
+
from sage.rings.integer import Integer
|
|
29
|
+
|
|
30
|
+
lazy_import("sage.functions.hyperbolic", "arccosh")
|
|
31
|
+
lazy_import("sage.functions.trig", ["sin", "cos", "cot"])
|
|
32
|
+
lazy_import("sage.symbolic.constants", ["pi", "e"])
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class HyperbolicRegularPolygon(HyperbolicPolygon):
|
|
36
|
+
r"""
|
|
37
|
+
Primitive class for regular hyperbolic polygon type.
|
|
38
|
+
|
|
39
|
+
See ``hyperbolic_regular_polygon?`` for information about plotting
|
|
40
|
+
a hyperbolic regular polygon in the upper complex halfplane.
|
|
41
|
+
|
|
42
|
+
INPUT:
|
|
43
|
+
|
|
44
|
+
- ``sides`` -- number of sides of the polygon
|
|
45
|
+
|
|
46
|
+
- ``i_angle`` -- interior angle of the polygon
|
|
47
|
+
|
|
48
|
+
- ``center`` -- center point as a complex number of the polygon
|
|
49
|
+
|
|
50
|
+
EXAMPLES:
|
|
51
|
+
|
|
52
|
+
Note that constructions should use :func:`hyperbolic_regular_polygon`::
|
|
53
|
+
|
|
54
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
55
|
+
sage: print(HyperbolicRegularPolygon(5,pi/2,I, {}))
|
|
56
|
+
Hyperbolic regular polygon (sides=5, i_angle=1/2*pi, center=1.00000000000000*I)
|
|
57
|
+
|
|
58
|
+
The code verifies is there exists a compact hyperbolic regular polygon
|
|
59
|
+
with the given data, checking
|
|
60
|
+
|
|
61
|
+
.. MATH::
|
|
62
|
+
|
|
63
|
+
A(\mathcal{P}) = \pi(s-2) - s \cdot \alpha > 0,
|
|
64
|
+
|
|
65
|
+
where `s` is ``sides`` and `\alpha` is ``i_angle``. This raises an error if
|
|
66
|
+
the ``i_angle`` is less than the minimum to generate a compact polygon::
|
|
67
|
+
|
|
68
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
69
|
+
sage: P = HyperbolicRegularPolygon(4, pi/2, I, {})
|
|
70
|
+
Traceback (most recent call last):
|
|
71
|
+
...
|
|
72
|
+
ValueError: there exists no hyperbolic regular compact polygon,
|
|
73
|
+
for sides=4 the interior angle must be less than 1/2*pi
|
|
74
|
+
|
|
75
|
+
It is an error to give a center outside the upper half plane in this model ::
|
|
76
|
+
|
|
77
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
78
|
+
sage: P = HyperbolicRegularPolygon(4, pi/4, 1-I, {})
|
|
79
|
+
Traceback (most recent call last):
|
|
80
|
+
...
|
|
81
|
+
ValueError: center: 1.00000000000000 - 1.00000000000000*I is not
|
|
82
|
+
a valid point in the upper half plane model of the hyperbolic plane
|
|
83
|
+
|
|
84
|
+
TESTS::
|
|
85
|
+
|
|
86
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
87
|
+
sage: P = HyperbolicRegularPolygon(4, -pi/4, I, {})
|
|
88
|
+
Traceback (most recent call last):
|
|
89
|
+
...
|
|
90
|
+
ValueError: interior angle -1/4*pi must be in (0, pi) interval
|
|
91
|
+
|
|
92
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
93
|
+
sage: P=HyperbolicRegularPolygon(16, 3*pi/2, I, {})
|
|
94
|
+
Traceback (most recent call last):
|
|
95
|
+
...
|
|
96
|
+
ValueError: interior angle 3/2*pi must be in (0, pi) interval
|
|
97
|
+
|
|
98
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
99
|
+
sage: P = HyperbolicRegularPolygon(2, pi/10, I, {})
|
|
100
|
+
Traceback (most recent call last):
|
|
101
|
+
...
|
|
102
|
+
ValueError: degenerated polygons (sides<=2) are not supported
|
|
103
|
+
"""
|
|
104
|
+
def __init__(self, sides, i_angle, center, options):
|
|
105
|
+
"""
|
|
106
|
+
Initialize HyperbolicRegularPolygon.
|
|
107
|
+
|
|
108
|
+
EXAMPLES::
|
|
109
|
+
|
|
110
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
111
|
+
sage: print(HyperbolicRegularPolygon(5,pi/2,I, {}))
|
|
112
|
+
Hyperbolic regular polygon (sides=5, i_angle=1/2*pi, center=1.00000000000000*I)
|
|
113
|
+
"""
|
|
114
|
+
self.center = CC(center)
|
|
115
|
+
if self.center.imag() <= 0:
|
|
116
|
+
raise ValueError("center: %s is not a valid point in the upper half plane model of the hyperbolic plane" % (self.center))
|
|
117
|
+
if sides < 3:
|
|
118
|
+
raise ValueError("degenerated polygons (sides<=2) are not supported")
|
|
119
|
+
if i_angle <= 0 or i_angle >= pi:
|
|
120
|
+
raise ValueError("interior angle %s must be in (0, pi) interval" % (i_angle))
|
|
121
|
+
if pi*(sides-2) - sides*i_angle <= 0:
|
|
122
|
+
raise ValueError("there exists no hyperbolic regular compact polygon,"
|
|
123
|
+
" for sides={} the interior angle must be less than {}".format(sides, pi * (sides-2) / sides))
|
|
124
|
+
self.sides = sides
|
|
125
|
+
self.i_angle = i_angle
|
|
126
|
+
beta = 2 * pi / self.sides # compute the rotation angle to be used ahead
|
|
127
|
+
alpha = self.i_angle / Integer(2)
|
|
128
|
+
I = CC(0, 1)
|
|
129
|
+
# compute using cosine theorem the radius of the circumscribed circle
|
|
130
|
+
# using the triangle formed by the radius and the three known angles
|
|
131
|
+
r = arccosh(cot(alpha) * (1 + cos(beta)) / sin(beta))
|
|
132
|
+
|
|
133
|
+
# The first point will be always on the imaginary axis limited
|
|
134
|
+
# to 8 digits for efficiency in the subsequent calculations.
|
|
135
|
+
z_0 = [I*(e**r).n(digits=8)]
|
|
136
|
+
|
|
137
|
+
# Compute the dilation isometry used to move the center
|
|
138
|
+
# from I to the imaginary part of the given center.
|
|
139
|
+
scale = self.center.imag()
|
|
140
|
+
|
|
141
|
+
# Compute the parabolic isometry to move the center to the
|
|
142
|
+
# real part of the given center.
|
|
143
|
+
h_disp = self.center.real()
|
|
144
|
+
|
|
145
|
+
d_z_k = [z_0[0]*scale + h_disp] # d_k has the points for the polygon in the given center
|
|
146
|
+
z_k = z_0 # z_k has the Re(z)>0 vertices for the I centered polygon
|
|
147
|
+
r_z_k = [] # r_z_k has the Re(z)<0 vertices
|
|
148
|
+
if is_odd(self.sides):
|
|
149
|
+
vert = (self.sides - 1) // 2
|
|
150
|
+
else:
|
|
151
|
+
vert = self.sides // 2 - 1
|
|
152
|
+
for k in range(vert):
|
|
153
|
+
# Compute with 8 digits to accelerate calculations
|
|
154
|
+
new_z_k = self._i_rotation(z_k[-1], beta).n(digits=8)
|
|
155
|
+
z_k = z_k + [new_z_k]
|
|
156
|
+
d_z_k = d_z_k + [new_z_k * scale + h_disp]
|
|
157
|
+
r_z_k = [-(new_z_k).conjugate() * scale + h_disp] + r_z_k
|
|
158
|
+
if is_odd(self.sides):
|
|
159
|
+
HyperbolicPolygon.__init__(self, d_z_k + r_z_k, "UHP", options)
|
|
160
|
+
else:
|
|
161
|
+
z_opo = [I * (e**(-r)).n(digits=8) * scale + h_disp]
|
|
162
|
+
HyperbolicPolygon.__init__(self, d_z_k + z_opo + r_z_k, "UHP", options)
|
|
163
|
+
|
|
164
|
+
def _repr_(self):
|
|
165
|
+
"""
|
|
166
|
+
String representation of HyperbolicRegularPolygon.
|
|
167
|
+
|
|
168
|
+
TESTS::
|
|
169
|
+
|
|
170
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
171
|
+
sage: HyperbolicRegularPolygon(5,pi/2,I, {})
|
|
172
|
+
Hyperbolic regular polygon (sides=5, i_angle=1/2*pi, center=1.00000000000000*I)
|
|
173
|
+
"""
|
|
174
|
+
return ("Hyperbolic regular polygon (sides={}, i_angle={}, center={})".format(self.sides, self.i_angle, self.center))
|
|
175
|
+
|
|
176
|
+
def _i_rotation(self, z, alpha):
|
|
177
|
+
r"""
|
|
178
|
+
Return the resulting point after applying a hyperbolic
|
|
179
|
+
rotation centered at `0 + i` and angle ``alpha`` to ``z``.
|
|
180
|
+
|
|
181
|
+
INPUT:
|
|
182
|
+
|
|
183
|
+
- ``z`` -- point in the upper complex halfplane to which
|
|
184
|
+
apply the isometry
|
|
185
|
+
|
|
186
|
+
- ``alpha`` -- angle of rotation (radians, counterclockwise)
|
|
187
|
+
|
|
188
|
+
OUTPUT: rotated point in the upper complex halfplane
|
|
189
|
+
|
|
190
|
+
TESTS::
|
|
191
|
+
|
|
192
|
+
sage: from sage.plot.hyperbolic_regular_polygon import HyperbolicRegularPolygon
|
|
193
|
+
sage: P = HyperbolicRegularPolygon(4, pi/4, 1+I, {})
|
|
194
|
+
sage: P._i_rotation(2+I, pi/2)
|
|
195
|
+
I - 2
|
|
196
|
+
"""
|
|
197
|
+
_a = alpha / 2
|
|
198
|
+
_c = cos(_a)
|
|
199
|
+
_s = sin(_a)
|
|
200
|
+
G = matrix([[_c, _s], [-_s, _c]])
|
|
201
|
+
return (G[0][0] * z + G[0][1]) / (G[1][0] * z + G[1][1])
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
@rename_keyword(color='rgbcolor')
|
|
205
|
+
@options(alpha=1, fill=False, thickness=1, rgbcolor='blue', zorder=2,
|
|
206
|
+
linestyle='solid')
|
|
207
|
+
def hyperbolic_regular_polygon(sides, i_angle, center=CC(0,1), **options):
|
|
208
|
+
r"""
|
|
209
|
+
Return a hyperbolic regular polygon in the upper half model of
|
|
210
|
+
Hyperbolic plane given the number of sides, interior angle and
|
|
211
|
+
possibly a center.
|
|
212
|
+
|
|
213
|
+
Type ``?hyperbolic_regular_polygon`` to see all options.
|
|
214
|
+
|
|
215
|
+
INPUT:
|
|
216
|
+
|
|
217
|
+
- ``sides`` -- number of sides of the polygon
|
|
218
|
+
|
|
219
|
+
- ``i_angle`` -- interior angle of the polygon
|
|
220
|
+
|
|
221
|
+
- ``center`` -- (default: `i`) hyperbolic center point
|
|
222
|
+
(complex number) of the polygon
|
|
223
|
+
|
|
224
|
+
OPTIONS:
|
|
225
|
+
|
|
226
|
+
- ``alpha`` -- (default: 1)
|
|
227
|
+
|
|
228
|
+
- ``fill`` -- (default: ``False``)
|
|
229
|
+
|
|
230
|
+
- ``thickness`` -- (default: 1)
|
|
231
|
+
|
|
232
|
+
- ``rgbcolor`` -- (default: ``'blue'``)
|
|
233
|
+
|
|
234
|
+
- ``linestyle`` -- (default: ``'solid'``) the style of the line,
|
|
235
|
+
which can be one of the following:
|
|
236
|
+
|
|
237
|
+
* ``'dashed'`` or ``'--'``
|
|
238
|
+
* ``'dotted'`` or ``':'``
|
|
239
|
+
* ``'solid'`` or ``'-'``
|
|
240
|
+
* ``'dashdot'`` or ``'-.'``
|
|
241
|
+
|
|
242
|
+
EXAMPLES:
|
|
243
|
+
|
|
244
|
+
Show a hyperbolic regular polygon with 6 sides and square angles::
|
|
245
|
+
|
|
246
|
+
sage: g = hyperbolic_regular_polygon(6, pi/2)
|
|
247
|
+
sage: g.plot()
|
|
248
|
+
Graphics object consisting of 1 graphics primitive
|
|
249
|
+
|
|
250
|
+
.. PLOT::
|
|
251
|
+
|
|
252
|
+
g = hyperbolic_regular_polygon(6, pi/2)
|
|
253
|
+
sphinx_plot(g.plot())
|
|
254
|
+
|
|
255
|
+
With more options::
|
|
256
|
+
|
|
257
|
+
sage: g = hyperbolic_regular_polygon(6, pi/2, center=3+2*I, fill=True, color='red')
|
|
258
|
+
sage: g.plot()
|
|
259
|
+
Graphics object consisting of 1 graphics primitive
|
|
260
|
+
|
|
261
|
+
.. PLOT::
|
|
262
|
+
|
|
263
|
+
g = hyperbolic_regular_polygon(6, pi/2, center=3+2*I, fill=True, color='red')
|
|
264
|
+
sphinx_plot(g.plot())
|
|
265
|
+
|
|
266
|
+
The code verifies is there exists a hyperbolic regular polygon
|
|
267
|
+
with the given data, checking
|
|
268
|
+
|
|
269
|
+
.. MATH::
|
|
270
|
+
|
|
271
|
+
A(\mathcal{P}) = \pi(s-2) - s \cdot \alpha > 0,
|
|
272
|
+
|
|
273
|
+
where `s` is ``sides`` and `\alpha` is ``i_angle``. This raises an error if
|
|
274
|
+
the ``i_angle`` is less than the minimum to generate a compact polygon::
|
|
275
|
+
|
|
276
|
+
sage: hyperbolic_regular_polygon(4, pi/2)
|
|
277
|
+
Traceback (most recent call last):
|
|
278
|
+
...
|
|
279
|
+
ValueError: there exists no hyperbolic regular compact polygon,
|
|
280
|
+
for sides=4 the interior angle must be less than 1/2*pi
|
|
281
|
+
|
|
282
|
+
It is an error to give a center outside the upper half plane in
|
|
283
|
+
this model::
|
|
284
|
+
|
|
285
|
+
sage: from sage.plot.hyperbolic_regular_polygon import hyperbolic_regular_polygon
|
|
286
|
+
sage: hyperbolic_regular_polygon(4, pi/4, 1-I)
|
|
287
|
+
Traceback (most recent call last):
|
|
288
|
+
...
|
|
289
|
+
ValueError: center: 1.00000000000000 - 1.00000000000000*I is not
|
|
290
|
+
a valid point in the upper half plane model of the hyperbolic plane
|
|
291
|
+
"""
|
|
292
|
+
g = Graphics()
|
|
293
|
+
g._set_extra_kwds(g._extract_kwds_for_show(options))
|
|
294
|
+
g.add_primitive(HyperbolicRegularPolygon(sides, i_angle, center, options))
|
|
295
|
+
g.set_aspect_ratio(1)
|
|
296
|
+
return g
|