All problems
Newton Step for Quadratic 2D
Problem
For f(x) = 0.5 x^T A x - b^T x, the Newton step from x is x_new = x - A^{-1} (A x - b), which reaches the minimizer in one step for a symmetric positive definite A.
Given A as nested rows, b, and x, return the updated point.
Hint
Compute the gradient, invert the 2x2 Hessian, and subtract.
Test cases
case 1
in: [[[2,0],[0,4]],[2,8],[0,0]]
expected: [1,2]
case 2
in: [[[1,0],[0,1]],[1,1],[3,-2]]
expected: [1,1]
case 3
in: [[[2,1],[1,2]],[1,1],[0,0]]
expected: [0.3333333333333333,0.3333333333333333]
Starter codePython
def newton_step_quadratic_2d(a, b, x):
# Your code here
pass3 test cases · run your code against them in the editor