?? sample4_12.java
字號(hào):
/*
* 示例程序Sample4_12: LEquations類的高斯-賽德爾迭代法
*/
package javaalgorithm.sample;
import javaalgorithm.algorithm.Matrix;
import javaalgorithm.algorithm.LEquations;
public class Sample4_12
{
public static void main(String[] args)
{
// 系數(shù)矩陣數(shù)據(jù)
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};
// 常數(shù)矩陣數(shù)據(jù)
double[] mtxDataConst11 = {
4.0,
7.0,
-1.0,
0.0};
// 構(gòu)造系數(shù)矩陣
Matrix mtxCoef11 = new Matrix(4, mtxDataCoef11);
// 構(gòu)造常數(shù)矩陣
Matrix mtxConst11 = new Matrix(4, 1, mtxDataConst11);
// 構(gòu)造線性方程組
LEquations leqs11 = new LEquations(mtxCoef11, mtxConst11);
// 高斯-賽德爾迭代法
Matrix mtxResult11 = new Matrix();
if (leqs11.getRootsetGaussSeidel(mtxResult11, 0.0001))
{
System.out.println(mtxResult11);
}
else
{
System.out.println("失敗");
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -