How do I approximate the Jacobian and Hessian of a function numerically?

前端 未结 2 844
暖寄归人
暖寄归人 2021-02-03 12:24

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

2条回答
  •  执笔经年
    2021-02-03 13:22

    Restricted to just SciPy, the most convenient way I found was scipy.misc.derivative, within the appropriate loops, with lambdas to curry the function of interest.

提交回复
热议问题