Why does the following code return the following output?
def z(x, y):
return (x + 2*y + 1)**2
delta = 0.1
x_derivative = (z(delta, 0) - z(0, 0)) / delta
print(x_derivative)
Output: 2.100000000000002
If my maths is correct, it should just be 2.1
.
This has probably be asked before, but I don't know the right terms to search for.