3 point quadratic regression formula

While developing the in-process stormer viscometer, one of my goals is to allow the end user to calibrate the device with 3 fluids of known viscosity. With a bit of help from mathematica, I’ve found the formula and for whoever wants it, it’s posted, also for my own future edification. This formula is meant to convert 3 data points of the form {X1,Y1},{X2,Y2},{X3,Y3} into a form of ax^2+bx+c=y. This is probably the fastest way to do this kind of operation on a microcontroller. Here’s an image of the formula

Reverse Quadratic from data
Reverse Quadratic from data

also, here’s a dirty FreeBasic program using it. regress-3point.bas

Also, for fun I decided to do a cubic version. This is in the form of 4 data points {X1,Y1},{X2,Y2},… converting to ax^3+bx^2+cx+d=y

Cubic equation inverse
Cubic equation inverse

You gotta love Mathematica!!!