Computes the partial derivative of f(x) with respect to x_i
    This is done by setting d/dx_j (x)=0 forall j != i

def partial(f, x, i):
    """
    Computes the partial derivative of f(x) with respect to x_i
    This is done by setting d/dx_j (x)=0 forall j != i
    """
    result = f(*[AdFloat(x_j, j == i) for j, x_j in enumerate(x)])
    return result.dx