using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter02.Section1 { public class Example01 { public Example01() { } private string result; public string Result { get { return result; } } public void Compute() { L.Vector v1 = new L.Vector(3); v1[0] = 1.0; v1[1] = 1.0; v1[2] = 1.0; L.Vector v2 = new L.Vector(3); v2[0] = 0.0; v2[1] = 0.0; v2[2] = 0.0; L.Vector v3 = new L.Vector(3); v3[0] = 0.0; v3[1] = 0.0; v3[2] = 0.0; L.Vector x = new L.Vector(3); x[0] = 4.0; x[1] = 5.0; x[2] = 6.0; L.Vector[] columnVector = new L.Vector[3]; columnVector[0] = v1; columnVector[1] = v2; columnVector[2] = v3; L.Matrix A = new L.Matrix(columnVector); L.Vector b = A * x; result += b.ToString()+"\r\n"; L.IdentityMatrix I = new L.IdentityMatrix(3); L.Vector c = I * x; result += c.ToString() + "\r\n"; } } } /* 4 4 4 4 5 6 */