fortran-lang / minpack

Modernized Minpack: for solving nonlinear equations and nonlinear least squares problems
https://fortran-lang.github.io/minpack/
Other
96 stars 20 forks source link

Curve fitting convenience interface #28

Open ivan-pi opened 2 years ago

ivan-pi commented 2 years ago

A typical usage case for non-linear least squares is curve fitting.

In the archived version of @certik, there is already a demo example of a find_fit subprogram: https://github.com/certik/minpack/blob/b46766bd42ec6f08114caf5f6d811d815f78a809/examples/example_primes.f90#L23

Both SciPy and MATLAB provide convenience functions for this purpose:

These are effectively just wrappers of the general non-linear least squares routines, which take the pair (xdata, ydata) alongside the function to be fitted.

certik commented 2 years ago

That's right. We need to add it.

jacobwilliams commented 2 years ago

I would say add the example, but don't try to provide a curve-fitting api in this library, since a general curve-fitting library should be a separate project. :) There are lot of different curve-fitting methods, and even quite a few fortran projects out there (I maintain several myself).