You are on page 1of 7

Lab Assignment

Assignment No. 01

Subject: Process Modeling & Simulation

Department: Chemical Engineering

(8 th semester)

Reg No. 2016-CH-434

Submitted to: Dr. Azam Saeed

Submitted by: Arslan Maqbool

University of Engineering and Technology, Lahore


(Faisalabad Campus)

1
Lab Assignment

Convergence Method
1- Secant Method
Example:

As an example of the secant method, suppose we wish to find a root of the


function f(x) = cos(x) + 2 sin(x) + x2. A closed form solution for x does not exist so
we must use a numerical technique. We will use x0 = 0 and x1 = -0.1 as our initial
approximations. We will let the two values ε step = 0.001 and εabs = 0.001 and we
will halt after a maximum of N = 100 iterations.

We will use four decimal digit arithmetic to find a solution and the resulting
iteration is shown in Table No. 01.

The secant method applied to f(x) = cos(x) + 2 sin(x) + x2

Table No: 01

Thus, with the last step, both halting conditions are met, and therefore, after six
iterations, our approximation to the root is -0.6595.

2- Broyden Method

Example:

2
Lab Assignment

Consider,

Assume that x is positive, without any loss of generality, then the parametric form
of this equation is as follows [4, 6]:

The above system needs initial values as follows. For α =0

3
Lab Assignment

4
Lab Assignment

3- Newton-Raphson Method
Example:
Let us solve x 3 − x − 1 = 0 for x.
In this case f(x) = x3 − x − 1, so f 0 (x) = 3x2 − 1.
So the recursion formula (1) becomes
xn+1 = xn − (x3n − xn − 1)/3x2n − 1
Need to decide on an appropriate initial guess x0 for this problem. A rough graph
can help. Note that f(1) = −1 < 0 and f(2) = 5 > 0. Therefore, a root of f(x) = 0 must
exist between 1 and 2. Let us take x0 = 1 as our initial guess. Then

and with x1 = 1.5 we get x2 = 1.34783. For the next stage,

and with the value just found for x2, we find x3 = 1.32520. Carrying on, we find
that x4 = 1.32472, x5 = 1.32472, etc. We can stop when the digits stop changing
to the required degree of accuracy. We conclude that the root is 1.32472 to 5
decimal places.

5
Lab Assignment

4- SQP (Sequential Quadratic Programming) method


Example:
Consider the following non-linear optimization (NLO) problem:

Formulate the SQP sub problem for the candidate point x = (2, 2, 0) T and the
candidate Lagrange multiplier y = 2.
The general form of NLO problem is
min f(x)
s.t. hj (x) = 0, j = 1, . . . , m.
The Lagrange function is

where yj = R, j = 1, . . . , m.
In our case the Lagrange function is

The gradient and Hessian of the Lagrange function with respect to x are:

6
Lab Assignment

The SQP sub problem is:

You might also like