Solution, in Maxima, of the least-squares problem described at http://www.inference.phy.cam.ac.uk/teaching/comput/ "A straight line y = mx is to be fitted (by least squares) to a data set that happens to lie uniformly on a circle of radius 1 centred at (1,1)." ------------------------------------------------------------------- (C1) x(t) := 1+cos(t); (D1) x(t) := 1 + COS(t) (C2) y(t) := 1+sin(t); (D2) y(t) := 1 + SIN(t) (C3) integrate( (y(t)-m*x(t))**2 , t,0,2*%pi ) / (2*%pi) ; 2 3 %PI m - 4 %PI m + 3 %PI (D3) -------------------------- 2 %PI (C4) diff( % , m ) ; 6 %PI m - 4 %PI (D4) --------------- 2 %PI (C5) solve( % ) ; 2 (D5) [m = -] 3