You are on page 1of 49

# EXPERIMENT NO.

1

NAME OF THE EXPERIMENT

Non-linear Algebraic Equations (Bisection Method)

AIM:

Write a program to find out the root of equation x3  1.8x2  10 x  17  0 and roots lie
between [1,2] by using Non-Linear Algebraic Method (Bisection Method) using Scilab.

PRE-REQUISITE:

1. Knowledge of SCILAB Programming
2. Knowledge of Numerical Methods

THEORY:

The bisection method in mathematics is a root finding method which repeatedly
bisects an interval and then selects a subinterval in which a root must lie for further
processing. It is a very simple and robust method, but it is also relatively slow. Because of
this it is often used to obtain a rough approximation to a solution which is then used as a
starting point for more rapidly converging methods. The method is also called Binary Search
method and Internal Halving method, and is similar to the concept of binary search, where
the range of possible solutions is halved for each iteration.

The method is applicable when we wish to solve the equation f ( x)  0 for the real

variable x, where f is a continuous function defined on an interval  a, b while f  a  and

f  b  have opposite signs. In this case a and b are said to bracket a root since, by the

intermediate value theorem, the f must have at least one root in the interval  a, b .

At each step the method divides the interval in two by computing the midpoint
c  (a  b) / 2 of the interval and the value of the function f  c  at that point. Unless c is itself

a root (which is very unlikely, but possible) there are now two possibilities: either f  a  and

f  c  have opposite signs and bracket a root or f  c  and f  b  have opposite signs and

bracket a root. The method selects a subinterval that is bracketed as new interval to be used in
the next step. In this way the interval that contains a zero of f is reduced in width by 50% at
each step. The process is continued until the interval is sufficiently small.

1

Explicitly, if f  a  and f  c  are opposite signs, then method sets c as the new value

for b, and if f  b  and f  c  are opposite signs then the method sets c as new a. In both cases,

the new f  a  and f  b  have opposite signs, so the method is applicable to this smaller

interval.

ALGORITHM FOR BISECTION METHOD:

1. Given a continuous function f  x 

2. Find points a and b such that a  b and f  a   f  b   0 .

3. Take the interval  a, b and find its midpoint x1 .

4. If f  x1   0 then x1 is an exact root, else if f  x1   f  b   0 then let a  x1 , else if

f  a   f  x1   0 then let b  x1 .

5. Repeat steps 2 and 3 until f  xi   0 or f  xi   DOA ( DOA  degree of accuracy).

Figure 1: Bisection Method
For the i th iteration, where, i  1, 2,..., n , the interval width is

xi  0.5

xi 1   0.5  b  a 
i

And the new midpoint is
xi  ai 1  xi

2

PROGRAM IN SCILAB
function [ ] = bisectionMethod( a,b )
a=3;
b=5;
MaxIt=1000;
epsilon=10^-6;
c=(b+a)/2;
NumIt=0;
while NumIt<MaxIt && abs (f(c))>epsilon
if f(a)*f(c)<0
b=c;
else
a=c;
end
NumIt=NumIt+1;
c=(b+a)/2;
end
c
end
function y=f(x)
y=x^3-1.8*x^2-10*x+17;
end

OUTPUT
C = 1.6618

RESULTS:
The root of the given Non-linear Algebraic Equation by Bisection Method is: 1.6618

CONCLUSION:
Thus we successfully studied the root finding program of Non-linear Algebraic Equation by
Bisection Method.

3

INDUSTRIAL APPLICATIONS:
1. It is used in computer science research to analyze safeguard zero finding methods
2. It is simplest of other all methods
3. We can safeguard bisection to detect cases where we don’t have any roots

VIVA QUESTIONS:
1. What is the difference between linear & nonlinear methods?
2. How does Bisection method differ from other numerical methods used for solving
linear algebraic equations?
3. What do you mean by Iterative process?
4. Bisection method uses Continuous functions or Non continuous functions?
5. Find root of following polynomial equation using Bisection method: f(x)=x3-x-2

4

2 NAME OF THE EXPERIMENT Non-linear Algebraic Equations (Secant Method) AIM: Write a program to find out the root of equation x3 – 5x – 7 = 0 and roots lie between [2. PRE-REQUISITE: 3. this method assumes the function to be approximately linear in the region of interest.3] by using Non-Linear Algebraic Method (Secant Method) using Scilab. Although secant method was developed independently. Mathematical Derivation of Secant Method: Consider a curve f(x) = 0 as shown in the figure below: 5 . Knowledge of SCILAB Programming 4. EXPERIMENT NO. During the course of iteration. Knowledge of Numerical Methods THEORY: Secant method is an iterative tool of mathematics and numerical methods to find the approximate root of polynomial equations. it is often considered to be a finite difference approximation of Newton’s method.

it uses succession of roots of secant line in the curve. . root of the equation that represents the curve) as exactly as possible.Secant method estimates the point of intersection of the curve and the X. Secant method falls under open bracket type. we get: Now. and construct a secant line to the curve through (x0. and solving for x. f(x1)). x3. Substituting y = 0 in the above equation. 6 . but the secant method algorithm and flowchart is easy to understand and use for coding in any high level programming language. x4.e. For that. considering this new x as x2.axis (i. and repeating the same process for x2. The equation of this secant line is given by: If x be the root of the given equation. . f(x0)) and (x1. . we end up with the following expressions: This is the required formula which will also be used in the program for secant method in Scilab. it must satisfy: f(x) = 0 or y= 0. Assume x0 and x1 to be the initial guess values. . The programming effort may be a tedious to some extent.

end NumIt=NumIt+1. NumIt=0. while NumIt<MaxIt && abs (f(c))>epsilon if f(a)*f(c)<0 b=c. else a=c. x1 and e Here x0 and x1 are the two initial guesses e is the stopping criteria. c=(b+a)/2. 6. Get values of x0. *Here [ ] is used as modulus sign* then assign x0 = x1 and x1 = x2 goto step 4 Else. end 7 . b=5. Stop PROGRAM IN SCILAB function [ ] = bisectionMethod( a. c=(b+a)/2. absolute error or the desired degree of accuracy 2.ALGORITHM FOR BISECTION METHOD: Given a continuous function f  x  Start 1. Compute f(x0) and f(x1) 3. epsilon=10^-6. Compute x2 = [x0*f(x1) – x1*f(x0)] / [f(x1) – f(x0)] 4. Test for accuracy of x2 If [ (x2 – x1)/x2 ] > e.b ) a=3. Display the required root as x2. MaxIt=1000. goto step 6 5.

The secant method does not require that the root remain bracketed like the bisection method does. How is Secant method a form of Newton Raphson method? 4. end OUTPUT C = 1.6618 RESULTS: The root of the given Non-linear Algebraic Equation by Bisection Method is: 1. How does Secant method differ from Bisection method? 2.8*x^2-10*x+17. 5. The secant method is a root-finding algorithm that uses a succession of roots of secant lines to better approximate a root of a function f. The secant method has also been used for capturing the peak response of complex multi-story buildings VIVA QUESTIONS: 1. 8 . Define Broyden's method in relation to secant method. INDUSTRIAL APPLICATIONS: 1.6618 CONCLUSION: Thus we successfully studied the root finding program of Non-linear Algebraic Equation by Bisection Method. How does Secant method differ from False position method? 3. 2. and hence it does not always converge. Define Order of Convergence.c end function y=f(x) y=x^3-1. 3.

In other words. the better. (The closer to the zero. in the absence of any intuition about where the zero might lie. The equation of the tangent line to the curve y= ƒ(x) at the point x = xn is: y = f’ (xn) (x-xn) + f (xn) Where. and one computes the x-intercept of this tangent line (which is easily done with elementary algebra).xn) + f (xn) Solving for xn+1 gives: xn+1 = xn – [f(xn) / (f’(xn)] We start the process off with some arbitrary initial value x0. The x-intercept of this line (the value of x such that y = 0) is then used as the next approximation to the root. The formula for converging on the root can be easily derived. then the function is approximated by its tangent line (which can be computed using the tools of calculus). 3 NAME OF THE EXPERIMENT Non-linear Algebraic Equations (Newton Raphson Method) AIM: Write a program to find out the root of equation x3 . setting y to zero and x to xn+1 gives: 0 = f’ (xn) (xn+1 . EXPERIMENT NO. Suppose we have some current approximation xn. This x-intercept will typically be a better approximation to the function's root than the original guess. b] with values in the real numbers R. Knowledge of Numerical Methods THEORY: The idea of the method is as follows: one starts with an initial guess which is reasonably close to the true root. f’ denotes the derivative of the function f. and the method can be iterated. xn+1. But. xn+1 by referring to the diagram on the right. Knowledge of SCILAB Programming 6.5x + 3 = 0 and initial guess of zero by using Non-Linear Algebraic Method (Newton Raphson Method) using Scilab. a "guess and check" 9 . PRE-REQUISITE: 5. b] → R is a differentiable function defined on the interval [a. Suppose ƒ: [a. Then we can derive the formula for a better approximation.

the desired degree of accuracy n is for operating loop d is for checking slope* 3.method might narrow the possibilities to a reasonably small interval by appealing to the intermediate value theorem. which intuitively means that the number of correct digits roughly at least doubles in every step. d x is the initial guess e is the absolute error i. More details can be found in the analysis section below. and that ƒ'(x0) ≠ 0. the convergence is at least quadratic (see rate of convergence) in a neighbourhood of the zero. Furthermore. for a zero of multiplicity 1. Start 2. the extra computations required for each step can slow down the overall performance relative to Newton's method. particularly if f or its derivatives are computationally expensive to evaluate.) The method will usually converge. e. ALGORITHM FOR NEWTON RAPHSON METHOD: 1. f = f(x) 5. The Householder's methods are similar but have higher order for even faster convergence. provided this initial guess is close enough to the unknown zero. However.e. Read x. n. f1 = f'(x) 10 . Do for i =1 to n in step of 2 4.

x1 = x – f/f1 8. b=1. Number of iterations') 11 . 6. Stop PROGRAM IN SCILAB f=@(x) x^3-5*x+3. *[ ] is used as modulus sign* 7. x=x1. er(5)=0. end plot(er) xlabel('Number of iterations') ylabel('Error') title('Error Vs.15f'. the display the root as x1 and goto 11. then display too small slope and goto 11. df=@(x) 3*(x^2)-5. x = x1 and end loop 10. If ( [f1] < d). x=a. a=0.sol) a=0. for i=1:1:100 x1=x-(f(x)/df(x)). *[ ] is used as modulus sign* 9. If ( [(x1 – x)/x1] < e ). Display method does not converge due to oscillation. b=1. er(i)=(sol-x1)/sol. 11. x=a. x=x1. fprintf('\n Approximate Root is %. end sol=x. for i=1:1:5 x1=x-(f(x)/df(x)).

2. Newton method for nonlinear systems: Application in Electronic Engineering. Civil Engineering: "Solution of the characteristic equation in the dynamic analysis of a plane frame using the newton‐raphson method". 5.656620431047110 RESULTS: The root of the given Non-linear Algebraic Equation by Newton Raphson Method is: ______ CONCLUSION: Thus we successfully studied the root finding program of Non-linear Algebraic Equation by Newton Raphson Method. 3.OUTPUT Approximate Root is 0. 12 . Newton’s method is a basic tool in numerical analysis and numerous applications. including operations research and data mining. These methods are used to approximate the solution of differential equations. INDUSTRIAL APPLICATIONS: 1. 4. Bisection method and Newton-Raphson methods are used to find the roots and fixed points of equations.

What is Fourier transforms of nonlinear differential equations? 5. 3. Write down “Colebrook equation”. Newton Raphson method is used to solve linear or nonlinear equations? 2. Give example of Newton Raphson method being used in Optimization. What is it used for? 13 .VIVA QUESTIONS: 1. What do you mean by “fixed point” of an equation? 4.

Knowledge of Numerical Methods THEORY In numerical analysis. The method proceeds by producing a sequence of shrinking intervals  ak . the number 14 . assuming continuity of the function f. the false position method starts with two points a0 and b0 such that f  a0  and f  b0  are of opposite signs. which implies by the intermediate value theorem that the function f has a root in the interval  a0 . 1]) by using False Position Method with the help of SCILAB. EXPERIMENT NO. At iteration number k. bk  that all contain a root of f. 4 NAME OF THE EXPERIMENT Non-linear Algebraic Equations (False Position Method/ Regula Falsi Method) AIM: Write a program to find out the root of equation sin  x   x 2  1 (roots lie between [0. PRE-REQUISITE: 7. Knowledge of SCILAB Programming 8. double false position became a root-finding algorithm that combines features from the bisection method and the secant method. b0  . Like the bisection method.

then assign x0 = x. Computer function values f(x0) and f(x1) 4. Check whether the product of f(x1) and f(x) is negative or not. then we set ak 1  ck and bk 1  bk . Stop 15 . while the false position method retains two points which certainly bracket a root.00001 or not. f  ak   and b . The above formula is also used in the secant method. goto step 5. otherwise we set ak 1  ak and bk 1  ck . Check whether the product of f(x0) and f(x1) is negative or not. Start 2. Check whether the value of f(x) is greater than 0.00001 is the desired degree of accuracy. 9. k k If f  ak  and f  ck  have the same sign. Determine: x = [x0*f(x1) – x1*f(x0)] / (f(x1) – f(x0)) 6. x1 and e *Here x0 and x1 are the two initial guesses e is the degree of accuracy or the absolute error i. If yes. If no. and setting y  0 and see that f  bk   f  ak  f  bk    ck  bk   0 bk  ak Solving this equation gives the above equation for ck . *Here the value 0. ALGORITHM: 1. 7.* 8. the only difference between the false position method and the bisection method is that the latter uses ck   ak  bk  / 2 . the stopping criteria* 3. If it is positive. ck  bk  f (bk )  bk  ak  f  bk   f  ak  is computed. f  bk   f  ak  y  f  bk    x  bk  bk  ak We now choose ck to be the root of this line (substituting for x). Display the root as x. but the secant method always retains the last two computed points. and hence the stopping criteria. goto step 8. If it is positive take another initial guesses. On the other hand. As explained below. 5.e. ck is the root of the secant line through  ak . If it is negative then goto step 5. f b  . Read values of x0. This process is repeated until the root is approximated sufficiently well. If it is negative. assign x1 = x.

end fprintf ('Approximate root after %d iterations is %0. estep=1e-15. f=@(x) sin(x)+x/2-1. OUTPUT Approximate root after 17 iterations is 0.n. stepsize =inf. if f(a)*f(c)<0 stepsize= b-c. b=c. CONCLUSION: Thus we successfully studied the root finding program of Non-linear Algebraic Equation by False Position Method. 16 . a=c. while (stepsize>=estep) c=b-(f(b)*(b-a))/(f(b)-f(a)). a=0.704576912921746 after 17 iterations.704576912921746 RESULT: The root of the given Non-linear Algebraic Equation by False Position Method is: 0.15f'.b=1. end n=n+1. else stepsize=c-a.c). n=0.PROGRAM IN SCILAB format long.

INDUSTRIAL APPLICATIONS: 1. Explain the successive under-interpolation (SUI). Explain the “Illinois Algorithm”. Modification of the Regula Falsi method to accelerate system convergence in the prediction of trace quantities of atmospheric pollutants. Explain the “Two point Bracketing Method”. 2. 3. VIVA QUESTIONS: 1. 3. The Regula Falsi method is applied to prediction of trace quantities of air pollutants produced by combustion reactions such as those found in industrial point sources. The application of various classical root-finding methods is in digital maximum power point tracking. Find root of following equation using Regula Falsi method: x + x/4 = 15 2. 17 . 5. Explain the “Anderson & Björk's algorithm”. 4.

. + a3nxn = b3 . . .... .. . . + annxn = bn Express these equations in the form: Ax = b where...... . .. Consider the following sets of liner equations: a11x1 + a12x2 + a13x3 + a14x4 . . .... .. ... . .. a randomized algorithm used for root finding. 18 .. .. .. .... . . The method of successive substitution is also known as back substitution... . . . + a2nxn = b2 a31x1 + a32x2 + a33x3 + a34x4 . .... Knowledge of Numerical Methods THEORY: In modular arithmetic.. EXPERIMENT NO. . ... There is also an unrelated numerical-analysis method of successive substitution. . . . .. . . Knowledge of Scilab Programming 10... .... an1x1 + an2x2 + an3x3 + an4x4 .. . . . an application of fixed-point iteration..... .... . . .. .. . . ... . ..... ... ....... .. . .... ... 5 NAME OF THE EXPERIMENT Non-linear Algebraic Equations (Successive Substitution Method) AIM: PRE-REQUISITE: 9... . ... ... . + a1nxn = b1 a21x1 + a22x2 + a23x3 + a24x4 . ... . It is commonly applied in cases where the conditions of the Chinese remainder theorem are not satisfied.. the method of successive substitution is a method of solving problems of simultaneous congruence by using the definition of the congruence equation.. .. . ... . ....... . ..

and upper triangular matrix U.Now. then simplify  rewrite back in the congruence form 19 . the (k+1)th can be evaluated sequentially by using forward substitution. Rewrite the system linear equation as: ( D + ωL ) x = ωb – [ ωU + ( ω – 1 ) D ] x Where. x(k) is the kth approximation for x and x(k+1) is (k+1)th approximation for x. such that: A = D + L + U where. The iteration equation is expressed analytically as: x(k+1) = ( D + ωL ) -1 (ωb – [ωU + (ω – 1 ) D ] x (k) ) = Lω (k) + c Where. the left hand side of the equation is solved by using the previous value for x on right hand side. Taking the advantage of triangular matrix form of ( D + ωL). ω is the relaxation factor and ω > 1 During the iteration process. decompose matrix A into Diagonal component matrix D. Lower triangular matrix L. The expression obtained for x(k+1) is: ALGORITHM:  write the first equation in its equivalent form  substitute it into the next  simplify. use the modular multiplicative inverse if necessary  continue until the last equation  back substitute.

It is commonly applied in cases where the conditions of the Chinese remainder theorem are not satisfied. error=x1-x.relative error i = 32 x1 = 0. if abs(error)<0.97844)^(1/2). break end x=x1.PROGRAM IN SCILAB: function[]=substitution(x) x=0.5*10^-5 char 'iteration. CONCLUSION: Thus we successfully studied the root finding program of Non-linear Algebraic Equation by using Successive Substitution Method. Numerical method for solving a nonlinear equation for the unknown.root. APPLICATIONS: 1.032823)/1.5.root. 2. 20 . for i=1:100 x1=((x^3+(0.9255e-006 RESULTS: The root of the given Non-linear Algebraic Equation by Successive Substitution Method is: 0. end OUTPUT ans = iteration.error.61506*x)-0.3021 after 32 iterations.relative error' i.3021 error = -4.x1. Used to solve Equations of State. 3.

VIVA QUESTIONS: 1. 5. Explain the “Successive over Relaxation” method. Successive substitution method is used to solve linear or nonlinear equations? 2. 3. What do you mean by simultaneous methods? 4. Find the positive root of x3-2x-8=0 by method of successive substitution correct up to two places of decimal. Why is initial approximation necessary? 21 .

EXPERIMENT NO.  a  b  . and 2) Variable volume (Constant Pressure) Batch Reactor using SimzLab software... PA0 and initial total pressure of the system. where C  RT 1 dPi ri  (2) RT dt For constant volume batch reactor the following equation:  a  PA  C A RT  PA0     P  P0  (3)  n  Gives the concentration or partial pressure of reactant A as a function of the total pressure P at time t. We have n  r  s  .. P0.. and for the reaction: aA  bB  . Most liquid-phase reactions as well as all gas phase reactions occurring in a constant volume bomb fall in this class In a constant volume system... 22 . (4) Similarly for any product R we can find: r PR  CR RT  PR 0   P  P0  (5) n Equations (4) and (5) are the desired relationships between total pressure of the system and the partial pressure of reacting materials and products.. the measure of reaction rate of component i becomes: 1 dNi d  Ni / V  dCi ri    (1) V dt dt dt P Or for ideal gases.. THEORY: There are two types of batch reactors: 1) Variable pressure (Constant Volume) Batch Reactor. and 2) Variable volume (Constant Pressure) Batch Reactor. 6 NAME OF THE EXPERIMENT Simulation of batch reactor AIM: To simulate the performance of 1) Variable pressure (Constant Volume) Batch Reactor. initial partial pressure of A.. Variable pressure (Constant Volume) Batch Reactor is a constant density reaction system...  rR  sS  ..

For such systems the volume is linearly related to the conversion. with symbol XA. or for reactions having a single stoichiometry. the conversion of A. and that NA is the amount present at time t. the fractional conversion. CA 1  X A   (13) C A0 1   A X A  23 . or the fraction of A reacted away. say A. converted to something else. or V  V0  V  V0 1   A X A  or X A  (10) V0  A Differentiating we get dV dX A  (11) V0  A Here  A is the fractional change in volume of the system between no conversion and complete conversion of reactant A. rearranging and integrating we obtain  CA  CA t dC A   CA 0 CA 0  k dt OR  ln   C A0   kt  (9) Variable volume batch reactors used for isothermal constant pressure operations. We call this. Then the conversion of A in the constant volume system is given by CA X A  1 (6) C A0 Differentiating we get. Thus VX A 1  VX A 0 A  (12) VX A 0 For variable volume system.Let us introduce one other useful term. Suppose that NA0 is the initial amount of A in the reactor at time t = 0. dC A dX A  (7) C A0 For first order irreversible unimolecular type reaction A  B dC A rA   kC A (8) dt For above relation. or the fraction of any reactant. simply.

time. time and the fractional conversion and the final pressure after a reaction time of 500 seconds. time plots for the variable pressure (constant volume) batch reactor. Ea = 40.0 kJ/mol Initial pressure = 100. k = 0. the concentration of A vs. 2) Variable Volume Batch Reactor For the first order reaction 2A  B carried out in a variable volume (constant pressure) batch reactor the following data are given Reaction rate constant.0 kPa Reaction temperature = 300 K Reaction time = 500 s Select the pressure range from 0 – 200 kPa and simulate the variable pressure (constant volume) batch reactor using SimzLab by clicking on the ‘Run Reaction’ button.0 kJ/mol Initial volume = 5 x 10-3 m3 Reaction temperature = 300 K Reaction time = 40 s Simulate the variable volume (constant pressure) batch reactor using SimzLab by clicking on the ‘Run Reaction’ button. k = 2x10-3 s-1 (value at 300 K) Activation energy. 24 . time and the fractional conversion vs. Ea = 20. Generate the pressure vs.The rate of reaction (disappearance of component A) can be written for a variable volume system as:  C A0  dX A rA    (14)  1   A   dt Or in terms of volume: C  dV  C A0  d  ln V  rA   A0    (15) VA  dt   A  dt SIMULATION USING SIMZLAB 1) Variable Pressure Batch Reactor For the first order reaction A  2B carried out in a variable pressure (constant volume) batch reactor the following data are given: Reaction rate constant.100 s-1(value at 300 K) Activation energy. Generate the volume vs.

50 28.765 3.74E-3 10.900 2.Determine the final volume.0 5.139 4.93E-3 4.683 3.95 0.00 16.5 0. Final 12.909 2.47E-3 23.394 4.0 0.65E-3 15.843 2.9 0.89E-3 5.00 18.0 4.32 0.70 0.00 29.64 0.42E-3 23.0 7.753 3.1 0.38E-3 24.221 4.35E-3 16.883 2.70 0.8 0.8 0.5 3.52E-3 22.26E-3 17.81E-3 8.78E-3 9.503 3.87E-3 19.922 2.50 23.81E-3 20.9 0.73E-3 11.9 0.914 2. OUTPUT 1) Variable Volume Batch Reactor Table 1: Concentration.16 0.5 9.295 4.44 0.02E-3 18.5 14.6 0.0 12.50 31.50 15. volume and conversion variation for Variable Volume (Constant Pressure) batch reactor Conct.5 11.895 2.0 4.728 3.181 4.52E-2 4.3 0.76E-3 9.3 0. the final concentration of A and the fractional conversion after reaction time of 40s.50 18.79E-3 8.1 0.00 19.51 0.50 20.43 0.551 3.30 0.40 0.82E-3 7.5 8.905 2.00 22.500 38. (mol/m3) Volume 13.88E-2 4.70E-3 25 .362 4.5 6.9 0.45E-3 16.25E-3 25.74E-3 20.4 0.0 14.817 2.82 0.889 2.01E-3 3.7 0.0 8.18E-3 0 40.33E-3 24.865 2.741 3.13 0.0 8.4 0.0 6.667 3.0 13.09E-3 1.71E-3 12.0 6.06E-3 2.777 3.29E-3 25.650 3.0 0.0 3.02 0.850 2.788 3.699 3.918 2.7 0.50 34.0 4.5 4.89 0.1 0.5 0.68E-3 21.259 4.5 0.75E-3 10.5 7.00 26.94E-3 19.3 9.00E-3 13.798 3.29 0.423 3.593 3.15E-3 0.18E-3 17.84E-3 7.0 10.88E-3 14.23 0.5 10.09 0.5 5.871 2.72E-3 11.55E-3 15.97 0.09E-3 18.12E-3 1.0 0.0 3.330 4.67 0.5 6.98E-3 3.451 3.1 0 5.478 3.632 3.9 0.96E-3 4.62E-3 21.858 2.22E-3 Time (s) Conv.91E-3 5.826 2.57E-3 22.5 4.5 3.76E-3 14.00 24.5 3.87E-3 6.5 5.2 0.00 32.00 36.877 2.3 0.5 12.613 3.714 3.50 17.808 2.528 3.63 0.50 25.00 0.835 2.46 0.86E-3 6.0 9.91 0.1 4.573 3.03E-3 2.

62E-3 37.5 2.58E-3 27.5 2.5 0.61E-3 38.936 2.65E-3 35.0 2.963 2.56 0.0 0.5 1.57E-3 28.950 2.56E-3 29.0 0.981 2.62E-3 38.69 0.982 2.897 0.977 2.55E-3 32.0 2.853 0.929 2.959 2.961 2.44 0.980 2.41 0.63E-3 37.967 2.0 1.970 2.965 2.0 0.955 2.968 2.10 0.5 1.34 0.5 1.0 1.942 2.26.60E-3 39.56E-3 31.58E-3 27.72 0.68E-3 34.933 2.55E-3 31.00 0.772 0.5 0.953 2.939 2.98 0.58E-3 28.971 2.5 2.15 0.0 2.59E-3 Figure 1: Volume vs Time plot for variable pressure reactor 26 .81 0.5 1.978 2.0 2.0 1.948 2.83 0.32 0.65E-3 36.67E-3 34.0 1.55 0.61E-3 39.55E-3 32.5 2.0 0.5 1.60E-3 40.21 0.926 2.63 0.0 1.90 0.48 0.56E-3 30.64E-3 36.5 0.56E-3 30.69E-3 33.04 0.957 2.59E-3 26.979 2.943 0.973 2.27 0.5 1.5 1.66E-3 35.57E-3 29.975 2.10 0.55E-3 33.0 1.812 0.0 2.945 2.991 0.21 0.974 2.734 0.

Figure 2: Concentration vs Time plot for variable pressure reactor Figure 3: Conversion vs Time plot for variable pressure reactor 2) Variable Pressure Batch Reactor Table 2: Conversion and pressure variation for Variable pressure (Constant volume) batch reactor 27 .

1 125.181 118.139 113.0 0.3 475.1 425.9 175.0 9. Pressure (kPa) 0 0 100.0 0.3 375.295 129.0 225.0 0.Time (s) Conv.0 0.0 0.8 350.8 400.5 75.259 125.3 450.9 50.3 500 0.0 0.0 0.0 0.0 25.9 100.3 275.3 300.0 4.0 0.0 0.88E-2 104.528 152.394 139.362 136.632 163.613 161.0 0.2 250.478 147.52E-2 109.551 155.0 0.573 157.451 145.0 0.0 0.221 122.503 150.1 150.423 142.5 200.2 28 .0 0.0 0.593 159.330 133.0 0.1 325.

2 % Final volume after 40 s = 2.2 % Final pressure after 500 s = 163.734 mol/m3 Fractional conversion after 40 s = 98.55 x 10-3 m3 2) Variable Pressure (Constant Volume) Batch Reactor Fractional conversion after 500 s = 63. Figure 4: Pressure vs Time plot for Variable pressure batch reactor Figure 5: Conversion vs Time plot for Variable pressure batch reactor RESULTS 1) Variable Volume (Constant Pressure) Batch Reactor Final concentration after 40 s = 0.2 kPa 29 .

Perpetuation and diffusion of process knowledge through acquisition and storage of data 7. SimzLab is a desktop app (Mac and Win) with web access for access to simulations of interest to chemists and chemical engineers.CONCLUSION The simulation of a variable pressure (constant volume) batch reactor and a variable volume (constant pressure) batch reactor was successfully carried out using SimzLab software. in particular when considering an existing reactor for a new process 8. 2. Cost reduction through optimization of operating conditions 6. Does BatchReactor take into account all type of reactions? 4. Safety studies through simulation of breakdowns and of strongly exothermic reactions 4. INDUSTRIAL APPLICATIONS: 1. What are the hardware requirements for BatchReactor? 30 . Evaluation of VOC emissions of production 5. What is the level of detail in the reactor description? 3. How is a chemical reaction defined? 2. Investment risk reduction through beforehand representation of new equipment configurations VIVA QUESTIONS: 1. Feasibility studies. Acceleration of scale-up projects. from laboratory bench to pilot and full-scale plants 3. Do you have any examples of industrial processes created with BatchReactor? 5.

7 NAME OF THE EXPERIMENT: Simulation of Plug Flow Reactor AIM: To simulate the performance of Variable Flow Rate Plug Flow Reactor using SimzLab and validate the predicted SimzLab results with the results obtained by hand calculations. X Af V V  dX A   FA0 v0 C A0 C A0    r  0 A (5) Here  is the space time. consequently.   C A0   r  0 A (6) Above equation is the generalised performance equation for a PFR.e. EXPERIMENT NO. the material balance for a reaction component must be made for a differential element of volume dV and can be written as: FA   FA  dFA    rA  dV (1) Since dFA  d  FA0 1  xA    FA0 dX A (2) We obtain on replacement FA0 dX A   rA  dV (3) This. THEORY: In a plug flow reactor the composition of the fluid varies from point to point along a flow path. X Af dX A i. then is the equation which accounts for A in the differential section of reactor of volume dV. we have: CA  CA0 1  X A  (7) rA  kCA (8) 31 . Now FA0 is the feed rate which is constant but the rate of reaction certainly depends on the concentration or conversion of materials. we obtain: V X Af dV dX A 0 FA0    r  0 A (4) Thus. For constant volume system where a first order reaction takes place. Grouping the terms accordingly and integrating them between appropriate limits. For the reactor as a whole the expression must be integrated.

k = 1 s-1 Activation energy.Generate the outlet flow rate vs reactor volume and the fractional conversion vs. k   ln 1  X A  (11) Equation (10) is the equation for a constant volume PFR when a first order reaction takes place. 32 .rA  kCA0 1  X A  (9) Substituting above equation in (6) X Af dX A   C A0  0 kC A0 1  X A  (10) Integrating above equation we get. reactor volume plots for the variable flow rate plug flow reactor. For variable volume PFR where a first order reaction takes place. we have V  V0 1   A X A  (12) And C A0 1  X A  CA  (13) 1   A X A  Substituting above equation in (6) X Af 1   A X A  dX A   C A0  0 kC A0 1  X A  (14) Solving above equation we get  1  k  ln   1   A    A X A (15)  1  X A  SIMULATION USING SIMZLAB: Variable flow rate plug flow reactor For the first order reaction A  4B carried out in a variable plug flow reactor the following data are given: Reaction rate constant. Ea = 100 kJ/mol Initial Flow Rate = 2 x 10-2 m3/s Reaction Temperature = 300 K Simulate the variable flow rate plug flow reactor using SimzLab by clicking on the Run Reaction button.

743 6.50E-2 3.374 4.80E-2 0.90E-2 0.91E-2 33 .485 4.726 6.717 6.776 6.084 2.730 6.10E-2 0.22E-2 3.673 6.40E-2 0.758 6.57E-2 4.754 6.638 5.79E-2 6.60E-2 0.60E-2 0.204 3.70E-2 0.583 5.20E-2 0.13E-2 0 0 2.150 2.50E-2 1.96E-2 3.402 4.20E-2 0.63E-2 2.782 6.51E-2 2.00E-2 0.70E-2 0.762 6.20E-2 5.551 5.Determine the outlet flow rate and fractional conversion after a space time of 5 seconds.16E-2 1.619 5.71E-2 2.83E-2 6.90E-2 7.60E-2 0.54E-2 6.178 3.534 5.80E-2 0.67E-2 2.568 5.644 5.97E-2 5.591 5.90E-2 0.20E-2 0.67E-2 6.10E-2 0.59E-2 6.45E-2 6.41E-2 5.41E-2 4.70E-2 0.40E-2 0.60E-2 0.60E-2 0.70E-2 0.452 4.30E-2 0.85E-2 3.40E-2 0.80E-2 0.04E-2 7.28E-2 5.440 4.50E-2 0.03E-2 5.00E-3 0.290 3.20E-2 0.36E-2 8.38E-2 9.747 6.71E-2 6.80E-2 0.00E-2 2.75E-2 6.49E-2 4.00E-2 0.463 4.97E-2 7.60E-2 0.119 2.598 5.10E-2 Conv (m3) (m3/s) 2.00E-3 0.228 3.495 4.40E-2 0.271 3.40E-2 0.388 4.343 4.605 5.65E-2 2.625 5.36E-2 5.09E-2 5.60E-2 0.87E-2 7.699 6.70E-2 0.50E-2 0.250 3.30E-2 0.309 3.72E-2 3.22E-2 3.15E-2 5.90E-2 0.505 5.61E-2 1.07E-2 3.24E-2 4.00E-3 0.90E-2 3.74E-2 3.52E-2 1.045 2.37E-2 3.683 6.30E-2 6.43E-2 1.30E-2 0.750 6.20E-2 0.739 6.474 4.40E-2 0.00E-3 0.45E-2 1.00E-2 0.33E-2 4.575 5.30E-2 0.50E-2 0.63E-2 6.694 6.33E-2 7.59E-2 1.00E-3 0.07E-2 7.27E-2 2.85E-2 5.15E-2 4.612 5.80E-2 0.708 6. OUTPUT Table 1: Variation of conversion and outlet volumetric flow rate with changing volume Vol Flow 2.678 6.632 5.734 6.40E-2 0.515 5.656 5.785 6.71E-2 4.00E-2 7.50E-2 0.559 5.20E-2 0.90E-2 0.70E-2 0.90E-2 0.00E-2 0.31E-2 5.542 5.415 4.772 6.10E-2 0.689 6.20E-2 0.722 6.30E-2 0.50E-2 6.662 5.10E-2 0.78E-2 4.326 3.00E-2 0.00E-3 0.06E-2 4.779 6.50E-2 0.428 4.769 6.524 5.650 5.667 6.50E-2 0.64E-2 4.90E-2 0.62E-2 3.69E-2 2.94E-2 7.713 6.26E-2 5.10E-2 0.19E-2 2.10E-2 0.00E-2 0.50E-2 0.00E-3 0.55E-2 1.80E-2 0.25E-2 4.703 6.00E-2 0.30E-2 0.30E-2 0.10E-2 0.41E-2 1.358 4.57E-2 1.48E-2 1.765 6.00E-3 0.00E-3 0.

98E-2 0.20E-2 0.05E-2 8.20E-2 0.80E-2 0.837 7.798 6.90E-2 0.10E-2 0.846 7.01E-2 7.844 7.830 6.70E-2 0.789 6.812 6.95E-2 9.70E-2 0.06E-2 8.80E-2 8.79E-2 8.848 7.09E-2 34 .817 6.806 6.70E-2 0.75E-2 8.840 7.04E-2 8.92E-2 9.10E-2 0.60E-2 0.77E-2 8.100 0.80E-2 0.86E-2 9.825 6.00E-2 0.84E-2 9.30E-2 0.50E-2 0.40E-2 0.823 6.90E-2 0.80E-2 0.87E-2 9.89E-2 9.00E-2 7.801 6.835 7.820 6.02E-2 8.804 6.795 6.40E-2 0.828 6.82E-2 9.00E-2 0.7.50E-2 0.90E-2 9.815 6.842 7.30E-2 0.833 7.97E-2 9.08E-2 8.94E-2 9.809 6.60E-2 0.792 6.73E-2 8.90E-2 0.

The values of conversion and outlet flow rate predicted from simulation was validated against results obtained from hand calculations and were found to be in complete agreement with each other.07088 m3/s Fractional conversion after space time of 5 sec = 0. INDUSTRIAL APPLICATIONS: 35 .848 2) Variable Flow Rate Plug Flow Reactor using hand calculations: Outlet flow rate after space time of 5 sec = 0.848 CONCLUSION The simulation of a variable volume plug flow reactor was successfully carried out using SimzLab software.09 x 10-2 m3/s Fractional conversion after space time of 5 sec = 0. Figure 1: Concentration vs volume plot for variable volume PFR Figure 2: Outlet volumetric flow rate vs volume plot for variable volume PFR RESULTS: 1) Variable Flow Rate Plug Flow Reactor using SimzLab: Outlet flow rate after space time of 5 sec = 7.

4. CSTR and Plug Flow reactor? 3. Continuous production 5. Differentiate between steady state and unsteady state reactors. Large-scale production 2.Plug flow reactors are used for some of the following applications: 1. Homogeneous or heterogeneous reactions 4. High-temperature reactions VIVA QUESTIONS: 1. Name the softwares that can be used for simulation & modelling of a chemical reactor. 5. What is difference between Batch. What are the input parameters given while simulation of a PFR using SimzLab? 36 . Give mass balance and energy balance reactions for a PFR. Fast reactions 3. 2.

) are almost always minimized instead of the perpendicular offsets. surface. the fitting technique can be easily generalized from a best-fit line to a best-fit polynomial when sums of vertical distances are used.34 x 10-4 45. The reaction rate constant for the decomposition of a particular acid has been determined at various temperatures as given in the following table: t in Celsius 50 70. Figure 1: Vertical and perpendicular offsets for Least Squares Method In practice. the difference between vertical and perpendicular fits is quite small. This provides a fitting function for the independent variable x that estimates y for a given x (most often what an experimenter wants).4 101 k in hr-1 1. etc. In addition. allows uncertainties of the data points along the x and y -axes to be incorporated simply. hyperplane. a property which may or may not be desirable depending on the problem at hand. because squares of the offsets are used. 37 . for a reasonable number of noisy data points. The sum of the squares of the offsets is used instead of the offset absolute values because this allows the residuals to be treated as a continuous differentiable quantity.1 89.4 x 10-4 138 x 10-4 THEORY Least Squares Method is a mathematical procedure for finding the best-fitting curve to a given set of points by minimizing the sum of the squares of the offsets ("the residuals") of the points from the curve. However.08 x 10-4 7. 8 NAME OF THE EXPERIMENT Linear regression using Least Squares Method and SCILAB AIM: To use MATLAB for determining the activation energy E in the equation: k  Ae E / RT where T is measured in Kelvin. EXPERIMENT NO. and also provides a much simpler analytic form for the fitting parameters than would be obtained using a fit based on perpendicular offsets. In any case. outlying points can have a disproportionate effect on the fit. the vertical offsets from a line (polynomial.

l in the case of analysing the period T of a pendulum as a function of its length l . and power laws are often explicitly computed. n .. it is often also possible to linearize a nonlinear function at the outset and still use linear methods for determining fit parameters without resorting to iterative procedures. l instead of T vs. In addition. Note that this procedure does not minimize the actual deviations from the line (which would be measured perpendicular to the given function). etc. This procedure results in outlying points being given disproportionately large weighting. it is common practice to transform the data in such a way that the resulting line is a straight line. although the unsquared sum of distances might seem a more appropriate quantity to minimize. Depending on the type of fit and initial parameters chosen.. logarithmic. if the functional relationship between the two quantities being graphed is known to within additive or multiplicative constants. error ellipses) are given for the points. The formulas for linear least squares fitting were independently derived by Gauss and Legendre. Vertical least squares fitting proceeds by finding the sum of the squares of the vertical deviations R 2 of a set of n data points (1) from a function . and the resulting residual is then minimized to find the best fit line. The linear least squares fitting technique is the simplest and most commonly applied form of linear regression and provides a solution to the problem of finding the best fitting straight line through a set of points. say by plotting T vs. The square deviations from each point are therefore summed. points can be weighted differently in order to give the high-quality points more weight. use of the absolute value results in discontinuous derivatives which cannot be treated analytically. This approach does commonly violate the implicit assumption that the distribution of errors is normal. 2. In fact. a pseudoinverse. but often still gives acceptable results using normal equations. The condition for R 2 to be a minimum is that (2) For i  1. However. For nonlinear least squares fitting to a number of unknown parameters.. linear least squares fitting may be applied iteratively to a linearized form of the function until convergence is achieved.. the nonlinear fit may have good or poor convergence properties. For a linear fit. For this reason. standard forms for exponential. If uncertainties (in the most general case.. (3) so (4) 38 .

1000 89. (5) (6) These lead to the equations (7) (8) PROGRAM IN SCILAB >> t=[50.0000 70.89.1.101] t= 50.1500 343.1500 >> T1=1.0000 >> T=t+273.15 T= 323.4000 101.0028 0.0029 0.5500 374./T T1 = 0.2500 362.4.0027 39 .70.0031 0.

1459 0.34E-4. APPLICATIONS: Least square method has following applications: 1. Control 4. The activation energy is found to be 95270.126 kJ.0138 >> polyfit (T1.0001 0.08E-4. CONCLUSION The method of least squares was studied successfully using Scilab.0e+004 * -1. Statistics 40 .7.1) OUTPUT ans = 1. Multi-objective least squares 3.0026 RESULTS: The slope (-E/R) is found to be -11459 and the intercept log(A) is found to be 26.138E-4] k= 0.4E-4. Model fitting 2.45. Estimation 5.>> k=[1.log(k).0045 0.0007 0.

VIVA QUESTIONS: 1. 5. Differentiate between vertical and perpendicular offsets with respect to least square method. What is the significance of Arrhenius equation? 4. What is regression analysis? Define linear & nonlinear regression. 41 . Define best-fit line and best-fit polynomial. 2. What is Activation energy? 3.

Let an initial value problem be specified as follows. y is an unknown function (scalar or vector) of time t which we would like to approximate. h. 1. 9 NAME OF THE EXPERIMENT 4th Order Runge Kutta Method using SCILAB AIM: To find the value of y art x  2 . is a function of t and of y itself. y0 are given. y(t 0 )  y 0 (1) dt Here. where each increment is the product of the size of the interval. 3. y n  (4)  h k  k 2  hf  t n  . (Euler's method) .…. and the next value y n 1 is determined by the present value ( y n ) plus the weighted average of four increments..5 .  k 1 is the increment based on the slope at the beginning of the interval. and an estimated slope specified by function f on the right-hand side of the differential equation. EXPERIMENT NO. y n  k 3 ) (7) Here y n 1 is the RK4 approximation of yt n 1  . x0  0. y).. dy y   f (t . The Ordinary Differential Equation (ODE) given is dy  x y dx THEORY: The 4th order Runge–Kutta method is often referred as "RK4". 2. The function f and the data t0 . "Classical Runge–Kutta method" or simply as "The Runge–Kutta method".5. given that h  0. using k1  hf t n . we are told that y the rate at which y changes. y n  1  (5)  2 2  h k  k 3  hf  t n  . y n  2  (6)  2 2 k 4  hf (t n  h. At the initial time t 0 the corresponding y-value is y0 . using y . 42 . y 0  0. Now pick a step-size h>0 and define y n 1  y n  h k1  2k 2  2k 3  k 4  (2) 6 t n 1  t n  h (3) For n = 0.

x. end function v = f(x. y+k2/2).0000.5000. If is independent of. y+k3). y+k1/2).y). fprintf ('Step 0: x=%12. y=%12.y) v=x+y. y = y + (k1+2*k2+2*k3+k4)/6. k4 = h*f(x+h. In averaging the four increments.x. 2 k  k 3 is again the increment based on the slope at the midpoint.4f. x = x + h. y = 2. i.219063043594360 Step 4: x = 2. for i=1:4 k1 = h*f(x.075955485925078 43 . using y  .8f. PROGRAM IN SCILAB function rungekutta h=0.076019287109375 Step 3: x = 1.00000000. k3 = h*f(x+h/2. so that the differential equation is equivalent to a simple integral. x=0. y = 8.5000. 2  k 4 is the increment based on the slope at the end of the interval. but now using y  2 . fprintf('Step %d: x = %6.0000. using y  k 3 . y = 0.50000000 Step 1: x = 0. y = 0. then RK4 is Simpson's rule. while the total accumulated error is order. y=0.075955485925078 RESULT The value of y at x=2 using the Runge Kutta method in SCILAB was found to be 8. k1  k 2 is the increment based on the slope at the midpoint of the interval. y).y).972656250000000 Step 2: x = 1.5. meaning that the local truncation error is on the order of . OUTPUT Step 0: x 0. y = 4. The RK4 method is a fourth-order method.8f\n'.15f\n'. y = %18.5. greater weight is given to the increments at the midpoint. k2 = h*f(x+h/2.

Applications in stability of structures and earthquake engineering and structural dynamics. 3. What is the difference between 2nd order and 4th order RK method? 4. 5. What are Semi-implicit additive RK methods? 3. Write down equations for the 4th order RK method. 4. 2. Define The Euler and Improved Euler Methods. What is the difference between Euler’s method and RK method? 44 . To solve the Schrodinger equation for hydrogen and positronium atoms 2. 5. APPLICATIONS: 1. To solve the problem of initial and boundary conditions.CONCLUSION Runge Kutta method was successfully studied using SCILAB. To solve nonlinear partial differential equations. VIVA QUESTIONS: 1. It is helpful in estimating the Force-Deformation behavior in the non-linear range in the field of structural engineering.

If these points are uniformly spaced then the corresponding integration formulae are called as Newton . c T   0. However.64  107 T 2 (T is in K) THEORY Numerical Integration is nothing but finding an approximate value of b I   f  x  dx (1) a There are two different strategies to develop numerical integration formulae. we approximate a polynomial for the given function and integrate that polynomial within the limits of the integration. One is similar to what we have adopted in numerical differentiation.56  104 T  2. That is. which approximates the function at non tabular points and passes through the tabular points.Cotes formulae for numerical integration. On the other hand if we know the function explicitly but could not integrate in the usual means because of the nature of the function then we can use the concept called quadrature rule to find an approximate value to the integration. 10 NAME OF THE EXPERIMENT Numerical Integration in SCILAB AIM: To compute the heat required to raise the temperature of 1kg of a given material from -100K to 200K using the Trapezoidal rule. if the degree of this polynomial is too high then the approximated integral value is prone to large errors due to round-off and local irregularities present in the function. two (Simpson’s 1/3rd rule) and three (Simpsons 3/8th rule). EXPERIMENT NO. Newton Cotes formulae If the function values are known at uniformly spaced-points then as we have already discussed. In the following discussion let us consider three widely used Newton-Cotes formulae obtained from polynomials of degree one (Trapezoidal rule). Trapezoidal Rule: 45 . by interpolation we can find a polynomial of degree n for the given n  1 data- points. This restricts us to integrate a function known at discrete tabular points. In this method the function is evaluated at some predetermined abscissa (nodal) points and then these values are added after multiplying them with some weights which are again predetermined. the interval of integration is divided into sub intervals and a polynomial of a lower degree is obtained in these sub intervals and integrated in the end points of the subinterval. To avoid these large errors. Simpson’s 3/8th rule and then by using the quadrature function in SCILAB The given integral function is T2 H  m  c T  dT (kJ/kg) T1 Here. to find an approximate value to the given integral. Simpson’s 1/3rd rule.132  1. to approximate I. Then the required result can be obtained by adding these values obtained in each of these sub intervals.

. with the only difference that instead of using straight lines....b] is n discretized into).If f  x  is a function which is known at discrete points x1 . 46 . h  (n is the number of equally spaced panels in which the domain [a. This method can be used only when the domain is discretized into even number of intervals. The integral of f  x  is then given as b h  f  x  dx  2  f  x   2 f  x   2 f  x   ... The plot for f  x  is divided into number of uniformly spaced trapezoids using straight lines to approximate the area under the curve. xn . x3 . in this method we approximate each part of the curve using parabolas.. x2 . Simpson’s rule: Simpson’s 1/3rd rule: The Simpson’s 1/3rd rule is similar to Trapezoidal rule..2 f  x   f  x  a 0 1 2 n 1 n (2) ba Here.