# # Numerical Mathematics and Computing, Fifth Edition # Ward Cheney & David Kincaid # Brooks/Cole Publ. Co. # (c) 2003 # # file: lstsq3 # # nonpolynomial least squares example with(stats): Xvalues := [0.24, 0.65, 0.95, 1.24, 1.73, 2.01, 2.23, 2.52, 2.77, 2.99]; Yvalues := [0.23, -0.26, -1.10, -0.45, 0.27, 0.10, -0.29, 0.24, 0.56, 1.00]; fit[leastsquare[[x,y], y=a*ln(x)+b*cos(x)+c*exp(x), {a,b,c}]]([Xvalues, Yvalues]);