Professional Documents
Culture Documents
Numerical Methods - Midterm Work-Sheet: Roots of Equations
Numerical Methods - Midterm Work-Sheet: Roots of Equations
Numerical Methods - Midterm Work-Sheet: Roots of Equations
Roots of equations
Bisection Method
Initial Step: a(0) = a, b(0) = b, I(0) = (a(0), b(0)), x(0) = (a(0) + b(0))/2.
At each step k ≥ 1 we select the subinterval I(k) = (a(k), b(k)) of the interval I(k−1) = (a(k−1),
b(k−1)) as follows:
- x(k−1) = (a(k−1) + b(k−1))/2,
- if f(x(k−1)) = 0 then α = x(k−1)
- if f(a(k−1))f(x(k−1)) < 0 set a(k) = a(k−1), b(k) = x(k−1);
- if f(x(k−1))f(b(k−1)) < 0 set a(k) = x(k−1), b(k) = b(k−1).
- x(k) = (a(k) + b(k))/2 and increase k by 1.
Newton Method
𝑓(𝑥 )
𝑥 =𝑥 −
𝑓′(𝑥 )
Error of approximation: 𝑒𝑟𝑟 = |𝑓(𝑥 )|
Secant Method
𝑓(𝑥 )(𝑥 − 𝑥 )
𝑥 =𝑥 −
𝑓(𝑥 ) − 𝑓(𝑥 )
Roots of Polynomials:
𝑝 (𝑥) = (𝑥 − 𝑥 )𝑝 (𝑥) + 𝑟
𝑝 (𝑥 )
𝑥 =𝑥 −
𝑝 (𝑥 )
Error of approximation: 𝑒𝑟𝑟 = |𝑃 (𝑥 )|
Linear Systems of Equations
Naive Gauss Method
Forward Elimination:
Step 1
a21 a a
a21 x1 a12 x2 ... 21 a1n xn 21 b1
a11 a11 a11
__________________________________
a a a
a22 21 a12 x2 ... a2 n 21 a1n xn b2 21 b1
a11 a11 a11
Step 2
At the end of (n-1) Forward Elimination steps, the system of equations will be triangular.
Back Substitution:
bn( n 1)
xn ( n 1)
ann
If the maximum of the values is a pk in the p th row, k p n, then switch rows p and k.
LU Decomposition
1 0 0 u11 u12 u13
A LU 21 1 0 0 u22 u23
31 32 1 0 0 u33
The coefficients of L are: 𝑙 = , used to multiply each equation during the Elimination steps.
Gauss Seidel
n
ci aij x j
j 1
j i
xi , i 1,2, , n.
aii
xinew xiold
a i 100
xinew
Error of approximation:
Polynomial Interpolation
Newton First Order Interpolating Polynomials
y1 y 0
P1 x y 0 x x0
x1 x0
b0 y 0
y1 y 0
b1
x1 x0
y 2 y1 y1 y 0
x 2 x1 x1 x 0
b2
x 2 x0
𝑏 =𝑦
𝑦 −𝑦
𝑏 = 𝑓[𝑥 , 𝑥 ] =
𝑥 −𝑥
𝑓[𝑥 , 𝑥 ] − 𝑓[𝑥 , 𝑥 ]
𝑏 = 𝑓[𝑥 , 𝑥 , 𝑥 ] =
𝑥 −𝑥
⋮
𝑓[𝑥 , ⋯ , 𝑥 ] − 𝑓[𝑥 ,⋯,𝑥 ]
𝑏 = 𝑓[𝑥 , ⋯ , 𝑥 , 𝑥 ] =
𝑥 −𝑥
b0
x0 f ( x0 ) b1
f [ x1 , x0 ] b2
x1 f ( x1 ) f [ x 2 , x1 , x0 ] b3
f [ x 2 , x1 ] f [ x3 , x 2 , x1 , x0 ]
x2 f ( x2 ) f [ x3 , x 2 , x1 ]
f [ x3 , x 2 ]
x3 f ( x3 )
n x xj
Li x
j 1 xi x j
j i
Quadratic splines
𝑓 (𝑥) = 𝑎 𝑥 + 𝑏 𝑥 + 𝑐
Interpolation conditions:
𝑓 (𝑥 ) = 𝑦
, 𝑖 = 1, … , 𝑛
𝑓 (𝑥 ) = 𝑦
Continuity of the derivatives:
𝑓 (𝑥 ) = 𝑓 (𝑥 ), 𝑖 = 1, … 𝑛 − 1
Forced condition:
𝑎 =0
Regression
Least-squares regression - minimize the sum of the squares of the estimate residuals:
𝑆 = 𝑒𝑟𝑟 = ( 𝑦 − 𝑓(𝑥 ))
𝑆 =∑ ( 𝑦 − 𝑓(𝑥 )) , 𝑆 = ∑ ( 𝑦 − 𝑦)
Linear Regression
𝑓(𝑥) = 𝑎𝑥 + 𝑏
Polynomial Regression
𝑓 (𝑥) = 𝑎 𝑥 + ⋯ + 𝑎 𝑥 + 𝑎
Exponential Regression
𝑓(𝑥) = 𝛼𝑒