che401 selected problems

6
ChE 401: Computational Methods in Chemical Engineering    :  Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz 1 King Saud University College of Engineering Chemical Engineering Department ChE 401: Computational Methods in Chemical Engineering    :  Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz Selected Problems –Part1 Problem 1: Solve the following system of equations (a) 4x 1 + x 2 + x 3 = 4 (b) x 1 + x 2 – x 3 = 2 x 1 + 4x 2 – 2x 3 = 4 2x 1 + 3x 2 + 5x 3 = – 3 3x 1 + 2x 2 – 4x 3 = 6 3x 1 + 2x 2 – 3x 3 = 6 (i) by the Gauss elimination method with partial pivoting, (ii) by the decomposition method with u 11 = u 22 = u 33 = 1. Problem 2: Show that the following matrix is nonsingular but it cannot be written as the product of lower and upper triangular matrices, that is, as LU. 1 2 3 2 4 1 1 0 2  A =  Problem 3: Show that there is no solution to t he following linear system: 4x 1 – x 2 +2x 3 + 3x 4 = 20 0x 2 + 7x 3 – 4x 4 = -7 6x 3 + 5x 4 = 4 3x 4 = 6 Problem 4: Determine whether the following matrix is singular: 2.1 0.6 1.1 3.2 4.7 0.8 3.1 6.5 4.1  Problem 5: Determine the number of terms necessary to approximate cos (x) to 8 significant figures using Taylor series approximation, cos(x) = 1 - x^2/2! + x^4/4! - x^6/4! + ... etc. Calculate the approximation using a value of x=2 B. Write a program to determine your result. Problem 6: Given the two following equations: 4x 1 – 8x 2 = 4 and x 1 + 6x 2 =9. (a) Solve them by Gaussian elimination; (b) Write Matlab code to solve by left division (backslash) operator. (c) Write Matlab code to solve them by first performing LU decompos ition, and then using the matrices L and U for the solution.

Upload: miguelmarsh

Post on 14-Apr-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ChE401 Selected Problems

7/29/2019 ChE401 Selected Problems

http://slidepdf.com/reader/full/che401-selected-problems 1/5

ChE 401: Computational Methods in Chemical Engineering    :  

Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz1

King Saud University

College of Engineering

Chemical Engineering Department

ChE 401: Computational Methods in Chemical Engineering    :  

Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz

Selected Problems –Part1

Problem 1:

Solve the following system of equations

(a) 4x1 + x2 + x3 = 4 (b) x1 + x2 – x3 = 2 x1 + 4x2 – 2x3 = 4 2x1 + 3x2 + 5x3 = – 3 

3x1 + 2x2 – 4x3 = 6 3x1 + 2x2 – 3x3 = 6 (i) by the Gauss elimination method with partial pivoting, (ii) by the decomposition method with u11 = u22 = u33 = 1. Problem 2:

Show that the following matrix is nonsingular but it cannot be written as the product of lower

and upper triangular matrices, that is, as LU.

1 2 3

2 4 1

1 0 2

 A

= −

 

Problem 3:

Show that there is no solution to the following linear system:

4x1 – x2 +2x3 + 3x4 = 200x2 + 7x3 – 4x4 = -7

6x3 + 5x4 = 4

3x4 = 6

Problem 4:

Determine whether the following matrix is singular:

2.1 0.6 1.1

3.2 4.7 0.8

3.1 6.5 4.1

− −

 

Problem 5:

Determine the number of terms necessary to approximate cos (x) to 8 significant figures using

Taylor series approximation, cos(x) = 1 - x^2/2! + x^4/4! - x^6/4! + ... etc. Calculate the

approximation using a value of x=2B. Write a program to determine your result.

Problem 6:

Given the two following equations: 4x1 – 8x2 = 4 and x1 + 6x2 =9.

(a) Solve them by Gaussian elimination;

(b) Write Matlab code to solve by left division (backslash) operator.

(c) Write Matlab code to solve them by first performing LU decomposition, and then usingthe matrices L and U for the solution.

Page 2: ChE401 Selected Problems

7/29/2019 ChE401 Selected Problems

http://slidepdf.com/reader/full/che401-selected-problems 2/5

ChE 401: Computational Methods in Chemical Engineering    :  

Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz2

Problem 7:

Solve the equations Ax = b, where

8 6 2 28

4 11 7 40

4 7 6 33

 A b

= − − = −

 

Knowing that the LU decomposition of the coefficient matrix is:

2 0 0 4 3 1

1 2 0 0 4 3

1 1 1 0 0 2

 A LU b

= = − = − −

 

Problem 8:

Use Gauss elimination to solve the equations Ax = B, where

6 4 1 14 22

4 6 4 36 18

1 4 6 6 7

 A B

− −

= − − = − −

 

Problem 9:

Solve the equations

1

2

3

4 1 1 12

1 4 2 1

1 2 4 5

 x

 A x

 x

= − − = −

 

Problem 10:

Use Gauss elimination to solve the following equations:

4x1 + x2 – x3 = -2

5x1 + x2 + 2x3 =4

6x1 + x2 + x3 = 6

Employ partial pivoting and check your answer by substituting them into the original equations.

Problem 11:

Use Gauss elimination to decompose the following system of equations:

7x1 + 2x2 – 3x3 = -12

2x1 + 5x2 – 3x3 = -20

x1 – x2 – 6x3 = -26

Then, multiply the resulting [L] and [U] to determine that [A] is produced.

Also use LU decomposition to solve this system of equations. Show all the steps in the

computation.

Problem 12:

Solve the following system of equation using LU decomposition with partial pivoting.

-5x1 + 12x3 = 60, 4x1 – x2 – x3 = -2, x1 – 2x2 + 12x3 = -86

Page 3: ChE401 Selected Problems

7/29/2019 ChE401 Selected Problems

http://slidepdf.com/reader/full/che401-selected-problems 3/5

ChE 401: Computational Methods in Chemical Engineering    :  

Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz3

Problem 13:

Solve the system of equations

4x1 + 2x2 + x3 = 4, x1 + 3x2 + x3 = 4, 3x1 + 2x2 + 6x3 = 7

using the Gauss-Seidel method, directly and in error format. Perform three iterations

using the initial approximation, x(0) = [0.1 0.8 0.5].

Problem 14:

Use the Gauss-Seidel method to solve the following equations (λ= 0.09 and gs = 5%).

-5x1 + 12x3 = 80, 4x1 – x2 – x3 = -2, 6x1 + 8x2 = 45

If necessary, make sure to rearrange the equations to achieve convergence.

Problem 15:

Determine the real roots of f(x) = -0.4x2

+ 2.2x + 4.7;

a)  Graphically.

b)  Using the quadratic formula.

c) 

Using three iterations of the bisection method to determine the highest root. Employinitial guesses of xl=5 and xu=10. Compute the estimated error ge and the true error gt 

after each iteration.

Problem 16:

Determine the real roots of f(x) = - 2 + 7x - 5x2

+ 6x3;

a)  Graphically.

b)  Using bisection method to locate the lowest root. Employ initial guesses of xl=0 and xu=1

and iterate until the estimated error ge below a level of gt =10%.

Problem 17:

The derivative of f(x)= 1/(3- 2x2) is given by 4x /(3 – 2x2)2. Do you expect to have difficultiesevaluating this function at x= 1.22? Try it using 3 and 4 digit arithmetic with chopping.

Problem 18:

The saturation of dissolved oxygen in freshwater can be calculated with the equation:

5 7 10 11

2 3 4

1.575701 10 6.642308 10 1.243800 10 8.621949 10ln ( ) 139.34411sf 

a a a a

 x x x xO

T T T T  = − + − + −  

Where Osf = the saturation concentration of dissolved oxygen in freshwater at 1 atm in mg/L and

Ta = absolute temperature in K. Remember that Ta = t + 273.15, where t = temperature inoC.

According to this equation, saturation decreases with increasing temperature. For typical naturalwaters in temperature climates, the equation can be used to determine that oxygen concentration

ranges from 14.621 mg/L at 0oC to 6.949 mg/L at 35

oC. Given a value of oxygen concentration,

this formula and the bisection method can be used to solve for temperature inoC.

a)  If the initial guesses are set at 0 and 35oC, how many bisection iteration would be

required to determine temperature to an absolute error of 0.05oC.

b)  Based on a), develop and test a bisection program to determine T as function of a given

oxygen concentration. Test your program for Osf = 8, 10 and 14 mg/L. Check your results

For a desired error Ea,d the number of iteration can be found from the following equation:

log( / ),,

log(2)

o o owhere x x x

u lo x E a d 

n ∆ = −∆

=  

Page 4: ChE401 Selected Problems

7/29/2019 ChE401 Selected Problems

http://slidepdf.com/reader/full/che401-selected-problems 4/5

ChE 401: Computational Methods in Chemical Engineering    :  

Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz4

Problem 19:

A mass balance for a pollutant in a well-mixed lake can be written as follows:

c

dcV W Q k V cdt 

= − −  

Given the parameter values V=1x106

m3, Q= 1x10

5m

3 /yr, W= 1x10

6g/yr and k=0.02

m0.5

 /g0.5

 /yr, use the modified secant method to solve the steady-state concentration. Employ an

initial guess of c=4 g/m3

and * =0.5. Perform two iterations and determine the percentage relative

error after the second iteration.

If the root can be located with fixed-point iteration as follows

( )W Q W kV ccc or as c

kV Q

− −= =  

Only one will work all the time for initial guesses of c >1. Select the correct one and demonstrate

why it always works.( ) ( )'

( ) f x x f xi i i f x

 x i

δ  

δ  

+ −≅  

Where * = a small perturbation fraction to yield the following iterative equation:( )

1( ) ( )

 x f xi i x xi i f x x f xi i i

δ  

δ  = −+

+ − 

Problem 20:

Page 5: ChE401 Selected Problems

7/29/2019 ChE401 Selected Problems

http://slidepdf.com/reader/full/che401-selected-problems 5/5

ChE 401: Computational Methods in Chemical Engineering    :  

Summer 1430/1431 (2010) Prof. Ibrahim S. Al-Mutaz5

Problem 21:

An irreversible first order reaction (A k  → B) takes place in four well-mixed reactor as show

in the figure. The rate at which A is transformed to B can be represented as Rab = k Vc.

The reactors have different volumes and because they are operated at different temperatures, eachhas a different reaction rate as shown below:

Reactor V, L k, h-1

 

1 25 0.05

2 75 0.1

3 100 0.5

4 25 0.1

Determine the concentration of A and B in each of reactor at steady state.

Problem 22:

The pH of water has great significant to environmental and chemical engineers. It can be releated

to processes ranging from pipe corrosion to acid rain. The pH is releated to hydrogen ion

concentration by the relation: pH= - log10 [H+].

The five equations govern the concentrations of mixture of carbon dioxide and water for a closed

system:2

[ ][ ][ ][ ]3 3, , [ ][ ]1 22 [ ]3

2[ ] [ ] [ ] [ ] 2[ ] [ ] [ ]

2 3 3 3 2

 H CO H HCOK K K H OH  wCO  HCO

C CO HCO CO and A lk HCO CO OH H  T 

+ −+ −

+ −= = =−

− − − − += + + = + + −

 

Where Alk = the alkalinity, CT = total inorganic carbon and the K's are equilibrium coefficients.

The five unknown are [CO2]= carbon dioxide, [HCO3-]= bicarbonate, [CO3

2-]= carbonate, [H

+]=

hydrogen ion and [OH-]=hydroxyl ion. Solve for the five unknowns given that Alk=2x10

-3,

CT=3x10-3

, K1=10-6.3

, K2=10-10.3

, Kw=10-14

. Also calculate the solution's pH.

BBBBESTESTESTESTWWWWISHESISHESISHESISHES