In [7]:
import numpy as np x = np.array([-6, -8]) v_hat2 = x / (x**2).sum()**0.5 print(v_hat2)
[-0.6, -0.8]
In [8]:
import numpy as np x = np.array([-5, -4]) v_hat = x / linalg.norm(x) print(v_hat)
[-0.78086881 -0.62469505]
In [7]:
import numpy as np x = np.array([-6, -8]) v_hat2 = x / (x**2).sum()**0.5 print(v_hat2)
[-0.6, -0.8]
In [8]:
import numpy as np x = np.array([-5, -4]) v_hat = x / linalg.norm(x) print(v_hat)
[-0.78086881 -0.62469505]