> points := []: > points := [op(points), [40, 436.0]]: > points := [op(points), [100, 2901.0]]: > points := [op(points), [200, 10627.0]]: > points := [op(points), [300, 23650.0]]: > points := [op(points), [500, 63510.0]]: > points := [op(points), [2000, 980025.0]]: > points; > [[40, 436.0], [100, 2901.0], [200, 10627.0], [300, 23650.0], [500, 63510.0], [2000, 980025.0]] > m := nops(points); m := 6 > x_coords := []: y_coords:=[]: yw_coords:=[]: > > for i from 1 to m do > x_coords := [op(x_coords), points[i,1]]; > y_coords := [op(y_coords), points[i,2]];yw_coords := > [op(yw_coords), Weight(points[i,2],1/points[i,1]^2)]; > od: > x_coords; [40, 100, 200, 300, 500, 2000] > y_coords; [436.0, 2901.0, 10627.0, 23650.0, 63510.0, 980025.0] > model := stats[fit,leastsquare[[x,y],y=a*x^2 + b*x + c, > {a,b,c}]]([x_coords, y_coords]); 2 model := y = .2417396892 x + 6.644678575 x - 223.2183200 > with(linalg): Warning, the protected names norm and trace have been redefined and unprotected > A := matrix(m,3): > for i from 1 to m do > for j from 0 to 2 do A[i,j+1] := x_coords[i]^j; > od: od: > print(A); [1 40 1600] [ ] [1 100 10000] [ ] [1 200 40000] [ ] [1 300 90000] [ ] [1 500 250000] [ ] [1 2000 4000000] > linsolve( evalm(transpose(A) &* A), evalm(transpose(A) &* > vector(y_coords)) ); [-223.2168495, 6.644670459, .2417396930] > floor(subs(x=10000,op(2,model))); 24240192 > yw_coords; [Weight(436.0, 1/1600), Weight(2901.0, 1/10000), Weight(10627.0, 1/40000), Weight(23650.0, 1/90000), Weight(63510.0, 1/250000), Weight(980025.0, 1/4000000)] > modelw := stats[fit,leastsquare[[x,y],y=a*x^2 + b*x + c, > {a,b,c}]]([x_coords, yw_coords]); 2 modelw := y = .2417791713 x + 6.566200967 x - 211.0466225 > floor(subs(x=10000,op(2,modelw))); 24243368 > model_w_lin_term := stats[fit,leastsquare[[x,y],y=a*x^2 + c, > {a,b,c}]]([x_coords, y_coords]); 2 model_w_lin_term := y = .2447694409 x + 1036.587255 > floor(subs(x=10000,op(2,model_w_lin_term))); 24477980 >