Modifications
This commit is contained in:
parent
659896de63
commit
5023793832
|
@ -6,13 +6,13 @@
|
||||||
|
|
||||||
// 1)
|
// 1)
|
||||||
|
|
||||||
float D3diag(int n, double* a, double* b, double* c) {
|
double D3diag(int n, double* a, double* b, double* c) {
|
||||||
float D[n];
|
double D[n];
|
||||||
int i;
|
int i;
|
||||||
D[0] = b[0];
|
D[0] = b[0];
|
||||||
D[1] = b[0] * b[1] - a[1] * c[0];
|
D[1] = b[0] * b[1] - a[1] * c[0];
|
||||||
for (i = 2; i < n; i++) {
|
for (i = 2; i < n; i++) {
|
||||||
D[i] = b[i] * D[i-1] - a[i] * c[i-2] * D[i-2];
|
D[i] = b[i] * D[i-1] - a[i] * c[i-1] * D[i-2];
|
||||||
}
|
}
|
||||||
return D[i];
|
return D[i];
|
||||||
}
|
}
|
||||||
|
|
2
TP2/E4.c
2
TP2/E4.c
|
@ -25,8 +25,10 @@ int main() {
|
||||||
int X[N] = {2,8,-3,5,9,-4,-2,0,1,16};
|
int X[N] = {2,8,-3,5,9,-4,-2,0,1,16};
|
||||||
int DX[N][N];
|
int DX[N][N];
|
||||||
int i;
|
int i;
|
||||||
|
printf("-- X ");
|
||||||
afficherTableau(X, N);
|
afficherTableau(X, N);
|
||||||
soustraire(X, DX[0], N);
|
soustraire(X, DX[0], N);
|
||||||
|
printf("-- D1X");
|
||||||
afficherTableau(DX[0], N-1);
|
afficherTableau(DX[0], N-1);
|
||||||
for (i = 0; i < N-1; i++) {
|
for (i = 0; i < N-1; i++) {
|
||||||
soustraire(DX[i], DX[i+1], N-i);
|
soustraire(DX[i], DX[i+1], N-i);
|
||||||
|
|
Reference in a new issue