📄 sample4_1.cs
字号:
/*
* 示例程序Sample4_1: LEquations类的基本用法
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 系数矩阵数据
double[] mtxDataCoef = {
0.2368,0.2471,0.2568,1.2671,
0.1968,0.2071,1.2168,0.2271,
0.1581,1.1675,0.1768,0.1871,
1.1161,0.1254,0.1397,0.1490};
// 常数矩阵数据
double[] mtxDataConst = {
1.8471,
1.7471,
1.6471,
1.5471};
// 构造系数矩阵
Matrix mtxCoef = new Matrix(4, mtxDataCoef);
// 构造常数矩阵
Matrix mtxConst = new Matrix(4, 1, mtxDataConst);
// 构造线性方程组
LEquations leqs = new LEquations(mtxCoef, mtxConst);
Matrix mtxCoef1 = leqs.GetCoefMatrix();
Matrix mtxConst1 = leqs.GetConstMatrix();
int equNum = leqs.GetNumEquations();
int uvNum = leqs.GetNumUnknowns();
Console.WriteLine("系数矩阵 = ");
Console.WriteLine(mtxCoef);
Console.WriteLine("常数矩阵 = ");
Console.WriteLine(mtxConst);
Console.WriteLine("方程个数 = " + equNum);
Console.WriteLine("未知数个数 = " + uvNum);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -