Reputation: 9
The problem is that i have this function:
def fuerza_repulsion(x):
area = 100 * 100
k = math.sqrt(area / len(self.grafo[0]))
return ((k**2 / x) * c2)
and in this line
f_mod = self.fuerza_repulsion(math.sqrt(dx**2 + dy**2))
i have this error:
TypeError: fuerza_repulsion() takes exactly 1 argument (2 given)
How can i fix it?
Upvotes: 0
Views: 11916
Reputation: 1254
It looks like your function is part of a class, in which case the first argument of the function needs to be self
, the class object itself. (Also, as @SRC pointed out, you generally call class functions 'methods')
So therefore use:
def fuerza_repulsion(self, x):
area = 100 * 100
k = math.sqrt(area / len(self.grafo[0]))
return ((k**2 / x) * c2)
Upvotes: 6