本文整理汇总了Python中sage.modular.cusps.Cusp.denominator方法的典型用法代码示例。如果您正苦于以下问题:Python Cusp.denominator方法的具体用法?Python Cusp.denominator怎么用?Python Cusp.denominator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.modular.cusps.Cusp
的用法示例。
在下文中一共展示了Cusp.denominator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: are_equivalent
# 需要导入模块: from sage.modular.cusps import Cusp [as 别名]
# 或者: from sage.modular.cusps.Cusp import denominator [as 别名]
def are_equivalent(self, x, y, trans = False):
r"""
Test whether or not cusps x and y are equivalent modulo self. If self
has a reduce_cusp() method, use that; otherwise do a slow explicit
test.
If trans = False, returns True or False. If trans = True, then return
either False or an element of self mapping x onto y.
EXAMPLE::
sage: Gamma0(7).are_equivalent(Cusp(1/3), Cusp(0), trans=True)
[ 3 -1]
[-14 5]
sage: Gamma0(7).are_equivalent(Cusp(1/3), Cusp(1/7))
False
"""
x = Cusp(x)
y = Cusp(y)
if not trans:
try:
xr = self.reduce_cusp(x)
yr = self.reduce_cusp(y)
if xr != yr:
return False
if xr == yr:
return True
except NotImplementedError:
pass
from all import SL2Z
vx = lift_to_sl2z(x.numerator(),x.denominator(), 0)
dx = SL2Z([vx[2], -vx[0], vx[3], -vx[1]])
vy = lift_to_sl2z(y.numerator(),y.denominator(), 0)
dy = SL2Z([vy[2], -vy[0], vy[3], -vy[1]])
for i in xrange(self.index()):
# Note that the width of any cusp is bounded above by the index of self.
# If self is congruence, then the level of self is a much better bound, but
# this method is written to work with non-congruence subgroups as well,
if dy * SL2Z([1,i,0,1])*(~dx) in self:
if trans:
return dy * SL2Z([1,i,0,1]) * ~dx
else:
return True
elif (self.is_odd() and dy * SL2Z([-1,-i,0,-1]) * ~dx in self):
if trans:
return dy * SL2Z([-1,-i,0,-1]) * ~dx
else:
return True
return False
示例2: reduce_cusp
# 需要导入模块: from sage.modular.cusps import Cusp [as 别名]
# 或者: from sage.modular.cusps.Cusp import denominator [as 别名]
def reduce_cusp(self, c):
r"""
Calculate the unique reduced representative of the equivalence of the
cusp `c` modulo this group. The reduced representative of an
equivalence class is the unique cusp in the class of the form `u/v`
with `u, v \ge 0` coprime, `v` minimal, and `u` minimal for that `v`.
EXAMPLES::
sage: Gamma(5).reduce_cusp(1/5)
Infinity
sage: Gamma(5).reduce_cusp(7/8)
3/2
sage: Gamma(6).reduce_cusp(4/3)
2/3
TESTS::
sage: G = Gamma(50); all([c == G.reduce_cusp(c) for c in G.cusps()])
True
"""
N = self.level()
c = Cusp(c)
u,v = c.numerator() % N, c.denominator() % N
if (v > N//2) or (2*v == N and u > N//2):
u,v = -u,-v
u,v = _lift_pair(u,v,N)
return Cusp(u,v)
示例3: cusp_data
# 需要导入模块: from sage.modular.cusps import Cusp [as 别名]
# 或者: from sage.modular.cusps.Cusp import denominator [as 别名]
def cusp_data(self, c):
r"""
Return a triple (g, w, t) where g is an element of self generating the
stabiliser of the given cusp, w is the width of the cusp, and t is 1 if
the cusp is regular and -1 if not.
EXAMPLES::
sage: Gamma1(4).cusp_data(Cusps(1/2))
(
[ 1 -1]
[ 4 -3], 1, -1
)
"""
c = Cusp(c)
# first find an element of SL2Z sending infinity to the given cusp
w = lift_to_sl2z(c.denominator(), c.numerator(), 0)
g = SL2Z([w[3], w[1], w[2],w[0]])
for d in xrange(1,1+self.index()):
if g * SL2Z([1,d,0,1]) * (~g) in self:
return (g * SL2Z([1,d,0,1]) * (~g), d, 1)
elif g * SL2Z([-1,-d,0,-1]) * (~g) in self:
return (g * SL2Z([-1,-d,0,-1]) * (~g), d, -1)
raise ArithmeticError("Can't get here!")
示例4: _reduce_cusp
# 需要导入模块: from sage.modular.cusps import Cusp [as 别名]
# 或者: from sage.modular.cusps.Cusp import denominator [as 别名]
def _reduce_cusp(self, c):
r"""
Compute a minimal representative for the given cusp c.
Returns a pair (c', t), where c' is the minimal representative
for the given cusp, and t is either 1 or -1, as explained
below. Largely for internal use.
The minimal representative for a cusp is the element in `P^1(Q)`
in lowest terms with minimal positive denominator, and minimal
positive numerator for that denominator.
Two cusps `u1/v1` and `u2/v2` are equivalent modulo `\Gamma_H(N)`
if and only if
- `v1 = h*v2 (mod N)` and `u1 = h^(-1)*u2 (mod gcd(v1,N))`
or
- `v1 = -h*v2 (mod N)` and `u1 = -h^(-1)*u2 (mod gcd(v1,N))`
for some `h \in H`. Then t is 1 or -1 as c and c' fall into
the first or second case, respectively.
EXAMPLES::
sage: GammaH(6,[5])._reduce_cusp(Cusp(5,3))
(1/3, -1)
sage: GammaH(12,[5])._reduce_cusp(Cusp(8,9))
(1/3, -1)
sage: GammaH(12,[5])._reduce_cusp(Cusp(5,12))
(Infinity, 1)
sage: GammaH(12,[])._reduce_cusp(Cusp(5,12))
(5/12, 1)
sage: GammaH(21,[5])._reduce_cusp(Cusp(-9/14))
(1/7, 1)
"""
c = Cusp(c)
N = int(self.level())
Cusps = c.parent()
v = int(c.denominator() % N)
H = self._list_of_elements_in_H()
# First, if N | v, take care of this case. If u is in \pm H,
# then we return Infinity. If not, let u_0 be the minimum
# of \{ h*u | h \in \pm H \}. Then return u_0/N.
if not v:
u = c.numerator() % N
if u in H:
return Cusps((1,0)), 1
if (N-u) in H:
return Cusps((1,0)), -1
ls = [ (u*h)%N for h in H ]
m1 = min(ls)
m2 = N-max(ls)
if m1 < m2:
return Cusps((m1,N)), 1
else:
return Cusps((m2,N)), -1
u = int(c.numerator() % v)
gcd = get_gcd(N)
d = gcd(v,N)
# If (N,v) == 1, let v_0 be the minimal element
# in \{ v * h | h \in \pm H \}. Then we either return
# Infinity or 1/v_0, as v is or is not in \pm H,
# respectively.
if d == 1:
if v in H:
return Cusps((0,1)), 1
if (N-v) in H:
return Cusps((0,1)), -1
ls = [ (v*h)%N for h in H ]
m1 = min(ls)
m2 = N-max(ls)
if m1 < m2:
return Cusps((1,m1)), 1
else:
return Cusps((1,m2)), -1
val_min = v
inv_mod = get_inverse_mod(N)
# Now we're in the case (N,v) > 1. So we have to do several
# steps: first, compute v_0 as above. While computing this
# minimum, keep track of *all* pairs of (h,s) which give this
# value of v_0.
hs_ls = [(1,1)]
for h in H:
tmp = (v*h)%N
if tmp < val_min:
val_min = tmp
hs_ls = [(inv_mod(h,N), 1)]
elif tmp == val_min:
hs_ls.append((inv_mod(h,N), 1))
if (N-tmp) < val_min:
val_min = N - tmp
#.........这里部分代码省略.........