Interpolate reciprocal function from a set of points

65 views Asked by At

Not sure whether to post this here or on Mathematics. Anyway my problem is that I have a set of points that describe a curve like the following

enter image description here

The points end abruptly at x=18 and I want to impute how the curve will continue later on. I reckon that the curve descends in a 1/x fashion after reaching the initial spike. However I would like to find the exact function that approximates best my points.

Moreover I would like to put an end to the curve, i.e. I want to see the curve if it reaches 0 at x=36 or 48 or 60 and obtain the equation accordingly.

I tried to solve this problem by using the numpy.Polynomial.fit function but with no luck (I believe that this is because the Polynomial.fit will not impute a reciprocal function). The results I obtained were not satisfactory as shown by the following picture (second degree polynomial). You can see that the curves do not reach the 0 at the desired x (36, 48 and 60) and they also show an abrupt step at the beginning of the interpolation. second degree polynomials as computed by Polynomial.fit

Is there a method to do so?

1

There are 1 answers

0
vakvakvak On

If the curve is roughly y=1/x, take the logarithm in both axis, and fit a polynomial log(y)=P(log(x)), which should be close to a straight line.

Your curve also looks like y[i]=c1*y[i-1]+c2*y[y-2]+...+cn*y[i-n], so you can make a cloud of points (y[i], y[i-1], y[y-2], ..., y[i-n]), and fit a multivariate polynomial to those points.