本文整理匯總了Python中sage.combinat.sf.sf.SymmetricFunctions.powersum方法的典型用法代碼示例。如果您正苦於以下問題:Python SymmetricFunctions.powersum方法的具體用法?Python SymmetricFunctions.powersum怎麽用?Python SymmetricFunctions.powersum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sage.combinat.sf.sf.SymmetricFunctions
的用法示例。
在下文中一共展示了SymmetricFunctions.powersum方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: charpoly
# 需要導入模塊: from sage.combinat.sf.sf import SymmetricFunctions [as 別名]
# 或者: from sage.combinat.sf.sf.SymmetricFunctions import powersum [as 別名]
def charpoly(self, g, var='x'):
r"""
Determines the characteristic polynomial `\det(I-gT)`
"""
if self.degree() == 0:
return QQ.one()
from sage.combinat.sf.sf import SymmetricFunctions
S = SymmetricFunctions(QQ)
p = S.powersum()
e = S.elementary()
deg = self.degree()
traces = [self(g ** n) for n in range(1, deg+1)]
x = PolynomialRing(QQ, var).gen()
cp = x ** deg
for n in range(deg):
mc = p(e[n+1]).monomial_coefficients()
cp += (-1) ** (n+1) * x ** (deg-1-n) * sum(mc[k] * prod(traces[j-1] for j in k) for k in mc.keys())
return cp
示例2: charpoly_reverse
# 需要導入模塊: from sage.combinat.sf.sf import SymmetricFunctions [as 別名]
# 或者: from sage.combinat.sf.sf.SymmetricFunctions import powersum [as 別名]
def charpoly_reverse(self, g, var='x'):
r"""
Determines the characteristic polynomial `\det(I-gT)`
sage: from sage.rings.number_field.galois_group import GaloisGroup_v3
sage: from sage.rings.number_field.artin_representation import ArtinRepresentation
sage: K = NumberField(x^3 - 2, 'a')
sage: G = GaloisGroup_v3(K, names='b2')
sage: chi = ArtinRepresentation(G, [2, 0, -1])
sage: L = G.splitting_field()
sage: for p in prime_range(5, 50):
... print p, chi.charpoly_reverse(G.artin_symbol(L.primes_above(p)[0]))
5 -x^2 + 1
7 x^2 + x + 1
11 -x^2 + 1
13 x^2 + x + 1
17 -x^2 + 1
19 x^2 + x + 1
23 -x^2 + 1
29 -x^2 + 1
31 x^2 - 2*x + 1
37 x^2 + x + 1
41 -x^2 + 1
43 x^2 - 2*x + 1
47 -x^2 + 1
"""
if self.degree() == 0:
return QQ.one()
from sage.combinat.sf.sf import SymmetricFunctions
S = SymmetricFunctions(QQ)
p = S.powersum()
e = S.elementary()
deg = self.degree()
traces = [self(g ** n) for n in range(1, deg+1)]
x = PolynomialRing(QQ, var).gen()
cp = QQ.one()
for n in range(deg):
mc = p(e[n+1]).monomial_coefficients()
cp += (-1) ** (n+1) * x ** (n+1) * sum(mc[k] * prod(traces[j-1] for j in k) for k in mc.keys())
return cp