How Can I Plot Energy Level Occupation Numbers in Mathematica?

Click For Summary

Discussion Overview

The discussion revolves around plotting energy level occupation numbers in Mathematica, specifically focusing on the implementation of a code that calculates these numbers and the subsequent heat capacity as a function of temperature. The scope includes programming challenges, mathematical reasoning, and conceptual understanding of energy distributions.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant shares a code snippet for calculating the distribution of energy levels and expresses difficulty in plotting the energy level occupation numbers and heat capacity.
  • Another participant questions the unspecified value of 'sumlim' in the code and seeks clarification on whether the participant intends to assign a sum to a variable or a specific value.
  • A participant confirms that 'sumlim' should be 300 and references a paper to explain their goal of creating a heat capacity plot, indicating prior experience with a Java implementation.
  • Another participant suggests that if the Java implementation is well-organized, it could be straightforward to translate it into Mathematica, potentially simplifying the process by using Mathematica functions.

Areas of Agreement / Disagreement

Participants have not reached a consensus, as there are differing views on the specifics of the code implementation and the approach to translating the Java code into Mathematica.

Contextual Notes

The discussion lacks clarity on certain assumptions, such as the exact nature of the sum being calculated and the intended structure of the Mathematica code. There are also unresolved questions regarding the completeness of the provided code.

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 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 23 ·
Replies
23
Views
11K
  • · Replies 3 ·
Replies
3
Views
2K