Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Alan Roy Redulla Computer Applications for ME

BSME 3-A ME 3111


Exercise 4

 Linear Regression (#1)

xi yi xi × y i xi2 n x́ ý
6 29 174 36 11 21.27273 14.45455
7 21 147 49
11 29 319 121
15 14 210 225
17 21 357 289
21 15 315 441
23 7 161 529
29 7 203 841
29 13 377 841
37 0 0 1369
39 3 117 1521 a1 -0.78055
∑ 234 159 2380 6262 a0 31.0589

y=31.0589−0.78055 x
 Quadratic Regression (#4)

xi yi xi2 xi3 xi4 xi × y i x 2i × y i n


5 17 25 125 625 85 425 10
10 24 100 1000 10000 240 2400
15 31 225 3375 50625 465 6975
20 33 400 8000 160000 660 13200
25 37 625 15625 390625 925 23125
30 37 900 27000 810000 1110 33300
35 40 1225 42875 1500625 1400 49000
40 40 1600 64000 2560000 1600 64000
45 42 2025 91125 4100625 1890 85050
50 41 2500 125000 6250000 2050 102500
∑ 275 342 9625 378125 15833125 10425 379975

10 275 9625 342


275 9625 378125 10425
158331
9625 378125 379975
25

10 275 9625 342


113437.
0 2062.5 1020
5
113437 656906
0 50800
.5 3

10 0 -5500 206
113437.
0 2062.5 1020
5
0 0 330000 -5300

117.66
10 0 0
67
2841.8
0 2062.5 0
75
0 0 330000 -5300

11.766
1 0 0
67
1.3778
0 1 0
79
-
0 0 1 0.0160
6

a0 = 11.76667
a1 = 1.377879
a2 = -0.01606

y=11.76667 +1.377879 x−0.01606 x 2


 Cubic Regression (#7)

xi yi xi2 xi3 xi4 xi5 xi6 xi × y i x 2i × y i x 3i × y i n


3 1.6 9 27 81 243 729 4.8 14.4 43.2 8
4 3.6 16 64 256 1024 4096 14.4 57.6 230.4
5 4.4 25 125 625 3125 15625 22 110 550
7 3.4 49 343 2401 16807 117649 23.8 166.6 1166.2
8 2.2 64 512 4096 32768 262144 17.6 140.8 1126.4
9 2.8 81 729 6561 59049 531441 25.2 226.8 2041.2
1 133 16105
1 3.8 121 1 14641 1 1771561 41.8 459.8 5057.8
1 172 24883
2 4.6 144 8 20736 2 2985984 55.2 662.4 7948.8
5 485 52289
∑ 9 26.4 509 9 49397 9 5689229 204.8 1838.4 18164

8 59 509 4859 26.4


59 509 4859 49397 204.8
509 4859 49397 522899 1838.4
485
49397 522899 5689229 18164
9

8 59 509 4859 26.4


0 73.875 1105.125 13561.875 10.1
0 1105.125 17011.875 213745.125 158.7
0 13561.88 213745.125 2737993.875 2129.3

-
8 0 -373.604061 18.33367174
5972.142132
0 73.875 1105.125 13561.875 10.1
0 0 479.8781726 10867.73604 7.610152284
0 0 10867.73604 248322.7614 275.1553299

8 0 0 2488.818482 24.25847508
-
0 73.875 0 -7.425634679
11465.74134
0 0 479.8781726 10867.73604 7.610152284
0 0 0 2202.613861 102.8092409

212
0 0 0 -91.90965743
5
0 73.875 0 0 527.7494971
0 0 479.8781726 0 -499.6524744
0 0 0 2202.613861 102.8092409

1 0 0 0 -0.043251603
0 1 0 0 7.143817219
0 0 1 0 -1.041206921
0 0 0 1 0.046676016

a0
-0.043251603
=
a1
7.143817219
=
a2
-1.041206921
=
a3
0.046676016
=

y=−0.043251603+7.143817219 x−−1.041206921 x 2+ 0.046676016 x 3

 Multiple Linear Regression (#11)

y x1 x2 x12 x22 x1 × x2 x1 × y x2 × y n
15.2 0 0 0 0 0 0 0 9
17.7 1 1 1 1 1 17.7 17.7
12.9 1 2 1 4 2 12.9 25.8
25.3 2 1 4 1 2 50.6 25.3
20.8 2 2 4 4 4 41.6 41.6
34.9 3 1 9 1 3 104.7 34.9
30 3 2 9 4 6 90 60
45.3 4 1 16 1 4 181.2 45.3
40.5 4 2 16 4 8 162 81
∑ 242.6 20 12 60 20 30 660.7 331.6

9 20 12 242.6
20 60 30 660.7
12 30 20 331.6

9 20 12 242.6
15.5555 3.33333 121.588
0
6 3 9
3.33333 8.13333
0 4
3 3

7.71428 86.2714
9 0
6 3
15.5555 3.33333 121.588
0
6 3 9
3.28571 -
0 0
4 17.9214

128.347
9 0 0
8
15.5555
0 0 139.77
6
3.28571 -
0 0
4 17.9214

14.2608
1 0 0
7
0 1 0 8.98521
7
-
0 0 1
5.45435

14.2608
a0 = 7
8.98521
a1 = 7
a2 = -5.45435

y=14.26087+ 8.985217 x−5.45435 x 2

 Newton's Divided-Difference Interpolating Polynomials Linear (#13)

i x f(xi) f(2.8)
2 8 14.42857
0 2.5 14
2.8 ?
1 3.2 15
4 8

 Newton's Divided-Difference Interpolating Polynomials (#14)

i x f(x) b0 b1 b2 f(4)
0 2 6 6 13 9 50
1 3 19
4 ?
2 5 99
7 291

 Lagrange Interpolating Polynomials - Second Order (#15)

i xi f(xi) L0 L1 L2 f(3.5)
0.27901 1.32812 9.5937
0 26 8 5 -0.60714 5
0 1.8 16.415
3.5 ?
1 5 5.375
2 6 3.5
 Lagrange Interpolating Polynomials - Third Order (#13)

i xi f(xi) L0 L1 L2 L3 f(2.8)
0.73142 0.42857 15.3885
0 2 8 -0.12 9 1 -0.04 7
1 2.5 14
2.8 ?
2 3.2 15
3 4 8

You might also like