using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter08.Section1 { public class Example01 { public Example01() { } private string result; public string Result { get{return result;} } public void Compute() { double[,] x = {{1.0,0.0,0.0}, {-1.0,1.0,0.0}, {0.0,-1.0,1.0}, {0.0,0.0,-1.0}}; L.Matrix A = new L.Matrix(x); L.Matrix C = new L.Matrix(4,4); C[0, 0] = 1.0; C[1, 1] = 1.0; C[2, 2] = 1.0; C[3, 3] = 1.0; L.StiffnessMatrix K = new L.StiffnessMatrix(A, C); result += K.ToString(); L.Matrix KInv = K.Inverse; result += KInv.ToString(); L.Vector f = new L.Vector(3); f[0] = 1.0; f[1] = 1.0; f[2] = 1.0; L.Vector KInvf = KInv * f; result += KInvf.ToString()+"\r\n"; result += (A * KInvf).ToString(); } } } /* 2 -1 0 -1 2 -1 0 -1 2 0.75 0.5 0.25 0.5 1 0.5 0.25 0.5 0.75 1.5 2 1.5 1.5 0.5 -0.5 -1.5 */