You are on page 1of 31

n

x
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

y
0
0.00000000
1.17500000
0.96250000
0.93312500
1.01187500
0.99932813
0.99552344
1.00075898
1.00006992
0.99970124
1.00004569
1.00001184
0.99998019
1.00000256
1.00000124
0.99999870
1.00000013
1.00000011
0.99999992
1.00000001
1.00000001
0.99999999
1.00000000
1.00000000
1.00000000
1.00000000
1.00000000
1.00000000
1.00000000
1.00000000

0
2.20000000
2.45000000
1.87000000
2.00125000
2.03137500
1.99184375
1.99929375
2.00216484
1.99950789
1.99990174
2.00014761
1.99997170
1.99999017
2.00000993
1.99999848
1.99999914
2.00000066
1.99999993
1.99999993
2.00000004
2.00000000
1.99999999
2.00000000
2.00000000
2.00000000
2.00000000
2.00000000
2.00000000
2.00000000
2.00000000

z
0
-1.25000000
-0.70000000
-0.93125000
-1.02312500
-0.98296875
-0.99512500
-1.00187109
-0.99905742
-0.99964854
-1.00014051
-0.99994988
-0.99997452
-1.00001003
-0.99999750
-0.99999816
-1.00000069
-0.99999989
-0.99999987
-1.00000005
-1.00000000
-0.99999999
-1.00000000
-1.00000000
-1.00000000
-1.00000000
-1.00000000
-1.00000000
-1.00000000
-1.00000000
-1.00000000

n:
a:
b:
h:

1
2
4
2

NUMERICAL INTEGRATION OF ORDER 1


Xo:
2
X1:
4

f(x):

fo:
f1:

7
13

fo:
f1:
f2:

4
4.75
7

20

NUMERICAL INTEGRATION OF ORDER 2


n:
a:
b:
h:

2
1
2
0.5

Xo:
X1:
X2:

1
1.5
2

f(x):

n:
a:
b:
h:

NUMERICAL INTEGRATION OF ORDER 3


Xo:
0
X1:
0
X2:
0
X3:
0

f(x):

fo:
f1:
f2:
f3:

NUMERICAL INTEGRATION OF ORDER 4


n:
a:
b:
h:

4
0
1
0.25

Xo:
X1:
X2:
X3:
X4:

0
0.25
0.5
0.75
1

f(x):

1.462909

fo:
f1:
f2:
f3:
f4:

1
1.064494459
1.284025417
1.755054657
2.718281828

*at any n*
TRAPEZOIDAL RULE
n:
a:
b:
h:
f(x)total:

10
0
1
0.1
44.3220

wf(x)total:

105.144029

i
0
1
2
3
4
5
6
7
8
9
10

Xi
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2

f(x):
f(x):

f(x)
-0.5000
0.0711
0.7652
1.6075
2.6314
3.8816
5.4195
7.3323
9.7485
12.8649
17.0000

w
1
2
2
2
2
2
2
2
2
2
1

5.257201452
5.257201452

wf(x)
-0.5000
0.1423
1.5304
3.2150
5.2629
7.7632
10.8389
14.6647
19.4970
25.7297
17.0000
105.1440

*n divisible by 2*
SIMPSON'S 1/3 RULE
n:
a:
b:
h:
f(odd):
f(even):
wf(x)total:
i
0
1
2
3
4
5
6
7
8
9
10

10
0
1
0.1
17.87036624
14.10666521
107.3801053
Xi
2
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3

f(x)
1.777778
2.055372
2.359994
2.692809
3.054971
3.447623
3.871899
4.328921
4.819801
5.345641
5.907532

3/8 RUL

f(x):
f(x):

3.503411
3.579337

w
1
4
2
4
2
4
2
4
2
4
1

wf(x)
1.777778
8.221488
4.719988
10.77123
6.109941
13.79049
7.743799
17.31569
9.639602
21.38256
5.907532

n:
a:
b:
h:
f(div3):
f(Ndiv3):
wf(x)total:
i
0
1
2
3
4
5
6
7
8
9
10
11
12

3/8 RULE
12
0
1
0.083333333
8.237932347
21.13384967
84.24372304
Xi
0
0.083333333
0.166666667
0.25
0.333333333
0.416666667
0.5
0.583333333
0.666666667
0.75
0.833333333
0.916666667
1

f(x)
0
0.690835
1.275692
1.771198
2.191945
2.551015
2.860454
3.131741
3.376317
3.60628
3.835416
4.080889
4.366309

f(x):
f(x):

2.632616
2.632616

w
1
3
3
2
3
3
2
3
3
2
3
3
1

wf(x)
0
2.072505
3.827075
3.542396
6.575834
7.653044
5.720908
9.395223
10.12895
7.21256
11.50625
12.24267
4.366309
84.24372

Runge kuta method of order 4


1+y+x^2

K1
K2
K3
K4

1 1.053813 1.115513 1.185503


1.025625 1.083284 1.149026 1.185503
1.026266 1.08402 1.149863 1.185503
1.053813 1.115514 1.185506 1.185503

Y1

1.051313 1.105513 1.163003 1.163003

Runge Kuta Nystrom


d^2y/dx^2=dy/dx +x+2y
y(0)=1
y'(0)=-1
H
0.05

K
L

-0.02375
-0.04509

K1
K2
K3
K4

0.1 0.086431 0.074185


0.098125 0.084993 0.072767
0.098219 0.085064 0.072837
0.096432
0.0837 0.071541

0
0
0
0

Y'1
Yn

-0.80363 -0.63354
-0.4879
-0.4879
1.954939 1.919033 1.891018 1.891018

-0.01901
-0.03593

Yn
Xn
n

h
1 1.051313288
0
0.05
0
1

0.05
0.05
0.05
1.105512751 1.163003 1.163003
0.1
0.15
0.2
2
3
4

Y'n
Yn
Xn
n

h
-1 -0.80362635
2 1.954939071
0
0.05
0
1

0.05
0.05
0.05
-0.63354488
-0.4879
-0.4879
1.91903255 1.891018 1.891018
0.1
0.15
0.2
2
3
4

Linear regression
Y=Ao+A1X+e

A1=slope Ao=intercept

xy

x^2

e=error of residual

y^2

-3.5
-2.1
-1.9
-1.4
-0.8
-0.3
1
1.1
1.8
2.3
3.7
4.2
4.9
5.2
6.7

18.2
17.7
17.1
16.6
16.1
15.9
15.3
15.1
14.8
14.4
13.1
12.4
12
11.2
10.3

-63.7
-37.17
-32.49
-23.24
-12.88
-4.77
15.3
16.61
26.64
33.12
48.47
52.08
58.8
58.24
69.01

12.25
4.41
3.61
1.96
0.64
0.09
1
1.21
3.24
5.29
13.69
17.64
24.01
27.04
44.89

20.9

220.2

204.02

160.97

n=

A1
Ao
331.24 -2.18433 15.28995
313.29 -2.18433 17.7235
292.41
275.56
AVERAGE(B5:B14)-F5*AVERAGE(A5:A14)
259.21
(J2*C21-A21*B21)/(J2*D21-A21^2)
252.81
234.09
228.01
219.04
207.36
171.61
153.76
144
125.44
106.09

3313.92

B5:B14)-F5*AVERAGE(A5:A14)
*D21-A21^2)

Goodness of fit of linear regression


10 SSt=SSR+SSE
Xi

Yi
2
2.4
2.6
3
3.7
4
4.3
4.7
5
5.2
36.9

ymean
r^2

(Yi-Ymean)^2
15.5
15.5
15.6
15.7
15.9
16
16
16.1
16.2
16.5
159

y
0.16
0.16
0.09
0.04
0
0.01
0.01
0.04
0.09
0.36
0.96

SST

15.429
15.541
15.596
15.708
15.903
15.986
16.07
16.181
16.265
16.321
159

(Yi-Y)^2
0.005
0.0017
1E-05
6E-05
8E-06
0.0002
0.0049
0.0066
0.0042
0.0322
0.0548
SSE

sst=sum (Yi-Ymean)
r=n(sumXiYi)-sumxi*sumYi / spqr(nsumXi^2)*sqrt(nsumYi^2-(sumYi)^2
94%of the original variation has been explained by the linear model

15.9
0.9429

R
Sy(standar deviation
Sy/xStan error esti

0.47145
0.3266
0.07805

Polynomial regression
1
1
D
6
6.8
36 46.24

1
8
64

1
1
8.8 10
77.44 100

1
11.4
129.96

1
12
144

1
12.6
158.76

1
1
13
14.4
169 207.36

1
14.9
222.01

(DD(transpose))A=DY
D(transpose)
1
6
1 6.8
1
8
1 8.8
1 10
1 11
1 12
1 13
1 13
1 14
1 15

y
36
46.24
64
77.44
100
129.96
144
158.76
169
207.36
222.01

D
14.2
16.4
17.7
18.4
19.5
20.1
21
21.8
23
23.7
25.2

Dt
11
117.9 1354.77 A1
117.9
1354.77 16424.8 A2
1354.77 16424.76 207205 A3
#N/A
#N/A
#N/A
A1
A2
A3

Dy
=

8.8057 c
1.0236 x
0.0026 x^2

221
2466.82
29270.5

x
y

3
7.2

3.4
8.2

4
9.8

4.4
11

5
13

5.7
15.6

6
16.8

6.3
18

6.5
19

7.2
22

Multiple linear regression


Y1
Y2
=
Y3
Yn

1
1
1
1

X1
X1
X1
X1

X2
X2
X2
X2

Xm
Xm
Xm
Xm

A0
A1
A2
An

(DD(transpose)A=DY
1
1
0
2

1
1
1
1

1
1
1
1

1
2
2
2

1
2
1
2

1
2
0
1

1
1
2
0

(DD(transpose))A=DY
D(transpose)

W
1
1
1
1
1
1
1
1
1
1

1
1
1
2
2
2
1
2
3
3

0
1
1
2
1
0
2
1
0
1

2
1
1
2
2
1
0
1
2
2

D
10
13
12
17
15
11
16
19
14
18

*
10
18
9
14

18
38
15
28
A1
A2
A3
A4

Linearization of non linear regression


LnP=lna+bx
y=lnp
Ao=lna
A1=b
y=Ao+A1X
x
y
lny

-3.5
-2.1
-1.9
-1.4
-0.8
0.3
1
18.2
17.7
17.1
16.6
16.1
15.9
15.3
2.901422 2.873565 2.839078 2.809403 2.778819 2.766319 2.727853
1
-3.5

Design matrix
(DDt)A=DY
Dtranspose

1
-2.1

1
-1.9
D*Dt

1
1
1
1

-3.5
-2.1
-1.9
-1.4

15
21.5

1
-1.4

1
-0.8

1
0.3

LnyT
DY
21.5 2.901422 40.09628 so
160.97 2.873565 50.24609
2.839078
2.809403

1
1

1
1
1
1
1
1
1
1
1
1
1

-0.8
0.3
1
1.1
1.8
2.3
3.7
4.2
4.9
5.2
6.7

2.778819
2.766319
2.727853
2.714695
2.694627
2.667228
2.572612
2.517696
2.484907
2.415914
2.332144

1
2
1
1

1
3
0
2

1
3
1
2

x
y
z
w

1
0
2
10

Dt
9
15
13
11

14
28
11
24
7.745856
2.762431
3.01105
-0.66298

A1
A2
A3
A4

1
1
1
13

A0
A1

cosntant
x
y
z

1
1.8

1
2.3

=
=
lny
y

2
2
2
17

Dw
145
271
143
203

1.1
1.8
2.3
3.7 4.2
4.9
15.1
14.8
14.4
13.1 12
12
2.714695 2.694627 2.667228 2.572612 2.5 2.485
1
1.1

1
1
1
12

1
1
3.7 4.2

1
4.9

5.2 6.7
11.2 10.3
2.42 2.33
1
5.2

2.752655 c
-0.05551 x
=
=

2.752655 15.68421 *

0.05551x
e^0.5551x

1
6.7

2
1
2
15

2
0
1
11

1
2
0
16

2 3
1 0
1 2
19 14

3
1
2
18

General Linear least squares


y=AoFo(x)+A1F1(x)++AmFm(x)
ex. Y=Ao+A1sinx+A2cosx

1
1
0.540302 0.070737
1.557408 14.10142

1
-0.41615
-2.18504

1
-0.80114
-0.74702

1
1
1
1
-0.98999 -0.93646 -0.65364
-0.2108
-0.14255 0.374586 1.157821 4.637332

(DD(transpose))A=DY
D(transpose)
1 0.540302
1 0.070737
1 -0.41615
1 -0.80114
1 -0.98999
1 -0.93646
1 -0.65364
1
-0.2108
1 0.283662
1 0.70867

y
1.557408
14.10142
-2.18504
-0.74702
-0.14255
0.374586
1.157821
4.637332
-3.38052
-0.99558

D
4.47
4.35
3.89
3.22
2.49
1.89
1.55
1.58
1.95
2.57

Dt
10 -2.40481 14.37786
-2.40481 4.023338 -0.26172
14.37786 -0.26172 242.0331

Ao
A1
A2

1
1
0.283662 0.708669774 x
-3.38052 -0.995584052 y

1
4.47

Dy
A1
A2
A3

2.81966 c
0.526196 sinx
0.071555 cosx

27.96
-4.6824
57.72155

1.5
4.35

2
3.89

2.5
3.22

3
2.49

3.5
1.89

4
1.55

4.5
1.58

5
1.95

5.5
2.57

Bisection theorem
find the root:
a

x^3 + 2*x - 4
b

1
1
1
1.125
1.125
1.15625
1.171875
1.171875
1.17578125
1.17773438

Xn
2
1.5
1.25
1.25
1.1875
1.1875
1.1875
1.1796875
1.1796875
1.1796875

f(a)
1.5
1.25
1.125
1.1875
1.15625
1.171875
1.1796875
1.17578125
1.177734375
1.178710938

-1
-1
-1
-0.32617
-0.32617
-0.14169
-0.04692
-0.04692
-0.02297
-0.01095

f(b)

f( Xn)
8
2.375
2.375 0.453125
0.453125 -0.32617
0.453125 0.049561
0.049561 -0.14169
0.049561 -0.04692
0.049561 0.001102
0.001102 -0.02297
0.001102 -0.01095
0.001102 -0.00492

Regula falsi
F(X):

x^3 + 2x-4

b
1
1.111111
1.154047
1.170117
1.176057
1.178242
1.179044
1.179338
1.179446
1.179486

2
2
2
2
2
2
2
2
2
2

Xn
f(a)
f(b)
1.111111
-1
1.154047 -0.40604
1.170117 -0.15492
1.176057 -0.05767
1.178242 -0.02127
1.179044 -0.00782
1.179338 -0.00287
1.179446 -0.00105
1.179486 -0.00039
1.179501 -0.00014

8
8
8
8
8
8
8
8
8
8

f( Xn)
-0.40604
-0.15492
-0.05767
-0.02127
-0.00782
-0.00287
-0.00105
-0.00039
-0.00014
-5.2E-05

LARGEST EIGEN
v

A
1
1
1
1

Power method
Eigenvector
v
1
-0.4
0.1
1
0
-0.25
1
0
0.1
1
1
1

1
0
1
0

0
-1
0
-1

-0.4
1
-0.4
-4

0.2
1.25
0
-3.75

Av
-0.05333 0.014545
-0.33333 -0.36364
0 0.014545
1
1

-0.008
-0.375
0
1

2
0
0
-5

1
0
-1
0

0
1
0
-4

k
-0.05333 0.029091
1.333333 1.363636
-0.05333
0
-3.66667 -3.63636

-0.008
1.375
-0.008
-3.625

-5

-4

3.75 3.666667 3.636364

-3.75

-3.66667

-3.63636

3.625

-3.625

SMALLEST

A
1
1
1
1

Power method
Eigenvector
v
1
1
0.625 0.833333
1
-1
1
-1
1
0
0.625
0
1
0
-0.25 0.333333

1
0
1
0

0
-1
0
-1

0.5
0.8
0.5
-0.2

0.625
-0.75
0
0.25

Av
1
-1
0
0

[A]-1
1
0
-1
0

0
1
0
-4

0.5
0
0.5
0

0
-0.8
0
0.2

0.8

-1

-0.8

0.5
0
-0.5
0

0
-0.2
0
-0.2

k
0.833333
1.333333
0.833333
-0.33333

0.75 0.333333

-0.75

-0.33333

mutli
A 3x2

B(2x1)

C(3x1)

det
1
3
5
7
8
23
53
83

2
4
6

D(3x3)

2
3
5
linear equations
A
1
2
3

2
4
6

9
8
7

1
3
1

x(A-1 x B)
4
0
1
1
2
1

[A]-1
-0.20833 -0.08333 0.458333
0.041667 0.416667 -0.29167
0.291667 -0.08333 -0.04167

-20

Newton rhapson

b
5
4
3

Estimate root
x
1
y
1
x
1.166667
y
8.5
x
1.566953
y
3.687817
x
2.010834
y
2.882424
x
1.999168
y
3.002282
x
2
y
3

f(x,y):X^2+xy-10
g(x,y):y+3xy^2 -57
delta(x,y)
matrix
0.166667
3
7.5
3
0.400286 10.83333
-4.81218
216.75
0.443881 6.821723
-0.80539 40.79998
-0.01167 6.904093
0.119858 24.92511
0.000832 7.000618
-0.00228 27.0411
1.89E-07
7
-5.8E-08
27

1
7
1.166667
60.5
1.566953
35.67182
2.010834
35.77647
1.999168
37.0124
2
37

negativeF(x,y)
8
53
-1.27778
-204.375
1.766022
-10.6195
0.160468
3.997311
0.001262
-0.06198
1.21E-06
2.95E-06

GUASS SIEDEL
n
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

0
1.00000000
2.45833333
2.93506944
3.20405961
3.32122234
3.37838840
3.40487257
3.41743092
3.42332358
3.42610168
3.42740863
3.42802406
3.42831375
3.42845012
3.42851432
3.42854455
3.42855877
3.42856547
3.42856862
3.42857011
3.42857081
3.42857114
3.42857129
3.42857136
3.42857140
3.42857141
3.42857142
3.42857143
3.42857143
3.42857143

0
-2.20000000
-2.76833333
-3.13515278
-3.28674780
-3.36259179
-3.39734433
-3.41390646
-3.42166027
-3.42531955
-3.42704024
-3.42785068
-3.42823212
-3.42841170
-3.42849623
-3.42853603
-3.42855476
-3.42856358
-3.42856774
-3.42856969
-3.42857061
-3.42857104
-3.42857125
-3.42857134
-3.42857139
-3.42857141
-3.42857142
-3.42857142
-3.42857143
-3.42857143
-3.42857143

z
0
-1.43333333
-2.20361111
-2.54593287
-2.71139377
-2.78837001
-2.82480163
-2.84191076
-2.84997377
-2.85376763
-2.85555402
-2.85639488
-2.85679075
-2.85697710
-2.85706482
-2.85710612
-2.85712556
-2.85713472
-2.85713902
-2.85714105
-2.85714201
-2.85714246
-2.85714267
-2.85714277
-2.85714282
-2.85714284
-2.85714285
-2.85714285
-2.85714286
-2.85714286
-2.85714286