0% found this document useful (0 votes)
5 views45 pages

7 - Numerical Methods

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views45 pages

7 - Numerical Methods

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Modeling, Simulation and Optimization for

Chemical Engineering
Part 2: Simulation

Lecture 7: Numerical Methods

Ho Chi Minh City University of Technology


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
Bisection method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Iterative
Secant Method
Convergence

Newton–Raphson
Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• For a given function f(x),the Bisection
• Newton–
Raphson Method Method algorithm works as follows:
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
• two values a and b are chosen for which f(a)
(RK) Method
> 0 and f(b) < 0 (or the other way around)

• interval halving: a midpoint c is calculated


as the
arithmetic mean between a and b, c = (a + b) /
2

• the function f is evaluated for the value of c

Lecture 7: Numerical Methods


Contents • if f(c) = 0 means that we found the root of the function,
• Bisection which is c
method
• Secant Method • if f(c) ≠ 0 we check the sign of f(c):
• Newton–
Raphson Method • if f(c) has the same sign as f(a) we replace a with c and
• Euler Method
• Heun Method we keep
• Taylor Method
• Runge–Kutta • the same value for b
(RK) Method
• if f(c) has the same sign as f(b), we replace b with c and
we keep
• the same value for a
• we go back to step 2. and recalculate c with the new value
of a or b
• The algorithm ends when the values of f(c) is less than a
defined tolerance (e.g. 0.001). In this case we say that c is
close enough to be the root of the function for which f(c)
~= 0.

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents Solution:
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents • Instead of using the average of the interval
• Bisection
method endpoints to select the next root estimate, it is
• Secant Method
• Newton–
Raphson Method required to construct a secant line and find its x-
• Euler Method
• Heun Method intercept as the next root estimate
• Taylor Method
• Runge–Kutta
(RK) Method

• For xk+1

Lecture 7: Numerical Methods


Contents
• Bisection • Put yk+1 = 0
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method
• Simplifying

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents Solution:
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents

• Bisection
method
• Secant Method
Using Taylor Series
• Newton–
Raphson
Method
• Euler Method
• Heun Method
• Limit to first order and neglect the second order and above
• Taylor Method
• Runge–Kutta
(RK) Method

• Next Iteration point is calculated

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson
Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents Solution:
• Bisection
method
• Secant Method
• Newton–
Raphson
Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson
Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson
Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method Find the root of an equation
• Secant Method
• Newton–
Raphson
Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Bisection method
Secant method
Newton Raphson method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson
Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
• Used for ODE with first order f(x,y)= dy/dx
y
Differential Eq
method Solution
• Secant Method
• Newton–
Raphson Method
• Initial value is provided, most y(xo) = yo Initial Value
• Euler Method
• Heun Method
• Taylor Method
basic method for ODEs y
• Runge–Kutta
(RK) Method
• Approximate method, there is
certain error in the method yn
dy/dx
Slope

y1 y2
yo

0 xo xn x
x1 x2

Lecture 7: Numerical Methods


Contents
• Bisection
method xn = xo + nh
• Secant Method
• Newton–
Raphson Method
Slope at P is y
• Euler Method
• Heun Method dy/dx = f(xo,yo) y1
• Taylor Method EXPLICIT / forward
• Runge–Kutta error
(RK) Method Approximated y1 = yo + t
yn+1 = yn + h f(xn,yn)
Slope at f(xo,y o) = tan = t/h yn+1 = yn + h f(xn+1,yn+1) P(xo ,y t
t= h f(xo,y o) yo )
o h yo yo + t
IMPLICIT / backward
Therefore y1 = yo + h f(xo,yo) 0 x
xo x1
Same for y2, y3 upto yn

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method Disadvantages:
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Error is big, if h has big value,
• Taylor Method
• Runge–Kutta
(RK) Method to make error smaller, h should
be very small

• Smaller h increases
computational time and effort

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method Solution:
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method Solution:
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection


method
• Secant Method
• Newton–
Average of Explicit and Implicit Euler Method to small down
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
the error of approximation
• Runge–Kutta
(RK) Method

yn+1 = yn + h f(xn,yn) + h f(xn+1,yn+1)

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Applied to higher order differential equations


• Secant Method
• Newton–
Raphson Method However, higher derivatives make the calculation complex
• Euler Method


• Heun Method
• Taylor Method
• Runge–Kutta The taylor series is the basis of Euler method
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Extension of Euler Method, however, the error is reduced
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Euler is also known as first order Runge-Kutta
• Taylor Method
• Runge–Kutta
(RK) Method • Many types: RK2, RK4, RKF45

• In each type the order is increased for better prediction


• Prediction increases with increase in order, however, the
prediction becomes more complex and time consuming

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Extension of RK method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Starts with RK method and then propagate in two steps
• Heun Method
• Taylor Method
• Runge–Kutta
involved, prediction and correction
(RK) Method

• Prediction formula is used once and correction is used again


and again until the accuracy is achieved

• This method is very fast than RK4 Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents Solution:
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents Solution:
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Solution:
Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents Solution:
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods


Contents
• Bisection
method
• Secant Method
• Newton–
Raphson Method
• Euler Method
• Heun Method
• Taylor Method
• Runge–Kutta
(RK) Method

Lecture 7: Numerical Methods

You might also like