Expressing sums of products in terms of sums of powers I'm working on building some software that does machine learning. One of the problems I've come up against is that, I have an array of numbers:
$[{a, b, c, d}]$
And I want to compute the following efficiently:
$ab + ac + ad + bc + bd + cd$
Or:
$abc + abd + acd + bcd$
Where the number of variables in each group is specified arbitrarily. I have a method where I use:
$f(x) = a^x + b^x + c^x + d^x$
And then compute:
$f(1) = a + b + c + d$
$(f(1)^2-f(2))/2 = ab + ac + ad + bc + bd + cd$
$(f(1)^3 - 3f(2)f(1) + 2f(3))/6 = abc + abd + acd + bcd$
$(f(1)^4 - 6f(2)f(1)^2 + 3f(2)^2 + 8f(3)f(1) - 6f(4))/24 = abcd$
But I worked these out manually and I'm struggling to generalize it. The array will typically be much longer and I'll want to compute much higher orders.

See Newton's identities en.wikipedia.org/wiki/Newton's_identities
