2
$\begingroup$

I need to produce identities related to Newton's Identities of arbitrary order. More specifically, I need the identities in the following image for an arbitrary n:

enter image description here

What I can't quite wrap my head around is how to work with expressions in Mathematica where I don't know how many variables are involved. Is there a way to programatically create subscripted variables on the fly? So, basically, looking for help getting started.

$\endgroup$

2 Answers 2

3
$\begingroup$
Format[p[x_] := Subscript[p, x]];
Format[e[x_] := Subscript[e, x]];
Table[p[k] == (-1)^(k - 1) e[k] k + 
    Sum[(-1)^(k - 1 + i) e[k - i] p[i], {i, 1, k - 1}], {k, 1, 
   10}] // Column

$$\begin{array}{l} p_1=e_1 \\ p_2=e_1 p_1-2 e_2 \\ p_3=-e_2 p_1+e_1 p_2+3 e_3 \\ p_4=e_3 p_1-e_2 p_2+e_1 p_3-4 e_4 \\ p_5=-e_4 p_1+e_3 p_2-e_2 p_3+e_1 p_4+5 e_5 \\ p_6=e_5 p_1-e_4 p_2+e_3 p_3-e_2 p_4+e_1 p_5-6 e_6 \\ p_7=-e_6 p_1+e_5 p_2-e_4 p_3+e_3 p_4-e_2 p_5+e_1 p_6+7 e_7 \\ p_8=e_7 p_1-e_6 p_2+e_5 p_3-e_4 p_4+e_3 p_5-e_2 p_6+e_1 p_7-8 e_8 \\ p_9=-e_8 p_1+e_7 p_2-e_6 p_3+e_5 p_4-e_4 p_5+e_3 p_6-e_2 p_7+e_1 p_8+9 e_9 \\ p_{10}=e_9 p_1-e_8 p_2+e_7 p_3-e_6 p_4+e_5 p_5-e_4 p_6+e_3 p_7-e_2 p_8+e_1 p_9-10 e_{10} \\ \end{array}$$

$\endgroup$
3
$\begingroup$

It's not clear whether you need just a display or formal expression or an actual recursive function. I'll assume the latter.

p[1] = e[1];
p[n_] := 
  Simplify[
    Sum[e[i]*p[n - i]*(-1)^(1 + i), {i, 1, n - 1}] + 
    n*e[n]*(-1)^(1 + n)]

This was just a matter of coming up with an expression for p[n] that matched the pattern provided. I didn't try to simplify it any. The Simplify just forces the terms to be combined. You should test to verify it actually matches your expectation--it looks correct to me for a small set of terms.

Now, you mentioned subscripts. Subscripts are just notation, so a formal expression like e[4] can be interpreted as equivalent to a subscripted e. However, if you really want to see subscripts you can use this:

Format[e[n_]] := Subscript[e, n]

Execute the above before evaluating any specific p, and then you should see the nicely subscripted format when you do evaluate a specific p. Understand that this will just affect the display. The actual expressions will still use things like e[5].

Since you provided the fully expanded expression on the far right hand side (the ones with just e and no p), then I'm assuming that you don't need to keep the intermediate form with p. If you do need that form, then we'd need to come up with something slightly different.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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