sample4_8.cs

来自「C#的数值计算的几乎所有算法」· CS 代码 · 共 51 行

CS
51
字号
/*
 * 示例程序Sample4_8: LEquations类的求解对称方程组的分解法
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 系数矩阵数据
            double[] mtxDataCoef7 = {
                                        5.0,7.0,6.0,5.0,1.0,
                                        7.0,10.0,8.0,7.0,2.0,
                                        6.0,8.0,10.0,9.0,3.0,
                                        5.0,7.0,9.0,10.0,4.0,
                                        1.0,2.0,3.0,4.0,5.0};
            // 常数矩阵数据
            double[] mtxDataConst7 = {
                                         24.0,96.0,
                                         34.0,136.0,
                                         36.0,144.0,
                                         35.0,140.0,
                                         15.0,60.0};
		
            // 构造系数矩阵
            Matrix mtxCoef7 = new Matrix(5, mtxDataCoef7);
            // 构造常数矩阵
            Matrix mtxConst7 = new Matrix(5, 2, mtxDataConst7);

            // 构造线性方程组
            LEquations leqs7 = new LEquations(mtxCoef7, mtxConst7);
		
            // 求解对称方程组的分解法
            Matrix mtxResult7 = new Matrix();
            if (leqs7.GetRootsetDjn(mtxResult7))
            {
                Console.WriteLine(mtxResult7);
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?