using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter10.Section3 { public class Example01 { public Example01() { } private string result; public string Result { get { return result; } } public void Compute() { Science.Mathematics.Complex[,] x = new Science.Mathematics.Complex[2,2]; x[0, 0] = new Science.Mathematics.Complex(2.0, 4.0); x[0, 1] = new Science.Mathematics.Complex(1.0, -1.0); x[1, 0] = new Science.Mathematics.Complex(4.0, 5.0); x[1, 1] = new Science.Mathematics.Complex(-3.0, 2.0); L.MatrixComplex A = new L.MatrixComplex(x); Science.Mathematics.Complex[] y = new Science.Mathematics.Complex[2]; y[0] = 1.0 + Science.Mathematics.Constant.I * 3.0; y[1] = 4.0 - Science.Mathematics.Constant.I; L.VectorComplex b = new L.VectorComplex(y); L.LinearEquationComplex obj = new L.LinearEquationComplex(A, b); obj.Solve(); result += obj.Solution[0].ToString() + "\r\n"; result += obj.Solution[1].ToString() + "\r\n"; } } } /* 0.481967213114754 -I 0.101639344262295 -0.822950819672131 +I 0.452459016393443 */