bopit is pretty spooky Kappa
banned-users
Phi Kappa Chi ΦΚΧ <a:yeah:589703000977571860><a:ppHop:536353159615086612>
Jump to date
Friday, September 22, 2017
Need to approximate madelung's constant for NaCl
Been stuck for 2 hours
cannot figure out how to sum my shit
not working
I know that
restarting my computer
I give up
will work on this tomorrow
do you want help?
Okay, do you know how to go from this
to getting a sum of all the values of M that this shit prints out
When I try making it an array, it tells me it is a 0d array and will not let me sum it, and I cannot figure out how to make it a non 0d array
np.zeros(1,1)
or just use a normal python array
do you need them individually or can you just sum them from the start?
I just need to sum them
to some large L
do
M=0 before the for loops then where you are computing them do M += ?no need to use an array
what is the ? supposed to be
your equation
Well, I am getting it to sum now
so thanks for that
but it seems to not be summing to the right value
so fml
it was just printing the last M in the list
or rather the last m calculated
I might have been able to do this Kappa
Running a test with large L
will take 6 years to run this test
seems to be summing each individual thing and printing each individual sum Kappa
Seems to only run each possible combination of i, j, k
minus 0,0,0 since I restricted that
correct value is -1.748 according to wikipedia
that is with L = 15, so it is working kind of
Just need to get it to only print the last value
permutations
order matters
it is a point in 3d space
yeah, if I can just get this thing to print the last calculated sum, I am good
Saturday, September 23, 2017
Fucking liar
Fucking
no shit
A month late
being bilingual is required though
is it, for english speakers?
for being an elected official
It is required that we teach french in schools and Quebec teaches english in theirs though
i wholesomely enjoy Justin Trudeau
I do not
fuck that guy
and everything about him
Haha my dudes I did it
you ended it all?
nice.
Got it to work
you shouldn't need to cast as float when you specify 1.0
I did not specify as 1.0 at first
forgot to take that out
wanna see my version? Kappa
doesn't python 3 need things casted
and sure
specifying the decimal casts to float
alright
i was bored so i wrote a much more in depth version of what you were working on
Already excited
from math import sqrt
import numpy as np
import matplotlib.pyplot as plt
def centeredgen(L):
for i in range(L+1):
for j in range(L+1):
for k in range(L+1):
yield i,j,k
if k > 0:
yield i,j,-k
if j > 0:
yield i,-j,k
if k > 0:
yield i,-j,-k
if i > 0:
yield -i,j,k
if k > 0:
yield -i,j,-k
if j > 0:
yield -i,-j,k
if k > 0:
yield -i,-j,-k
if __name__ == "__main__":
L = 30
M = 0.0
a = []
gen = centeredgen(L)
next(gen) # skip the 0,0,0
sign2 = lambda n: " " if n >= 0 else ""
sign = lambda n: " "*(3-len(str(n)))
for i,j,k in gen:
h = ((-1.0)**(i+j+k))/sqrt(i*i+j*j+k*k)
M += h
a += [M]
print("%s%d,%s%d,%s%d -> %s%01.4f => %s%01.4f"%(sign(i),i,sign(j),j,sign(k),k,sign2(h),h,sign2(M),M))
print("\nMean estimate: %.4f" % np.mean(a))
plt.plot(a)
plt.show()
rip me
