本文整理汇总了Python中sage.modular.cusps.Cusp类的典型用法代码示例。如果您正苦于以下问题:Python Cusp类的具体用法?Python Cusp怎么用?Python Cusp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cusp类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: reduce_cusp
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)
开发者ID:bgxcpku,项目名称:sagelib,代码行数:28,代码来源:congroup_gamma.py
示例2: cusp_data
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!")
开发者ID:Babyll,项目名称:sage,代码行数:26,代码来源:arithgroup_generic.py
示例3: _find_cusps
def _find_cusps(self):
r"""
Calculate a list of inequivalent cusps.
EXAMPLES::
sage: sage.modular.arithgroup.congroup_generic.CongruenceSubgroup(5)._find_cusps()
Traceback (most recent call last):
...
NotImplementedError
NOTE: There is a generic algorithm implemented at the top level that
uses the coset representatives of self. This is *very slow* and for all
the standard congruence subgroups there is a quicker way of doing it,
so this should usually be overridden in subclasses; but it doesn't have
to be.
"""
i = Cusp([1,0])
L = [i]
for a in self.coset_reps():
ai = i.apply([a.a(), a.b(), a.c(), a.d()])
new = 1
for v in L:
if self.are_equivalent(ai, v):
new = 0
break
if new == 1:
L.append(ai)
return L
开发者ID:Babyll,项目名称:sage,代码行数:29,代码来源:arithgroup_generic.py
示例4: are_equivalent
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
开发者ID:jwbober,项目名称:sagelib,代码行数:52,代码来源:arithgroup_generic.py
示例5: _compute_lattice
def _compute_lattice(self, rational_only=False, rational_subgroup=False):
r"""
Return a list of vectors that define elements of the rational
homology that generate this finite subgroup.
INPUT:
- ``rational_only`` - bool (default: False); if
``True``, only use rational cusps.
OUTPUT:
- ``list`` - list of vectors
EXAMPLES::
sage: J = J0(37)
sage: C = sage.modular.abvar.cuspidal_subgroup.CuspidalSubgroup(J)
sage: C._compute_lattice()
Free module of degree 4 and rank 4 over Integer Ring
Echelon basis matrix:
[ 1 0 0 0]
[ 0 1 0 0]
[ 0 0 1 0]
[ 0 0 0 1/3]
sage: J = J0(43)
sage: C = sage.modular.abvar.cuspidal_subgroup.CuspidalSubgroup(J)
sage: C._compute_lattice()
Free module of degree 6 and rank 6 over Integer Ring
Echelon basis matrix:
[ 1 0 0 0 0 0]
[ 0 1/7 0 6/7 0 5/7]
[ 0 0 1 0 0 0]
[ 0 0 0 1 0 0]
[ 0 0 0 0 1 0]
[ 0 0 0 0 0 1]
sage: J = J0(22)
sage: C = sage.modular.abvar.cuspidal_subgroup.CuspidalSubgroup(J)
sage: C._compute_lattice()
Free module of degree 4 and rank 4 over Integer Ring
Echelon basis matrix:
[1/5 1/5 4/5 0]
[ 0 1 0 0]
[ 0 0 1 0]
[ 0 0 0 1/5]
sage: J = J1(13)
sage: C = sage.modular.abvar.cuspidal_subgroup.CuspidalSubgroup(J)
sage: C._compute_lattice()
Free module of degree 4 and rank 4 over Integer Ring
Echelon basis matrix:
[ 1/19 0 0 9/19]
[ 0 1/19 1/19 18/19]
[ 0 0 1 0]
[ 0 0 0 1]
We compute with and without the optional
``rational_only`` option.
::
sage: J = J0(27); G = sage.modular.abvar.cuspidal_subgroup.CuspidalSubgroup(J)
sage: G._compute_lattice()
Free module of degree 2 and rank 2 over Integer Ring
Echelon basis matrix:
[1/3 0]
[ 0 1/3]
sage: G._compute_lattice(rational_only=True)
Free module of degree 2 and rank 2 over Integer Ring
Echelon basis matrix:
[1/3 0]
[ 0 1]
"""
A = self.abelian_variety()
Cusp = A.modular_symbols()
Amb = Cusp.ambient_module()
Eis = Amb.eisenstein_submodule()
C = Amb.cusps()
N = Amb.level()
if rational_subgroup:
# QQ-rational subgroup of cuspidal subgroup
assert A.is_ambient()
Q = Cusp.abvarquo_rational_cuspidal_subgroup()
return Q.V()
if rational_only:
# subgroup generated by differences of rational cusps
if not is_Gamma0(A.group()):
raise NotImplementedError, 'computation of rational cusps only implemented in Gamma0 case.'
if not N.is_squarefree():
data = [n for n in range(2,N) if gcd(n,N) == 1]
C = [c for c in C if is_rational_cusp_gamma0(c, N, data)]
v = [Amb([infinity, alpha]).element() for alpha in C]
cusp_matrix = matrix(QQ, len(v), Amb.dimension(), v)
#.........这里部分代码省略.........
开发者ID:bgxcpku,项目名称:sagelib,代码行数:101,代码来源:cuspidal_subgroup.py
示例6: _reduce_cusp
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
#.........这里部分代码省略.........
开发者ID:robertwb,项目名称:sage,代码行数:101,代码来源:congroup_gammaH.py
注:本文中的sage.modular.cusps.Cusp类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论