You are on page 1of 15

NUMERICAL COMPUTATION OF CHEMICAL ENGINEERING

FINAL REPORT

MODULE :2
TITLE : Successive Approximation and Newton-Raphson

Nama Praktikan : Aryasatya Wicaksono


NRP : 5008211047

ASSISTANT
Assistant Name 1 : Hugo
Assistant NRP 1 : 5008201154
Assistant Name 2 : Edbert Gervais de Liyis
Assistant NRP 2 : 5008201168

LECTURER
Lecturer Name : Firman Kurniawansyah, S.T., M.Eng.Sc., Ph.D
NIP : 197705292003121002

Experiment Date : 19th September 2022

SIMULATION AND COMPUTATION LABORATORY


CHEMICAL ENGINEERING DEPARTMENT
FAKULTAS TEKNOLOGI INDUSTRI DAN REKAYASA SISTEM
INSTITUT TEKNOLOGI SEPULUH NOPEMBER
I Introduction
I.1 Objective
The practical aim of module 2 is to discuss and comparing numerical
methods for solving non-linear equations, namely Successive
Approximation and Newton Raphson
I.2 Basic theory
Generally, a non-linear equation f(x) = 0 cannot be solved analytically, but
can be solved using more complex numerical methods. Various kinds of
numerical methods have been developed, including the Successive
Approximation method and Newton Raphson using only one number as an
initial approximation. The following is an explanation of these numerical
methods:
1.2.1 Successive Approximation Method
This method is also called the iterative trial and error method, where you
use the initial price and then get a new price. The method is considered
convergent if the difference between the new price and the previous price is
smaller than the tolerance. The algorithm for this method is:
1. Choose the initial approach price, x1.
2. Change f(x) to x=g(x), so x2=g(x1).
3. If |x2-x1| ≤ tolerance, then the price x2 is the price x sought, if not proceed
to stage 2

Figure 1.1 Graphical representation of the convergent Sequential


Approximation method: a) [g'(x)>0]; b) [g’(x)<0]
Figure 1.2 Graphical representation of the divergent Sequential
Approximation method: a)[g'(x)>0]; b) [g’(x)<0]

1.3.2 Newton-Raphson method


This method uses a derivative function as a tangent function. The advantage
of using the Newton-Raphson method is that it is more effective for solving
non-linear equation problems. The calculation steps for this method can be
carried out by iteration, that is, carrying out repeated calculations until the
value obtained or the solution to the equation gives a relatively small error
regarding the exact root. The weakness of this method is that it requires a
first derivative for the iteration formula. If the first derivative is not found,
it becomes an obstacle in carrying out calculations using iteration. And
choosing an initial guess that is not quite right can cause a discrepancy
between the root result obtained and the exact root, and even cause the
number sequence to diverge. (Rochmad, 2013).
The algorithm of this method is:
1. Choose the initial approach price, X1.
2. Determine the price x2=x1-f(x1)/f'(x1).
3. If |f(x2)|≤ tolerance, then the price of x2 is the price of x being sought,
otherwise proceed to step 4.
4. Determine the new price x1=x2 then return to step 2.

Figure 1.3 Graphical Newton-Raphson method calculation process

So, to determine Xn+1 the following equation is used:


f(xn) + (xn+1–xn)f’(xn)=0

The iteration will stop if (xn+1 – xn)/xn becomes smaller than the largest
error allowed (tolerance). (Altway et al, 2021)

1.3

I.2.1
II Listing Discussion

• Successive Approximation
1. Clc
This command clears the command window in MATLAB, removing
any text or output that was previously displayed. It stands for "clear
command window."

2. clear all
This command clears all the variables in the MATLAB workspace. It
removes any data that was previously stored in memory. Be cautious
when using clear all as it will remove all variables, and this action cannot
be undone.

3. close all
This command closes all open figure windows in MATLAB. If you had
any plots or graphs open, they would be closed, and the figures would
be removed from the screen.
4. X = input ('Masukkan nilai X =');
entering a value for the variable X represents the variable that we would
like to gain by input a certain value

5. Tol = input ('Masukkan nilai Toleransi =');


The variable that we would like to obtain by inputting a certain value is
represented by the next line. The degree to which the approximation root
will resemble the real root depends on tolerance. Successive
Approximation method must obtain the exact root as closely as possible
the smaller the tolerance value.

6. E = 1;
Initialize the variable E (error) with an initial value of 1. This will be
used as the initial stopping criterion in the while loop.

7. iterasi = 0;
Initialize the iteration variable to calculate the number of iterations
required.

8. while E>Tol
Initialize the iteration variable to calculate the number of iterations
required.

9. f = ((-0.016464*X^3)+0.1252832*X^2+0.04704)/0.1558592;
calculates a value for the variable f based on the value of the variable X
which is equation that we need to be solve

10. X1 = f;
X1 is the next root approximation, which is calculated based on the
value of f.

11. E =abs((X1-X)/X);
This line, you calculate the error (E) as the absolute difference between
the value of the next root estimate X1 and the value of the previous root
estimate X, then divide it by the value of the previous root estimate next
root as a proportion of the estimate of the previous root.

12. iterasi = iterasi + 1;


Increase the number by +1 of iterations each time a new iteration is
started
13. X = X1;
The variable of x is equal to x1

14. End
This line means that the calculation is done

15. disp([('Nilai X (V/F) ='),num2str(X1)]);


disp([('Jumlah Iterasi ='),num2str(iterasi)]);
disp([('Nilai Error ='),num2str(E)]);
This three line of display represents the value that would like to be
displayed on command window

• Newton-Raphson
1. Clc
This command clears the command window in MATLAB, removing
any text or output that was previously displayed. It stands for "clear
command window."

2. clear all
This command clears all the variables in the MATLAB workspace. It
removes any data that was previously stored in memory. Be cautious
when using clear all as it will remove all variables, and this action cannot
be undone.

3. close all
This command closes all open figure windows in MATLAB. If you had
any plots or graphs open, they would be closed, and the figures would
be removed from the screen.
4. X = input ('Masukkan nilai X =');
entering a value for the variable X represents the variable that we would
like to gain by input a certain value

5. Tol = input ('Masukkan nilai Toleransi =');


The variable that we would like to obtain by inputting a certain value is
represented by the next line. The degree to which the approximation root
will resemble the real root depends on tolerance. The Newton-Raphson
method must obtain the exact root as closely as possible the smaller the
tolerance value.
6. E = 1;
Initialize the variable E (error) with an initial value of 1. This will be
used as the initial stopping criterion in the while loop.

7. iterasi = 0;
Initialize the iteration variable to calculate the number of iterations
required.

8. while E>=Tol
Initialize the iteration variable to calculate the number of iterations
required.

9. f = 0.016464*X^3-0.1252832*X^2+0.1558592*X-0.04704;
calculates a value for the variable f based on the value of the variable X
which is equation that we need to be solve

10. df = 0.049392*X^2-0.2505664*X+.1558592;
It is obliged to do the derivative from the first equation.

11. X1 = X - (f/df);
Input the Rhapson method equation. The Newton-Raphson method's
central step is this one. Here, using the estimated value of X, the first
derivative of the function with respect to X (df), and the current estimate
of X, you may estimate the next root of X1. The estimated root is now
getting closer to the real root thanks to this phase.

12. E = abs (f);


Calculate the error E as the absolute value of the function f. This is one
way to measure how close the current estimate of the root of X is to the
true root.

13. iterasi = iterasi + 1;


Increase the number by +1 of iterations each time a new iteration is
started

14. X = X1;
The variable of X is equal to X1
15. End
This line means that the calculation is done

16. disp([('Nilai X (V/F) ='),num2str(X1)]);


disp([('Jumlah Iterasi ='),num2str(iterasi)]);
disp([('Nilai Error ='),num2str(E)]);
This three line of display represents the value that would like to be
displayed on command window

III Results and Discussion


In this practicum to find Successive Approximation and Newton-Raphson
these are the data to find the solution of the problem

Table 1. of the propane, ethane, and the n-butane in the mixture


Component Formula Mole Fraction Distribution
(%) Coefficient (Ki)
Propane C3H8 42.8 1.42
Ethane C2H6 19.6 0.86
n-buthane C4H10 37.6 0.72

Table 2. Comparison Results of Newton-Rhapson and Successive


Approximation
Method Trial Tolarance x/f Iteration Error
X1
Newton- 0.1 0.0001 0.46499 4 3.5191e-
Rhapson 05
Successive 0.1 0.0001 0.46489 19 9.7948e-
Approximation 05

From the result above we can see that we already obtain the data needed to
answer the problem from both method, there are different in result of
iteration and error. The Newton-Raphson method and the Successive
Approximation method are two numerical techniques used to approximate
the roots or solutions of equations, but they have different approaches and
characteristics. The Newton-Raphson method is an iterative technique that
uses the derivative of the function to find better and better approximations
of the root. The Successive Approximation method is also an iterative
technique but does not rely on the derivative. It can be used for a wide range
of functions, including nonlinear and non-differentiable functions. the
choice between these two methods depends on the specific problem, the
nature of the function, and whether or not derivatives are available. The
Newton-Raphson method is a powerful tool when derivatives can be
computed, while the Successive Approximation method offers more
flexibility for a wider range of functions.

The preceding practical outcomes demonstrate that every difference and


every method has unique benefits and drawbacks. The benefit of Newton
Raphson's method is that it requires less iterations, which speeds up
calculations and produces results that are near to the real ones. The method's
flaw, however, is the requirement for accuracy in the first estimated value
selection, which makes convergence unpredictable. Two equations or
functions must be assessed for each stage of this procedure, and derivatives
must be sought right away. Successive method approximation has the
advantages of being a broad approach that is simple to comprehend and the
downsides of having less accuracy and the inability to guarantee
convergence values.

IV Conclusion
From the practicum that has been carried out, it can be conclude both
the Successive Approximation Method and the Newton-Raphson Method
are powerful numerical techniques for approximating equation solutions,
although their approaches and efficiency differ. The Successive
Approximation Method is suited for a wide range of issues due to its
comparatively simple iterative methodology. However, for all equations,
convergence is not guaranteed, and the pace of convergence can be slow,
depending on the formula chosen and the starting guess. It is very useful for
situations with complicated analytical answers, but it may take more
iterations to obtain the requisite accuracy. The Newton-Raphson Method,
on the other hand, is recognized for its quick convergence and effectiveness
in locating the roots of functions. It uses the function's derivative to direct
the iteration process. The approach quickly arrives at a solution when the
initial guess is sufficiently near the root and other requirements are satisfied.
It is commonly utilized in domains of science, engineering, and
mathematics where accuracy and speed are essential.
REFERENCE
Altway, A. et al. (2021) Komputasi Numerik Teknik Kimia. Surabaya: ITS Press.
Burden, R. L. and Faires, J. D. (1985) Numerical Analysis. 10th edn. PWS-KENT
Publishing Company.
Chapra, S. C. and Canale, R. P. (2005) Numerical Methods for Engineers. 7th edn.
McGraw-Hill Science/Engineering/Math.
APPENDIX
Successive Approximation Method Flowchart
Metode Newton-Raphson Method Flowchar
Listing Coading
clc
clear all
close all

disp('Aryasatya Wicaksono');
disp('NRP 5008211047');
disp('Successive Aproximation Method Test');

X = input ('Masukkan nilai X =');


Tol = input ('Masukkan nilai Toleransi =');
E = 1;
iterasi = 0;
while E>Tol
f = ((-0.016464*X^3)+0.1252832*X^2+0.04704)/0.1558592;
X1 = f;
E =abs((X1-X)/X);
iterasi = iterasi + 1;
X = X1;
end

disp([('Nilai X (V/F) ='),num2str(X1)]);


disp([('Jumlah Iterasi ='),num2str(iterasi)]);
disp([('Nilai Error ='),num2str(E)]);

clc
clear all
close all

disp('Aryasatya Wicaksono');
disp('NRP 5008211047');
disp('Newton Rhapson Method Test');

X = input ('Masukkan nilai X1 =');


Tol = input ('Masukkan nilai Toleransi =');
E = 1;
iterasi = 0;
while E>=Tol
f = 0.016464*X^3-0.1252832*X^2+0.1558592*X-0.04704;
df = 0.049392*X^2-0.2505664*X+.1558592;
X1 = X - (f/df);
E = abs (f);
iterasi = iterasi + 1;
X = X1;
end

disp([('Nilai X (V/F) ='),num2str(X1)]);


disp([('Jumlah Iterasi ='),num2str(iterasi)]);
disp([('Nilai Error ='),num2str(E)]);

You might also like