Skip to content

Commit

Permalink
Replace .all imports in doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Jan 14, 2025
1 parent ef8fb98 commit 74d833c
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion doc_src/verify.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Some examples of verified computations are:

* An example of finding all geodesics up to length 1::

sage: from sage.all import RIF
sage: from snappy.sage_helper import RIF
sage: L = RIF(1)
sage: M = Manifold("m003")
sage: spec = M.length_spectrum_alt_gen(verified=True)
Expand Down
2 changes: 1 addition & 1 deletion python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def short_slopes(manifold,
The given :attr:`length` is cast to a SageMath ``RealIntervalField`` of the
given precision if :attr:`verified = True`::
sage: from sage.all import pi
sage: from sage.symbolic.constants import pi
sage: M.short_slopes(length = 2 * pi, verified = True, bits_prec = 100)
[[(1, 0), (-5, 1), (-4, 1), (-3, 1), (-2, 1), (-1, 1), (0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1)]]
Expand Down
4 changes: 2 additions & 2 deletions python/cusps/cusp_areas_from_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def unbiased_cusp_areas_from_cusp_area_matrix(cusp_area_matrix):
Examples::
sage: from sage.all import matrix, RIF
sage: from snappy.sage_helper import matrix, RIF
sage: unbiased_cusp_areas_from_cusp_area_matrix(
... matrix([[RIF(9.0,9.0005),RIF(6.0, 6.001)],
... [RIF(6.0,6.001 ),RIF(4.0, 4.001)]]))
Expand All @@ -35,7 +35,7 @@ def unbiased_cusp_areas_from_cusp_area_matrix(cusp_area_matrix):
def greedy_cusp_areas_from_cusp_area_matrix(cusp_area_matrix, first_cusps=[]):
"""
sage: from sage.all import matrix, RIF
sage: from snappy.sage_helper import matrix, RIF
sage: greedy_cusp_areas_from_cusp_area_matrix(
... matrix([[RIF(9.0,9.0005),RIF(6.0, 6.001)],
... [RIF(6.0,6.001 ),RIF(10.0, 10.001)]]))
Expand Down
2 changes: 1 addition & 1 deletion python/math_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def correct_min(l):
This is needed because python's min returns the wrong result
for intervals, for example:
sage: from sage.all import RIF
sage: from snappy.sage_helper import RIF
sage: min(RIF(4,5), RIF(3,6)).endpoints()
(4.00000000000000, 5.00000000000000)
Expand Down
2 changes: 1 addition & 1 deletion python/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def mat_solve(m, v, epsilon=0):
Setup a complex interval for example::
sage: from sage.all import RealIntervalField, ComplexIntervalField
sage: from snappy.sage_helper import RealIntervalField, ComplexIntervalField
sage: RIF = RealIntervalField(80)
sage: CIF = ComplexIntervalField(80)
sage: fuzzy_four = CIF(RIF(3.9999,4.0001),RIF(-0.0001,0.0001))
Expand Down
2 changes: 1 addition & 1 deletion python/tiling/floor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def floor_as_integers(x) -> Sequence[int]:
Computes floor of a number or interval, returning a list of integers
if evaluating floor is ambiguous.
sage: from sage.all import RIF
sage: from snappy.sage_helper import RIF
sage: floor_as_integers(RIF(1.8, 1.9))
[1]
sage: floor_as_integers(RIF(1.9, 2.1))
Expand Down
2 changes: 1 addition & 1 deletion python/tiling/real_hash_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RealHashDict:
>>> d.get(to_number(10.0000001))
['A', 'B']
sage: from sage.all import RIF
sage: from snappy.sage_helper import RIF
sage: def equality_predicate(x, y):
... d = abs(x - y)
... if d < RIF(0.1):
Expand Down
4 changes: 2 additions & 2 deletions python/verify/interval_newton_shapes_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def certified_newton_iteration(equations, shape_intervals,
Intervals containing the true solution::
sage: from sage.all import vector
sage: from snappy.sage_helper import vector
sage: good_shapes = vector([
... C.CIF(C.RIF(0.78055, 0.78056), C.RIF(0.91447, 0.91448)),
... C.CIF(C.RIF(0.78055, 0.78056), C.RIF(0.91447, 0.91448)),
Expand All @@ -368,7 +368,7 @@ def certified_newton_iteration(equations, shape_intervals,
Intervals not containing a true solution::
sage: from sage.all import vector
sage: from snappy.sage_helper import vector
sage: bad_shapes = vector([
... C.CIF(C.RIF(0.78054, 0.78055), C.RIF(0.91447, 0.91448)),
... C.CIF(C.RIF(0.78055, 0.78056), C.RIF(0.91447, 0.91448)),
Expand Down
2 changes: 1 addition & 1 deletion python/verify/interval_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class IntervalTree():
Create an interval tree and add pairs to it::
sage: from sage.all import RIF
sage: from snappy.sage_helper import RIF
sage: t = IntervalTree()
sage: t.insert(RIF(1.01,1.02),'1')
sage: t.insert(RIF(3.01,3.02),'3')
Expand Down
2 changes: 1 addition & 1 deletion python/verify/krawczyk_shapes_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def krawczyk_interval(self, shape_intervals):
Do several Krawczyk operations to get a better solution::
sage: from sage.all import vector
sage: from snappy.sage_helper import vector
sage: M = Manifold("m019")
sage: shapes = vector(ComplexIntervalField(53), [ 0.5+0.8j, 0.5+0.8j, 0.5+0.8j])
sage: for i in range(15):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def canonical_translates(self, finitePoint):
"""
TESTS::
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: t0 = CIF(RIF(2.3, 2.30000000001), 3.4)
sage: t1 = CIF(4.32, RIF(5.43, 5.4300000001))
sage: c = CuspTranslateEngine(t0, t1)
Expand Down Expand Up @@ -106,7 +106,7 @@ def _translate_to_match(self, z, targetZ):
def translate_to_match(self, finitePoint, targetFinitePoint):
"""
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: t0 = CIF(RIF(2.3, 2.30000000001), 3.4)
sage: t1 = CIF(4.32, RIF(5.43, 5.4300000001))
sage: c = CuspTranslateEngine(t0, t1)
Expand Down
2 changes: 1 addition & 1 deletion python/verify/short_slopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def short_slopes_from_cusp_shape_and_area(
cusp_shape is longitude over meridian (conjugate).
l/m
sage: from sage.all import RIF, CIF
sage: from snappy.sage_helper import RIF, CIF
sage: short_slopes_from_cusp_shape_and_area(CIF(RIF(1.0),RIF(1.3333,1.3334)), RIF(12.0))
[(1, 0), (-2, 1), (-1, 1), (0, 1)]
Expand Down
2 changes: 1 addition & 1 deletion python/verify/upper_halfspace/extended_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExtendedMatrix():
Multiply two extended matrix::
sage: from sage.all import matrix, CIF
sage: from snappy.sage_helper import matrix, CIF
sage: m = ExtendedMatrix(matrix([[CIF(2), CIF(0,2)],[CIF(1,2), CIF(3,4)]]))
sage: m2 = ExtendedMatrix(matrix.identity(CIF, 2), isOrientationReversing = True)
sage: m * m2
Expand Down
12 changes: 6 additions & 6 deletions python/verify/upper_halfspace/finite_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class FinitePoint():
A point in the upper half space model represented by the quaternion
z + t * j with t > 0. For example, the point (1 + 2 * i) + 3 * j is::
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: FinitePoint(CIF(1,2),RIF(3))
FinitePoint(1 + 2*I, 3)
Expand All @@ -32,7 +32,7 @@ def key_interval(self):
Returns an element in ``RealIntervalField`` which can be used as key
for an interval tree to implement a mapping from :class:`FinitePoint`::
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: FinitePoint(CIF(1,2),RIF(3)).key_interval() # doctest: +NUMERIC12
36.8919985104477?
Expand All @@ -52,7 +52,7 @@ def translate_PSL(self, m):
with coefficients in SageMath's ``ComplexIntervalField`` and have
determinant 1::
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: pt = FinitePoint(CIF(1,2),RIF(3))
sage: m = matrix([[CIF(0.5), CIF(2.4, 2)],[CIF(0.0), CIF(2.0)]])
sage: pt.translate_PSL(m) # doctest: +NUMERIC12
Expand All @@ -72,7 +72,7 @@ def translate_PGL(self, m):
The matrix m should be an :class:`ExtendedMatrix` or a SageMath
``Matrix`` with coefficients in SageMath's ``ComplexIntervalField``::
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: pt = FinitePoint(CIF(1,2),RIF(3))
sage: m = matrix([[CIF(0.25), CIF(1.2, 1)],[CIF(0.0), CIF(1.0)]])
sage: pt.translate_PGL(m) # doctest: +NUMERIC12
Expand Down Expand Up @@ -132,7 +132,7 @@ def cosh_dist(self, other):
Returns cosh of the distance of this finite point to another
finite point::
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: a = FinitePoint(CIF(1,2),RIF(3))
sage: b = FinitePoint(CIF(4,5),RIF(6))
sage: a.cosh_dist(b) # doctest: +NUMERIC12
Expand Down Expand Up @@ -177,7 +177,7 @@ def dist(self, other):
"""
Returns the distance of this finite point to another finite point::
sage: from sage.all import *
sage: from snappy.sage_helper import *
sage: a = FinitePoint(CIF(1,2),RIF(3))
sage: b = FinitePoint(CIF(4,5),RIF(6))
sage: a.dist(b) # doctest: +NUMERIC12
Expand Down
12 changes: 6 additions & 6 deletions python/verify/upper_halfspace/ideal_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def apply_Moebius(m, z):
"""
Applies the matrix m to the ideal point z::
sage: from sage.all import matrix, CIF, RIF
sage: from snappy.sage_helper import matrix, CIF, RIF
sage: m = matrix([[CIF(2,1), CIF(4,2)], [CIF(2,3), CIF(4,2)]])
sage: apply_Moebius(m, CIF(3,4)) # doctest: +NUMERIC12
0.643835616438356? - 0.383561643835617?*I
Expand All @@ -68,7 +68,7 @@ def cross_ratio(z0, z1, z2, z3):
Computes the cross ratio (according to SnapPea conventions) of
four ideal points::
sage: from sage.all import CIF
sage: from snappy.sage_helper import CIF
sage: cross_ratio(Infinity, CIF(0), CIF(1), CIF(1.2, 1.3)) # doctest: +NUMERIC12
1.2000000000000000? + 1.300000000000000?*I
Expand All @@ -88,7 +88,7 @@ def compute_midpoint_of_triangle_edge_with_offset(idealPoints, offset):
with the side a b the midpoint. This function returns this point moved
towards a by hyperbolic distance log(offset)::
sage: from sage.all import CIF, RIF
sage: from snappy.sage_helper import CIF, RIF
sage: compute_midpoint_of_triangle_edge_with_offset( # doctest: +NUMERIC12
... [ CIF(0), Infinity, CIF(1) ], RIF(5.0))
FinitePoint(0, 0.2000000000000000?)
Expand Down Expand Up @@ -138,7 +138,7 @@ def compute_incenter_of_triangle(idealPoints):
"""
Computes incenter of the triangle spanned by three ideal points::
sage: from sage.all import CIF
sage: from snappy.sage_helper import CIF
sage: z0 = Infinity
sage: z1 = CIF(0)
sage: z2 = CIF(1)
Expand All @@ -164,7 +164,7 @@ def compute_inradius_and_incenter(idealPoints):
Computes inradius and incenter of the tetrahedron spanned by four
ideal points::
sage: from sage.all import CIF
sage: from snappy.sage_helper import CIF
sage: z0 = Infinity
sage: z1 = CIF(0)
sage: z2 = CIF(1)
Expand Down Expand Up @@ -193,7 +193,7 @@ def Euclidean_height_of_hyperbolic_triangle(idealPoints):
containing the triangle or the Euclidean radius of one of its hyperbolic
sides (if the projection onto the boundary is an obtuse triangle)::
sage: from sage.all import CIF
sage: from snappy.sage_helper import CIF
sage: z0 = CIF(0)
sage: z1 = CIF(1)
sage: Euclidean_height_of_hyperbolic_triangle([z0, z1, Infinity])
Expand Down

0 comments on commit 74d833c

Please sign in to comment.