Hi,
I'm happy to announce the first release of curve-sampling, a library that helps to draw graphs or images of functions with few evaluations of them. For example, one samples the function x ↦ x·sin(1/x) using solely 200 evaluations with
use curve_sampling::Sampling;
let s = Sampling::uniform(|x| x * (1. / x).sin(), 0., 4.).n(200).build();
The sampling can then be saved to a file (whose format is compatible with Gnuplot) with
s.write(&mut BufWriter::new(File::create("sin.dat")?))?;
Passing this file to Gnuplot yields
Here is another picture that shows the points selected by the library in order to have a graphic as accurate as possible given the constraint on the number of function evaluations.
There is also a LaTeX export that allows to add arrows to indicate the orientation of the curves. Here is a example to convey the dynamic of an ODE system.
Feedback is welcome.
Enjoy,
Christophe