RosettaCodeData/Task/Singular-value-decomposition/Mathematica/singular-value-decomposition.math
2026-04-30 12:34:36 -04:00

15 lines
335 B
Text

(* Define the matrix *)
matrix = {{3, 0}, {4, 5}};
(* Perform singular value decomposition *)
{u, s, v} = SingularValueDecomposition[matrix];
(* Display results with 10 decimal places *)
Print["U matrix:"]
N[u, {Infinity, 10}] //Print
Print["S matrix:"]
N[s, {Infinity, 10}] //Print
Print["V matrix:"]
N[v, {Infinity, 10}] //Print