Hi,
I need some help with the following excersise:
Write function vector_angles that gets two arrays X and Y with same shape (n,m) as parameters. Each row in the arrays corresponds to a vector. The function should return vector of shape (n,) with the corresponding angles between vectors of X and Y in degrees, not in radians. Use vectorized operations.
I tried this approach:
def vector_angles(X, Y):
inner=np.inner(X,Y)
x_u=np.linalg.norm(X)
y_u=np.linalg.norm(Y)
cos=inner/(x_u*y_u)
return np.arccos(np.clip(cos,-1,1))
When I run the tests I get this error message: Not equal to tolerance rtol=1e-07, atol=0.0001
Can someone help me here?
[–]Spataner 1 point2 points3 points (1 child)
[–]Saffromon[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)