You are on page 1of 10

Faculty of Mechanical Engineering

MEC500
Numerical Method

Individual Assignment

Lecturer:
HAFIZI BIN LUKMAN

Name: KAMIL BUDIMAN BIN MOHD ZAKI


UiTM Id: 2016229964
Class: EMD6M6A
Question A

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

Therefore, the real root of the equation is x=0.0210937.


Bisection Method

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%

Iteration Xl Xr Xu f(Xl) f(Xr) F(Xl). ℇa (%) ℇt (%)


f(Xr)
1 0 0.015 0.03 2 0.970628 1.941257 - 28.89
2 0.015 0.0225 0.03 0.970628 -0.28233 -0.27404 33.33 6.67
3 0.015 0.01875 0.0225 0.970628 0.405671 0.393755 20 11.11
4 0.01875 0.020625 0.0225 0.405671 0.07705 0.031257 9.09 2.22
5 0.02065 0.021575 0.0225 0.07246 -0.10119 -0.00733 4.40 2.28
6 0.02065 0.021113 0.021575 0.07246 -0.01343 -0.00097 2.19 0.09
7 0.02065 0.020882 0.021113 0.07246 0.029703 0.002152 1.11 1.01
8 0.020882 0.020998 0.021113 0.02961 0.008101 0.00024 0.55 0.46
9 0.020998 0.021056 0.021113 0.008008 -0.00274 -0.000022 0.28 0.18

Table 1: Bisection method

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

f’(x) = 3x2 – 8750x -3

Initial condition; x = 0.03


𝑓(0.03)
𝑋𝑖+1 = (0.03) −
𝑓′(0.03)

−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.

Iteration Xi Xi+1 f(Xi) f’(Xi) ℇa (%) ℇt (%)


1 0.03 0.022363 -2.02747 -265.497 100 42.22
2 0.022363 0.021079 -0.25513 -198.679 34.15 6.02
3 0.021079 0.021041 -0.00721 -187.443 6.09 0.07
4 0.021041 0.021041 -0.0000065 -187.106 0.18 0.25

Table 2: Newton-Raphson Method


At the fourth iteration, the approximate error value is below the stopping criterion thus
the iteration is stopped. The root is determined to be x = 0.021041 with approximate error of
0.18% and a true error of 0.25%.
Question A (2)

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.

3. Freesourcecode.net. (n.d.). Retrieved from


http://freesource.net/matlabprojects/56940/bisection-method-matlab-code

4. https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/10RootFinding/bisection/example
s.html
MEC500 ASSIGNMENT RUBRICS- ASSIGNMENT

GROUP NO DUE DATE SUBMISSION REMARKS


DATE

ON TIME /
EMD6M6A 15/7/2018 15/7/2018
LATE

LECTURER NAME HAFIZI BIN LUKMAN

No Name Student ID

1 KAMIL BUDIMAN BIN MOHD ZAKI 2016229964

Guidelines Level Poor Satisfactory Good Excellent


Scale
Scale 0-4 5-6 7-8 9-10

Assessment Criteria (Report) Weight Scale Total

(w) (y) (w * y)

Content/ Diagrams/ Figures/ Discussion and Conclusion

CO2/PO1/C3 Solve the task 2.5 2

CO2/PO1/C3 Show justification 2.5 2

Display computer computational


CO4/PO5/P4 2.5 2
approach
Display Format, Language and
CO4/PO5/P4 2.5 2
Organization, References and citation

TOTAL 20%

REMARKS:

END OF QUESTION PAPER

You might also like