/* Wilkinson's famous example */ #define N 10 int main() { array double x[N], p[N+1]; linspace(x, 1, N); printf("x = %f\n", x); polycoef(p, x); printf("p = %f\n", p); roots(x, p); printf("x = %f\n", x); }
x = 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000 9.000000 10.000000 p = 1.000000 -55.000000 1320.000000 -18150.000000 157773.000000 -902055.000000 3416930.000000 -8409500.000000 12753576.000000 -10628640.000000 3628800.000000 x = 9.000000 10.000000 8.000000 7.000000 6.000000 5.000000 4.000000 3.000000 2.000000 1.000000