Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1.0000
1.5000
1.2500
1.0000
1.2500
1.1250
1.1250
1.2500
1.1875
1.1875
1.2500
1.2188
1.1875
1.2188
1.1875
1.2031
1.2032
1.195
3
0.3415
0.3415
0.3415
0.1366
0.0173
0.0173
0.0173
0.7525
0.1135
0.1135
0.1366
0.0173
0.1135
0.0467
0.0468
0.0144
0.0016
0.1135
0.0143
c=a
Set [a,b]
f ( a ) [ba ]
f ( b )f (a)
CALCULATOR CODE
c= A
c=
a+b
2
X [ B A]
Y X
Stopping criteria:
- set number of iterations
- |f(c)|
Stopping criteria:
- set number of iterations
- |f(c)|
Example:
Example:
1
2
0.0000
1.0000
2.0000
2.0000
1.0000
1.5000
f(b)
2.5907
2.5907
f(c)
0.3415
0.7525
0.0001
i
1
2
a
1.000
0
1.156
1
b
1.5000
1.5000
c
1.156
1
1.188
6
f(a)
0.3415
0.0787
A-JAY GALIZA
f(b)
0.752
5
0.752
5
f(c)
0.0787
0.0150
1.188
6
1.194
7
1.195
8
1.194
7
1.195
8
1.19
60
1.5000
1.5000
1.5000
0.0150
0.0027
0.0005
0.752
5
0.752
5
0.752
5
0.0027
0.0005
0.0001
x i+1=x i
C. Newton-Rhapson Method
CALCULATOR CODE
Set xi
x i+1=x i
f (x i)
f ( x i ) f ( x i1)
x ix i1
x i+1=B
f ( xi )
f '( xi )
D
DC
B A
Example:
f ( x )=cos ( x ) +2 sin ( x )+ x
CALCULATOR CODE
x i+1=X
xi = -0.1 and i = 5
f ( x i)
d
f ( x i) x= X
dx
i
1
xi-1
xi
xi+1
f(xi)
f(xi+1)
Stopping criteria:
- set number of iterations
- |f(xi+1)|
- |xi+1 xi |
f(xi-1)
0.805
0.1520 0.0461
3
0.152
0.0461 0.0066
0
0.046
0.0066 0.0004
1
Example:
f ( x )=x2 sin ( x )
0.0001
xi
xi+1
f(xi+1)
1.5000
2.0766
0.3269
2.0766
1.9105
0.0248
1.9105
1.8956
0.0002
1.8956
1.8955
1.5461E-08
*note:
f ' ( x )=12cos ( x )
D. Secant Method
f ( x )=x 4 x10
A-JAY GALIZA
g1 ( x ) =
10
3
x 1
g2 ( x )= 4 x +10
A. Jacobi Method
x+ 10
g3 ( x ) =
Given
For
g1 ( x ) =
i
1
xi
1.5000
xi+1
4.2105
4.2105
0.1358
0.1358
10.0251
10.0251
-0.0099
-0.0099
10.0000
10.0000
-0.0100
-0.0100
10.0000
10.0000
-0.0100
-0.0100
10.0000
For
choose xi = 1.5
g2 ( x )= 4 x +10
choose xi = 1
xi
xi+1
1.0000
1.8212
1.8212
1.8542
1.8542
1.8555
1.8555
1.8556
1.8556
1.8556
SYSTEM OF LINEAR
EQUATION
I. Direct Methods
- Substitution and Elimination
- Matrix
NUMERICAL METHODS | NECES ACADEMICS
COMMITTEE 2014-2015
x 1=
1
b a x a x
a11 1 12 2 13 3
x 2=
1
b a x a x
a22 2 21 1 23 3
x 3=
1
b a x a x
a33 3 31 1 32 2
Example:
4 wx y=3
; 6+7 y + x=w ; y+ 6 x2 w=9
Arrange so that it is diagonally dominant.
4 wx y=3
2 w +6 x+ y=9
w+ x +7 y=6
A-JAY GALIZA
k+1
1
= 3+ x+ y
4
1
x k+1= 9+ 2 w y
6
1
y k+1 = 6+ wx
7
wk+
1
x k+1
y k+1
---
---
---
0.75
1.5
0.75
1.5
-0.857
0.91
1
1.89
3
0.16
1
0.39
3
-0.107
0.98
2
1.96
4
0.07
1
0.07
1
-0.033
0.99
2
1.99
4
0
0.85
7
0.96
4
0.99
7
0.99
7
0.01
0.03
0.99
9
0.99
9
1.99
7
-1
0.00
7
-1
0.00
3
0.00
3
-1
0.00
1
5
6
7
-0.003
0
0
* = 0.001
B. Gauss-Seidel Method
If x1(k+1) is a better approximation to the true
value of x1 than x1(k) is, then it would make
sense that once we have found the new
value x1(k+1) , use it (rather than the old
value x1(k)) in finding x2(k+1), , xn(k+1). In other
words, instead of using the old value
of x1(k) and the old values x3(k),
, xn(k), we now use
the new value x1(k+1) and the old
values x3(k), , xn(k), and similarly for
findingx3(k+1), , xn(k+1).
A-JAY GALIZA
( x )=
4 wx y=3
xx1 x x2
x ix 1 x ix 2
2 w +6 x+ y=9
w+ x +7 y=6
For n=3
( x )=
wk+
1
x k+1
y k+1
---
---
---
0.75
0
1.75
0
0.75
0
1.75
0
1.000
0.93
8
1.97
9
0.18
8
0.22
9
0.006
0.99
3
1.99
9
0.05
5
0.02
0
0.005
0.99
9
2.00
0
0
1.00
0
1.00
6
1.00
1
1.00
0
0.00
6
0.00
1
0.001
1.00
0
2.00
0
0.00
1
0.00
0
0.000
1.00
0
xx1 x x2 x x3
x ix 1 x ix 2 x ix 3
Example:
Compute for f(0.3) for the given data set,
use n= 2 and f(3.1), use n = 3
x
f(x)
49
129
813
*Find the range where 0.3 lies for n=2 (blue line);
3.1 for n= 3 (green line).
* = 0.001
For f(0.3), n = 2:
INTERPOLATION,
EXTRAPOLATION, CURVE FIT
A. Lagrange Interpolation
y ( x )= y 1
xx 2
xx 1
+ y2
x1x 2
x 2x1
y ( x )= y 1 ( x ) + y 2 ( x ) + y 3 ( x )
( x )=
x0 x1
x i0 x i1
( 0.3 )=
y ( 0.3 )= y 1
0.3 0.7
0.3 0.7
+ y2
x 10 x 11
x 20 x 21
y ( 0.3 )=1
0.3 0.7
0.3 0.7
+3
00 01
10 11
( x )=
j=1
i=n
j i
xx j
xi x j
x i0 x i1 x i0 x i1
y ( 0.3 )=
0.7
0.3
+3
01
10
y ( 0.3 )=1.6, 0 x 1
For n=2
A-JAY GALIZA
( x )=
x1 x3 x 4
x i1 x i3 x i4
(3.1 ) =
+ 49
11 13 14
31
3.13 3.14
3.11 3.13 3.14
+129
33 34
41 43 44
3.13 3.14
3.11
y (3.1 ) =3
+49
13 14
31
f ( x )=a x 2 +bx +c
x i1 x i3 x i4
y (3.1 ) =3
Eq . 3
y=a x +bx+ cn
3.14
3.11 3.13
+129
34
41 43
x x x x xy x y y
Modes:
Example:
Compute for f(4.3) and f(15.7) using Linear
and Quadratic fit.
x
f(x
)
8
3
2
1
0
1
1
4
1
2
1
2
1
1
4
y (3.1 ) =55.29,1 x 4
Linear Fit:
B. Method of Least Square (MLS)
xy =317
x =528
x=64
xy =a x2 +bx
2
xy =a x +bx Eq .1
y=ax+bn Eq . 2
317=a ( 528 )+ b ( 64 )
f ( x )=ax +b
y=ax+bn
70=a ( 64 ) +b (10)
x y=a x + b x +c x Eq. 1
3
a = -1.1064, b = 14.0811
f ( x )=1.1064 x+ 14.0811
xy=a x +b x + cx Eq . 2
NUMERICAL METHODS | NECES ACADEMICS
COMMITTEE 2014-2015
A-JAY GALIZA
y =70
f ( 4.3 )=9.3236
Quadratic Fit
f ( 15.7 ) =3.2894
16
14
x 2 y=2009
12
Quadratic Fit:
x 4 =
49524 x =
xy =317
x =528
10
4930
8
6
x=64
4
2
y =70
x 2 y=a x 4 + b x 3 +c x 2
10
12
14
PRACTICE PROBLEMS
y=a x +bx+ cn
f ( 15.7 ) =1.7420
Linear Fit
MOSS
16
14
12
10
Let i=7.
8
6
4
2
0
10
12
14
x+ 2 y +3 z=5
2 x 5 y +2 z=1
3 x+ y 2 z =1
A-JAY GALIZA
Use =0.001
x
f(x)
-0.33
-0.15
1.35
0.88
2.32
1.31
3.17
1.87
4.22
2.11
5.11
2.42
A-JAY GALIZA