Пример #1
0
def check_certified_intervals():
    for n in [
            'm009', 'm015', 't02333', 't02333(1,2)', 'm129(2,3)',
            'm129(2,3)(3,4)'
    ]:
        M = Manifold(n)
        high_prec = M.tetrahedra_shapes('rect', bits_prec=1000)

        intervals = M.tetrahedra_shapes('rect', bits_prec=100, intervals=True)

        for z, interval in zip(high_prec, intervals):
            if not abs(interval.center() - z) < 1e-10:
                raise Exception

            if not z in interval:
                raise Exception
def draw_ladders_and_geometric_boundary_for_veering_isosig(sig, args={}):
    if args == {}:
        args = {
            'draw_boundary_triangulation': True,
            'draw_triangles_near_poles': False,
            'ct_depth': -1,
            'ct_epsilon': 0.03,
            'global_drawing_scale': 4,
            'delta': 0.2,
            'ladder_width': 10.0,
            'ladder_height': 20.0,
            'draw_labels': True
        }

    out_dir_ladders = 'Images/Ladders'
    out_dir_geometric = 'Images/Geometric'

    output_filename = sig + '.pdf'
    tri, angle = isosig_to_tri_angle(sig)

    M = Manifold(tri)
    tet_shapes = M.tetrahedra_shapes()
    tet_shapes = [complex(shape["rect"]) for shape in tet_shapes]
    args['tet_shapes'] = tet_shapes

    B = generate_boundary_triangulation(tri,
                                        angle,
                                        args=args,
                                        output_filename=output_filename)
    args_ladder = args.copy()
    args_ladder['style'] = 'ladders'
    output_filename_ladders = out_dir_ladders + '/' + output_filename
    B.draw(output_filename_ladders, args=args_ladder)

    args_geometric = args.copy()
    args_geometric['style'] = 'geometric'
    output_filename_geometric = out_dir_geometric + '/' + output_filename
    B.draw(output_filename_geometric, args=args_geometric)
Пример #3
0
"""
Run this in Sage and SnapPy and see that the last line of the result differs dramatically.

If we multiply two numbers with different precisions, we expect the result to be
of the lower precision. This is consistent between Sage and SnapPy.
However, if we cast the low precision to a type of higher precision and then multiply, we
expect the result to be of the type of the higher precision.
This works in Sage, but it doesn't work for SnapPy Numbers.

This affects the code computing cusp translations, look for "_SnapPyNumberHack".
"""

from snappy import Manifold
M = Manifold("m004")

# Let's take a real 53bit precision number
v = M.cusp_neighborhood().volume(0)
# And a complex 1000bit precision number
z = M.tetrahedra_shapes('rect', bits_prec = 1000)[0]
# High precision real field
RF = z.real().parent()

print("Expect low precision number: ", v)
print("Expect high precision number:", z)
print("Product, expect low precision number:", v * z)
print("Casting to high precision:", RF(v))
print("Product again, this time it should be high precision (!!!):", RF(v) * z)