How to fit a formula to three data points?

79 Views Asked by At

I need a very basic formula that will be used to determine a CSS line-height based on a provided font pixel size.

So in essence, I need the formula to covert

13 == > 17
15 == > 22
19 == > 27

Been going crazy all morning trying to derive a formula to do this...

1

There are 1 best solutions below

0
On BEST ANSWER

Well, three non-collinear points uniquely specify a parabola, so a simple solution would simply be to perform a quadratic regression on the points $(13, 17)$, $(15, 22)$, and $(19, 27)$. This gets you the following quadratic equation:

$\displaystyle-\frac{5}{24}x^2+\frac{25}{3}x-\frac{449}{8}$