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

NUMERICAL METHODS (EP207)

ASSIGNMENT 1

NAME: 1. AINGGARARUBAN A/L GANESHAN


2.
ID: 1. 1001642979
2.
LECTURER: IR. BONAVIAN HASIHOLAN

SCHOOL OF ENGINEERING
FACULTY OF ENGINEERING, TECHNOLOGY & BUILT
ENVIRONMENT
2020
Chapter 2: Locating the Roots of Single Non‐Linear Equation

Introduction

A chemical engineer was required to design a computerised system for production of acetone with
could be controlled automatically with minimal supervision to enhance the efficiency of the
production line. This requires accurate estimates of molar volume of the gas involved on a
continuous basis to ensure the desired final product. The exact estimate of the volumes of gas
involved should be evaluated in a short period.

Problem Statement

The ideal gas law is given as PV=nRT. Although this equation is widely used, it is only accurate
over a limited range of temperature and pressure. An alternative equation to calculate the molar
volume of gas is given by the Van de Waals equation as follows.
𝑎
(𝜌 + ) (𝑣 − 𝑏) = 𝑅𝑇
𝑣2

Where 𝜌 is the pressure, 𝑣 = 𝑉/𝑛 is the molar volume, 𝑎 & 𝑏 are the empirical constant of the gas,
R is the universal gas constant and T is the temperature. The following information is obtained to
be used in the calculations in the ideal conditions for reaction:

𝑅 = 0.082054 𝐿. 𝑎𝑡𝑚/(𝑚𝑜𝑙. 𝐾)
𝑇 = 400𝐾
𝑝 = 2.5𝑎𝑡𝑚
𝐺𝑎𝑠 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡, 𝑎 = 14.09
𝐺𝑎𝑠 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡, 𝑏 = 0.0994

Solution

𝑃𝑉 = 𝑛𝑅𝑇

𝑉 𝑅𝑇 0.082054 × 400
= = = 13.12864 𝐿/𝑚𝑜𝑙
𝑛 𝑃 2.5

Using the Van de Waals equation;


𝑎
(𝜌 + ) (𝑣 − 𝑏) = 𝑅𝑇
𝑣2

The root is given by;


𝑎
𝑓(𝑣) = (𝜌 + ) (𝑣 − 𝑏) − 𝑅𝑇
𝑣2
Substitute all the values given into function;

14.09
𝑓(13.12864 ) = (2.5 + ) (13.12864 − 0.0994) − 0.082054(400)
(13.12864 )2

= 0.81660

Differentiating the function above;

14.09 2.801092
𝑓 ′ (𝑣) = 2.5 − +
𝑣2 𝑣3
14.09 2.801092
𝑓 ′ (13.12864) = 2.5 − 2
+
(13.12864) (13.12864)3

= 2.41949

Newton-Raphson is selected to be used to calculate the root as it is the most efficient when
estimating values for numerous data as should be expected from an automatically controlled
system. It only requires one guess to obtain the root which speeds up to process of calculation by
the computer, in contrast to other methods which requires more data.

Newton-Raphson iterative method;

𝑎
(𝜌 + ) (𝑣𝑖 − 𝑏) − 𝑅𝑇
𝑣𝑖 2
𝑣𝑖+1 = 𝑣𝑖 −
𝑎 2𝑎
(𝜌 + 2 ) − (𝑣𝑖 − 𝑏) ( 3 )
𝑣𝑖 𝑣𝑖

First iteration:

The values of constants were substituted in when where 𝑣0 = 13.12864.

14.09
(2.5 + ) (13.12864 − 0.0994) − 0.082054(400)
(13.12864)2
𝑣1 = 13.12864 −
14.09 2(14.09)
(2.5 + 2 ) − (13.12864 − 0.0994) ( )
(13.12864) (13.12864)3

= 12.79113

Substitute all the variables in the main function,

14.09
𝑓 (12.79113 ) = (2.5 + ) (12.79113 − 0.0994) − 0.082054(400)
(12.79113 )2
= 0.0007
14.09 2.801092
𝑓 ′ (12.79113) = 2.5 − +
(12.79113)2 (12.79113)3
= 2.41522

Second iteration:

𝑣1 = 12.79113

14.09
(2.5 + ) (12.79113 − 0.0994) − 0.082054(400)
(12.79113)2
𝑣2 = 12.79113 −
14.09 2(14.09)
(2.5 + ) − (12.79113 − 0.0994) ( )
(12.79113)2 (12.79113)3

= 12.79083

Substitute all the variables in the main function,

14.09
𝑓(12.79083 ) = (2.5 + ) (12.79083 − 0.0994) − 0.082054(400)
(12.79083 )2
= - 0.000015

14.09 2.801092
𝑓 ′ (12.79083) = 2.5 − 2
+
(12.79083) (12.79083)3
= 2.41521

The following few iterations were calculated using excel and is shown in below table:

i 𝑣𝑖 𝑓(𝑣𝑖 ) 𝑓′(𝑣𝑖 ) 𝜀𝑎 (%)


0 13.1286 0.8166 2.4194 -
1 12.7911 0.0007 2.4152 2.6386
2 12.7908 5.7000× 10−10 2.4152 0.0023
3 12.7908 0 2.4152 0.0000

After three iterations, the molar volume obtained is 𝑣 = 12.7908 𝐿/𝑚𝑜𝑙 which is close to the
initial calculated value from the ideal gas formula and with an 𝜀𝑎 of less than 0.0001 percent,
which was set as the tolerable error percentage. This concludes that Newton-Raphson is a suitable
method of estimation for this case study.
Chapter 3: Finding the Solution of Linear Algebraic Equations System

Introduction

A chemical engineer working in an electroplating processing company was tasked by the


production manager to research on various methods of electroplating nickel onto other metals to
obtain more efficient methods which could reduce cost and increase revenue for the company in
the future.

Problem Statement

The liquid-liquid electroplating process was conducted in the company laboratory that involved
the extraction of nickel from the aqueous phase to the organic phase. The experimental data is as
below:

Ni aqueous phase, k (g/l) 2 3 6


Ni organic phase, j (g/l) 7.07 11.2 13.4

Assuming j is the amount of Ni in the organic phase and k is the amount of Ni in the aqueous
phase, the quadratic interpolant that estimates g is given by :

𝑗 = 𝑥1𝑘 2 + 𝑥2 𝑘 + 𝑥3, 2≤𝑘≤6

The solution for the unknowns is given by the following equations.

4𝑥1 + 2𝑥2 + 𝑥3 = 7.07


6.25𝑥1 + 2.5𝑥2 + 𝑥3 = 11.2
9𝑥1 + 3𝑥2 + 𝑥3 = 13.4

Find the values of 𝑥1 , 𝑥2 , 𝑥3 using LU decomposition. Estimate the amount of nickel in the
organic phase when 4.1 g/l is in the aqueous phase using quadratic interpolation.
Solution

LU decomposition was choosen as the method to find solution for the linear equations as it can
produce accurate results with minimal steps.

Using MatLab

A : Defining the matrix with the coefficients of x1, x2 and x3 respectively.


B : Defining the matrix with the coefficients of the solution of each equation.
Line 1&2: Defining the equations in terms of matrix. A is the coefficients, b is the answer of the
equations.
Line 3: A is factored into the lower and upper triangular matrice using built in LU decomposition
MATLAB function.

d is the solution for lower triangular matrix by the B(solution).

Finally, the solution is found by function of x, in which the upper triangular matrix is divided by
the d.

X1 = -3.8600
X2 = 25.6300
X3 = -28.7500

Manual Calculation

1 0 0 𝑢11 𝑢12 𝑢13


[𝐴] = [𝐿][𝑈] = [𝑙21 1 0] [ 0 𝑢22 𝑢23 ]
𝑙31 𝑙32 1 0 0 𝑢33

4 2 1
[6.25 2.5 1]
9 3 1
4 2 1
Row 2 – (Row 1× (1.5625)) = [0 −0.625 −0.5625]
9 3 1
4 2 1
Row 3 – (Row 1 × (2.25)) = [0 −0.625 −0.5625]
0 −1.5 0.1
4 2 1
Row 3 – (Row 2× (2.4)) = [0 −0.625 −0.5625]
0 0 0.1
4 2 1
[𝑈] = [0 −0.625 −0.5625]
0 0 0.1

To find [L],

6.25
𝑙21 = = 1.5625
4

9
𝑙31 = = 2.25
4

−1.5
𝑙32 = = 2.4
−0.625
1 0 0
[𝐿] = [1.5625 1 0]
2.25 2.4 1

[𝐿][𝑍] = [𝐶]

1 0 0 𝑧1 7.07
[1.5625 1 0] [𝑧2 ] = [11.2]
2.25 2.4 1 𝑧3 13.4

Solving the matrix above gives the following equations:

𝑧1 = 7.07
1.5625𝑧1 + 𝑧2 = 11.2
2.25𝑧1 + 2.4𝑧2 + 𝑧3 = 13.4

Solving this;

𝑧2 = 11.2 − 1.5625𝑧1 = 11.2 − 1.5625(7.07) = 0.1531


𝑧3 = 13.4 − 2.25𝑧1 − 2.4𝑧2 = 13.4 − 2.25(7.07) − 2.4(0.1531) = −2.8749

Solving for [U][X] = [Z];

4 2 1 𝑥1 𝑧1
[0 𝑥 𝑧
−0.625 −0.5625] [ 2] = [ 2 ]
0 0 0.1 𝑥3 𝑧3

4 2 1 𝑥1 7.07
[0 𝑥
−0.625 −0.5625] [ 2] = [ 0.1531 ]
0 0 0.1 𝑥3 −2.8749

4𝑥1 + 2𝑥2 + 𝑥3 = 7.07


−0.625𝑥2 − 0.5625𝑥3 = 0.1531
0.1𝑥3 = −2.8749

Solving these equations;

−2.8749
𝑥3 = = −28.749
0.1

0.1531 + 0.5625𝑥3 0.1531 + 0.5625(−28.749)


𝑥2 = = = 25.6291
−0.625 −0.625

7.07 − 2𝑥2 − 𝑥3 7.07 − 2(25.6291) − (−28.749)


𝑥1 = = = −3.8598
4 4
After obtaining the values of x, proceed to solve the amount of Ni present in the organic
phase using quadratic interpolation when there is 4.1 g/l in the aqueous phase;

𝑗 = 𝑥1 𝑘 2 + 𝑥2𝑘 + 𝑥3

𝑗 = (−3.8598)(4.12 ) + 25.6291(4.1) + (−28.749)

𝒋 = 𝟏𝟏. 𝟒𝟒𝟕𝟏𝒈/𝒍

You might also like