All problems
Directional Derivative with Normalized Vector
Problem
The directional derivative of a differentiable function at a point in direction v is grad dot v, and normalizing v gives the slope per unit distance.
Given the gradient and a nonzero direction vector, return grad dot (v / ||v||).
Hint
Divide the dot product by the Euclidean norm of the direction.
Test cases
case 1
in: [[3,4],[1,0]]
expected: 3
case 2
in: [[1,0,0],[2,3,6]]
expected: 0.2857142857142857
case 3
in: [[1,-1],[1,1]]
expected: 0
Starter codePython
def directional_derivative_normalized(grad, direction):
# Your code here
pass3 test cases · run your code against them in the editor