3
* Reversion of power series
11
* double x[n+1], y[n+1];
16
* Note, polini() initializes the polynomial arithmetic subroutines;
44
* etc. The coefficients of x(y) are found by expanding
52
* and setting each coefficient of x , higher than the first,
59
* y[0] must be zero, and y[1] must be nonzero.
64
Cephes Math Library Release 2.2: July, 1992
65
Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier
66
Direct inquiries to 30 Frost Street, Cambridge, MA 02140
74
extern int MAXPOL; /* initialized by polini() */
77
void polmov(), polclr(), poladd(), polmul();
83
double *yn, *yp, *ysum;
87
mtherr( "revers", DOMAIN );
88
/* printf( "revers: y[1] = 0\n" );*/
89
j = (MAXPOL + 1) * sizeof(double);
90
yn = (double *)malloc(j);
91
yp = (double *)malloc(j);
92
ysum = (double *)malloc(j);
100
/* A_(j-1) times the expansion of y^(j-1) */
101
polmul( &x[j-1], 0, yn, n, yp );
102
/* The expansion of the sum of A_k y^k up to k=j-1 */
103
poladd( yp, n, ysum, n, ysum );
104
/* The expansion of y^j */
105
polmul( yn, n, y, n, yn );
106
/* The coefficient A_j to make the sum up to k=j equal to zero */
107
x[j] = -ysum[j]/yn[j];