Mathematica How Can I Plot Energy Level Occupation Numbers in Mathematica?

AI Thread Summary
The discussion centers on plotting energy level occupation numbers in Mathematica, with the user successfully generating a distribution but struggling to plot energy levels and heat capacity. They provide code snippets for calculating the distribution and seek guidance on defining the variable for energy, E, and the sum limit, sumlim. Clarification is requested regarding the purpose of the sum and the specific values needed for accurate plotting. The user expresses a desire to replicate a Java implementation in Mathematica while learning the programming language. Assistance is sought to resolve these issues and successfully create the desired plots.
Munin
Messages
4
Reaction score
0
So, I've managed to get the distribution in a decent way. Using this code;

Code:
hw = 1;
kt = 25;
n = 10000;
dist[b_] := 1/(b*Exp[hw*m/kt] - 1);
normsum[b_] := Sum[dist[b]*(m + 2)*(m + 1)/2, {m, 0, 300}]
q = FindRoot[normsum[b] == n, {b, 0.5}]
occnumber = Table[N[dist[b /. q]*(m + 2)*(m + 1)/2], {m, 0, sumlim}];
Part[occnumber, 1];
ListPlot[occnumber, PlotRange -> {0, 500}]

Now I want to plot the Energy level occupation numbers where

E=Sum[m*hw*(m+1)*(m+2)*0.5/b*Exp[m*hw/kt]-1

But, I've been unable to do so, and then of course I want to get the Heat Capacity as a function of the temperature, but I think I might be able to manage that if I get some help on this.

I've been stuck for hours, please help me!
 
Physics news on Phys.org
In your code above you didn't say what value sumlim should have. I'm guessing perhaps 300 to get a reasonable plot.

Are you really saying you want to assign the value of a Sum to E==2.71828?
Or do you want to assign the value of a sum to a variable of your own?

What are you trying to Sum over? I can't see if your problem is with the Sum or the Plot until you give more information. Your Sum appears to be incomplete.
 
Yea, the Sum should be 300. It would be easier if I just showed you what I'm trying to do:
The thing I'm trying to do is explained in:
http://www.eg.bucknell.edu/physics/ligare/ajp_bose1.pdf"

I want to get the Heat Capacity-Plot.

I've done it in Java, now all I want to do it in Mathematica as well as I'm trying to learn the language.
 
Last edited by a moderator:
If you have an extraordinarily simple and well done Java implementation that looks like and is organized just like the mathematics in the paper and you wanted to show your code then it should be a pretty simple task of replacing that line by line with Mathematica.

Often it is possible to reorganize the result and replace several lines or even whole sections with a single Mathematica function, but that may be optional.
 

Similar threads

Replies
1
Views
2K
Replies
2
Views
2K
Replies
2
Views
3K
Replies
10
Views
2K
Replies
1
Views
2K
Replies
3
Views
3K
Replies
1
Views
4K
Replies
5
Views
2K
Replies
23
Views
11K
Back
Top