⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample4_6.cs

📁 用于矩阵的各种运算
💻 CS
字号:
/*
 * 示例程序Sample4_6: LEquations类的求解三对角线方程组的追赶法
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 系数矩阵数据
            double[] mtxDataCoef5 = {
                                        13,12,0,0,0,
                                        11,10,9,0,0,
                                        0, 8,7,6,0,
                                        0, 0,5,4,3,
                                        0, 0,0,2,1};
            // 常数矩阵数据
            double[] mtxDataConst5 = {
                                         3.0,
                                         0.0,
                                         -2.0,
                                         6.0,
                                         8.0};
		
            // 构造系数矩阵
            Matrix mtxCoef5 = new Matrix(5, mtxDataCoef5);
            // 构造常数矩阵
            Matrix mtxConst5 = new Matrix(5, 1, mtxDataConst5);

            // 构造线性方程组
            LEquations leqs5 = new LEquations(mtxCoef5, mtxConst5);
		
            // 求解三对角线方程组的追赶法
            Matrix mtxResult5 = new Matrix();
            if (leqs5.GetRootsetTriDiagonal(mtxResult5))
            {
                Console.WriteLine(mtxResult5);
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
	}
}

⌨️ 快捷键说明

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