Let's say you need to write a polynomial function that exactly goes through certain points. For example, let's say you need a polynomial that will go through (1, 3), (2, 8), and (4, 2). The easiest way to do this is by splitting your polynomial into three parts: f(x) = A(x) + B(x) + C(x). The trick is that A(1) = 3, B(1) = 0, and C(1) = 0; B(2) = 8, A(2) = 0, and C(2) = 0; and C(4) = 2, A(4) = 0, and B(4) = 0. Because A(1) = 3, A(2) = 0, and A(4) = 0, therefore A(x) = (x - 2)(x - 4).
Likewise, because B(2) = 8, B(1) = 0, and B(4) = 0, therefore B(x) = -4 (x - 1)(x - 4).
And finally, because C(4) = 2, C(1) = 0, and C(2) = 0, therefore
That means our final function is
Of course, one can simplify it into a traditional quadratic, or one can just leave it in this form. Tip of the hat to Marc Rios for alerting me to this method, attributed to Lagrange.
No comments:
Post a Comment