I'm trying to solve the following problem:

For a vector $v$ of length $c$, $\min \frac{\sum v[i]^4}{(\sum v[i]^2)^2}$ subject to $\sum v[i] = N$.

I can solve this numerically for a given $c$ using the following command:

Minimize[{Total[z^4]/Total[z^2]^2, Total[z] == N}, z]

Is it possible to solve this problem symbolically leaving $c$ as a free variable?


Isn't this is a problem of mathematics more than programming? Under the stated conditions, by permutation symmetry of the indexes of $v$ all entries of $v$ should be the same (up to absolute value, because in the problem statement all elements are squared). Thus one answer is $v$ is an array of $c$ entries each of which is $n/c$. This solution is confirmed through code for $n = 1, 2$ and $3$.

According to @2012rcampion, these are other solutions for odd $c$:

otherSolutions[c_?OddQ] := 
       Permutations[Join[Table[n, {c/2 + 1/2}], Table[-n, {c/2 - 1/2}]]]
| improve this answer | |
  • $\begingroup$ Actually, (at least in the case of three dimensions) there is an alternate solution of $v=\{-n,+n,+n\}$. $\endgroup$ – 2012rcampion Mar 28 '15 at 23:57
  • $\begingroup$ Actually, a similar solution should work for all odd dimensionalities. $\endgroup$ – 2012rcampion Mar 29 '15 at 0:00

You're like 99% of the way there. You just need to tell Mathematica that z is a vector by feeding it the components:

With[{z = Array[v, 3]}, 
 Minimize[{Total[z^4]/Total[z^2]^2, Total[z] == n}, z]]

For dimensions 1 and 2 the answers are as expected. For 3 (the code above) Minimize outputs a bunch of ugly Roots. So although there is a symbolic solution, there may not be an analytic one.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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