using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter03.Section2 { public class Example04 { public Example04() { } private string result; public string Result { get{return result;} } public void Compute() { double[,] a = {{1.0, 5.0, 7.0}, {0.0, 0.0, 9.0} }; double[,] b = {{1.0, 2.0, 3.0}}; double[,] c = {{1.0,0.0}, {4.0,3.0}, {2.0,3.0}}; double[,] x = { { 1.0, 2.0, 3.0, 5.0, 0.0}, { 2.0, 4.0, 8.0, 12.0, -6.0}, { 3.0, 6.0, 7.0, 13.0, 6.0} }; L.Matrix C = new L.Matrix(x); L.FactorizationEAeqR obj = new L.FactorizationEAeqR(C); obj.Compute(); result += obj.Elimination.ToString(); result += obj.ReducedRowEchelonForm.ToString(); L.Nullspace N = new L.Nullspace(C); foreach (L.Vector v in N.Basis) result += v.ToString(); } } } /* 1 -0.777777777777778 0 0.111111111111111 1 5 8.88178419700125E-16 0 0 1 -5 1 0 */