It is my pleasure to announce the first release of the package
curve-sampling which provides adaptive sampling of functions (and more generally parametric curves) so they can be represented graphically with a minimal number of evaluations.
Curve_sampling takes the viewpoint that the evaluation function may be costly, so one specifies the number of evaluations one wants. For example, a representation of x ↦ x sin(1/x) with 227 evaluations gives (rendered with Gnuplot but
Curve_sampling is independent of a rendering engine):
The chosen evaluation points are displayed on the following graph:
As a comparison, here is the graph produced by Mathematica for the same function (which uses a different procedure which does not allow to limit the number of evaluations, only the recursion depth, here 5, yielding to the evaluation at 227 points):
With 389 evaluations (recursion depth of 6 for Mathematica), the graphs become:
Enjoy the library and, if you have functions that are not sampled well with the current algorithm, do not hesitate to fill an issue.
Have a nice day,