All problems
First Order Optimality Check
Problem
An unconstrained differentiable objective is numerically stationary at a point when the Euclidean norm of the gradient is below a tolerance.
Given the gradient and the tolerance, return True when the point passes the first-order optimality check.
Hint
This is only necessary, not sufficient, for a minimum.
Test cases
case 1
in: [[1e-9,-1e-9],0.000001]
expected: true
case 2
in: [[0.1,0],0.05]
expected: false
case 3
in: [[0,0],0]
expected: false
Starter codePython
def first_order_optimality_check(grad, tol):
# Your code here
pass3 test cases · run your code against them in the editor