# # Numerical Mathematics and Computing, Fifth Edition # Ward Cheney & David Kincaid # Brooks/Cole Publ. Co. # (c) 2003 # # file: sing_val_decomp # # Using Maple Linear Algebra package to determine # the singular-value decomposition of the matrix A: with(LinearAlgebra): A := Matrix([[1, 3, -2],[2, 7, 5],[-2, -3, 4],[5, -3, -2]]); U,Vt := SingularValues(A, output=['U','Vt']); S:=SingularValues(A, output=['list']); map(evalf[8],%); Sig := DiagonalMatrix( S[1..3], 3, 4); U.Sig.Vt; with(LinearAlgebra): A := Matrix([[1.,3.,-2.],[2.,7.,5.], [-2.,-3.,4.],[5.,-3.,-2.]]); U,S,Vt := SingularValues(A, output=['U','S','Vt']); DD := DiagonalMatrix( [S[1],S[2],S[3]],4,3); B := evalf(U.DD.Vt, 6);