I am trying to fit a function of the form f(x)=1/x
or somthing like f(x)=1/poly(x)
to this data:
I try to use scipy.optimize.curve_fit which do works but not return the regression itself, I want to know the function itself that succeeded in fitting the data. Also, I thought about an option of rotating and using np.polyfit but I don't really know how to invert it back to a function of that form.
This is my data for about 12 points:
x_points= [8, 9, 10, 11, 12, 13, 14, 16, 17, 20, 22, 26]
y_points=[26, 22, 20, 17, 16, 14, 13, 12, 11, 10, 9, 8]
I can generate more data but not more than about 100 points, it is more of a sub-problem to the original problem, for confusion reasons only, I will not explain here where the data came from, it will be a tedious explanation and won't benefit to the understanding the problem
If you have no model coming from physics try various mathemetical models up to find a satisfising one. For example with the exponential function :
Don't be surprised if the values of the parameters that you get with your software are slightly different from the above values (a, b, c). The criteria of fitting implicitly set in your software is probably different from the criteria of fitting set in my software.
The method of regression used above is a Least Mean Square Errors wrt a linear integral equation to which the exponential equation is solution. Ref.: https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales
This non-standard method isn't iterative and doesn't require initial "guessed" values of parameters.
Below the MathCad code and numerical example :