Hey, so I've started doing a plasma physics research project and one of the things that I have to do is design a function which approximates a curve based on data points that its fed. So far I found the formula for creating a linear regression, but I'm having trouble finding the formulas for quadratic and higher level polynomial regressions. I know that a calculator can do it, but I can't find source code in any language to compare it to. More or less what I'm looking for is either code in some language like this one y = mx + b """ Sx = Sy = Sxx = Sxy = Syy = 0.0 n = len(pairs) for x,y in pairs: Sx = Sx + x Sy = Sy + y Sxx = Sxx + x*x Sxy = Sxy + x*y Syy = Syy + y*y m = ((n * Sxy) - (Sx * Sy)) / ((n * Sxx) - Sx ** 2) b = (Sy - (m * Sx)) / n r = ((n * Sxy) - (Sx * Sy)) / (math.sqrt((n * (Sxx)) - (Sx ** 2)) * math.sqrt((n * Syy) - (Sy ** 2))) print("y = %sx + %s" % (m, b)) print("r = %s" % r) return m, b, r Where I can just translate it Except for something which gives the formulas for polynomial functions like y= ax^2+bx+c Where this gives the quadratic regression formula Or simply the formula for calculating quadratic regression, cubic regression and so on. I would like to go as high as sixth order but please if you have anything that would help please post it.