using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter06.Section3 { public class ExampleA { public ExampleA() { } private string result; public string Result { get { return result; } } public void Compute() { double[,] x = { {-2.0, 1.0, 0.0}, {1.0,-2.0, 1.0}, {0.0, 1.0,-2.0}}; L.Matrix P = new L.Matrix(x); L.FactorizationAeqSLSi obj = new L.FactorizationAeqSLSi(P); obj.Compute(); result += obj.Eigenvectors.ToString() + "\r\n"; result += obj.Eigenvalues.ToString() + "\r\n"; L.MatrixComplex A = obj.Eigenvectors; L.VectorComplex b = new L.VectorComplex(3); b[0] = new Science.Mathematics.Complex(2.0, 0.0); b[1] = new Science.Mathematics.Complex(0.0, 0.0); b[2] = new Science.Mathematics.Complex(2.0, 0.0); L.LinearEquationComplex eq = new L.LinearEquationComplex(A, b); eq.Solve(); foreach (Science.Mathematics.Complex c in eq.Solution) result += c.ToString() + "\r\n"; } } } /* -0.500000000000001 0.707106781186548 -0.5 -0.707106781186548 1.24425301739437E-17 0.707106781186547 -0.5 -0.707106781186548 -0.5 -0.585786437626905 0 0 0 -2 0 0 0 -3.41421356237309 -2 -1.88411095042053E-15 -2 */