Hey everyone:
I'm not quite sure what I'm doing incorrectly here, but I wrote some code
which outputs a plot in the end. I start by running:
n =16;
J = 1;
h = 1;
var('T,h');
spinConfig = Tuples([-1,1],n).list()
Then, I run:
def Ham(spins,J,h):
total = J*sum(spins[x]*spins[x+1] for x in range(0,len(spins)-1)) + -h *
sum(spin for spin in spins)
return total
def Partition(spinConfig,T):
return sum(e^(-Ham(spins,J,h)/T) for spins in spinConfig)
T = 1
mag = (1/n)*derivative(-T*log(Partition(spinConfig,T)),h)
plot(mag(h),(-10,10))
Now, if I run just this last part a second time, the plot changes! Can
anyone tell me what I am doing incorrectly?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/601d776e-9ac9-40d8-ab23-1d31d53e9089%40googlegroups.com.