What strategy can I use to choose points for approximating an expensive-to-compute function?

70 Views Asked by At

Suppose:

  • I have some function $f(x)$ which is very expensive to compute
  • I do not have a way to calculate its derivative (except as a numerical approximation given nearby points $f(x)$)
  • I have enough computation resources to compute it at $N$ points within some interval $x\in[x_1,x_2]$.

Are there any algorithms to help choose those N points such that I can minimize the error from some kind of approximation, e.g. a spline or piecewise Chebyshev approximation?

Just as an example, consider the following function in the interval $[0,2]$:

$$f(x)=\frac{x}{e^{40(x-1)}+1} + \frac{x^2}{4e^{40(1-x)}+4}$$

It is very polynomial in subintervals $[0,3/4]$ and $[5/4,2]$, but has sharp curvature near $x=1$; in this case I'd want to put most of the $N$ points concentrated near $x=1$. But that would require me to know something about the function ahead of time. Is there a strategy that selects points as you go? For example, start evaluating at $x={0,\frac{1}{2},1,\frac{3}{2},2}$, and then look numerically to select intervals that need more points than others.

enter image description here