0% found this document useful (0 votes)
37 views3 pages

Maple 3

The document demonstrates using the least squares method to fit polynomial functions to sets of data points. It performs linear, quadratic, cubic, and quartic regression on four different datasets to find the coefficients of the polynomials that best fit the data. For each fit, it substitutes a value into the polynomial to check the result.

Uploaded by

HKHKBOOKS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views3 pages

Maple 3

The document demonstrates using the least squares method to fit polynomial functions to sets of data points. It performs linear, quadratic, cubic, and quartic regression on four different datasets to find the coefficients of the polynomials that best fit the data. For each fit, it substitutes a value into the polynomial to check the result.

Uploaded by

HKHKBOOKS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

O p:=interp([1,2,3,4,5,6,7,8,9,10],[1.3,3.5,4.2,5.0,7.0,8.8,10.

1,
12.5,13.0,15.6],x);
p := 0.00007164903227 x9 K0.003127480266 x8 C0.05718584874 x7 K0.5698264133 x6
5

(1)

C3.378032576 x K12.26852504 x C27.40284704 x K37.40852517 x


C31.31186805 x K10.60000106
O plot({p},x=1..10);

14

12

10

2
1

10

x
O p:=interp([2,2.5,4],[0.5,0.4,0.25],x);
2
p := 0.05000000000 x K0.4250000000 x C1.150000000

(2)

O evalf(subs(x=3,p));
0.3250000000

(3)

O restart:with(stats):
O xvals:=[0,0.25,0.5,0.75,1];
xvals := 0, 0.25, 0.5, 0.75, 1

(4)

O yvals:=[1,1.284,1.6487,2.117,2.7183];
yvals := 1, 1.284, 1.6487, 2.117, 2.7183

(5)

O z:=fit[leastsquare[[x,y],y=a*x^2+b*x+c,{a,b,c}]]([xvals,yvals]);
z := y = 0.8436571429 x2 C0.8641828571 x C1.005137143
(6)
O evalf(subs(x=1.7,z));
y = 4.912417143

(7)

O restart:with(stats):
O xvals:=[1,2,3,4,5,6,7,8,9,10];
xvals := 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

(8)

O yvals:=[1.3,3.5,4.2,5.0,7.0,8.8,10.1,12.5,13.0,15.6];
yvals := 1.3, 3.5, 4.2, 5.0, 7.0, 8.8, 10.1, 12.5, 13.0, 15.6

(9)

O z:=fit[leastsquare[[x,y],y=a*x+b,{a,b}]]([xvals,yvals]);
z := y = 1.538181818 x K0.3600000000

(10)

O evalf(subs(x=1.7,z));
y = 2.254909091

(11)

xvals := 2, 2.5, 4

(12)

O restart:with(stats):
O xvals:=[2,2.5,4];
O yvals:=[0.5,0.4,0.25];
yvals := 0.5, 0.4, 0.25

(13)

O z:=fit[leastsquare[[x,y],y=a*x+b,{a,b}]]([xvals,yvals]);
z := y = K0.1192307692 x C0.7211538462

(14)

O evalf(subs(x=3,z));
y = 0.3634615386

(15)

xvals := 2, 2.5, 4

(16)

O restart:with(stats):
O xvals:=[2,2.5,4];
O yvals:=[0.5,0.4,0.25];
yvals := 0.5, 0.4, 0.25

(17)

O z:=fit[leastsquare[[x,y],y=a*x^2+b*x+c,{a,b,c}]]([xvals,yvals]);
z := y = 0.05000000000 x2 K0.4250000000 x C1.150000000
(18)
O evalf(subs(x=3,z));
y = 0.3250000000

(19)

xvals := 2, 2.5, 4

(20)

O restart:with(stats):
O xvals:=[2,2.5,4];
O yvals:=[0.5,0.4,0.25];
yvals := 0.5, 0.4, 0.25

(21)

O z:=fit[leastsquare[[x,y],y=a*x^3+b*x^2+c*x+d,{a,b,c,d}]]([xvals,
yvals]);
z := y = a x3 C 0.05000000000 K8.500000000 a x2 C K0.4250000000 C23. a x
(22)

C1.150000000 K20. a
O evalf(subs(x=3,z));
y = K0.50000000 a C0.3250000000

(23)

You might also like