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

This question already has an answer here:

Given any number (including decimals) between 12.5 and 87.5 I need to calculate another number based on these results:

 Input = 12.5 | 31.25 | 50 | 68.75 | 87.5
Result = 12.5 | 64.5  | 78 | 84       | 87.5

So, for example, if "input = 25" or "input = 58", what can I use to calculate a result?

The only thing I can determine from looking at these numbers is that the closer the input is to 87.5, the smaller the increment in the result. (The result of 12.5 to 13.5 would have a much greater difference than 86.5 to 87.5).

share|cite|improve this question

marked as duplicate by vadim123, Julian Kuelshammer, Amzoti, Lord_Farin, J. M. May 31 '13 at 14:35

This question was marked as an exact duplicate of an existing question.

You are looking for an interpolation function or a fitted curve that comes close to the points. It is a huge field in numerical analysis, and routines can be found in any text. If you plot the data in Excel, "Add Trendline", and "Show Equation on Graph" you can see the function and how well it fits. You can choose various functional forms to see what fits your needs.

share|cite|improve this answer
Ok, I have tried this. I messed with all of the Trendline options and the closest was Polynomial Order 4. However, it still arced over my line a bit for the first half of it. Further, it gave me this equation: y = -9E-06x4 + 0.0022x3 - 0.2073x2 + 8.9144x - 70.634 I'm doing javascript and don't have any experience with math on this level. I'm not sure how to think of that equation. I'm guessing that x is my row 1 number....but I don't know what it is actually doing in there. – m59 May 31 '13 at 14:40
@m59: A fourth order polynomial should fit five points exactly. It will wiggle worse than a lower order polynomial between the points, so you might prefer a lower order. You could look at chapter 3 of Numerical Recipes for a discussion. It is free on line. – Ross Millikan May 31 '13 at 15:27

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