ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 14 Apr 2017 16:15:59 +0200Compute elementary Symmetrical functions on roots of a polynomialhttps://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/How to compute the elementary symmetric functions `e[1,1,..]`'s of given variables `a,b,c,...`, typically computing "elements" on roots of a polynomial? This seems such a basic question, but I can't find anywhere.Thu, 13 Apr 2017 16:57:55 +0200https://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/Answer by dan_fulea for <p>How to compute the elementary symmetric functions <code>e[1,1,..]</code>'s of given variables <code>a,b,c,...</code>, typically computing "elements" on roots of a polynomial? This seems such a basic question, but I can't find anywhere.</p>
https://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/?answer=37282#post-id-37282
Use the method expand with a specific alphabet. (If the default alphabet is not wanted.)
For instance:
e = SymmetricFunctions( QQ ).e()
alphabet = 'a,b,c,d'
print "The elementary symmetric functions in the alphabet %s are:" % alphabet
for k in [0,1,2,3,4]:
print e( [k] ).expand( 4, alphabet=alphabet )
print "\ne(3,2,2,1) is:\n%s" % e( [3,2,2,1] ).expand( 4, alphabet=alphabet ).factor()
And we get:
The elementary symmetric functions in the alphabet a,b,c,d are:
1
a + b + c + d
a*b + a*c + b*c + a*d + b*d + c*d
a*b*c + a*b*d + a*c*d + b*c*d
a*b*c*d
e(3,2,2,1) is:
(a + b + c + d) * (a*b + a*c + b*c + a*d + b*d + c*d)^2 * (a*b*c + a*b*d + a*c*d + b*c*d)
Thu, 13 Apr 2017 20:20:48 +0200https://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/?answer=37282#post-id-37282Comment by nd for <p>Use the method expand with a specific alphabet. (If the default alphabet is not wanted.)
For instance:</p>
<pre><code>e = SymmetricFunctions( QQ ).e()
alphabet = 'a,b,c,d'
print "The elementary symmetric functions in the alphabet %s are:" % alphabet
for k in [0,1,2,3,4]:
print e( [k] ).expand( 4, alphabet=alphabet )
print "\ne(3,2,2,1) is:\n%s" % e( [3,2,2,1] ).expand( 4, alphabet=alphabet ).factor()
</code></pre>
<p>And we get:</p>
<pre><code>The elementary symmetric functions in the alphabet a,b,c,d are:
1
a + b + c + d
a*b + a*c + b*c + a*d + b*d + c*d
a*b*c + a*b*d + a*c*d + b*c*d
a*b*c*d
e(3,2,2,1) is:
(a + b + c + d) * (a*b + a*c + b*c + a*d + b*d + c*d)^2 * (a*b*c + a*b*d + a*c*d + b*c*d)
</code></pre>
https://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/?comment=37285#post-id-37285Yes but this is not only symbolic computation as I have some calculated values for `a,b,c..`, say `a=u1*u2` and `b=u3*u4` and `c=u5*u6`. Then how to assign them to the `e`'s? (and the `ui`'s can be complicated !
`e[2].expand(3) = ab+ac+bc=(u1*u2)*(u3*u4)+(u1*u2)*(u5*u6)+(u3*u4)*(u5*u6)`Thu, 13 Apr 2017 20:56:00 +0200https://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/?comment=37285#post-id-37285Answer by nd for <p>How to compute the elementary symmetric functions <code>e[1,1,..]</code>'s of given variables <code>a,b,c,...</code>, typically computing "elements" on roots of a polynomial? This seems such a basic question, but I can't find anywhere.</p>
https://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/?answer=37297#post-id-37297To compute the elem. sym pol. on some (calculated) roots `y1,...,y6`, I create the ring `R=PolynomialRing(ZZ,6,'y')` and `RR.<T>=R[]`. I can assign some calculated values to these `yi`'s. Then one forms the the polynomial `P=(T-y1)*...*(T-y6)` and then:
`[e(SymmetricFunctions(RR.base_ring().from_polynomial(P.coefficients()[i])) for i in range(0,P.degree()+1)]`
with`e=SymmetricFunctions().elementary()`
then these coefficients appear in the form of a sum of elementary functions `e[4,2,1..]=e[4]*e[2]*e[1]...`
Then I identify "by hand" the `e[i]`'sFri, 14 Apr 2017 16:15:59 +0200https://ask.sagemath.org/question/37278/compute-elementary-symmetrical-functions-on-roots-of-a-polynomial/?answer=37297#post-id-37297