A polynomial p(x) of degree n can be used to approximate a function f(x) by setting the coefficients of p(x) to match the first n coefficients of the power series of f(x) (expanded about x = 0). For example,
1/(1-x)≈1 + x + x2 + ... + xn.
Unfortunately, polynomials are "nice" and they do not work well when they are used to approximate functions that behave poorly (e.g. those with singularities). To overcome this problem, we can instead approximate functions by rational functions of the form p(x)/q(x), where p(x) and q(x) are polynomi-als. You have been asked by Approximate Calculation Machinery to solve this problem, so they can incorporate your solution into their approximate calculation software.
Given m, n, and the first m + n coefficients of the power series of f(x), we wish to compute two polynomials p(x) and q(x) of degrees at most m-1 and n-1,respectively, such that the power series expansion of q(x)*f(x)-p(x) has 0 as its first m+n-1 coefficients, and 1 as its coefficient corresponding to the xm+n-1 term. In other words, we want to find p(x) and q(x) such that
q(x)*f(x)-p(x)=xm+n-1+...
where ... contains terms with powers of x higher than m+n-1 From this, f(x) can be approximated by p(x)/q(x).
Background Definitions
A polynomial p(x) of degree n can be written as p0 + p1x + p2x2 + ... + pnxn, where pi's are integers in this problem.
A power series expansion of f(x) about 0 can be written as f0 +f1x+f2x2+... , where fi's are integers in this problem.