Modifications

This commit is contained in:
Geoffrey Frogeye 2016-03-09 08:28:07 +01:00
parent 659896de63
commit 5023793832
2 changed files with 5 additions and 3 deletions

View file

@ -6,13 +6,13 @@
// 1)
float D3diag(int n, double* a, double* b, double* c) {
float D[n];
double D3diag(int n, double* a, double* b, double* c) {
double D[n];
int i;
D[0] = b[0];
D[1] = b[0] * b[1] - a[1] * c[0];
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];
}

View file

@ -25,8 +25,10 @@ int main() {
int X[N] = {2,8,-3,5,9,-4,-2,0,1,16};
int DX[N][N];
int i;
printf("-- X ");
afficherTableau(X, N);
soustraire(X, DX[0], N);
printf("-- D1X");
afficherTableau(DX[0], N-1);
for (i = 0; i < N-1; i++) {
soustraire(DX[i], DX[i+1], N-i);