Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-328

Coordinate Descent Quadratic Update

Problem

For the 1D restriction f(x) = 0.5 * a * x^2 - b * x with a > 0, the coordinate-wise minimizer is x* = b / a.

Given a and b, return the update.

Hint

Set the scalar derivative a x - b to zero.

Test cases

case 1
in: [2,4]
expected: 2
case 2
in: [1,-3]
expected: -3
case 3
in: [0.5,1]
expected: 2
Starter codePython
def coordinate_descent_quadratic_update(a, b):
    # Your code here
    pass

3 test cases · run your code against them in the editor