Since Accipiter22 seems unable to try the confusing directions above, I'll actually show them to him. There is no need to beat around the bush like everyone else here is doing. I'll use DrPizza's formula and do it step by step.
Accipiter22, I really hope you read this and try it yourself. I took the time to type it out, I hope you take the time to write it out yourself with a piece of paper and solve it with me.
Assumptions:
[*]Assume you want a polynomial.
[*]Assume you want a polynomial that exactly matches all the points you gave.
Then, with those assumptions, we can continue:
[*]Since you have 3 known points, that polynomial MUST have 3 terms to be guaranteed to fit any 3 points. You may be lucky with fewer terms, but in most cases, you need 3 terms for 3 points. If you had 5 points, you'd need 5 terms.
[*]DrPizza gave a clear example of a polynomial with three terms. However, he made it very confusing. So let me make it less confusing. Lets use this polynomial:
[*]Do you see how there are three terms? "c" is one term. "d*A" is another term. "e*A*A" is the third term. If you wanted more terms for more known points, just continue the pattern.
See if you have enough data to solve the problem:
[*]That equation above has three missing pieces of information. What do "c", "d", and "e" equal? We just don't know yet.
[*]You have three independent pieces of information: B=0 when A=2.5, B=1 when A=4, and B=2 when A=5.
[*]Since you have three data points and three unknowns, this can be solved easilly. IF these numbers don't match, it is much more difficult to solve. But since they do match, this is a ~8th grade math problem (give or take a year depending on your school).
Plug in the data into the equation:
[*]We will do this three times because we have three unknowns and three data points.
[*]#1: A=2.5, B=0. Thus, plugging it into the equation:
- 0 = c + d*2.5+ e*2.5*2.5.
[*]#2: A=4, B=1. Thus, plugging it into the equation:
[*]#3: A=5, B=2. Thus, plugging it into the equation:
**Solve the equations for "c", "d", or "e":
[*]There are many, many ways to proceed, I will show you one possible way to solve this. Other ways may be easier or harder for you. But all you'll ever need to know in life is one method. Learn it, and you'll be able to solve everything. Math teachers tend to try to confuse students into learning a dozen ways to solve this same problem then force the students to use all the methods. Guess what? It just confuses the fuc& out of the students. I will show you one way, and it will always work (even if the dozen other methods may be easier in some cases).
[*]Choose any equation out of the three above. I will choose the first one: 0 = c + d*2.5+ e*6.25. You could choose any of the other equations, it will always work.
[*]I simplified it a bit by multiplying 2.5*2.5 = 6.25. Always simplify if possible. It'll keep your problem clean, managable, and less confusing.
[*]Rearrange to get ANY of the variables alone on one side. I will choose "c". A little subtraction gives you this:
[*]Do you understand how I got this?
[*]Bingo! I already know what "c" is equal to. All I have to do is find "d" and "e" and I'll know "c".
**Plug "c" into either of the other equations.
[*]Pick either equation #2 or #3. Remember we already used #1, so forget it ever existed. I'll pick equation #2: 1 = c + d*4+ e*4*4.
[*]We know what c is equal to. I bolded it above. Thus plug it into equation #2.
- 1 = (- d*2.5 - e*6.25) + d*4+ e*4*4.
[*]Do you see where I put what "c" was equal to into that equation?
[*]Simplify to make life easier. I will combine "d*4" and "-d*2.5" to be "d*1.5". Also I will combine the "e" terms. The final result is:
Repeat the steps marked with ** above.
[*]Solve for "d" or "e". I'll choose "d"
- d*1.5 = 1 - e*9.75.
d = (1 - e*9.75)/1.5.
d = 2/3 - e*6.5.
[*]Bingo! Now we know what "d" is! Of course, unfortunately we just have to first find "e".
[*]Do you remember where above I said we can solve for "c" if we only knew "d" and "e"? Well, now we know "d". Lets simplify "c":
- c = - d*2.5 - e*6.25 = -(2/3 - e*6.5)*2.5 - e*6.25.
[*]Do you see where I plugged in the formula for "d"?
[*]That is a nasty formula, I will simplify it (I'll let you try this part on your own). The simplified version is:
[*]Look! Now all we need to do is to find "e" and we'd know both "c" and "d".
[*]Plug "c" and "d" into the third and final equation: 2 = c + d*5+ e*5*5.
- 2 = (- 5/3 + e*10) + (2/3 - e*6.5)*5 + e*25.
[*]Do you see how I plugged those in?
[*]Oh crap! This is complicated again. I always say, simplify to make life easier. Do a little algebra (I'll let you do this on your own) and you get:
[*]Solve for "e":
- e*2.5 = 2 - 5/3 = 1/3.
e = (1/3)/2.5 = 1 / 7.5 = 0.133333333.
Find "c" and "d":
[*]We needed to know "e" to find both "c" and "d". Since we now know "e", we can do it all.
- c= - 5/3 + e*10 = -5/3 + 10/7.5 = -1/3 = -.333333333333.
d = 2/3 - e*6.5 = 2/3 - 6.5/7.5 = -1/5 = -0.2.
We know it all. Plug, "c", "d", and "e" into the original equation:
- B = -1/3 + -0.2*A + 1/7.5
Problem solved. This looks long and complicated, but it can be done in under 5 minutes with some practice. With Excel, it can be done in under 30 seconds. Jedec started it, I'll show you the Excel result.
Click me!