質問編集履歴
2
コードの編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,9 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
```
|
13
|
+
```
|
14
|
-
|
15
|
-
|
16
14
|
|
17
15
|
#include <iostream>
|
18
16
|
|
@@ -40,23 +38,35 @@
|
|
40
38
|
|
41
39
|
{-3.0,7.0,9.0,5.0},{6.0,-12.0,-9.0,3.0}};
|
42
40
|
|
41
|
+
double ai[N][N]={{0.0,0.0,0.0,0.0},{0.0,0.0,0.0,0.0},
|
42
|
+
|
43
|
+
{0.0,0.0,0.0,0.0},{0.0,0.0,0.0,0.0}}; ;//逆行列用
|
44
|
+
|
43
|
-
double b[N]={27.0, 4.0,11.0,49.0};
|
45
|
+
double b[N]={27.0, 4.0,11.0,49.0};
|
44
|
-
|
45
|
-
double ai[N][N]={};//逆行列用
|
46
46
|
|
47
47
|
SLE_by_LU(x,a,b); // LU 分解により連立1次方程式を解く関数の呼び出し
|
48
48
|
|
49
|
-
InvMat(a,ai);
|
49
|
+
InvMat(a,ai);//逆行列の計算関数呼び出し
|
50
|
+
|
51
|
+
|
50
52
|
|
51
53
|
/* データ出力 */
|
52
54
|
|
53
|
-
for(int i=0; i<N; i++) cout << 'x' << i+1 << '=' << setw(12) <<
|
55
|
+
for(int i=0; i<N; i++) {cout << 'x' << i+1 << '=' << setw(12) <<
|
54
56
|
|
55
57
|
fixed << setprecision(9) << x[i] << endl;
|
56
58
|
|
59
|
+
}
|
60
|
+
|
61
|
+
for(int i=0; i<N; i++){
|
62
|
+
|
63
|
+
for(int j=0; j<N; j++){
|
64
|
+
|
57
|
-
|
65
|
+
cout<<ai[i][j]<<endl; //逆行列出力
|
66
|
+
|
58
|
-
|
67
|
+
}
|
68
|
+
|
59
|
-
|
69
|
+
}
|
60
70
|
|
61
71
|
return 0;
|
62
72
|
|
1
コードの編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
+
```ここに言語を入力
|
14
|
+
|
13
15
|
|
14
16
|
|
15
17
|
#include <iostream>
|
@@ -213,3 +215,5 @@
|
|
213
215
|
}
|
214
216
|
|
215
217
|
}
|
218
|
+
|
219
|
+
```
|