I would like to know if there is a technical term to cover both interpolation and extrapolation. The reason why I am asking is that I am writing a computer program to do interpolation and extrapolation using a functional-object language called Scala. In there, I would like to define a class/template that abstracts the notion of interpolation and extrapolation. At the moment it is called interpolation but that's not really reflecting all of what it really does since the same methods can be used to do extrapolation. Is there a general term that mathematicians use that cover both these areas?
You're right; indeed, both interpolation and extrapolation are broadly described by the following:
We have an unknown function $f:X\to Y$ and are given a set of points $(x_i,y_i)$ and told that $f(x_i)=y_i$ for each $i$ (or is at least approximately equal). Given $x\in X$, we estimate $f(x)$ by fitting a function $\hat f$ to the points $(x_i,y_i)$ in some way and computing $\hat f(x)$.
We normally use the term interpolation when the point $x$ lies 'between' some of the $x_i$, in an appropriate sense, and extrapolation when the point $x$ lies outside the range spanned by the set of $x_i$. The distinction is important, at least statistically: interpolation is far more likely to give you a reliable result than extrapolation.
Unfortunately, as far as I know there is no term that describes both of these procedures, even though the basic algorithm you go through is the same. We use the term curve fitting to refer to the process of fitting the function $\hat f$ to the points $(x_i,y_i)$ (at least when $X,Y$ are subsets of the real line), but curve fitting is not quite what you're looking for:
Interpolation, extrapolation $=$ curve fitting $+$ evaluation on the fitted curve
If you want to choose one word to describe both interpolation and extrapolation, you could do worse than just choosing one of them (my preference would be extrapolation; otherwise, your users might be misled into thinking that the
interpolate function always gave accurate approximations when they were in fact extrapolating) and sticking with it, putting a note in your documentation to explain that it could be used equally for interpolation as well. You could always create a dummy interface called
interpolate that is just an alias for