我被要求寫使用中央差「詮釋」在Python代碼uncallable
"Central difference formula"
def difc(f,x,h):
h = float(h)
return (f(x + h) - f(x - h))/2*h
"Entraphy function"
f = 259.8*(3.782*x - 2.997*(10**-3)*(x**2)/2 + 9.847*(10**-6)*(x**3)/3 - 9.681*(10**-9)*(x**4)/4 + 3.243*(10**-12)*(x**5)/5 - 1.064*10**3)
"temperature"
x = 500
print (difc(f,500,5))
一個程序當我運行的代碼中,我得到的錯誤
line 9, in derivative
return (f(x+h) - f(x))/h
TypeError: 'int' object is not callable"
我在哪裏去了錯誤?
[我得到的可能重複「類型錯誤:‘名單’對象不是可調用」。如何修復這個錯誤?](https://stackoverflow.com/questions/45740182/im-getting-typeerror-list-object-is-not-callable-how-do-i-fix-this-error) –