I have a function of one variable $f(x): \mathbb{R}\to \mathbb{C}$ which is very difficult to evaluate. Single evaluations may take hours, and I need to use the function at a large variety of points.
Despite its complexity, the graph of the function is very simple; it looks nearly gaussian.
Therefore I would like to just cache individual values of the function and use some kind of interpolation in between for the intermediate values. This interpolated approximation could then be evaluated at any point.
I have not found a nice function for cacheing in mathematica nor is it obvious to me what kind of interpolation would be suited for such a problem.
Maybe someone here has expertise which they could share with me on this issue?
I have already implemented the function as a "function which remembers values it has found" but this is not sufficient as I need speedy evaluation of intermediate points as well.
Interpolation. The smoother your function is, the higher aInterpolationOrderyou may use. – Henrik Schumacher Feb 20 '20 at 14:01data = Table[{x, f[x]}, {x, xmin, xmax}];Then useInterpolation– Bob Hanlon Feb 20 '20 at 15:05Interpolationis a piecewise function (InterpolatingFunction) and will go exactly through all the points. – Gustavo Delfino Feb 20 '20 at 17:34