本文整理汇总了Python中sage.rings.power_series_ring.PowerSeriesRing.gen方法的典型用法代码示例。如果您正苦于以下问题:Python PowerSeriesRing.gen方法的具体用法?Python PowerSeriesRing.gen怎么用?Python PowerSeriesRing.gen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.power_series_ring.PowerSeriesRing
的用法示例。
在下文中一共展示了PowerSeriesRing.gen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: local_coordinates_at_nonweierstrass
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.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: _all_weak_taylor_coefficients
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _all_weak_taylor_coefficients(weight, index) :
r"""
A product basis of the echelon bases of
- `M_k, M_{k + 2}, ..., M_{k + 2 m}` etc. if ``weight`` is even,
- `M_{k + 1}, ..., M_{k + 2 m - 3}` if ``weight`` is odd.
INPUT:
- ``weight`` -- An integer.
- ``index`` -- A non-negative integer.
TESTS::
sage: from psage.modform.jacobiforms.jacobiformd1nn_fegenerators import _all_weak_taylor_coefficients
sage: _all_weak_taylor_coefficients(12, 1)
[[<bound method ModularFormElement.qexp of 1 + 196560*q^2 + 16773120*q^3 + 398034000*q^4 + 4629381120*q^5 + O(q^6)>, <function <lambda> at ...>], [<bound method ModularFormElement.qexp of q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)>, <function <lambda> at ...>], [<function <lambda> at ...>, <bound method ModularFormElement.qexp of 1 - 24*q - 196632*q^2 - 38263776*q^3 - 1610809368*q^4 - 29296875024*q^5 + O(q^6)>]]
"""
R = PowerSeriesRing(ZZ, 'q'); q = R.gen()
if weight % 2 == 0 :
nmb_modular_forms = index + 1
start_weight = weight
else :
nmb_modular_forms = index - 1
start_weight = weight + 1
modular_forms = list()
for (i,k) in enumerate(range(start_weight, start_weight + 2 * nmb_modular_forms, 2)) :
modular_forms += [ [lambda p: big_oh.O(q**p) for _ in range(i)] + [b.qexp] + [lambda p: big_oh.O(q**p) for _ in range(nmb_modular_forms - 1 - i)]
for b in ModularForms(1, k).echelon_basis() ]
return modular_forms
示例3: _test__jacobi_predicted_taylor_coefficients
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _test__jacobi_predicted_taylor_coefficients(fs, q_precision) :
r"""
Given a list of power series, which are the corrected Taylor coefficients
of a Jacobi form, return the renormalized uncorrected ones, assuming that
all but one `f` vanish.
INPUT:
- ``fs`` -- A list of power series.
- ``q_precision`` -- An integer.
OUPUT:
- A list of power series.
TESTS:
See jacobi_form_by_taylor_expansion.
"""
from sage.rings.arith import gcd
R = PowerSeriesRing(ZZ, 'q'); q = R.gen(0)
diff = lambda f: f.derivative().shift(1)
normalize = lambda f: f / gcd(f.list()) if f != 0 else f
diffnorm = lambda f,l: normalize(reduce(lambda a, g: g(a), l*[diff], f))
taylor_coefficients = list()
allf = R(0)
for f in fs :
allf = f(q_precision) + diffnorm(allf, 1)
taylor_coefficients.append(allf)
return taylor_coefficients
示例4: form_acting_matrix_on_dist
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def form_acting_matrix_on_dist(p,M,k,a,b,c,d):
"""forms a large M x M matrix say G such that if v is the vector of moments of a distribution mu, then v*G is the vector of moments of mu|[a,b;c,d]"""
# print("Checking...")
# print(a,b,c,d)
# print(p)
assert (a%p != 0) and (c%p == 0), "acting by bad matrix"
R=PowerSeriesRing(QQ,'y',default_prec=M)
y=R.gen()
scale=(b+d*y)/(a+c*y)
t=((a+c*y)**k).truncate(M)
A = []
for i in range(0,M):
temp1=t.list();
d=len(temp1)
for j in range(d,M):
temp1 = temp1 + [0]
#while len(temp1)>M:
# temp1.pop()
A = A + [temp1]
t=(t*scale).truncate(M)
q=p**M
B=Matrix(QQ,A).transpose()
for r in range(0,M):
for c in range(0,M):
#B[r,c]=B[r,c]%(p**(M-c))
B[r,c]=B[r,c]%(q)
return B
示例5: _repr_
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _repr_(self):
r"""
Returns the representation of self as a string.
"""
R = PowerSeriesRing(self._parent._R,default_prec=self._depth,name='z')
z = R.gen()
s = str(sum([R(self._val[ii,0]*z**ii) for ii in range(self._depth)]))
return s
示例6: _compute_acting_matrix
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _compute_acting_matrix(self, g, M):
r"""
INPUT:
- ``g`` -- an instance of
:class:`sage.matrices.matrix_integer_2x2.Matrix_integer_2x2`
or :class:`sage.matrix.matrix_generic_dense.Matrix_generic_dense`
- ``M`` -- a positive integer giving the precision at which
``g`` should act.
OUTPUT:
-
EXAMPLES::
sage: from sage.modular.pollack_stevens.distributions import Distributions, Symk
"""
#tim = verbose("Starting")
a, b, c, d = self._adjuster(g)
# if g.parent().base_ring().is_exact():
# self._check_mat(a, b, c, d)
k = self._k
if g.parent().base_ring() is ZZ:
if self._symk:
base_ring = QQ
else:
base_ring = Zmod(self._p**M)
else:
base_ring = self.underlying_set().base_ring()
#cdef Matrix B = matrix(base_ring,M,M)
B = matrix(base_ring,M,M) #
if M == 0:
return B.change_ring(self.codomain().base_ring())
R = PowerSeriesRing(base_ring, 'y', default_prec = M)
y = R.gen()
#tim = verbose("Checked, made R",tim)
# special case for small precision, large weight
scale = (b+d*y)/(a+c*y)
t = (a+c*y)**k # will already have precision M
#cdef long row, col #
#tim = verbose("Made matrix",tim)
for col in range(M):
for row in range(M):
B.set_unsafe(row, col, t[row])
t *= scale
#verbose("Finished loop",tim)
# the changering here is annoying, but otherwise we have to change ring each time we multiply
B = B.change_ring(self.codomain().base_ring())
if self._character is not None:
B *= self._character(a)
if self._dettwist is not None:
B *= (a*d - b*c)**(self._dettwist)
return B
示例7: _sa_coefficients_lambda_
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _sa_coefficients_lambda_(K, beta=0):
r"""
Return the coefficients `\lambda_{k, \ell}(\beta)` used in singularity analysis.
INPUT:
- ``K`` -- an integer.
- ``beta`` -- (default: `0`) the order of the logarithmic
singularity.
OUTPUT:
A dictionary mapping pairs of indices to rationals.
.. SEEALSO::
:meth:`~AsymptoticExpansionGenerators.SingularityAnalysis`
TESTS::
sage: from sage.rings.asymptotic.asymptotic_expansion_generators \
....: import _sa_coefficients_lambda_
sage: _sa_coefficients_lambda_(3)
{(0, 0): 1,
(1, 1): -1,
(1, 2): 1/2,
(2, 2): 1,
(2, 3): -5/6,
(2, 4): 1/8,
(3, 3): -1,
(3, 4): 13/12,
(4, 4): 1}
sage: _sa_coefficients_lambda_(3, beta=1)
{(0, 0): 1,
(1, 1): -2,
(1, 2): 1/2,
(2, 2): 3,
(2, 3): -4/3,
(2, 4): 1/8,
(3, 3): -4,
(3, 4): 29/12,
(4, 4): 5}
"""
from sage.rings.laurent_series_ring import LaurentSeriesRing
from sage.rings.power_series_ring import PowerSeriesRing
from sage.rings.rational_field import QQ
V = LaurentSeriesRing(QQ, names='v', default_prec=K)
v = V.gen()
T = PowerSeriesRing(V, names='t', default_prec=2*K-1)
t = T.gen()
S = (t - (1+1/v+beta) * (1+v*t).log()).exp()
return dict(((k + L.valuation(), ell), c)
for ell, L in enumerate(S.list())
for k, c in enumerate(L.list()))
示例8: local_coordinates_at_weierstrass
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.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))
示例9: _repr_
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _repr_(self):
r"""
This returns the representation of self as a string.
EXAMPLES:
This example illustrates ...
::
"""
R=PowerSeriesRing(self._parent._R,default_prec=self._depth,name='z')
z=R.gen()
s=str(sum([R(self._val[ii,0]*z**ii) for ii in range(self._depth)]))
return s
示例10: _test__jacobi_taylor_coefficients
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _test__jacobi_taylor_coefficients(expansion, weight, prec = None) :
r"""
Compute the renormalized Taylor coefficients of
a Jacobi form.
INPUT:
- ``expansion`` -- A Fourier expansion or a dictionary with corresponding keys.
- ``weight`` -- An integer.
- ``prec`` -- A filter for Fourier expansions, of if ``expansion`` is a Fourier expansion
possibly ``None``.
OUTPUT:
- A list of power series in `q`.
"""
from sage.rings.arith import gcd
if prec is None :
prec = expansion.precision()
jacobi_index = prec.jacobi_index()
q_precision = prec.index()
R = PowerSeriesRing(ZZ, 'q'); q = R.gen(0)
weak_prec = JacobiFormD1NNFilter(prec, reduced = False, weak_forms = True)
indices = JacobiFormD1NNIndices(jacobi_index)
projs = list()
for pw in (range(0, 2 * jacobi_index + 1, 2) if weight % 2 == 0 else range(1, 2 * jacobi_index - 1, 2)) :
proj = dict( (n, 0) for n in range(q_precision) )
for (n, r) in weak_prec :
((nred, rred), sign) = indices.reduce((n,r))
try :
proj[n] += (sign * r)**pw * expansion[(nred, rred)]
except (KeyError, ValueError) :
pass
projs.append(proj)
gcd_projs = [gcd(proj.values()) for proj in projs]
gcd_projs = [g if g != 0 else 1 for g in gcd_projs]
projs = [sorted(proj.iteritems()) for proj in projs]
projs = [ R([c for (_, c) in proj]).add_bigoh(q_precision) / gcd_proj
for (proj, gcd_proj) in zip(projs, gcd_projs) ]
return projs
示例11: _test__jacobi_torsion_point
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _test__jacobi_torsion_point(phi, weight, torsion_point) :
r"""
Given a list of power series, which are the corrected Taylor coefficients
of a Jacobi form, return the specialization to ``torsion_point``.
INPUT:
- ``phi`` -- A Fourier expansion of a Jacobi form.
- ``weight`` -- An integer.
- ``torsion_point`` -- A rational.
OUPUT:
- A power series.
TESTS:
See jacobi_form_by_taylor_expansion.
sage: from psage.modform.jacobiforms.jacobiformd1nn_fegenerators import *
sage: from psage.modform.jacobiforms.jacobiformd1nn_types import *
sage: precision = 50
sage: weight = 10; index = 7
sage: phis = [jacobi_form_by_taylor_expansion(i, JacobiFormD1NNFilter(precision, index), weight) for i in range(JacobiFormD1NN_Gamma(weight, index)._rank(QQ))]
sage: fs = [JacobiFormD1NNFactory_class._test__jacobi_torsion_point(phi, weight, 2/3) for phi in phis]
sage: fs_vec = [vector(f.padded_list(precision)) for f in fs]
sage: mf_span = span([vector(b.qexp(precision).padded_list(precision)) for b in ModularForms(GammaH(9, [4]), weight).basis()])
sage: all(f_vec in mf_span for f_vec in fs_vec)
True
FIXME: The case of torsion points of order 5, which should lead to forms for Gamma1(25) fails even in the simplest case.
"""
from sage.rings.all import CyclotomicField
K = CyclotomicField(QQ(torsion_point).denominator()); zeta = K.gen()
R = PowerSeriesRing(K, 'q'); q = R.gen(0)
ch = JacobiFormD1WeightCharacter(weight)
coeffs = dict( (n, QQ(0)) for n in range(phi.precision().index()) )
for (n, r) in phi.precision().monoid_filter() :
coeffs[n] += zeta**r * phi[(ch, (n,r))]
return PowerSeriesRing(K, 'q')(coeffs)
示例12: herm_modform_space_dim
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def herm_modform_space_dim(D, HermWeight):
"""
Calculates and returns the dimension of the vector space
of Hermitian modular forms of weight `HermWeight` over \Gamma,
where \Gamma = \Sp_2(\curlO) and \curlO is the maximal order
of \QQ(\sqrt{D}).
"""
if D == -3:
# dern2003graded, Thm 7
R = PowerSeriesRing(ZZ, name="t", default_prec = HermWeight + 1)
t = R.gen()
dims = (1 + t**45) / (1 - t**4 ) / ( 1 - t**6 ) / ( 1 - t**9 ) / ( 1 - t**10 ) / ( 1 - t**12 )
return dims[HermWeight]
#elif D == -4:
# dern2003graded, Corollary 9 and Lemma 3
# TODO...
#R = PowerSeriesRing(ZZ, name="t", default_prec = HermWeight + 1)
#t = R.an_element()
else:
raise NotImplementedError, "dimension calculation of Hermitian modular form with D = %i not implemented" % D
示例13: _test__by_taylor_expansion
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def _test__by_taylor_expansion(q_precision, weight, jacobi_index) :
r"""
Run tests that validate by_taylor_expansions for various indices and weights.
TESTS::
sage: from psage.modform.jacobiforms.jacobiformd1nn_fegenerators import *
sage: JacobiFormD1NNFactory_class._test__by_taylor_expansion(100, 10, 2)
sage: JacobiFormD1NNFactory_class._test__by_taylor_expansion(20, 11, 2)
sage: JacobiFormD1NNFactory_class._test__by_taylor_expansion(50, 9, 3) # long time
sage: JacobiFormD1NNFactory_class._test__by_taylor_expansion(50, 10, 10) # long time
sage: JacobiFormD1NNFactory_class._test__by_taylor_expansion(30, 7, 15) # long time
"""
from sage.rings import big_oh
prec = JacobiFormD1NNFilter(q_precision, jacobi_index)
factory = JacobiFormD1NNFactory(prec)
R = PowerSeriesRing(ZZ, 'q'); q = R.gen(0)
if weight % 2 == 0 :
nmb_modular_forms = jacobi_index + 1
start_weight = weight
else :
nmb_modular_forms = jacobi_index - 1
start_weight = weight + 1
modular_forms = list()
for (i,k) in enumerate(range(start_weight, start_weight + 2 * nmb_modular_forms, 2)) :
modular_forms += [ [lambda p: big_oh.O(q**p) for _ in range(i)] + [b.qexp] + [lambda p: big_oh.O(q**p) for _ in range(nmb_modular_forms - 1 - i)]
for b in ModularForms(1, k).echelon_basis() ]
for (fs_index, fs) in enumerate(modular_forms) :
expansion = factory.by_taylor_expansion(fs, weight, True)
taylor_coefficients = JacobiFormD1NNFactory_class._test__jacobi_taylor_coefficients(expansion, weight, prec)
predicted_taylor_coefficients = JacobiFormD1NNFactory_class._test__jacobi_predicted_taylor_coefficients(fs, q_precision)
for (i, (proj, f)) in enumerate(zip(taylor_coefficients, predicted_taylor_coefficients)) :
if f != proj :
raise AssertionError( "{0}-th Taylor coefficient of the {1}-th Jacobi form is not correct. Expansions are\n {2}\nand\n {3}".format(i, fs_index, proj, f) )
示例14: compute_wp_fast
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
def compute_wp_fast(k, A, B, m):
r"""
Computes the Weierstrass function of an elliptic curve defined by short Weierstrass model: `y^2 = x^3 + Ax + B`. It does this with as fast as polynomial of degree `m` can be multiplied together in the base ring, i.e. `O(M(n))` in the notation of [BMSS].
Let `p` be the characteristic of the underlying field: Then we must have either `p=0`, or `p > m + 3`.
INPUT:
- ``k`` - the base field of the curve
- ``A`` - and
- ``B`` - as the coeffients of the short Weierstrass model `y^2 = x^3 +Ax +B`, and
- ``m`` - the precision to which the function is computed to.
OUTPUT:
the Weierstrass `\wp` function as a Laurent series to precision `m`.
ALGORITHM:
This function uses the algorithm described in section 3.3 of
[BMSS].
EXAMPLES::
sage: from sage.schemes.elliptic_curves.ell_wp import compute_wp_fast
sage: compute_wp_fast(QQ, 1, 8, 7)
z^-2 - 1/5*z^2 - 8/7*z^4 + 1/75*z^6 + O(z^7)
sage: k = GF(37)
sage: compute_wp_fast(k, k(1), k(8), 5)
z^-2 + 22*z^2 + 20*z^4 + O(z^5)
"""
R = PowerSeriesRing(k,'z',default_prec=m+5)
z = R.gen()
s = 2
f1 = z.add_bigoh(m+3)
n = 2*m + 4
# solve the nonlinear differential equation
while (s < n):
f1pr = f1.derivative()
next_s = 2*s - 1
a = 2*f1pr
b = -(6*B*(f1**5) + 4*A*(f1**3))
c = B*(f1**6) + A*f1**4 + 1 - (f1pr**2)
# we should really be computing only mod z^next_s here.
# but we loose only a factor 2
f2 = solve_linear_differential_system(a, b, c, 0)
# sometimes we get to 0 quicker than s reaches n
if f2 == 0:
break
f1 = f1 + f2
s = next_s
R = f1
Q = R**2
pe = 1/Q
return pe
示例15: MPowerSeriesRing_generic
# 需要导入模块: from sage.rings.power_series_ring import PowerSeriesRing [as 别名]
# 或者: from sage.rings.power_series_ring.PowerSeriesRing import gen [as 别名]
class MPowerSeriesRing_generic(PowerSeriesRing_generic, Nonexact):
r"""
A multivariate power series ring. This class is implemented as a
single variable power series ring in the variable ``T`` over a
multivariable polynomial ring in the specified generators. Each
generator ``g`` of the multivariable polynomial ring (called the
"foreground ring") is mapped to ``g*T`` in the single variable power series
ring (called the "background ring"). The background power series ring
is used to do arithmetic and track total-degree precision. The
foreground polynomial ring is used to display elements.
For usage and examples, see above, and :meth:`PowerSeriesRing`.
"""
### methods from PowerSeriesRing_generic that we *don't* override:
#
# variable_names_recursive : works just fine
#
# __contains__ : works just fine
#
# base_extend : works just fine
#
# is_exact : works just fine
#
# random_element : works just fine
#
# is_field : works just fine
#
# is_finite : works just fine
#
# __setitem__ : works just fine
#
#
#### notes
#
# sparse setting may not be implemented completely
Element = MPowerSeries
def __init__(self, base_ring, num_gens, name_list,
order='negdeglex', default_prec=10, sparse=False):
"""
Initializes a multivariate power series ring. See PowerSeriesRing
for complete documentation.
INPUT
- ``base_ring`` - a commutative ring
- ``num_gens`` - number of generators
- ``name_list`` - List of indeterminate names or a single name.
If a single name is given, indeterminates will be this name
followed by a number from 0 to num_gens - 1. If a list is
given, these will be the indeterminate names and the length
of the list must be equal to num_gens.
- ``order`` - ordering of variables; default is
negative degree lexicographic
- ``default_prec`` - The default total-degree precision for
elements. The default value of default_prec is 10.
- ``sparse`` - whether or not power series are sparse
EXAMPLES::
sage: R.<t,u,v> = PowerSeriesRing(QQ)
sage: g = 1 + v + 3*u*t^2 - 2*v^2*t^2
sage: g = g.add_bigoh(5); g
1 + v + 3*t^2*u - 2*t^2*v^2 + O(t, u, v)^5
sage: g in R
True
TESTS:
By :trac:`14084`, the multi-variate power series ring belongs to the
category of integral domains, if the base ring does::
sage: P = ZZ[['x','y']]
sage: P.category()
Category of integral domains
sage: TestSuite(P).run()
Otherwise, it belongs to the category of commutative rings::
sage: P = Integers(15)[['x','y']]
sage: P.category()
Category of commutative rings
sage: TestSuite(P).run()
"""
order = TermOrder(order,num_gens)
self._term_order = order
if not base_ring.is_commutative():
raise TypeError("Base ring must be a commutative ring.")
n = int(num_gens)
if n < 0:
raise ValueError("Multivariate Polynomial Rings must have more than 0 variables.")
self._ngens = n
self._has_singular = False #cannot convert to Singular by default
# Multivariate power series rings inherit from power series rings. But
# apparently we can not call their initialisation. Instead, initialise
#.........这里部分代码省略.........