Estimate the Taylor polynomial of f at x by polynomial fitting
A polynomial Parameters ———- f : callable
The function whose Taylor polynomial is sought. Should accept a vector of x values.
Returns: | p : poly1d
|
---|
Notes
The appropriate choice of “scale” is a tradeoff - too large and the function differs from its Taylor polynomial too much to get a good answer, too small and roundoff errors overwhelm the higher-order terms. The algorithm used becomes numerically unstable around order 30 even under ideal circumstances.
Choosing order somewhat larger than degree may improve the higher-order terms.