本文整理汇总了Python中sage.rings.power_series_ring.PowerSeriesRing.gens方法的典型用法代码示例。如果您正苦于以下问题:Python PowerSeriesRing.gens方法的具体用法?Python PowerSeriesRing.gens怎么用?Python PowerSeriesRing.gens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.power_series_ring.PowerSeriesRing
的用法示例。
在下文中一共展示了PowerSeriesRing.gens方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tensprod_11a_17a
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gens [as 别名]
def test_tensprod_11a_17a():
C11=[1,-2,-1,2,1,2,-2,0,-2,-2,1,-2,4,4,-1,-4,-2,4,0,2,2,-2,\
-1,0,-4,-8,5,-4,0,2,7,8,-1,4,-2,-4,3,0,-4,0,-8,-4,-6,2,-2,\
2,8,4,-3,8,2,8,-6,-10,1,0,0,0,5,-2,12,-14,4,-8,4,2,-7,-4,\
1,4,-3,0,4,-6,4,0,-2,8,-10,-4,1,16,-6,4,-2,12,0,0,15,4,-8,\
-2,-7,-16,0,-8,-7,6,-2,-8,2,-4,-16,0,2,12,18,10,10,-2,-3,8,\
9,0,-1,0,-8,-10,4,0,1,-24,8,14,-9,-8,8,0,6,-8,-18,-2,0,14,\
5,0,-7,-2,10,-4,-8,6,4,8,0,-8,3,6,-10,-8,2,0,4,4,7,-8,-7,\
20,6,8,2,-2,4,-16,-1,12,-12,0,3,4,0,-12,-6,0,8,-4,-5,-30,\
-15,-4,7,16,-12,0,3,14,-2,16,-10,0,17,8,4,14,-4,-6,-2,4,0,0]
C17=[1,-1,0,-1,-2,0,4,3,-3,2,0,0,-2,-4,0,-1,1,3,-4,2,0,0,4,\
0,-1,2,0,-4,6,0,4,-5,0,-1,-8,3,-2,4,0,-6,-6,0,4,0,6,-4,0,\
0,9,1,0,2,6,0,0,12,0,-6,-12,0,-10,-4,-12,7,4,0,4,-1,0,8,\
-4,-9,-6,2,0,4,0,0,12,2,9,6,-4,0,-2,-4,0,0,10,-6,-8,-4,0,\
0,8,0,2,-9,0,1,-10,0,8,-6,0,-6,8,0,6,0,0,-4,-14,0,-8,-6,\
6,12,4,0,-11,10,0,-4,12,12,8,3,0,-4,16,0,-16,-4,0,3,-6,0,\
-8,8,0,4,0,3,-12,6,0,2,-10,0,-16,-12,-3,0,-8,0,-2,-12,0,10,\
16,-9,24,6,0,4,-4,0,-9,2,12,-4,22,0,-4,0,0,-10,12,-6,-2,8,\
0,12,4,0,0,0,0,-8,-16,0,2,-2,0,-9,-18,0,-20,-3]
ANS=[1,2,0,2,-2,0,-8,8,15,-4,0,0,-8,-16,0,12,-2,30,0,-4,0,0,\
-4,0,29,-16,0,-16,0,0,28,-8,0,-4,16,30,-6,0,0,-16,48,0,-24,\
0,-30,-8,0,0,22,58,0,-16,-36,0,0,-64,0,0,-60,0,-120,56,-120,\
-8,16,0,-28,-4,0,32,12,120,-24,-12,0,0,0,0,-120,-24,144,96,\
24,0,4,-48,0,0,150,-60,64,-8,0,0,0,0,-14,44,0,58,-20,0,-128,\
-64,0,-72,144,0,60,0,0,-96,-126,0,8,0,-120,-120,16,0,-11,-240,\
0,56,-158,-240,64,-32,0,32,-288,0,0,-56,0,-16,42,0,-80,32,0,\
24,0,180,0,-48,0,-12,100,0,-32,0,-30,0,-56,0,14,-240,0,16,32,\
288,96,96,0,48,48,0,142,8,0,-48,-132,0,-232,0,0,300,-180,-60,\
-14,128,0,-32,12,0,0,0,0,0,-272,0,8,-28,0,44,36,0,0,232]
R = PowerSeriesRing(ZZ, "T")
T = R.gens()[0]
B11=[11,1-T,1+11*T**2]
B17=[17,1+2*T+17*T**2,1-T]
assert ANS==tensor_get_an_no_deg1(C11,C17,2,2,[B11,B17])
示例2: test_tensprod_121_chi
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gens [as 别名]
def test_tensprod_121_chi():
C121=[1,2,-1,2,1,-2,2,0,-2,2,0,-2,-4,4,-1,-4,2,-4,0,2,-2,0,\
-1,0,-4,-8,5,4,0,-2,7,-8,0,4,2,-4,3,0,4,0,8,-4,6,0,-2,-2,\
8,4,-3,-8,-2,-8,-6,10,0,0,0,0,5,-2,-12,14,-4,-8,-4,0,-7,4,\
1,4,-3,0,-4,6,4,0,0,8,10,-4,1,16,6,-4,2,12,0,0,15,-4,-8,\
-2,-7,16,0,8,-7,-6,0,-8,-2,-4,-16,0,-2,-12,-18,10,-10,0,-3,\
-8,9,0,-1,0,8,10,4,0,0,-24,-8,14,-9,-8,-8,0,-6,-8,18,0,0,\
-14,5,0,-7,2,-10,4,-8,-6,0,8,0,-8,3,6,10,8,-2,0,-4,0,7,8,\
-7,20,6,-8,-2,2,4,16,0,12,12,0,3,4,0,12,6,0,-8,0,-5,30,\
-15,-4,7,-16,12,0,3,-14,0,16,10,0,17,8,-4,-14,4,-6,2,0,0,0]
chi=[1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,\
1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,\
-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,\
1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,\
1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,\
1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,\
-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,\
-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,\
-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1]
ANS=[1,-2,-1,2,1,2,-2,0,-2,-2,1,-2,4,4,-1,-4,-2,4,0,2,2,-2,\
-1,0,-4,-8,5,-4,0,2,7,8,-1,4,-2,-4,3,0,-4,0,-8,-4,-6,2,-2,\
2,8,4,-3,8,2,8,-6,-10,1,0,0,0,5,-2,12,-14,4,-8,4,2,-7,-4,\
1,4,-3,0,4,-6,4,0,-2,8,-10,-4,1,16,-6,4,-2,12,0,0,15,4,-8,\
-2,-7,-16,0,-8,-7,6,-2,-8,2,-4,-16,0,2,12,18,10,10,-2,-3,8,\
9,0,-1,0,-8,-10,4,0,1,-24,8,14,-9,-8,8,0,6,-8,-18,-2,0,14,\
5,0,-7,-2,10,-4,-8,6,4,8,0,-8,3,6,-10,-8,2,0,4,4,7,-8,-7,\
20,6,8,2,-2,4,-16,-1,12,-12,0,3,4,0,-12,-6,0,8,-4,-5,-30,\
-15,-4,7,16,-12,0,3,14,-2,16,-10,0,17,8,4,14,-4,-6,-2,4,0,0]
R = PowerSeriesRing(ZZ, "T")
T = R.gens()[0]
assert ANS==tensor_get_an_deg1(C121,chi,[[11,1-T]])
assert ANS==tensor_get_an(C121,chi,2,1,[[11,1-T,1-T]])
assert get_euler_factor(ANS,2)==(1+2*T+2*T**2+O(T**8))
assert get_euler_factor(ANS,3)==(1+T+3*T**2+O(T**5))
assert get_euler_factor(ANS,5)==(1-T+5*T**2+O(T**4))
示例3: series
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gens [as 别名]
def series(self, n, prec):
r"""
Returns the `n`-th approximation to the `p`-adic `L`-series
associated to self, as a power series in `T` (corresponding to
`\gamma-1` with `\gamma= 1 + p` as a generator of `1+p\ZZ_p`).
EXAMPLES::
sage: from sage.modular.pollack_stevens.space import ps_modsym_from_elliptic_curve
sage: E = EllipticCurve('57a')
sage: p = 5
sage: prec = 4
sage: phi = ps_modsym_from_elliptic_curve(E)
sage: phi_stabilized = phi.p_stabilize(p,M = prec+3)
sage: Phi = phi_stabilized.lift(p,prec,None,algorithm='stevens',eigensymbol=True)
sage: L = pAdicLseries(Phi)
sage: L.series(3,4)
O(5^3) + (3*5 + 5^2 + O(5^3))*T + (5 + O(5^2))*T^2
sage: L1 = E.padic_lseries(5)
sage: L1.series(4)
O(5^6) + (3*5 + 5^2 + O(5^3))*T + (5 + 4*5^2 + O(5^3))*T^2 + (4*5^2 + O(5^3))*T^3 + (2*5 + 4*5^2 + O(5^3))*T^4 + O(T^5)
"""
p = self.prime()
M = self.symb().precision_absolute()
K = pAdicField(p, M)
R = PowerSeriesRing(K, names = 'T')
T = R.gens()[0]
R.set_default_prec(prec)
return sum(self[i] * T**i for i in range(n))
示例4: series
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gens [as 别名]
def series(self, prec=5):
r"""
Return the ``prec``-th approximation to the `p`-adic `L`-series
associated to self, as a power series in `T` (corresponding to
`\gamma-1` with `\gamma` the chosen generator of `1+p\ZZ_p`).
INPUT:
- ``prec`` -- (default 5) is the precision of the power series
EXAMPLES::
sage: E = EllipticCurve('14a2')
sage: p = 3
sage: prec = 6
sage: L = E.padic_lseries(p,implementation="pollackstevens",precision=prec) # long time
sage: L.series(4) # long time
2*3 + 3^4 + 3^5 + O(3^6) + (2*3 + 3^2 + O(3^4))*T + (2*3 + O(3^2))*T^2 + (3 + O(3^2))*T^3 + O(T^4)
sage: E = EllipticCurve("15a3")
sage: L = E.padic_lseries(5,implementation="pollackstevens",precision=15) # long time
sage: L.series(3) # long time
O(5^15) + (2 + 4*5^2 + 3*5^3 + 5^5 + 2*5^6 + 3*5^7 + 3*5^8 + 2*5^9 + 2*5^10 + 3*5^11 + 5^12 + O(5^13))*T + (4*5 + 4*5^3 + 3*5^4 + 4*5^5 + 3*5^6 + 2*5^7 + 5^8 + 4*5^9 + 3*5^10 + O(5^11))*T^2 + O(T^3)
sage: E = EllipticCurve("79a1")
sage: L = E.padic_lseries(2,implementation="pollackstevens",precision=10) # not tested
sage: L.series(4) # not tested
O(2^9) + (2^3 + O(2^4))*T + O(2^0)*T^2 + (O(2^-3))*T^3 + O(T^4)
"""
p = self.prime()
M = self.symbol().precision_relative()
K = pAdicField(p, M)
R = PowerSeriesRing(K, names="T")
T = R.gens()[0]
return R([self[i] for i in range(prec)]).add_bigoh(prec)
示例5: list_to_euler_factor
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gens [as 别名]
def list_to_euler_factor(L,prec):
"""
takes a list [a_p, a_p^2,...
and returns the euler factor
"""
if isinstance(L[0], int):
K = QQ
else:
K = L[0].parent()
R = PowerSeriesRing(K, "T")
T = R.gens()[0]
f = 1/ R([1]+L)
f = f.add_bigoh(prec+1)
return f
示例6: padic_Lfunction_two_variable
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gens [as 别名]
class padic_Lfunction_two_variable(padic_Lfunction):
def __init__(self, Phis, var='T', prec=None):
#TODO: prec: Default it to None would make us compute it.
self._Phis = Phis #should we create a copy of Phis, in case Phis changes? probably
self._coefficient_ring = Phis.base_ring()
self._base_ring = PowerSeriesRing(self._coefficient_ring, var) #What precision?
self._prec = prec
def base_ring(self):
return self._base_ring
def coefficient_ring(self):
return self._coefficient_ring
def variables(self):
#returns (T, w)
return (self._base_ring.gens()[0], self._coefficient_ring.gens()[0])
def _max_coeff(self):
Phis = self._Phis
p = Phis.parent().prime()
p_prec, var_prec = Phis.precision_absolute()
max_j = Phis.parent().coefficient_module().length_of_moments(p_prec)
n = 0
while True:
if max_j - (n / (p-1)).floor() - min(max_j, n) - (max_j / p).floor() <= 0:
return n - 1
n += 1
def _on_Da(self, a, twist):
r"""
An internal method used by ``self._basic_integral``. The parameter ``twist`` is assumed to be either ``None`` or a primitive quaratic Dirichlet character.
"""
p = self._Phis.parent().prime()
if twist is None:
return self._Phis(M2Z([1,a,0,p]))
D = twist.level()
DD = self._Phis.parent().coefficient_module()
S0 = DD.action().actor()
ans = DD.zero()
for b in range(1, D + 1):
if D.gcd(b) == 1:
ans += twist(b) * (self._Phis(M2Z([1, D * a + b * p, 0, D * p])) * S0([1, b / D, 0, 1]))
return ans
@cached_method
def _basic_integral(self, a, j, twist=None):
r"""
Computes the integral
.. MATH::
\int_{a+p\ZZ_p}(z-\omega(a))^jd\mu_\chi.
If ``twist`` is ``None``, `\\chi` is the trivial character. Otherwise, ``twist`` can be a primitive quadratic character of conductor prime to `p`.
"""
#is this the negative of what we want?
#if Phis is fixed for this p-adic L-function, we should make this method cached
p = self._Phis.parent().prime()
if twist is None:
pass
elif twist in ZZ:
twist = kronecker_character(twist)
if twist.is_trivial():
twist = None
else:
D = twist.level()
assert(D.gcd(p) == 1)
else:
if twist.is_trivial():
twist = None
else:
assert((twist**2).is_trivial())
twist = twist.primitive_character()
D = twist.level()
assert(D.gcd(p) == 1)
onDa = self._on_Da(a, twist)#self._Phis(Da)
aminusat = a - self._Phis.parent().base_ring().base_ring().teichmuller(a)
#aminusat = a - self._coefficient_ring.base_ring().teichmuller(a)
try:
ap = self._ap
except AttributeError:
self._ap = self._Phis.Tq_eigenvalue(p) #catch exception if not eigensymbol
ap = self._ap
if not twist is None:
ap *= twist(p)
if j == 0:
return (~ap) * onDa.moment(0)
if a == 1:
#aminusat is 0, so only the j=r term is non-zero
return (~ap) * (p ** j) * onDa.moment(j)
#print "j =", j, "a = ", a
ans = onDa.moment(0) * (aminusat ** j)
#ans = onDa.moment(0)
#print "\tr =", 0, " ans =", ans
for r in range(1, j+1):
if r == j:
ans += binomial(j, r) * (p ** r) * onDa.moment(r)
else:
#.........这里部分代码省略.........