[sage-combinat-devel] Re: [sage-devel] Symmetric polynomial in terms of elementary symmetric polynomials
On Fri, Dec 09, 2011 at 10:19:22AM +0100, Jeroen Demeyer wrote: > I am asking for: > > sage: e = SymmetricFunctions(QQ).e() > sage: R. = PolynomialRing(QQ) > sage: e[3,1,1].express_as_polynomial([1,e1,e2,e3]) > e1^2*e3 Ah, you want the result expressed as a plain polynomial. Then it's just a one-liner change of representation: sage: e = SymmetricFunctions(QQ).e() sage: x = e.an_element() sage: x 1/2*e[] + 3*e[1, 1, 1] + 2*e[2, 1, 1] sage: sum( c*prod( Re[i-1] if i<=3 else R.zero for i in part ) for (part,c) in x ) 3*e1^3 + 2*e1^2*e2 + 1/2 However I agree this one-liner deserves to be wrapped for the user, especially since this one-liner won't handle properly corner cases (in particular x=0). So ... Free commutative algebras represented using a multiplicative basis (like this one) should have: - An "algebra_morphism" method - A morphism and its inverse, built using algebra_morphism, implementing the isomorphism with some plain Sage polynomial ring Any good suggestion of name? the obvious to_polynomial is ambiguous since we don't know if we want a polynomial in the x's or in the e's. - Functionalities like factor and such, implemented through the those isomorphisms Note: in MuPAD, had the algebra_morphism functionality, and we could also write expr(x) which returned x as an expression in (the analogue of) SR, and then we could just do poly(expr(x)). We also. That's probably why we had not come up with an appropriate interface for this functionality. Cheers, Nicolas -- Nicolas M. Thiéry "Isil" http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] Re: [sage-devel] Symmetric polynomial in terms of elementary symmetric polynomials
On Sunday, 4 December 2011 21:34:20 UTC+8, Nicolas M. Thiéry wrote: > > On Sun, Dec 04, 2011 at 03:56:39AM -0800, Dima Pasechnik wrote: > >unless I missed something, > >your > http://combinat.sagemath.org/doc/thematic_tutorials/demo-symmetric-functions.html > >lacks any information as to how to take any symmetric polynomial, and > >expand it in some basis of symmetric functions. > > Indeed: this tutorial is very incomplete. Someone should stand up and > take the time to gather all the bits of docs from here and there, and > merge a nice and clean tutorial on Symmetric functions into Sage. > > >Is it even possible with the combinat functionality? > > It definitely is. Here is a story without subtitles (please ask for > those if needed: > > sage: S = SymmetricFunctions(QQ) > sage: m = S.m() > sage: e = S.e() > sage: f = e[3,2,1] > sage: f_as_poly = f.expand(3); f_as_poly > x0^3*x1^2*x2 + x0^2*x1^3*x2 + x0^3*x1*x2^2 + 3*x0^2*x1^2*x2^2 + > x0*x1^3*x2^2 + x0^2*x1*x2^3 + x0*x1^2*x2^3 > sage: f_as_poly.parent() > Multivariate Polynomial Ring in x0, x1, x2 over Rational Field > > sage: f_in_m = m.from_polynomial(f_as_poly); f_in_m > 3*m[2, 2, 2] + m[3, 2, 1] > > sage: f_in_e = e(f_in_m) > sage: f_in_e > e[3, 2, 1] - 3*e[4, 1, 1] - 2*e[4, 2] + 13*e[5, 1] - 18*e[6] > > Oops, but we don't get the original symmetric function f! Actually > this is perfectly correct since we lost information by only expanding > in 3 variables: > > sage: f_in_e.expand(3) == f.expand(3) > > If one kills all terms with parts larger than 3 (since > e_4=e_5=e_6=...=0 in three variables). > Thanks, it's really useful, and really must make its way into the docs ASAP... > >It's often suggested that in practice Groebner-basis based > >methods are more efficient... > > Really? A proof by benchmark is welcome :-) > I probably meant a (rather naive?) algorithm implemented in Symmetrica, which is known to be unable to expand (x+y+z)^3. So this one is easy to beat with anything, I guess. > I guess it depends a lot on what kind of polynomials are being fed in > (degree, number of variables), and in particular if one is interested > in symmetric functions (on an infinite number of variables) or > symmetric polynomials (on a, typically small, finite number of > variables). > by the way, how about settings when more than one bunch of symmetric polynomials (or functions). E.g. I have a polynomial expression P in roots of a polynomial f(x), and in roots of the complex conjugate of f(x), and it is symmetric (via the natural bijection between the roots of f and the roots its conjugate). (Example: take a general quadratic polynomial, then the distance between its roots in the complex plane is such an expression.) And I would like to express P in some symmetric functions of the coefficients of f and its conjugate. Is it easy to do? Or here one would need a Groebner basis anyway? Thanks, Dima > Best, > Nicolas > -- > Nicolas M. Thi�ry "Isil" > http://Nicolas.Thiery.name/ > > -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To view this discussion on the web visit https://groups.google.com/d/msg/sage-combinat-devel/-/ZhkojeuCAOQJ. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] Re: [sage-devel] Symmetric polynomial in terms of elementary symmetric polynomials
On Sun, Dec 04, 2011 at 03:56:39AM -0800, Dima Pasechnik wrote: >unless I missed something, >your > http://combinat.sagemath.org/doc/thematic_tutorials/demo-symmetric-functions.html >lacks any information as to how to take any symmetric polynomial, and >expand it in some basis of symmetric functions. Indeed: this tutorial is very incomplete. Someone should stand up and take the time to gather all the bits of docs from here and there, and merge a nice and clean tutorial on Symmetric functions into Sage. >Is it even possible with the combinat functionality? It definitely is. Here is a story without subtitles (please ask for those if needed: sage: S = SymmetricFunctions(QQ) sage: m = S.m() sage: e = S.e() sage: f = e[3,2,1] sage: f_as_poly = f.expand(3); f_as_poly x0^3*x1^2*x2 + x0^2*x1^3*x2 + x0^3*x1*x2^2 + 3*x0^2*x1^2*x2^2 + x0*x1^3*x2^2 + x0^2*x1*x2^3 + x0*x1^2*x2^3 sage: f_as_poly.parent() Multivariate Polynomial Ring in x0, x1, x2 over Rational Field sage: f_in_m = m.from_polynomial(f_as_poly); f_in_m 3*m[2, 2, 2] + m[3, 2, 1] sage: f_in_e = e(f_in_m) sage: f_in_e e[3, 2, 1] - 3*e[4, 1, 1] - 2*e[4, 2] + 13*e[5, 1] - 18*e[6] Oops, but we don't get the original symmetric function f! Actually this is perfectly correct since we lost information by only expanding in 3 variables: sage: f_in_e.expand(3) == f.expand(3) If one kills all terms with parts larger than 3 (since e_4=e_5=e_6=...=0 in three variables). >It's often suggested that in practice Groebner-basis based >methods are more efficient... Really? A proof by benchmark is welcome :-) I guess it depends a lot on what kind of polynomials are being fed in (degree, number of variables), and in particular if one is interested in symmetric functions (on an infinite number of variables) or symmetric polynomials (on a, typically small, finite number of variables). Best, Nicolas -- Nicolas M. Thiéry "Isil" http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] Re: [sage-devel] Symmetric polynomial in terms of elementary symmetric polynomials
Hi Nicolas, unless I missed something, your http://combinat.sagemath.org/doc/thematic_tutorials/demo-symmetric-functions.html lacks any information as to how to take any symmetric polynomial, and expand it in some basis of symmetric functions. Is it even possible with the combinat functionality? It's often suggested that in practice Groebner-basis based methods are more efficient... Dmitrii -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To view this discussion on the web visit https://groups.google.com/d/msg/sage-combinat-devel/-/tIOIIQDC9vYJ. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] Re: [sage-devel] Symmetric polynomial in terms of elementary symmetric polynomials
On Sat, Dec 03, 2011 at 01:22:32AM -0300, Federico Lebrón wrote: > I've written a small pair of functions which could be useful: > > 1) A function is_symmetric which, given a polynomial, returns whether > or not the polynomial is a symmetric polynomial. > 2) A function symmetrize which, given a symmetric polynomial, returns > an equivalent expression in terms of the elementary symmetric polynomials. > > The code, which likely needs some cleanup (and modifications to do things > "the Sage way", whatever it may be), is here: http://codepad.org/gJpNRfHH > > Would there be interest in adding these to Sage perhaps? I tried searching > for similar functionality but couldn't find it. Please have a look at SymmetricFunctions and http://combinat.sagemath.org/doc/thematic_tutorials/demo-symmetric-functions.html and get back to us for more information if needed! Cheers, Nicolas -- Nicolas M. Thiéry "Isil" http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.