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

📄 sample4_7.cs

📁 使用C#编辑的一些矩阵运算的源程序
💻 CS
字号:
/*
 * 示例程序Sample4_7: LEquations类的一般带型方程组的求解
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 系数矩阵数据
            double[] mtxDataCoef6 = {
                                        3.0,-4.0,1.0,0.0,0.0,0,0,0,
                                        -2.0,-5.0,6.0,1.0,0.0,0,0,0,
                                        1.0,3.0,-1.0,2.0,-3.0,0,0,0,
                                        0,2.0,5.0,-5.0,6.0,-1.0,0,0,
                                        0,0,-3.0,1.0,-1.0,2.0,-5.0,0,
                                        0,0,0,6.0,1.0,-3.0,2.0,-9.0,
                                        0,0,0,0,-4.0,1.0,-1.0,2.0,
                                        0,0,0,0,0,5.0,1.0,-7.0};
            // 常数矩阵数据
            double[] mtxDataConst6 = {
                                         13.0,29.0,-13.0,
                                         -6.0,17.0,-21.0,
                                         -31.0,-6.0,4.0,
                                         64.0,3.0,16.0,
                                         -20.0,1.0,-5.0,
                                         -22.0,-41.0,56.0,
                                         -29.0,10.0,-21.0,
                                         7.0,-24.0,20.0};
		
            // 构造系数矩阵
            Matrix mtxCoef6 = new Matrix(8, mtxDataCoef6);
            // 构造常数矩阵
            Matrix mtxConst6 = new Matrix(8, 3, mtxDataConst6);

            // 构造线性方程组
            LEquations leqs6 = new LEquations(mtxCoef6, mtxConst6);
		
            // 一般带型方程组的求解
            Matrix mtxResult6 = new Matrix();
            if (leqs6.GetRootsetBand(5, mtxResult6))
            {
                Console.WriteLine(mtxResult6);
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
	}
}

⌨️ 快捷键说明

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