All problems
Quadratic Closed Form Iterate
Problem
For f(x) = 0.5 * a * x^2, gradient descent with step lr produces x_k = x0 * (1 - lr * a)^k.
Given x0, lr, a, and the number of steps k, return x_k.
Hint
The iterate is geometric in the factor (1 - lr * a).
Test cases
case 1
in: [1,0.1,2,5]
expected: 0.3276800000000001
case 2
in: [2,0.5,1,3]
expected: 0.25
case 3
in: [1,1,2,4]
expected: 1
Starter codePython
def quadratic_closed_form_iterate(x0, lr, a, steps):
# Your code here
pass3 test cases · run your code against them in the editor