Beispiel #1
0
 static void Main2(string[] args)
 {
     NVector A = new NVector(new double[] { 1, 3, 5, -2, 0 });
     NVector B = new NVector(new double[] { -1, -2, 3, 1, 2 });
     NVector C = A + B;
     Console.WriteLine("A =" + A.ToString("0.000"));
     Console.WriteLine("B =" + B.ToString("0.000"));
     Console.WriteLine("A+B =" + C.ToString("0.000"));
     double p = A.Dot(B);
     NMMatrix E = A.Cross(B);
     Console.WriteLine("A x B =" + E.ToString("0.000"));
     E[4, 0] = -2;
     E[4, 1] = 3;
     E[4, 2] = 5;
     E[4, 3] = -5;
     E[4, 4] = 7;
     E[0, 0] = -7;
     E[1, 3] = -3;
     E[3, 4] = -3.5;
     E[2, 4] = -2;
     NMMatrix H = new NMMatrix(new double[,] { { 5, 3, -2 ,1}, { 0, 3, 2,-3 }, { 4, 2, 3,2 }, { -6, 2, 8,-5 } });
     Console.WriteLine("H =" + H.ToString("0.000"));
     NVector V = new NVector(new double[] { 1, -1, 3, -2 });
     Console.WriteLine("V =" + V.ToString("0.000"));
     Console.WriteLine(" V / H =" + (V / H).ToString("0.0000"));
     NMMatrix HI = H.Inverse();
     Console.WriteLine("Inverse H =" + HI.ToString("0.000"));
     Console.WriteLine("H * HI " + (H * HI).ToString("0.00000"));
     Console.ReadKey();
     NVector F = C / E;
     NMMatrix G = E.Inverse();
     NMMatrix N = (G * E - NMMatrix.I(5)).Apply((LinearAlgebra.F)Math.Abs);
     double e = N.Max();
     Console.WriteLine((e*1E15).ToString("0.00"));
     Console.ReadKey();
 }