using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter04.Section2 { public class ExampleA { public ExampleA() { } private string result; public string Result { get { return result; } } public void Compute() { double[,] x = { {2.0, 1.0}, {2.0, 0.0}, {1.0, 0.0}}; L.Matrix A = new L.Matrix(x); L.Vector b = new L.Vector(3); b[0] = 3.0; b[1] = 4.0; b[2] = 4.0; L.Subspace s = new L.Subspace(A); L.Projection obj = new L.Projection(s, b); result += obj.OntoSubspace.ToString() + "\r\n"; result += obj.Error.ToString() + "\r\n"; result += obj.ProjectionMatrix.ToString() + "\r\n"; } } } /* 3 4.8 2.4 4.44089209850063E-16 -0.8 1.6 1 0 0 0 0.8 0.4 0 0.4 0.2 */