I know this should not be difficult, probably I've been too lazy to figure it out. When I execute the python script below, I get this message: <bound method Forces.Sums of <main.Forces instance at 0x7fcecfb56a28>>. What is wrong?
import numpy
class Forces:
""" Forces between particles"""
def __init__(self, l1, l2):
self.l1 = l1
self.l2 = l2
N = len(l1)
k = list(xrange(N*N))
result = numpy.zeros(N*N) #No repetition N*(N-1)
def Sums(self):
l1, l2 = self.l1, self.l2
for i in range(0, (len(l1)-1)):
for j in range(0, (len(l2)-1)):
result[i+j] += l1[i]*l2[j]
k += 1
return result
#Demo
if __name__ == '__main__':
list1 = [1,2,3,4,5]
list2 = [6,7,8,9,10]
p = Forces(list1, list2)
print p.Sums