?? sample4_12.cs
字號:
/*
* 示例程序Sample4_12: LEquations類的高斯-賽德爾迭代法
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 系數矩陣數據
double[] mtxDataCoef11 = {
7.0,2.0,1.0,-2.0,
9.0,15.0,3.0,-2.0,
-2.0,-2.0,11.0,5.0,
1.0,3.0,2.0,13.0};
// 常數矩陣數據
double[] mtxDataConst11 = {
4.0,
7.0,
-1.0,
0.0};
// 構造系數矩陣
Matrix mtxCoef11 = new Matrix(4, mtxDataCoef11);
// 構造常數矩陣
Matrix mtxConst11 = new Matrix(4, 1, mtxDataConst11);
// 構造線性方程組
LEquations leqs11 = new LEquations(mtxCoef11, mtxConst11);
// 高斯-賽德爾迭代法
Matrix mtxResult11 = new Matrix();
if (leqs11.GetRootsetGaussSeidel(mtxResult11, 0.0001))
{
Console.WriteLine(mtxResult11);
}
else
{
Console.WriteLine("失敗");
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -