I hope this is easy but I need to get the numbers 16 13 and 12 from 1 2 and 3 via a mathematical formula. For the life of me I fail at this can anyone help me with this?
He used the Excel solver function, i think. If you really wanted to do it, you can use "system of equations".
You can take a look at the points and deduce that a quadratic curve should fit the data, so you use
Y = AX^2 + BX + C
and then each data point would generate an equation, totaling 3 equations and 3 unknowns (A,B, and C). Solve for A,B,C and you have your coefficients for your equation.
You can fit curves to data in excel and make it display the formula.
For this particular problem you just set up an solve a linear system. You know that it's going to be a quadratic polynomial because there are three points. You know the general formula for that is y = a*x^2 + b * x + c. Each (x, y) pair corresponds to an equation so you have the following equations:
a + b + c = 16
a*4 + b*2 + c = 13
a*9 + b*3 + c = 12
Apparently according to excel, the solution is a = 1, b = -6, and c = 21 (I haven't checked, don't see much point :P). You can use gaussian elimination to determine this on paper systematically(it's not that bad for 3x3, they likely didn't teach you the explicit method for this but it's really easy and you can look it up on wikipedia or something) or you can just brute force substitute.
Since I was really ashamed of myself I thought at little bit more :D
By guessing that it is a second degree polynomial equation [ y = ax^2 + bx + c ]...
We have (by sending our y at the right of the equation) .....[ 0 = ax^2 + bx + c - y ]
These 3 equations!
[1]: 0 = a + b + c - 16 ( 0 = a(1)^2 + b(1) + c )
[2]: 0 = 4a + 2b + c - 13 ( 0 = a(2)^2 + b(2) + c )
[3]: 0 = 9a + 3b + c -12 ( 0 = a(3)^2 + b(3) + c )
===============
- Step 1 : Solving a by reduction -
1) [2] - [1] = (4a - a) + (2b - b) + (c - c) + (-13 - (-16)) = 3a + b + 3 ----------> b = -3a - 3
2) [3] - [2] = (9a - 4a) + (3b - 2b) + (c - c) + (-12 - (-13)) = 5a + b + 1 ------> b = -5a - 1
- Step 2 : Solving b -
(by putting our solved a in either of b equations)
b = -3a - 3 = -3(1) - 3 = -6 --------------> b = -6
or
b = -5a - 1 = -5(1) -1 = -6 ---------------> b = -6
- Step 3 : ??? -
(by using one of the 3 beginning equations with a = 1 and b = -6)
0 = a + b + c - 16 ----------> 0 = 1 + (-6) + c - 16 --------> c = -21
or
0 = 4a + 2b + c - 13 -------> 0 = 4(1) + 2(-2) + c - 13 ------> c = -21
or
0 = 9a + 3b + c - 12 -------> 0 = 9(1) + 3(-2) + c - 12 ------> c = -21
- Step 4: Profit!! -
(by putting our determined letters in the [ ax^2 + bx + c ] equation)
a = 1
b = -6
c = -21
Wow, that's uh crazy. I was never much of a math person but damn that sure is a lot of effort. Thank you though cause that really simplifies part of one of my functions :x I was using an if then else statement and honestly it prolly would have worked but I'm trying to keep my functions as streamlined as I can.
I hope this is easy but I need to get the numbers 16 13 and 12 from 1 2 and 3 via a mathematical formula. For the life of me I fail at this can anyone help me with this?
Are you talking about something like a function where you would input 1 as the x and it would give you 16 as y?
(1,16) (2,13) (3,12)
?
@Koronis: Go
Yep.
While we wait for a math guru to explain us how (completly forgot how...how sad is this lol high school stuff :( ),
this is easily done with excel : x^2 - 6x + 21
@Koronis: Go
You just blew my mind! No idea how you did that (not a math person here) but yeah thank you!
@Sneakervek: Go
He used the Excel solver function, i think. If you really wanted to do it, you can use "system of equations".
You can take a look at the points and deduce that a quadratic curve should fit the data, so you use
Y = AX^2 + BX + C
and then each data point would generate an equation, totaling 3 equations and 3 unknowns (A,B, and C). Solve for A,B,C and you have your coefficients for your equation.
You can fit curves to data in excel and make it display the formula.
For this particular problem you just set up an solve a linear system. You know that it's going to be a quadratic polynomial because there are three points. You know the general formula for that is y = a*x^2 + b * x + c. Each (x, y) pair corresponds to an equation so you have the following equations: a + b + c = 16 a*4 + b*2 + c = 13 a*9 + b*3 + c = 12
Apparently according to excel, the solution is a = 1, b = -6, and c = 21 (I haven't checked, don't see much point :P). You can use gaussian elimination to determine this on paper systematically(it's not that bad for 3x3, they likely didn't teach you the explicit method for this but it's really easy and you can look it up on wikipedia or something) or you can just brute force substitute.
@Catalisk
Since I was really ashamed of myself I thought at little bit more :D
By guessing that it is a second degree polynomial equation [ y = ax^2 + bx + c ]...
We have (by sending our y at the right of the equation) .....[ 0 = ax^2 + bx + c - y ]
These 3 equations!
[1]: 0 = a + b + c - 16 ( 0 = a(1)^2 + b(1) + c )
[2]: 0 = 4a + 2b + c - 13 ( 0 = a(2)^2 + b(2) + c )
[3]: 0 = 9a + 3b + c -12 ( 0 = a(3)^2 + b(3) + c )
===============
- Step 1 : Solving a by reduction -
1) [2] - [1] = (4a - a) + (2b - b) + (c - c) + (-13 - (-16)) = 3a + b + 3 ----------> b = -3a - 3
2) [3] - [2] = (9a - 4a) + (3b - 2b) + (c - c) + (-12 - (-13)) = 5a + b + 1 ------> b = -5a - 1
1 = 2 ----------> -3a - 3 = -5a - 1 ---------> a = 1
- Step 2 : Solving b -
(by putting our solved a in either of b equations)
b = -3a - 3 = -3(1) - 3 = -6 --------------> b = -6
or
b = -5a - 1 = -5(1) -1 = -6 ---------------> b = -6
- Step 3 : ??? -
(by using one of the 3 beginning equations with a = 1 and b = -6)
0 = a + b + c - 16 ----------> 0 = 1 + (-6) + c - 16 --------> c = -21
or
0 = 4a + 2b + c - 13 -------> 0 = 4(1) + 2(-2) + c - 13 ------> c = -21
or
0 = 9a + 3b + c - 12 -------> 0 = 9(1) + 3(-2) + c - 12 ------> c = -21
- Step 4: Profit!! -
(by putting our determined letters in the [ ax^2 + bx + c ] equation)
a = 1
b = -6
c = -21
we've found: x^2 - 6x - 21!!!!!!!!!!!
:D
Wow, that's uh crazy. I was never much of a math person but damn that sure is a lot of effort. Thank you though cause that really simplifies part of one of my functions :x I was using an if then else statement and honestly it prolly would have worked but I'm trying to keep my functions as streamlined as I can.
@Koronis: Go
That's linear algebra for you...