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

What I want to show is:

  Sum[1000*Subscript[C, i]^2/(1000*Subscript[C, i] - 600)^r, {i, 1, k}],
  {k, 1, 30}, {r, 0.1, 1.5}]

And, I want the list of Subscript[C, i] to be the elements of the subsets:

Select[Subsets[Range[30], {k}], Total[#] == 30 &]

For example, if k = 2, the results of

Select[Subsets[Range[30], {2}], Total[#] == 30 &]


{{1, 29}, {2, 28}, {3, 27}, {4, 26}, {5, 25}, {6, 24}, {7, 23}, {8, 
  22}, {9, 21}, {10, 20}, {11, 19}, {12, 18}, {13, 17}, {14, 16}}

Further, I want to assign {1, 29} to C1 and C2 of Sum firstly, and then assign {2, 28} to C1 and C2 of Sum secondly, etc. As a result, I will be able to get the graphic I want by Plot3D!

share|improve this question
Your sum returns a list of size k, but it should return a number. – Coolwater Feb 28 '14 at 13:05
Thanks for your comment! Because I want to observe a range of sum by plot3D... How can I solve this problem? – Winnie Lee Feb 28 '14 at 13:10
Don't use C as a variable name (it is a built-in function). Also, it will be easier to use a list of the cs rather than subscripts. Subscript is best thought of as a typesetting function. – bill s Feb 28 '14 at 14:03
Thanks for your advice! Could you answer my question below? – Winnie Lee Mar 1 '14 at 2:42

I suspect based on this and your other related questions you want to visualize how the number of permutations of partitions of an integer total of size k changes with total and k. (If not, comment and I'll delete this answer).

If so, something like:

 Flatten[Table[{total, k, 
    Length[Join @@ 
      Permutations /@ IntegerPartitions[total, {k}]]}, {total, 1, 
    30}, {k, 1, 8}], 1], PlotRange -> All, 
 AxesLabel -> {"Total", "K", "# of perms"}, ImageSize -> 500]

Which outputs:

enter image description here

share|improve this answer

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.