Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We do have elementary symmetric functions, SymmetricPolynomial[k, {x_1, ..., x_n}] .

But I didn't find complete homogeneous symmetric functions.

The induction method to compute $h_n$ from $e_i$ and $h_j$ ($j\leq n-1$) is not that efficient.

Is there any easier way to do this?

share|improve this question

migrated from Jun 9 '12 at 13:57

This question came from our site for people studying math at any level and professionals in related fields.

up vote 8 down vote accepted

For example:

completeSymmetricPolynomial[i_?IntegerQ, vars_?ListQ] :=
      Total@Union@Tuples[Times @@ vars, {i}];

completeSymmetricPolynomial[2, {a, b, c, d}]

(* a^2 + a b + b^2 + a c + b c + c^2 + a d + b d + c d + d^2 *)


You can verify the fundamental relationship between complete and incomplete symmetric polynomials:

$$\sum_{i=0}^m (-1)^i e_i(X_1,\dots,X_n)h_{m-i}(X_1,\dots,X_n)=0$$

 Table[Sum[(-1)^i completeSymmetricPolynomial[i, {a, b, c, d}]     
                          SymmetricPolynomial[m - i, {a, b, c, d}], 
      {i, 0, m}], {m, 1, 4}]

(* -> {0, 0, 0, 0} *)
share|improve this answer
I think you can replace Times[Sequence @@ vars] with Times @@ vars. – Mr.Wizard Jun 9 '12 at 15:21
...and the Plus @@ stuff is more compactly written as Total[stuff]. – J. M. Jun 9 '12 at 15:33
Thanks, edits done – Dr. belisarius Jun 9 '12 at 16:08
The fundamental relationship belisarius is using to check his implementation is essentially the second method in my answer. – J. M. Jun 9 '12 at 17:11
The only little issue is 0-th order is not well defined, i.e. completeSymmetricPolynomial[0, {a, b, c, d}] – Osiris Xu Jun 12 '12 at 21:44

What I'd do, based on the generating function identity in your Wikipedia link:

completeSymmetricPolynomial[k_Integer, vars_List] := 
   Apply[Times, 1/(1 - vars \[FormalT])], {\[FormalT], 0, k}] /; 
  0 <= k <= Length[vars]

This is somewhat slower, but I want to demonstrate that the induction approach can be made to work as well (and is easily modified if you want all the $n$-variable polynomials all at once, as opposed to just one):

completeSymmetricPolynomial[k_Integer, vars_List] := 
     Table[(-1)^\[FormalK] SymmetricPolynomial[\[FormalK], vars],
           {\[FormalK], 0, Length[vars] - 1}], 
     UnitVector[Length[vars], 1]],
     -Table[(-1)^\[FormalK] SymmetricPolynomial[\[FormalK], vars],
            {\[FormalK], Length[vars]}]][[k]]]
share|improve this answer
:) Yes, this works too. – Osiris Xu Jun 9 '12 at 21:22

This variant seems competitive in terms of speed.

completeSymmetricPolynomial2[i_?IntegerQ, vars_?ListQ] :=
  Expand[(Total@vars)^i]/. aa_Integer*bb_ :> bb
share|improve this answer
cool. Thanks. :) – Osiris Xu Jun 9 '12 at 21:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.