Professional Documents
Culture Documents
MEC500
Numerical Method
Individual Assignment
Lecturer:
HAFIZI BIN LUKMAN
Background
Water vapor (H2O) is heated to sufficiently high temperatures that a significant portion of the
water dissociates, or splits apart, to form oxygen (O2) and hydrogen (H2):
1
𝐻2 𝑂 ↔ 𝐻2 + 𝑂2
2
If it is assumed that this is the only reaction involved, the mole fraction x of H2O that dissociates
can be represented by
𝑥 2𝑝𝑡
𝐾= √
1−𝑥 2+𝑥
where K = the reaction equilibrium constant and pt = the total pressure of the mixture.
The Task
An engineering design project requires that you accurately estimate the mole fraction x of H2O
if pt = 3.5 atm and K = 0.04, determine the value of x that satisfies the equation above.
Instruction
1. Use any two numerical roots of equations method and determine the roots for the mole
fraction x of H2O.
(CO2/PO1/C3)
2. Show justification for your choice of method to solve task above.
(CO2/PO1/C3)
Question A (1)
From the equation,
𝑥 2𝑝𝑡
𝐾= √
1−𝑥 2+𝑥
By applying the value of K=0.04 and pt = 3.5 the equation can be rearranged to:
3
0 = 𝑥 3 − 4375𝑥 2 − 3𝑥 + 2
Thus,
𝑓(𝑥) = 𝑥 3 − 4375𝑥 2 − 3𝑥 + 2
The roots of equation will be determined by using both bisection method and Newton-Raphson
method. The real root will first be calculated by using MATLAB using bisection method.
MATLAB Script
MATLAB Result
The bisection method finds the roots of equation by continuously bisecting the interval and
then selects a subinterval in which a root must lie for further processing. It is a robust but slow
method of finding the roots. For this problem, the stopping criterion ℇs is 0.5%.
Sample of calculation
Initial value;
Xl = 0
Xu = 0.03
Xr = (0+0.03)/2
= 0.015
Lower limits
f(Xl)
𝑓(0) = (0)3 − 4375(0)2 − 3(0) + 2
𝑓(0) = 2
Middle point
f(Xr)
𝑓(0.015) = (0.015)3 − 4375(0.015)2 − 3(0.015) + 2
𝑓(0.015) = 0.970628375
If the product of f(Xl) and f(Xr) is of positive value then the value of Xr will go to the next Xl ,
if the product yield a negative value them the value of Xr will go to the next Xu .
Approximate error, ℇa
𝑋𝑟 𝑜𝑙𝑑 − 𝑋𝑟 𝑛𝑒𝑤
𝜀𝑎 = | | × 100%
𝑋𝑟 𝑛𝑒𝑤
0.015 − 0.0225
𝜀𝑎 = | | × 100%
0.0225
𝜀𝑎 = 33.33%
True error, ℇt
𝑋𝑟 − 0.0210937
𝜀𝑎 = | | × 100%
0.0210937
0.015 − 0.0210937
𝜀𝑎 = | | × 100%
0.0210937
𝜀𝑎 = 28.89%
The iteration is stopped at the ninth iteration as both the approximate and true error is
below the stopping criterion. From this bisection iteration method, the root of the equation
x= 0.021056 with 0.28% approximate error and 0.18% true error.
Newton-Raphson Method
The Newton-Raphson method use the formula;
𝑓(𝑥𝑖 )
𝑋𝑖+1 = 𝑋𝑖 −
𝑓′(𝑥𝑖 )
to determine the next value of x which will approximately approach the value of the roots of
equation and by calculating the approximate error the roots of equation are determined. The
stopping criterion ℇs is 0.5%.
Sample of calculation
−2.02747
𝑋𝑖+1 = 0.03 −
−265.497
𝑋𝑖+1 = 0.022363
The calculation for approximate error and the true error is the same as in bisection method.
The 2 methods chosen to solve taken from the bracketing method and the open method. Since
the equation is not a polynomial equation thus the third method categories cannot be used. To
ensure high accuracy of the result, the stopping criterion is set at ℇs=0.5%.
The bisection method is a bracketing method that continuously bisecting the interval
and then selects a subinterval in which a root must lie for further processing. It is a robust but
slow method of finding the roots. But the result of the approximation will surely approach the
root of the equation. Another reason is to compare the efficiency of this method with the second
method used to solve the problem. The result show that the root of equation can be determine
after 9 iterations with x = 0.021056. The root has an approximate error of 0.25% and a true
error of 0.18%.
The Newton-Rapson method is an open method. It is simple and can be used to
determine the root of equation faster than the other method. Compared with the bisection
method, the Newton-Raphson method will only require less iteration to determine the root of
equation with the same accuracy level. The Newton-Rapson method is able to determine the
root of the equation after 4 iterations. The root determined is x = 0.021041. It has an
approximate error of 0.18% and a true error of 0.25%.
References
1. http://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/07/bisection.html
2. Lecturer note: Hafizi Bin Lukman, “Chapter 2: Roots of Equation”, Numerical Method
MEC500, Universiti Teknologi MARA.
4. https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/10RootFinding/bisection/example
s.html
MEC500 ASSIGNMENT RUBRICS- ASSIGNMENT
ON TIME /
EMD6M6A 15/7/2018 15/7/2018
LATE
No Name Student ID
(w) (y) (w * y)
TOTAL 20%
REMARKS: