Различите различную дифференциацию

# function wrt to differentate
def cu(x):
    return x*x*x

# differentation function
# Slightly increase x and compute the result. 
# Then compute the ratio of change in result with change in x
def diff(fun, x):
    delta = 0.000000001
    y = fun(x)
    x1 = x+delta
    y1 = fun(x1)
    return (y1-y) / (x1-x)

# X^3 = 3X^2
diff(cu,2)
# >>12.0
coder