Consider a function of the form
y = a1x + a0.
If two distinct points (x1,y1) and
(x2,y2) are known, then the coefficients
a0 and a1 are given by
a0 = x2y1 - x1y2
------------
x2 - x1
a1 = y2 - y1
--------
x2 - x1
If one point (x1,y1) is known, along with
the slope m, then the coefficients
a0 and a1 are given by
a0 = y1 - mx1 a1 = m
Consider a function of the form
y = a2x2 + a1x + a0.
If three distinct points (x1,y1),
(x2,y2) and
(x3,y3) are known, then the coefficients
a0, a1 and
a2 are given by
a0 = y1x2x3(x3 - x2) + y2x1x3(x1 - x3) + y3x1x2(x2 - x1)
-------------------------------------------------
(x2 - x1)(x3 - x1)(x3 - x2)
a1 = y1(x22 - x32) + y2(x32 - x12) + y3(x12 - x22)
-------------------------------------------
(x2 - x1)(x3 - x1)(x3 - x2)
a2 = y1(x2 - x3) + y2(x1 - x3) + y3(x2 - x1)
---------------------------------------
(x2 - x1)(x3 - x1)(x3 - x2)
If two distinct points (x1,y1) and
(x2,y2) are known, along with the slope
z3 at x = x3,
then the coefficients
a0, a1 and
a2 are given by
a0 = y1x2(x2 - 2x3) - y2x1(x1 - 2x3) + z3x1x2(x2 - x1)
-----------------------------------------------
(x2 - x1)(x1 + x2 - 2x3)
a1 = 2y1x3 - 2y2x3 + z3(x22 - x12)
----------------------------
(x2 - x1)(x1 + x2 - 2x3)
a2 = -y1 + y2 + z3(x1 - x2)
-----------------------
(x2 - x1)(x1 + x2 - 2x3)
Note that these results are invalid if x3 = (x1 + x2)/2.
If one point (x1,y1) is known,
along with the slopes
z2 at x = x2 and
z3 at x = x3
(x2 and x3 being distinct
values), then the coefficients
a0, a1 and
a2 are given by
a0 = 2y1(x2 - x3) - z2x1(x1 - 2x3) + z3x1(x1 - 2x2)
---------------------------------------------
2(x2 - x3)
a1 = -z2x3 + z3x2
-------------
x2 - x3
a2 = z2 - z3
----------
2(x2 - x3)
Note that these results reduce to a linear function if z2 = z3.
Copyright © 2011 by L. M. Stockman - All Rights Reserved