def testVectorOp(): x = [23, 34, 53] y = [12, 17, 7] additon = op.Addition(x, y) subtraction = op.Subtraction(x, y) innerProduct = op.InnerProduct(x, y) crossProduct = op.CrossProduct(x, y) scalarProduct = op.ScalarMultiplication(x, .5) print(additon, subtraction, innerProduct, crossProduct, x, sep='\n')
def Basis(u, v): temp = copy.deepcopy(u) VectorOperations.ScalarMultiplication( temp, VectorOperations.InnerProduct(temp, v) / lengthnorms.LengthNorm2(temp)**2) VectorOperations.ScalarMultiplication(temp, 1 / lengthnorms.LengthNorm2(temp)) orthogonal = copy.deepcopy(temp) orthogonal[0] *= -1 return temp, orthogonal