Some helper methods and examples of how to find an orthonormal basis
import numpy as np
def gs(X):
Q, R = np.linalg.qr(X)
return Q
This shows how an ON basis can be found. Columns of a are the ON-basis (so they are already normalized)
Note: Since we are engineers, 5.55111512e-17 = 0 in most of the cases.
m = np.array([[1,1,1],[1,1,0], [1,0,0]])
gs(m)
This shows the orginal
vectors that we would get if we did not normalize.
We then normalize them to show that they are equivalent to those we got above.
v1 = np.array([1, 1,1])
v1/np.linalg.norm(v1)
v2 = np.array([-1/3, -1/3, 2/3])
v2/np.linalg.norm(v2)
v3 = np.array([1/2, -1/2, 0])
v3/np.linalg.norm(v3)