So I would like to plot the series below:

$$ S_q = k \frac{1-\sum_{i=1}^{W}(1/W)^q}{1-q} $$

where $k$ is a constant which I assume for now to be equal to 1 and $q \in \mathbb{R}$. However, for my problem $q$ takes integer values such that $q \in [-2,3]$.

I do not know how to plot a series with Mathematica and a series with a parameter is even more daunting. I have tried out some coding but I cannot get the result right.

If anyone could assist me with this one I would be grateful.

  • $\begingroup$ @JohnConorCosnett Weel, tbh I really do not know how to proceed. I mean I looked up the documentation but I am not able to find out how to plot this series. :/ $\endgroup$ – Mitscaype Jan 30 '16 at 12:17
  • $\begingroup$ (I'm only a physics undergrad with a smattering of logic) If q is an integer AND is an element of the interval -2,3 inclusive. THEN there must be a separate plot for: q = {-2, -1, 0, 1, 2, 3} ? $\endgroup$ – Conor Cosnett Jan 30 '16 at 12:38
  • $\begingroup$ @JohnConorCosnett But $q$ is a real parameter. It defines a new series for each value it takes. Then we plot the six results, one for each $q$ in the same graph. Not in separate ones. $\endgroup$ – Mitscaype Jan 30 '16 at 12:48
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Jan 30 '16 at 13:02
  • 1
    $\begingroup$ No problem. Just trying to help. :) -- Formatting code is done by putting it between back-ticks. See also the ? in the edit window (of a question or answer -- comments don't have help) for more formatting help. $\endgroup$ – Michael E2 Jan 30 '16 at 17:06

Perhaps this is will work for you.

s[1, n_] = 0;
s[q_, n_] := (1 - Sum[1/w, {w, 1, n}])/(1 - q)

tbl = Flatten[Table[{q, n, s[q, n]}, {q, -2, 3}, {n, 1, 5}], 1];
ListPlot3D[tbl, Mesh -> {5, 5}, AxesLabel -> {"q", "n", "S"}]


or perhaps

ListPointPlot3D[tbl, Filling -> Bottom, AxesLabel -> {"q", "n", "S"}]


  • $\begingroup$ Thank you! But still,how am I able to get a $(S_q, w)$ plot? $\endgroup$ – Mitscaype Jan 30 '16 at 15:00
  • $\begingroup$ @Mitscaype. I think what you are calling W, I have renamed n. $\endgroup$ – m_goldberg Jan 30 '16 at 15:17
  • $\begingroup$ You are right. Thank you so much. That solved my problem! But I have one last question. All of this has to do with statistical mechanics and therefore later on, I will have to plot this kind of quantities alongside with probabilities. But then it gets complicated, find the probabiltiy which corresponds to each $n$ etc. Any good ideas where I could get material on how to make such plots? Thank you again! $\endgroup$ – Mitscaype Jan 30 '16 at 15:31
  • $\begingroup$ @Mitscaype. As for your additional question concerning probabilities, I suggest you ask a new question about that on this site when you are ready extend your work in that direction. $\endgroup$ – m_goldberg Jan 31 '16 at 5:54
  • $\begingroup$ Ok then! Will do :) Thank you once again! $\endgroup$ – Mitscaype Feb 1 '16 at 15:58

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