Formula Sheet - Numerical Methods - Dr. Saeed
Formula Sheet - Numerical Methods - Dr. Saeed
MATH 472
Error Definitions:
Stopping criterion:
Terminate computation when εa < εs where εs s is the desired percent relative error.
Taylor Series:
1
Part 2: Roots of Equations
Method Formulation
xu + xl
Bisection xr = if f (xl ) × f (xr ) < 0, set xu = xr
2
if f (xl ) × f (xr ) > 0, set xl = xr
f (xu )(xl − xu )
False position xr = xu − if f (xl ) × f (xr ) < 0, set xu = xr
f (xl ) − f (xu )
if f (xl ) × f (xr ) > 0, set xl = xr
f (xi )
Newton Raphson xi+1 = xi −
f (xi )
f (xi )(xi−1 − xi )
Secant xi+1 = xi −
f (xi−1 ) − f (xi )
A. Numerical Differentiation
2
B. Numerical Integration
b−a
First: Closed Newton-Cots Formulas: h =
n
Trapezoidal Rule n = 1, h = b − a
∫b 2
f ′′ (ξ)
n=1 a
f (x) dx = h2 [(x0 ) + f (x1 )] Et = − h 12
Simpson’s Rule n = 2, h = b−a
∫b 2
5
f (4) (ξ)
n=2 a
f (x) dx = h3 [f (x0 ) + 4f (x1 ) + f (x2 )] Et = − h 90
Simpson’s n = 3, h = b−a
∫b 3
5
f (4) (ξ)
Three-eighths a
f (x) dx = 3h
8 [f (x0 ) + 3f (x1 ) + 3f (x2 ) + f (x3 )] Et = − 3h 80
b−a
Second: Open Newton-Cots Formulas: h =
n+2
b−a
Third: Composite Numerical Integration: h = , n is even
n
b−a
Composite h= n
∫ b ∑2
n
h (b−a)h4 f (4) (ξ)
Simpson’s rule f (x) dx = [f (x0 ) + 4 (f (x2j−1 )) Et = 180
a 3 j=1
2 −1
n
∑
+2 (f (x2j )) + f (xn )]
j=1
3
Part 4: Curve Fitting
∑
i=n
polynomial fn (x) = Li (x)f (xi )
i=0
where
∏
n
(x − xj )
Li (x) =
(xi − xj )
j=0,j̸=i
√
Sr
Linear Regression y = a0 + a1 x S xy =
n−2
where St − Sr
2
r =
∑
i=n
St
Sr = (yi − a0 − a1 xi )2 where
∑
i=0
∑ ∑ ∑
n x y − xi yi St = (yi − y)2
a1 = ∑i i2 ∑
n xi − ( xi )2
a0 = y − a1 x
Polynomial Regression √
2 Sr
2nd order poly. fit y = a0 + a1 x + a2 x S xy =
n − (m + 1)
where
∑ ∑ 2 ∑ St − Sr
r2 =
∑n ∑ x2i ∑ xi3 a0 ∑ yi St
xi a1 = xi yi
∑ 2 ∑ xi3 x
∑ 4 i ∑ 2 where
xi xi xi a2 xi yi ∑
St = (yi − y)2
4
Part 5: Linear Algebraic Equations
Method Formulation
Euler’s First-Order RK yi+1 = yi + k1 h
k1 = f (xi , yi )
1 1
Heun’s Second Order RK yi+1 = yi + ( k1 + k2 )h
2 2
k1 = f (xi , yi )
k2 = f (xi + h, yi + k1 h)
Midpoint Second Order RK yi+1 = yi + k2 h
k1 = f (xi , yi )
1 1
k2 = f (xi + h, yi + k1 h)
2 2
1 2
Ralston’s Second Order RK yi+1 = yi + ( k1 + k2 )h
3 3
k1 = f (xi , yi )
3 3
k2 = f (xi + h, yi + k1 h)
4 4
1
Classical Fourth Order RK yi+1 = yi + (k1 + 2k2 + 2k3 + k4 )h
6
k1 = f (xi , yi )
1 1
k2 = f (xi + h, yi + k1 h)
2 2
1 1
k3 = f (xi + h, yi + k2 h)
2 2
k2 = f (xi + h, yi + k3 h)