vagoberto
vagoberto

Reputation: 2442

get polynomials out of an interpolating Function

Is there a way to extract the coefficients or polynomial that results from an interpolation in Mathematica?

These polynomials are functions over the real axis. But I need to evaluate one of these polynomials with a complex number. Something like this:

data = Table[ Exp[-x^2], {x,-4,4,0.4} ];
f = ListInterpolation[ data, {{-4,4}} ];

z = 3.1 + I;

g = Polynomial which evaluates f[3.1] or f[Re[z]]
g[z]

Is there a way to do this?

Upvotes: 2

Views: 1280

Answers (1)

Bill
Bill

Reputation: 3957

According to the documentation here if you click on Details and Options it says it returns an InterpolatingFunction and according to the documentation here and scroll down to the bottom and click on Properties and Relations it says it does Piecewise polynomial interpolation. Thus I don't think you are going to get "the polynomial" from this. But that does show how you could construct your own Piecewise InterpolatingPolynomial from your data. Or you could use Fit documented here to construct a single polynomial.

Upvotes: 1

Related Questions