Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'me trying to remember my math classes but no luck... I've got a pair of values i.e .


Is there a way that I can find the function associated to that so I can calculate it for any X.

share|cite|improve this question
Try to search Lagrange interpolating polynomial. – Giuseppe Nov 15 '11 at 13:35
In fact, there are infinitely many functions which have those values! – Tigran Hakobyan Nov 15 '11 at 14:16
up vote 1 down vote accepted

You are asking for "the" function, but as Tigran notes in the comments there are many many many functions that will give you those 6 values (and then differ from each other when you put in a different $x$). The only way to make progress is to know something about the type of function you are looking for. So let's go back to the beginning.

First of all, you say you have a pair of values, but you don't - you have six pairs of values. Then you say "i.e.," but I don't think you mean that. Do you mean "namely," which I would take to mean that you actually have those six pairs of values and you want a function to fit them? or do you mean "e.g.," which I would interpret to mean you are making up those six pairs and you don't have any reason to think there is a simple rule to fit them?

If it's the latter, you are out of luck. Tigran's comment applies, and the value corresponding to, say, $x=10,000,000$, could just as easily be 1,000 as $\pi$ or $-\sqrt2$ or $49867584932/409685753421$ or anything else you care to name.

So we come back to the question, do you have a reason to expect some particular kind of function is involved? If, for example, you have some reason to think there's a polynomial going on here, then Giuseppe's comment is spot on; look up Lagrange interpolation. But your values are growing too slowly for a low degree polynomial to be a likely explanation. So, again, where do those six pairs come from?

share|cite|improve this answer
Gerry thanks for your comments. I do have 6 pairs and I meant 'id est'. has a Portuguese user, its difficult do express myself. those values are: number of bytes, time to record them in milliseconds. and i want to predict the time for any given number of bytes... i found myself on a dead end because the number of variables for the equation are infinite... so i used Lagrange interpolating to estimate a value when it is whiting an interval I have, otherwise i record the time it took so i can predict values on the future... – user952887 Nov 16 '11 at 9:22
I'm surprised that the time to record isn't just a linear function of the number of bytes, but I don't pretend to any expertise in computer science. Maybe a least squares linear fit would be better than Lagrange interpolation. On the other hand, maybe this isn't a function at all. If you use the same input twice, will it take the same amount of time to record it both times? – Gerry Myerson Nov 16 '11 at 12:24
no it doesn't, it depends on many values the amount of used processor used is one of them, all of this makes it impossible to predict. Kolmogorov complexity sucks... given the amount of time given for me to solve the problem I've made that choice... the only thing I can expect its higher bytes higher milliseconds – user952887 Nov 16 '11 at 14:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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