All problems
Total Differential Estimate
Problem
For f(x, y) = a*x^2 + b*y^2 + c*x*y, estimate the change in f for a small step (dx, dy) with the total differential:
df ≈ f_x * dx + f_y * dy
where f_x = 2*a*x + c*y and f_y = 2*b*y + c*x. Evaluate the differential at (x, y).
Hint
The total differential is the dot product of the gradient with the displacement.
Test cases
case 1
in: [1,1,0,1,1,0.1,0.2]
expected: 0.6000000000000001
case 2
in: [1,0,1,0,0,0.5,1]
expected: 0
case 3
in: [2,3,1,1,2,0.01,-0.02]
expected: -0.2
case 4
in: [0,0,0,3,4,1,1]
expected: 0
Starter codePython
def total_differential(a, b, c, x, y, dx, dy):
# Your code here
pass4 test cases · run your code against them in the editor