Estimate the diagonal of the Hessian of a scalar function: the second derivative along each coordinate axis.
Implement solve(f, x, h=1e-5).
Returns. Return a NumPy array of length n. The values are finite-difference estimates, accurate to roughly three decimals.
Example 1
Input:
solve(lambda z: float(np.sum(z**2)), [1.0, 2.0])
Output:
[2.0, 2.0]
Example 2
Input:
solve(lambda z: float(np.sum(z**3)), [1.0, 2.0])
Output:
[6.0, 12.0]
No results yet
Run your code to check it against the examples, or submit to run every test.