Suppose that we are given a sample of input-output pairs of a deterministic function. To make it concrete, I can generate input-output pairs of a function I myself created (for example $y = 240 + 20x - 12x^2)$. The function might be linear or non-linear. But there are no unknown noise or other contributing factors.

The aim is to identify the function from the given inputs and ouputs. In such a situation which techniques are possible to use? Can I use regression techniques or are there better alternatives?

  • $\begingroup$ It depends on what you think the possible functions might be. There will be an infinite number of functions which fit your data. For example, if you have $(1,2), (2,3), (3,5), (4,7), (5,11)$ then OEIS gives many many suggestions including the prime numbers, the number of partitions of $x+1$, $\lfloor (3/2)^{x+1}\rfloor$, and $(3x^4-34x^3+141x^2-206x+144)/24$ $\endgroup$
    – Henry
    Feb 25, 2023 at 14:25

1 Answer 1


What you aiming to do is called Interpolation in mathematics.

It is important to remember that no finite dataset can exactly determine a function over an infinite domain without stringent assumptions that hold. The best you can hope for is decent interpolation for the values in between the values you know. Furthermore if you know that the function falls into a certain class of functions such as sinusoids or polynomials then it can make your life a lot easier.

Mathematical assumptions about what kind of functions are allowed can be very powerful. In the extreme case if you know that your function is made from a sum of a finite number of waves that are within a given range of frequency and your samples are more than twice as dense as the highest frequency then you can determine that function exactly given the samples. That is a proven mathematical fact.

I would start by reading up on interpolation and the difficulties at a high level. Then play around with the SciPy tools for interpolation using simple functions you choose.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.