I have a function in Python:

def f(x):
    return x[0]**3 + x[1]**2 + 7 
    # Actually more than this.
    # No analytical expression

It's a scalar valued function of a vector.

How can I approximate the Jacobian and Hessian of this function in numpy or scipy numerically?

Edit
Report