# Is there a way to find out that two set of numbers generated by same function

So the question is "kinda" simple. But i don't think that the answer exist.

I have function ( usually simple ones )

(for example) f(x) = x*2;

And two sets of numbers

(for example) ( 2,4,6,8 ) and ( 10,12,14,16 )

So the question is - is there a way to find that those two sets are generated by the same function without computing every value of the function?

So here is what i can do. I can calculate function for certain ammount of values. From 1 to 10 ( f(1) = 2; f(2) = 4 ect.. ), and then compare results. But i don't want to do that. I want to do as little as possible, and be able to say that those values are from the same function.

Is there a simple way?

PS: more examples of functions - f(x) = sin(x), f(x) = 1/x, f(x) = x^2 ect..

-
Every sets of values are generated by $f(x)=x$. I'm not clear on whether your question let you choose your function or not, but this at least answer the case when you can choose. –  Gina Jan 6 '14 at 23:19
Well, that's the problem, i have it predefined so i can't "choose" function. –  Ai_boy Jan 6 '14 at 23:23
@Ai_boy You seem to think that a given set of data can only be generated by one function. That isn't nearly the case! –  Nick Peterson Jan 6 '14 at 23:24
I know what you talking about but what i trying to say that the function is given to me. Like f(x) = sin(x). And two sets of values. And i need to tell is it from same function or not. I could choose function then i would difinetly folowed your advice. But i can't :) –  Ai_boy Jan 6 '14 at 23:27

If you give me any two finite sets of points, I can always find a function which "generates" both. One way to do this is, assuming you have $n$ points $a_1,a_2,\ldots,a_n$, to consider the $(x,y)$-pairs $(1,a_1),(2,a_2),\ldots,(n,a_n)$ and use Polynomial Interpolation.

-
ok, one stupid question. Should those two finite sets be equal at size? –  Ai_boy Jan 6 '14 at 23:21
Nope! It doesn't matter. If you give me a set of 10 points and a set of 4 points, I can always find a polynomial (in fact, a polynomial of degree at most 13, in this case) which passes through all of the points $(i,a_i)$. –  Nick Peterson Jan 6 '14 at 23:22
Well thanks, i'm going to dig into 'Polynomial Interpolation'. Couse i can admit that i don't know anything about it :) Tnx anyway. –  Ai_boy Jan 6 '14 at 23:34
@Ai_boy look up splines while you are reading, too. –  username Jun 7 '14 at 9:09

I think the most useful theorem to use here is going to be the intermediate value theorem. If you know that $f$ is continuous, and you know value of $f(x_{1})$ and $f(x_{2})$ at any 2 points $x_{1}$ and $x_{2}$ you pick and the function are defined everywhere between the 2 points, then for any $f(x_{1})\leq y\leq f(x_{2})$ there exist an $x$ where $x_{1}\leq x\leq x_{2}$ where $y=f(x)$. Since all your function are continuous, all you need to find is to find 2 values of the function, one is upper bound and one is lower bound.

-
One problem. How to find this 'upper bound'? Should i just pick it randomly or i can "compute" it? –  Ai_boy Jan 6 '14 at 23:30
Use your intuition to guess where it is, then compute. For example, you know $\frac{1}{x}$ will go to infinity when $x$ go to $0$ so pick a small positive $x$ that is good enough for your purpose to get an upper bound, and lower bound is by picking a very large $x$. You know that $\sin(\frac{\pi}{2})=1$ and $\sin(-\frac{\pi}{2})=-1$ and that is in fact the best bound for the sine function already. Similar for other case. Given any odd degree polynomial, you know it will go to both side of infinity, so pick $x$ large enough positively and negatively. –  Gina Jan 6 '14 at 23:37
So basicly I can 'predefine' for each function it's 'lower' and 'upper' bounds and then compute results based on that? –  Ai_boy Jan 6 '14 at 23:41
@Ai_boy: I'm not sure what you means by that. You already predefine the function isn't it? So you can't actually choose its upper bound and lower bound. You can, however, choose where to compute at where you guess to be good bounds, and if the bound is good enough for you to conclude that all the number in the set is generated by the function. –  Gina Jan 6 '14 at 23:45
Basicly what i'm asking is there a functions that can give me lower and upper bounds for given function :) like l(f) = getLover(f)? –  Ai_boy Jan 6 '14 at 23:55