1
$\begingroup$

What I want to show is:

Plot3D[
  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 &]

is

{{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!

$\endgroup$
  • $\begingroup$ Your sum returns a list of size k, but it should return a number. $\endgroup$ – Coolwater Feb 28 '14 at 13:05
  • $\begingroup$ Thanks for your comment! Because I want to observe a range of sum by plot3D... How can I solve this problem? $\endgroup$ – Winnie Lee Feb 28 '14 at 13:10
  • $\begingroup$ 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. $\endgroup$ – bill s Feb 28 '14 at 14:03
  • $\begingroup$ Thanks for your advice! Could you answer my question below? $\endgroup$ – Winnie Lee Mar 1 '14 at 2:42
2
$\begingroup$

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:

ListPlot3D[
 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

| improve this answer | |
$\endgroup$

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.