本文整理汇总了Python中sage.rings.all.PowerSeriesRing.gen方法的典型用法代码示例。如果您正苦于以下问题:Python PowerSeriesRing.gen方法的具体用法?Python PowerSeriesRing.gen怎么用?Python PowerSeriesRing.gen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.all.PowerSeriesRing
的用法示例。
在下文中一共展示了PowerSeriesRing.gen方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: local_coordinates_at_nonweierstrass
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
def local_coordinates_at_nonweierstrass(self, P, prec=20, name='t'):
"""
For a non-Weierstrass point `P = (a,b)` on the hyperelliptic
curve `y^2 = f(x)`, return `(x(t), y(t))` such that `(y(t))^2 = f(x(t))`,
where `t = x - a` is the local parameter.
INPUT:
- ``P = (a, b)`` -- a non-Weierstrass point on self
- ``prec`` -- desired precision of the local coordinates
- ``name`` -- gen of the power series ring (default: ``t``)
OUTPUT:
`(x(t),y(t))` such that `y(t)^2 = f(x(t))` and `t = x - a`
is the local parameter at `P`
EXAMPLES::
sage: R.<x> = QQ['x']
sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x)
sage: P = H(1,6)
sage: x,y = H.local_coordinates_at_nonweierstrass(P,prec=5)
sage: x
1 + t + O(t^5)
sage: y
6 + t - 7/2*t^2 - 1/2*t^3 - 25/48*t^4 + O(t^5)
sage: Q = H(-2,12)
sage: x,y = H.local_coordinates_at_nonweierstrass(Q,prec=5)
sage: x
-2 + t + O(t^5)
sage: y
12 - 19/2*t - 19/32*t^2 + 61/256*t^3 - 5965/24576*t^4 + O(t^5)
AUTHOR:
- Jennifer Balakrishnan (2007-12)
"""
d = P[1]
if d == 0:
raise TypeError("P = %s is a Weierstrass point. Use local_coordinates_at_weierstrass instead!"%P)
pol = self.hyperelliptic_polynomials()[0]
L = PowerSeriesRing(self.base_ring(), name)
t = L.gen()
L.set_default_prec(prec)
K = PowerSeriesRing(L, 'x')
pol = K(pol)
x = K.gen()
b = P[0]
f = pol(t+b)
for i in range((RR(log(prec)/log(2))).ceil()):
d = (d + f/d)/2
return t+b+O(t**(prec)), d + O(t**(prec))
示例2: _e_bounds
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
def _e_bounds(self, n, prec):
p = self._p
prec = max(2,prec)
R = PowerSeriesRing(ZZ,'T',prec+1)
T = R(R.gen(),prec +1)
w = (1+T)**(p**n) - 1
return [infinity] + [valuation(w[j],p) for j in range(1,min(w.degree()+1,prec))]
示例3: local_coordinates_at_weierstrass
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
def local_coordinates_at_weierstrass(self, P, prec=20, name="t"):
"""
For a finite Weierstrass point on the hyperelliptic
curve y^2 = f(x), returns (x(t), y(t)) such that
(y(t))^2 = f(x(t)), where t = y is the local parameter.
INPUT:
- P a finite Weierstrass point on self
- prec: desired precision of the local coordinates
- name: gen of the power series ring (default: 't')
OUTPUT:
(x(t),y(t)) such that y(t)^2 = f(x(t)) and t = y
is the local parameter at P
EXAMPLES:
sage: R.<x> = QQ['x']
sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x)
sage: A = H(4, 0)
sage: x, y = H.local_coordinates_at_weierstrass(A, prec=7)
sage: x
4 + 1/360*t^2 - 191/23328000*t^4 + 7579/188956800000*t^6 + O(t^7)
sage: y
t + O(t^7)
sage: B = H(-5, 0)
sage: x, y = H.local_coordinates_at_weierstrass(B, prec=5)
sage: x
-5 + 1/1260*t^2 + 887/2000376000*t^4 + O(t^5)
sage: y
t + O(t^5)
AUTHOR:
- Jennifer Balakrishnan (2007-12)
- Francis Clarke (2012-08-26)
"""
if P[1] != 0:
raise TypeError, "P = %s is not a finite Weierstrass point. Use local_coordinates_at_nonweierstrass instead!" % P
L = PowerSeriesRing(self.base_ring(), name)
t = L.gen()
pol = self.hyperelliptic_polynomials()[0]
pol_prime = pol.derivative()
b = P[0]
t2 = t ** 2
c = b + t2 / pol_prime(b)
c = c.add_bigoh(prec)
for _ in range(1 + log(prec, 2)):
c -= (pol(c) - t2) / pol_prime(c)
return (c, t.add_bigoh(prec))
示例4: zeta_series
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
def zeta_series(self, n, t):
"""
Return the zeta series.
Compute a power series approximation to the zeta function of a
scheme over a finite field.
INPUT:
- ``n`` -- the number of terms of the power series to
compute
- ``t`` -- the variable which the series should be
returned
OUTPUT:
A power series approximating the zeta function of self
EXAMPLES::
sage: P.<x> = PolynomialRing(GF(3))
sage: C = HyperellipticCurve(x^3+x^2+1)
sage: R.<t> = PowerSeriesRing(Integers())
sage: C.zeta_series(4,t)
1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5)
sage: (1+2*t+3*t^2)/(1-t)/(1-3*t) + O(t^5)
1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5)
Note that this function depends on count_points, which is only
defined for prime order fields::
sage: C.base_extend(GF(9,'a')).zeta_series(4,t)
Traceback (most recent call last):
...
NotImplementedError: Point counting only implemented for schemes over prime fields
"""
F = self.base_ring()
if not F.is_finite():
raise TypeError('zeta functions only defined for schemes over finite fields')
try:
a = self.count_points(n)
except AttributeError:
raise NotImplementedError('count_points() required but not implemented')
R = PowerSeriesRing(Rationals(), 'u')
u = R.gen()
temp = sum(a[i-1]*(u.O(n+1))**i/i for i in range(1,n+1))
temp2 = temp.exp()
return(temp2(t).O(n+1))
示例5: MFSeriesConstructor
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
#.........这里部分代码省略.........
sage: MFSeriesConstructor(prec=3).J_inv_ZZ()
q^-1 + 31/72 + 1823/27648*q + O(q^2)
sage: MFSeriesConstructor(group=5, prec=3).J_inv_ZZ()
q^-1 + 79/200 + 42877/640000*q + O(q^2)
sage: MFSeriesConstructor(group=5, prec=3).J_inv_ZZ().parent()
Laurent Series Ring in q over Rational Field
sage: MFSeriesConstructor(group=infinity, prec=3).J_inv_ZZ()
q^-1 + 3/8 + 69/1024*q + O(q^2)
"""
F1 = lambda a,b: self._series_ring(
[ ZZ(0) ]
+ [
rising_factorial(a,k) * rising_factorial(b,k) / (ZZ(k).factorial())**2
* sum(ZZ(1)/(a+j) + ZZ(1)/(b+j) - ZZ(2)/ZZ(1+j)
for j in range(ZZ(0),ZZ(k))
)
for k in range(ZZ(1), ZZ(self._prec+1))
],
ZZ(self._prec+1)
)
F = lambda a,b,c: self._series_ring(
[
rising_factorial(a,k) * rising_factorial(b,k) / rising_factorial(c,k) / ZZ(k).factorial()
for k in range(ZZ(0), ZZ(self._prec+1))
],
ZZ(self._prec+1)
)
a = self._group.alpha()
b = self._group.beta()
Phi = F1(a,b) / F(a,b,ZZ(1))
q = self._series_ring.gen()
# the current implementation of power series reversion is slow
# J_inv_ZZ = ZZ(1) / ((q*Phi.exp()).reverse())
temp_f = (q*Phi.exp()).polynomial()
new_f = temp_f.revert_series(temp_f.degree()+1)
J_inv_ZZ = ZZ(1) / (new_f + O(q**(temp_f.degree()+1)))
return J_inv_ZZ
@cached_method
def f_rho_ZZ(self):
r"""
Return the rational Fourier expansion of ``f_rho``,
where the parameter ``d`` is replaced by ``1``.
.. NOTE:
The Fourier expansion of ``f_rho`` for ``d!=1``
is given by ``f_rho_ZZ(q/d)``.
EXAMPLES::
sage: from sage.modular.modform_hecketriangle.series_constructor import MFSeriesConstructor
sage: MFSeriesConstructor(prec=3).f_rho_ZZ()
1 + 5/36*q + 5/6912*q^2 + O(q^3)
sage: MFSeriesConstructor(group=5, prec=3).f_rho_ZZ()
1 + 7/100*q + 21/160000*q^2 + O(q^3)
sage: MFSeriesConstructor(group=5, prec=3).f_rho_ZZ().parent()
Power Series Ring in q over Rational Field
sage: MFSeriesConstructor(group=infinity, prec=3).f_rho_ZZ()
示例6: MFSeriesConstructor
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
#.........这里部分代码省略.........
Hecke triangle group for n = 3
sage: MFC.prec()
10
sage: MFC.d().parent()
Fraction Field of Univariate Polynomial Ring in d over Integer Ring
sage: MFC._ZZseries_ring
Power Series Ring in q over Rational Field
sage: MFSeriesConstructor(set_d=CC(1))
Power series constructor for Hecke modular forms for n=3, base ring=Complex Field with 53 bits of precision
with (basic series) precision 10 with parameter d=1.00000000000000
sage: MFSeriesConstructor(group=4, fix_d=True)
Power series constructor for Hecke modular forms for n=4, base ring=Rational Field
with (basic series) precision 10 with parameter d=1/256
sage: MFSeriesConstructor(group=5, fix_d=True)
Power series constructor for Hecke modular forms for n=5, base ring=Real Field with 53 bits of precision
with (basic series) precision 10 with parameter d=0.00705223418128563
"""
self._group = group
self._base_ring = base_ring
self._prec = prec
self._fix_d = fix_d
self._set_d = set_d
self._d_num_prec = d_num_prec
if (set_d):
self._coeff_ring = FractionField(base_ring)
self._d = set_d
else:
self._coeff_ring = FractionField(PolynomialRing(base_ring,"d"))
self._d = self._coeff_ring.gen()
self._ZZseries_ring = PowerSeriesRing(QQ,'q',default_prec=self._prec)
self._qseries_ring = PowerSeriesRing(self._coeff_ring,'q',default_prec=self._prec)
def _repr_(self):
r"""
Return the string representation of ``self``.
EXAMPLES::
sage: MFSeriesConstructor(group=4, fix_d=True)
Power series constructor for Hecke modular forms for n=4, base ring=Rational Field
with (basic series) precision 10 with parameter d=1/256
sage: MFSeriesConstructor(group=5)
Power series constructor for Hecke modular forms for n=5, base ring=Integer Ring
with (basic series) precision 10 with formal parameter d
"""
if (self._set_d):
return "Power series constructor for Hecke modular forms for n={}, base ring={} with (basic series) precision {} with parameter d={}".\
format(self._group.n(), self._base_ring, self._prec, self._d)
else:
return "Power series constructor for Hecke modular forms for n={}, base ring={} with (basic series) precision {} with formal parameter d".\
format(self._group.n(), self._base_ring, self._prec)
def group(self):
r"""
Return the (Hecke triangle) group of ``self``.
EXAMPLES::
示例7: JFSeriesConstructor
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
#.........这里部分代码省略.........
sage: JFSeriesConstructor(prec=3).J_inv_ZZ()
q^-1 + 31/72 + 1823/27648*q + O(q^2)
sage: JFSeriesConstructor(group=5, prec=3).J_inv_ZZ()
q^-1 + 79/200 + 42877/640000*q + O(q^2)
sage: JFSeriesConstructor(group=5, prec=3).J_inv_ZZ().parent()
Laurent Series Ring in q over Rational Field
sage: JFSeriesConstructor(group=infinity, prec=3).J_inv_ZZ()
q^-1 + 3/8 + 69/1024*q + O(q^2)
"""
F1 = lambda a,b: self._qseries_ring(
[ ZZ(0) ]
+ [
rising_factorial(a,k) * rising_factorial(b,k) / (ZZ(k).factorial())**2
* sum(ZZ(1)/(a+j) + ZZ(1)/(b+j) - ZZ(2)/ZZ(1+j)
for j in range(ZZ(0),ZZ(k))
)
for k in range(ZZ(1), ZZ(self._prec+1))
],
ZZ(self._prec+1)
)
F = lambda a,b,c: self._qseries_ring(
[
rising_factorial(a,k) * rising_factorial(b,k) / rising_factorial(c,k) / ZZ(k).factorial()
for k in range(ZZ(0), ZZ(self._prec+1))
],
ZZ(self._prec+1)
)
a = self._group.alpha()
b = self._group.beta()
Phi = F1(a,b) / F(a,b,ZZ(1))
q = self._qseries_ring.gen()
# the current implementation of power series reversion is slow
# J_inv_ZZ = ZZ(1) / ((q*Phi.exp()).reversion())
temp_f = (q*Phi.exp()).polynomial()
new_f = temp_f.revert_series(temp_f.degree()+1)
J_inv_ZZ = ZZ(1) / (new_f + O(q**(temp_f.degree()+1)))
q = self._series_ring.gen()
J_inv_ZZ = sum([J_inv_ZZ.coefficients()[m] * q**J_inv_ZZ.exponents()[m] for m in range(len(J_inv_ZZ.coefficients()))]) + O(q**J_inv_ZZ.prec())
return J_inv_ZZ
@cached_method
def f_rho_ZZ(self):
r"""
Return the rational Fourier expansion of ``f_rho``,
where the parameter ``d`` is replaced by ``1``.
.. NOTE:
The Fourier expansion of ``f_rho`` for ``d!=1``
is given by ``f_rho_ZZ(q/d)``.
EXAMPLES::
sage: from sage.modular.modform_hecketriangle.series_constructor import JFSeriesConstructor
sage: JFSeriesConstructor(prec=3).f_rho_ZZ()
1 + 5/36*q + 5/6912*q^2 + O(q^3)
sage: JFSeriesConstructor(group=5, prec=3).f_rho_ZZ()
1 + 7/100*q + 21/160000*q^2 + O(q^3)
sage: JFSeriesConstructor(group=5, prec=3).f_rho_ZZ().parent()
Power Series Ring in q over Rational Field
示例8: series
# 需要导入模块: from sage.rings.all import PowerSeriesRing [as 别名]
# 或者: from sage.rings.all.PowerSeriesRing import gen [as 别名]
def series(self, n=2, quadratic_twist=+1, prec=5):
r"""
Returns the `n`-th approximation to the `p`-adic L-series as a
power series in `T` (corresponding to `\gamma-1` with
`\gamma=1+p` as a generator of `1+p\ZZ_p`). Each coefficient
is a `p`-adic number whose precision is provably correct.
Here the normalization of the `p`-adic L-series is chosen such
that `L_p(J,1) = (1-1/\alpha)^2 L(J,1)/\Omega_J` where
`\alpha` is the unit root
INPUT:
- ``n`` - (default: 2) a positive integer
- ``quadratic_twist`` - (default: +1) a fundamental
discriminant of a quadratic field, coprime to the
conductor of the curve
- ``prec`` - (default: 5) maximal number of terms of the
series to compute; to compute as many as possible just
give a very large number for ``prec``; the result will
still be correct.
ALIAS: power_series is identical to series.
EXAMPLES:
sage: J = J0(188)[0]
sage: p = 7
sage: L = J.padic_lseries(p)
sage: L.is_ordinary()
True
sage: f = L.series(2)
sage: f[0]
O(7^20)
sage: f[1].norm()
3 + 4*7 + 3*7^2 + 6*7^3 + 5*7^4 + 5*7^5 + 6*7^6 + 4*7^7 + 5*7^8 + 7^10 + 5*7^11 + 4*7^13 + 4*7^14 + 5*7^15 + 2*7^16 + 5*7^17 + 7^18 + 7^19 + O(7^20)
"""
n = ZZ(n)
if n < 1:
raise ValueError, "n (=%s) must be a positive integer"%n
if not self.is_ordinary():
raise ValueError, "p (=%s) must be an ordinary prime"%p
# check if the conditions on quadratic_twist are satisfied
D = ZZ(quadratic_twist)
if D != 1:
if D % 4 == 0:
d = D//4
if not d.is_squarefree() or d % 4 == 1:
raise ValueError, "quadratic_twist (=%s) must be a fundamental discriminant of a quadratic field"%D
else:
if not D.is_squarefree() or D % 4 != 1:
raise ValueError, "quadratic_twist (=%s) must be a fundamental discriminant of a quadratic field"%D
if gcd(D,self._p) != 1:
raise ValueError, "quadratic twist (=%s) must be coprime to p (=%s) "%(D,self._p)
if gcd(D,self._E.conductor())!= 1:
for ell in prime_divisors(D):
if valuation(self._E.conductor(),ell) > valuation(D,ell) :
raise ValueError, "can not twist a curve of conductor (=%s) by the quadratic twist (=%s)."%(self._E.conductor(),D)
p = self._p
if p == 2 and self._normalize :
print 'Warning : For p=2 the normalization might not be correct !'
#verbose("computing L-series for p=%s, n=%s, and prec=%s"%(p,n,prec))
# bounds = self._prec_bounds(n,prec)
# padic_prec = max(bounds[1:]) + 5
padic_prec = 10
# verbose("using p-adic precision of %s"%padic_prec)
res_series_prec = min(p**(n-1), prec)
verbose("using series precision of %s"%res_series_prec)
ans = self._get_series_from_cache(n, res_series_prec,D)
if not ans is None:
verbose("found series in cache")
return ans
K = QQ
gamma = K(1 + p)
R = PowerSeriesRing(K,'T',res_series_prec)
T = R(R.gen(),res_series_prec )
#L = R(0)
one_plus_T_factor = R(1)
gamma_power = K(1)
teich = self.teichmuller(padic_prec)
p_power = p**(n-1)
# F = Qp(p,padic_prec)
verbose("Now iterating over %s summands"%((p-1)*p_power))
verbose_level = get_verbose()
count_verb = 0
alphas = self.alpha()
#print len(alphas)
Lprod = []
self._emb = 0
if len(alphas) == 2:
split = True
else:
#.........这里部分代码省略.........