Given the equations Applied Numerical Methods with MATLAB fo

where c = concentration, t = time, x = distance, D = diffusion coefficient, U = fluid velocity, and k = a first-order decay rate. Convert this differential equation to an equivalent system of simultaneous algebraic equations. Given D = 2, U = 1, k = 0.2, c0 = 80 and c10 = 10, solve these equa- tions from x = 0 to 10 and develop a plot of concentration versus distance. 9.13 A stage extraction process is depicted in Fig. P9.13. In such systems, a stream containing a weight fraction y in of a chemical enters from the left at a mass flow rate of F 1 . Simultaneously, a solvent carrying a weight fraction x in of the same chemical enters from the right at a flow rate of F 2 . Thus, for stage i, a mass balance can be represented as F 1 y i − 1 + F 2 x i + 1 = F 1 y i + F 2 x i P9.13a At each stage, an equilibrium is assumed to be established between y i and x i as in K = x i y i P9.13b where K is called a distribution coefficient. Equation P9.13b can be solved for x i and substituted into Eq. P9.13a to yield y i − 1 − 1 + F 2 F 1 K y i + F 2 F 1 K y i + 1 = P9.13c If F 1 = 400 kgh, y in = 0.1, F 2 = 800 kgh, x in = 0, and K = 5, determine the values of y out and x out if a five-stage reactor is used. Note that Eq. P9.13c must be modified to account for the inflow weight fractions when applied to the first and last stages. 9.14 A peristaltic pump delivers a unit flow Q 1 of a highly viscous fluid. The network is depicted in Fig. P9.14. Every pipe section has the same length and diameter. The mass and mechanical energy balance can be simplified to obtain the pits from which these materials can be obtained. The com- position of these pits is Sand Fine Gravel Coarse Gravel Pit1 52 30 18 Pit2 20 50 30 Pit3 25 20 55 How many cubic meters must be hauled from each pit in order to meet the engineer’s needs?

9.11 An electrical engineer supervises the production of three

types of electrical components. Three kinds of material— metal, plastic, and rubber—are required for production. The amounts needed to produce each component are Metal g Plastic g Rubber g Component component component component 1 15 0.25 1.0 2 17 0.33 1.2 3 19 0.42 1.6 If totals of 2.12, 0.0434, and 0.164 kg of metal, plastic, and rubber, respectively, are available each day, how many com- ponents can be produced per day? 9.12 As described in Sec. 9.4, linear algebraic equations can arise in the solution of differential equations. For example, the following differential equation results from a steady-state mass balance for a chemical in a one-dimensional canal: 0 = D d 2 c d x 2 − U dc d x − kc Flow = F 1 Flow = F 2 x 2 x out x 3 x i x i ⫹ 1 x n ⫺ 1 x n x in y 1 y in y 2 y i ⫺ 1 y i y n ⫺ 2 y n ⫺ 1 y out 1 2 n 0i n ⫺ 1 • • • • • • FIGURE P9.13 A stage extraction process. flows in every pipe. Solve the following system of equations to obtain the flow in every stream. Q 3 + 2Q 4 − 2Q 2 = Q 5 + 2Q 6 − 2Q 4 = 3Q 7 − 2Q 6 = 9.15 A truss is loaded as shown in Fig. P9.15. Using the following set of equations, solve for the 10 unknowns, AB, BC , AD, BD, CD, DE, CE, A x , A y , and E y . A x + A D = − 24 − C D − 45C E = 0 A y + A B = − A D + D E − 35B D = 0 74 + BC + 35B D = 0 C D + 45B D = 0 − A B − 45B D = 0 −D E − 35C E = 0 −BC + 35C E = 0 E y + 45C E = 0 PROBLEMS 253 Q 1 Q 3 Q 5 Q 2 Q 4 Q 6 Q 7 FIGURE P9.14 3 m 3 m 4 m D A E C B 74 kN 24 kN FIGURE P9.15 9.16 A pentadiagonal system with a bandwidth of five can be expressed generally as ⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ f 1 g 1 h 1 e 2 f 2 g 2 h 2 d 3 e 3 f 3 g 3 h 3 · · · · · · · · · d n− 1 e n− 1 f n− 1 g n− 1 d n e n f n ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ × ⎧ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎩ x 1 x 2 x 3 · · · x n− 1 x n ⎫ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎬ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎭ = ⎧ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎩ r 1 r 2 r 3 · · · r n− 1 r n ⎫ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎬ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎭ Develop an M-file to efficiently solve such systems without pivoting in a similar fashion to the algorithm used for tridiag- onal matrices in Sec. 9.4.1. Test it for the following case: ⎡ ⎢ ⎢ ⎢ ⎢ ⎣ 8 − 2 − 1 − 2 9 − 4 − 1 − 1 − 3 7 − 1 − 2 − 4 − 2 12 − 5 − 7 − 3 15 ⎤ ⎥ ⎥ ⎥ ⎥ ⎦ ⎧ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎩ x 1 x 2 x 3 x 4 x 5 ⎫ ⎪ ⎪ ⎪ ⎪ ⎬ ⎪ ⎪ ⎪ ⎪ ⎭ = ⎧ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎩ 5 2 1 1 5 ⎫ ⎪ ⎪ ⎪ ⎪ ⎬ ⎪ ⎪ ⎪ ⎪ ⎭

9.17 Develop an M-file function based on Fig. 9.5 to im-

plement Gauss elimination with partial pivoting. Modify the function so that it computes and returns the determinant with the correct sign, and detects whether the system is sin- gular based on a near-zero determinant. For the latter, define “near-zero” as being when the absolute value of the determi- nant is below a tolerance. When this occurs, design the func- tion so that an error message is displayed and the function terminates. Here is the functions first line: function [x, D] = GaussPivotNewA, b, tol where D = the determinant and tol = the tolerance. Test your program for Prob. 9.5 with tol = 1 × 10 − 5 . Q 1 = Q 2 + Q 3 Q 3 = Q 4 + Q 5 Q 5 = Q 6 + Q 7