Ich komme bei folgender Python Funktion (Hartman -function), wohl auf zu grosse Zahlen:
def f14(x):#ToDo: Remove Warning
a = [[-32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32],
[-32, -32, -32, -32, -32, -16, -16, -16, -16, -16, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32]]
a = np.array(a)
b = 0
for j in range(0, 25):
x1 = int(x[0])
x2 = int(x[1])
a1j = int(a[0][j])
a2j = int(a[1][j])
b = b + (1/(j+1+(np.power((x1-a1j), 6) + np.power((x2-a2j), 6))))
return 1/((1/500)+b)
print(f14([1,2]))
Denn beim ausführen wird zwar das richtige Ergebnis ausgegeben, aber es erscheint auch der Error:
"RuntimeWarning: overflow encountered in int_scalars".
Wie beseitige ich den Error?
PS: das np steht für das numpy package