Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168731
Image: ubuntu2004
#Schroeder Thermal Physics problem 3.17 #Properties of a two-state paramagnet with 100 dipoles in magnetic field B. #Nup is the number of dipoles pointing up.
N = 100 U = [] #list of values of U/mu/B for Nup in range(N+1): U.append([Nup, N - 2*Nup]) from sage.plot.scatter_plot import ScatterPlot scatter_plot(U, marker='s')
range(0,N/2-1)+[N/2]+range(N/2+2,N+1)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
M = [] #list overall Magnetism values M/N/mu for Nup in range(N+1): M.append([Nup, 2*Nup/N - 1]) scatter_plot(M, marker='s')
Omega = [] #list values of the multiplicity for Nup in range(N+1): Omega.append([Nup, binomial(N,Nup)]) scatter_plot(Omega, marker='s')
S = [] #list of values of the entropy S/k for Nup in range(N+1): S.append([Nup, ln(binomial(N,Nup))]) scatter_plot(S, marker='s')
T = [] #list values of Temperature k*T/mu/B def Temp(Nup): DU = (N-2*(Nup+1)) - (N-2*(Nup-1)) #difference in U between next and previous Nup value DS = ln(binomial(N,Nup+1)) - ln(binomial(N,Nup-1)) return DU/DS #DU/DS approximates the derivative dU/dS = T for Nup in range(N+1): if Nup!=50: #skip trouble spot (division by zero) T.append([Nup, Temp(Nup)]) scatter_plot(T, marker='s')
#looks like 1/x, so try taking the reciprocal of previous plot's y-axis #1/T vs Nup oneOverT = [] #start list values of Temperature 1/(k*T/mu/B) for Nup in range(1,N/2)+range(N/2+1,N): oneOverT.append([Nup, 1/Temp(Nup)]) scatter_plot(oneOverT, marker='s')
range(1,N/2-1)+[N/2]+range(N/2+2,N)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
C = [] #list values of Heat Capacity C/N/k = d(U/mu/B)/d(k*T/u/B)/N for Nup in range(1,N/2-1)+[N/2]+range(N/2+2,N): #skip trouble spots DU = (N-2*(Nup+1)) - (N-2*(Nup-1)) DT = Temp(Nup+1) - Temp(Nup-1) C.append([Nup, DU/DT]) #DU/DT approximates the derivative dU/dT scatter_plot(C, marker='s')
range(1,N/2-1)+range(N/2+2,N)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
#Heat Capacity as a function of Temperature CT = [] for Nup in range(1,N/2-1)+range(N/2+2,N): #avoid dividing by zero DU = (N-2*(Nup+1)) - (N-2*(Nup-1)) DT = Temp(Nup+1) - Temp(Nup-1) CT.append((n(Temp(Nup), digits=4), n(DU/DT, digits=4))) #DU/DT approximates the derivative dU/dT scatter_plot(CT, marker='s', aspect_ratio='.5')