0
$\begingroup$

I would like to generate automatically a polynomial in two variables $(s,t)$ which is symmetric under the exchange of those variables. There are three kinds of terms; at order $k$, we have $$(s+t)^k, \quad (st)^k, \quad (s+t)^a(st)^b,$$ where $a+b=k$. Using a simple sum it is not difficult to write down in Mathematica the first two types. If "ord" is the degree of the polynomial, I just define a function $poly[s,t,ord]$ as $$\sum_{i=0}^{ord} \big( c_i(s+t)^i +d_i(st)^i \big),$$ where $c_i,d_i$ are some coefficients.

But how can I generate the third type?

$\endgroup$
1
  • $\begingroup$ But the degree of (s+t)^k is k and the degree of (st)^k is 2k and the degree of (s+t)^a (st)^b is a+2b, what is the order do you want? $\endgroup$
    – cvgmt
    Commented Nov 23, 2022 at 1:23

1 Answer 1

1
$\begingroup$

You may use one running index: k and a second running index: a for a=0..k. b will then be k-a. With this e.g:

ord=3;
Sum[Subscript[c, a, i - a] (s + t)^a (s t)^(i - a), {i, 0, ord}, {a, 0, i}]

enter image description here

$\endgroup$

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