Coeb223 Formula Sheet For Final Exam

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

FORMULA SHEET FOR NUMERICAL METHODS FOR ENGINEERS

COEB223 / MATB324

Part 1: Modeling, Computers and Error Analysis


Error Definitions
 = 




True error:
True percent relative error:





100 %



 =

Approximate percent relative error:


 =



  


100 %




Stopping criterion:

Terminate computation when a < s where s is the desired percent relative error

Taylor Series
Taylor series expansion
 !" # =   # +  %  # +
where remainder
/. =

 # *  # ,
 .#  # .
+
+ +
+ /.
2!
3!
!

0123#4#
.!"#!

.!"

or

/. = 5.!" #

Error propagation

For n independent variables x1, x2, , xn having errors 7", 7*, , 7. , the error in the
function f can be estimated via

:
:
:
 = 9
9 7" + 9
9 7* + + 9
9 7.
:"
:*
:.

Part 2: Roots of Equations


Method

; =

Bisection

< + =
2

Formulation

; = =

False Position

 !"

Secant

=

If < # ; # > 0, set < = ;

= #< = #
  < #   = #

 !" = 

Newton Raphson

If < # ; # < 0, set = = ;


If < # ; # < 0, set = = ;
If < # ; # > 0, set < = ;

  #
 #

  # @"  #
  @" #  #

Part 3: Linear Algebraic Equations


Gauss Elimination

""
A
*"

,"

"*

**

,*

",

*,

,,

|
|
|

""
C"
C* D F 0
C,
0

"*

**
0

",

*,

,,

|
|
|

C,,

,,
C"
C
*, ,
C* G * = *

**
C,
C"
"* *
", ,
" =

""
, =

LU decomposition
Decomposition

""

A *"

,"

"*

**

,*

",
1

*, D A *"

,,
,"

0
1

,*

Back Substitution

""
C"
0 I"
0D HI* J = HC* J A 0
0
1 I,
C,

"*
**
0

", "
"
I"
*, D H* J = HI* J H* J
,
,, ,
I,

Forward Substitution

Gauss-Seidel method
C"
"* *
", , O
=

""
M P 
  Q 
K
K@" M  K  K@"
C*
*" "
*, ,
K
R
R 100% < S
* =
K

**

N
K
K
M 
 
C,
," "
,* *
K
M
, =

,,
L
K@"

K
"

With relaxation,

K@"

 .TU = V .TU + 1 V# W<X

Part 4: Curve Fitting


Method
Linear
Regression

Q =
Y +
" 

where

Formulation

Z; = [Q
Y
"  #*

" =

\"

 Q  Q
  *   #*

Y = Q
" 

Polynomial
Regression

For a 2nd order polynomial fit,


Q =
Y +
"  +
*  *

where

Z; = [Q
Y
" 
*  * #*
\"

by differentiating Sr with respect to each coefficients


and setting the partial derivatives equal to zero, we
have:

Errors

Z;
Z^/` = a
2
* =

Z Z;
Z

where:

Z = [Q Qb#*
Z;
Z^/` = a
  + 1#

* =

Z Z;
Z

where:

Z = [Q Qb#*

Multiple
Linear
Regression

e 
d
d[ 
d
d
*
c[ 

[

[ *
[ ,

[  *i
h
Y
,h

[  H "J =
h
*
fh
[ g

Q =
Y +
" " + +
m m

l[ Q O
M
M
[ Q
k
N
M[  * Q M
j
L

Q =
Y +
" " +
* *

For a two-variable linear fit,

where

* =

Z; = [Q
Y
" "
* * #*
by differentiating Sr with respect to each coefficients
and setting the partial derivatives equal to zero, we
have:

Newtons
divided
difference
interpolating
polynomial

[ "

[ "*

[ " *

[ * i
h
Y
[ " * h H
" J =
h
*
h
[ ** g

,  # = CY + C"  Y # + C*  Y # " #


+ C,  Y # " # * #

CY =  Y #

C" =  n" , Y o

C* =  n* , " , Y o

C, =  n, , * , " , Y o

Lagrange
interpolating
polynomial

l[ Q
O
M
M
[ " Q
k
N
M[  Q M
*
j
L

For third order:

where

.  # = [ p  # #
\Y

Z Z;
Z

where:

\"

e 
d
d[ "
d
d
c [ *

Z;
Z^/` = a
  + 1#

Z = [Q Qb#*

where,

p  # = q
K\Y
Kr

 K
 K

Part 6: Numerical Differentiation and Integration


A. Numerical Differentiation
Method
Forward finitedivided difference

Formulation
 %  # =
 %  # =

Backward finitedivided difference

 !* # + 4 !" # 3 #


2

  #  @" #

First Derivative:
 %  # =
 %  # =

Centred finitedivided difference

  !" #  #

First Derivative:

3 # 4 @" # +  @* #


2

  !" #  @" #


 #=
2

First Derivative
%

 %  # =

 !* # + 8 !" # 8 @" # +  @* #


12

Errors
5#
5* #
5#
5* #
5* #
5f #

B. Numerical Integration
Method
Trapezoidal rule

Multiple-application
trapezoidal rule
Simpsons 1/3 rule

Multiple-application
Simpsons 1/3 rule

Simpsons 3/8 rule

Gauss Quadrature
Gauss-Legendre

u C
#

 
# +  C #
2

Formulation

C
#
wY # + 2 [  # +  . #x
u
2
.@"

u C
#

\"

Y # + 4" # + * #


6

C
#
u
zY # + 4 [  # + 2
3
.@"

\",,,{,

u C
#

.@*

K\*,f,,

Y # + 3" # + 3* # + , #


8

u PY  Y # + P" " # + + P.@"  .@" #


PY = 1.0000000

For two-point Gauss-Legendre:

P" = 1.0000000

Y = 0.577350269
" = 0.577350269
PY = 0.5555556

For three-point Gauss-Legendre:

P" = 0.8888889
P* = 0.5555556

}K ~ + . #

Y = 0.774596669
" = 0.0

* = 0.774596669

Change of variables:

=

C +
# + C
# X
2
C

I =
IX
2

Part 7: Ordinary Differential Equations


Method
Eulers First-Order RK

Heuns Second Order RK

Q !" = Q + "

Formulation

" =   , Q #

1
1
Q !" = Q + " + *
2
2
" =   , Q #

* =  + , Q + " #

Midpoint Second Order RK

Q !" = Q + *

" =   , Q #

1
1
* =   + , Q + "
2
2

Ralstons Second Order RK

1
2
Q !" = Q + " + *
3
3
" =   , Q #

3
3
* =   + , Q + "
4
4

Classical Fourth Order RK

1
 + 2* + 2, + f #
6 "
" =   , Q #
1
1
* =   + , Q + "
2
2
1
1
, =   + , Q + *
2
2
f =  + , Q + , #

Q !" = Q +

Part 8: Partial Differential Equations


Method
Elliptic PDEs
Liebmanns Method

Parabolic PDEs (one


dimensional)
Explicit Method

Simple Implicit Method

Crank-Nicolson Method

Formulation
,K =

!",K + @",K + ,K!" + ,K@"


4

<!" = < + V} <!" 2 < + <@" ~


V=


 #*

<!"
<
V <!"
V <!"
@" + 1 + 2V #
!" =

V=


 #*

<!"
V <!"
V <!"
@" + 21 + V #
!"
= V <@" + 21 V# < + V <!"

V=


 #*

You might also like