'int' object not callable when defining function [on hold]
'int' object not callable when defining function [on hold]
I have the following code:
from __future__ import division
import numpy as np
def gauss(k):
x, y = np.arange(100.0)/100.0, np.arange(100.0)/100.0
return((0.5**2/((2*3.14159)*(k**2)))*np.exp(-((1-(x-k))**2)/(2(k**2))).sum()*np.exp(-((1+k-y)**2)/(2(k**2))).sum())
And I get an error:
'int' object is not callable
I've seen answers to questions similar to this one, but I'm still stuck because I can't work out what integer in this code could possibly be causing the proble. Any help would be greatly appreciated.
This question appears to be off-topic. The users who voted to close gave this specific reason:
2(k**2)
1 Answer
1
The error is in the 2(k**2)
part (which occurs twice). There's probably an infix operator missing between the two and the parenthesis.
2(k**2)
In general, I think that line is trying to do too much at once which makes bugs hard to spot.
Thanks very much
– Iwan Phillips
Jun 30 at 11:38
The import is irrelevant:
2(k**2)
.– jonrsharpe
Jun 29 at 18:42