| 22 | } |
| 23 | |
| 24 | int main() { |
| 25 | double a[] = {0.0, 2.0, 3.0}; |
| 26 | double b[] = {1.0, 3.0, 6.0}; |
| 27 | double c[] = {4.0, 5.0, 0.0}; |
| 28 | double x[] = {7.0, 5.0, 3.0}; |
| 29 | |
| 30 | printf("The system,\n"); |
| 31 | printf("[1.0 4.0 0.0][x] = [7.0]\n"); |
| 32 | printf("[2.0 3.0 5.0][y] = [5.0]\n"); |
| 33 | printf("[0.0 3.0 6.0][z] = [3.0]\n"); |
| 34 | printf("has the solution:\n"); |
| 35 | |
| 36 | thomas(a, b, c, x, 3); |
| 37 | |
| 38 | for (size_t i = 0; i < 3; ++i) { |
| 39 | printf("[%f]\n", x[i]); |
| 40 | } |
| 41 | |
| 42 | return 0; |
| 43 | } |