All problems
Mixed Partial of a Bivariate Quadratic
Problem
For f(x, y) = a x^2 + b x y + c y^2, estimate the mixed partial f_xy with the central difference (f(x+h, y+h) - f(x+h, y-h) - f(x-h, y+h) + f(x-h, y-h)) / (4 h^2).
Given a, b, c, the point [x, y], and h (default 1e-3), return the estimate (exactly b for this quadratic up to rounding).
Hint
Only the cross term contributes to the mixed partial.
Test cases
case 1
in: [1,2,3,[0,0]]
expected: 2
case 2
in: [2,-1,0.5,[1,2]]
expected: -1.0000000000287557
case 3
in: [0,4,1,[-1,1]]
expected: 4.000000000004
Starter codePython
def mixed_partial_bivariate_quadratic(a, b, c, point, h=1e-3):
# Your code here
pass3 test cases · run your code against them in the editor