EBK NUMERICAL METHODS FOR ENGINEERS
EBK NUMERICAL METHODS FOR ENGINEERS
7th Edition
ISBN: 8220100254147
Author: Chapra
Publisher: MCG
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 9, Problem 21P

Recall from Sec. 8.2 that determining the chemistry of water exposed to atmospheric CO 2 can be determined by solving five nonlinear equations ( Eqs .8 .6 through 8 .10 ) for five unknowns: c T , [ HCO 3 ] , [ CO 3 2 ] , [ H + ] ,  and  [ OH ] . Employing the parameters from Sec. 8.2 and the program developed in Prob. 9.20, solve this system for conditions in 1958 when the partial pressure of CO 2 was 315 ppm. Use your results to compute the pH.

Expert Solution & Answer
Check Mark
To determine

To calculate: The solutions of the system offive nonlinear equations (refer section 8.2) given by,

K1=106[H+][HCO3]KHpCO2K2=[H+][CO32][HCO3]cT=KHpCO2106+[HCO3]+[CO32]Kw=[H+][OH]0=[HCO3]+2[CO32]+[OH][H+]

And, to compute the pH of the rainwater.

Answer to Problem 21P

Solution: The solution to the system of five nonlinear equations is [H+]=2.3419×106, [OH]=4.2701×109, cT=1.3260×105, [HCO3]=2.3375×106, and [CO32]=5.0025×1011.

The pH of the rainwater is 5.6304.

Explanation of Solution

Given Information:

The system offivesimultaneousnonlinear equations,

K1=106[H+][HCO3]KHpCO2K2=[H+][CO32][HCO3]

cT=KHpCO2106+[HCO3]+[CO32]Kw=[H+][OH]0=[HCO3]+2[CO32]+[OH][H+]

Here, KH is Henry’s constant, cT is total inorganic carbon, [HCO3] is bicarbonate, Kw,K1, and K2 are equilibrium constants, [H+] is hydrogen ion, [CO32] is carbonate, and [OH] is hydroxyl ion.

The values of constants KH,K1,K2, and Kw are as follows:

KH=101,46K1=106.3K2=1010.3Kw=1014

Consider, the value of partial pressure of CO2 in 1958 as,

pCO2=315 ppm

Formula used:

For system of n simultaneous nonlinear equations formulated as,

f1(x1,x2,...,xn)=0f2(x1,x2,...,xn)=0...fn1(x1,x2,...,xn)=0fn(x1,x2,...,xn)=0

From Newton-Raphson method, for mth equation,

fm,i+1=fm,i+(x1,i+1x1,i)fm,ix1+(x2,i+1x2,i)fm,ix2+...+(xn,i+1xn,i)fm,ixn

Here, m represents the equation and the second subscript represents the value of the function at current value i or at next value i+1.

Further, the above equation is rewritten as,

fm,i+x1,ifm,ix1+x2,ifm,ix2+...+xn,ifm,ixn=x1,i+1fm,ix1+x2,i+1fm,ix2+...+xn,i+1fm,ixn

Write the matrix equation for partial derivatives.

[Z]=[f1,ix1f1,ix2...f1,ixnf2,ix1f2,ix2...f2,ixn.........fn,ix1fn,ix2...fn,ixn]

Initial and the final values are expressed as,

{Xi}T=[x1,ix2,i...xn,i]

And,

{Xi+1}T=[x1,i+1x2,i+1...xn,i+1]

Write the function values at i as,

{Fi}T=|f1,if2,i...fn,i|

Thus, simplify the partial derivative equation as,

[Z]{Xi+1}={Fi}+[Z]{Xi}

The above equation can then be solved iteratively to obtain the solutions to the system of nonlinear equations.

Calculation:

Apply a technique based on Newton-Raphson method to solve the system of nonlinear equations.

Use the following MATLAB code toimplement Newton Raphson method and solve the given system of simultaneous nonlinear equations.

function Code_9_21P()

format short g

x0=[10^-7;10^-7;1e-5;2e-6;5e-11];

KH=10^-1.46;K1=10^-6.3;K2=10^-10.3;Kw=10^-14;pco2=315;

[x,f,e_a,itr]=newtmult(@jfrain,x0,[],[],KH,K1,K2,Kw,pco2);

fprintf('H: %2.4e\n',x(1))

fprintf('OH: %2.4e\n',x(2))

fprintf('cT: %2.4e\n',x(3))

fprintf('HCO3: %2.4e\n',x(4))

fprintf('CO3: %2.4e\n\n',x(5))

fprintf('Maximum relative error = %2.4g percent\n',e_a)

fprintf('Number of iterations = %d',itr)

pH=-log10(x(1));

fprintf('\npH: %2.4f\n',pH)

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function[x,f,e_a,itr]=newtmult(func,x0,es,maxit,varargin)

% check for minimum input required

ifnargin<2,error('Provide at least 2 arguments for input'), end

ifnargin<3||isempty(es),es=0.0001;end

ifnargin<4||isempty(maxit),maxit=50;end

% initialize

itr=0; x=x0;

while(1)

[J,f]=func(x,varargin{:});

dx=J\f;

x=x-dx;

% increase counter in every run of the loop

itr=itr+1;

e_a=100*max(abs(dx./x));

% stopping criteria

ifitr>=maxit||e_a<=es, break, end

end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function[J,f]=jfrain(x,varargin)

del=0.00001;

% determine the elements of J matrix

df1dx1=(f1(x(1)+del*x(1),x(2),x(3),x(4),x(5),varargin{:})-...

f1(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(1));

%

df1dx2=(f1(x(1),x(2)+del*x(2),x(3),x(4),x(5),varargin{:})-...

f1(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(2));

%

df1dx3=(f1(x(1),x(2),x(3)+del*x(3),x(4),x(5),varargin{:})-...

f1(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(3));

%

df1dx4=(f1(x(1),x(2),x(3),x(4)+del*x(4),x(5),varargin{:})-...

f1(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(4));

%

df1dx5=(f1(x(1),x(2),x(3),x(4),x(5)+del*x(5),varargin{:})-...

f1(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(5));

%

df2dx1=(f2(x(1)+del*x(1),x(2),x(3),x(4),x(5),varargin{:})-...

f2(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(1));

%

df2dx2=(f2(x(1),x(2)+del*x(2),x(3),x(4),x(5),varargin{:})-...

f2(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(2));

%

df2dx3=(f2(x(1),x(2),x(3)+del*x(3),x(4),x(5),varargin{:})-...

f2(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(3));

%

df2dx4=(f2(x(1),x(2),x(3),x(4)+del*x(4),x(5),varargin{:})-...

f2(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(4));

%

df2dx5=(f2(x(1),x(2),x(3),x(4),x(5)+del*x(5),varargin{:})-...

f2(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(5));

%

df3dx1=(f3(x(1)+del*x(1),x(2),x(3),x(4),x(5),varargin{:})-...

f3(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(1));

%

df3dx2=(f3(x(1),x(2)+del*x(2),x(3),x(4),x(5),varargin{:})-...

f3(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(2));

%

df3dx3=(f3(x(1),x(2),x(3)+del*x(3),x(4),x(5),varargin{:})-...

f3(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(3));

%

df3dx4=(f3(x(1),x(2),x(3),x(4)+del*x(4),x(5),varargin{:})-...

f3(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(4));

%

df3dx5=(f3(x(1),x(2),x(3),x(4),x(5)+del*x(5),varargin{:})-...

f3(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(5));

%

df4dx1=(f4(x(1)+del*x(1),x(2),x(3),x(4),x(5),varargin{:})-...

f4(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(1));

%

df4dx2=(f4(x(1),x(2)+del*x(2),x(3),x(4),x(5),varargin{:})-...

f4(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(2));

%

df4dx3=(f4(x(1),x(2),x(3)+del*x(3),x(4),x(5),varargin{:})-...

f4(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(3));

%

df4dx4=(f4(x(1),x(2),x(3),x(4)+del*x(4),x(5),varargin{:})-...

f4(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(4));

%

df4dx5=(f4(x(1),x(2),x(3),x(4),x(5)+del*x(5),varargin{:})-...

f4(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(5));

%

df5dx1=(f5(x(1)+del*x(1),x(2),x(3),x(4),x(5),varargin{:})-...

f5(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(1));

%

df5dx2=(f5(x(1),x(2)+del*x(2),x(3),x(4),x(5),varargin{:})-...

f5(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(2));

%

df5dx3=(f5(x(1),x(2),x(3)+del*x(3),x(4),x(5),varargin{:})-...

f5(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(3));

%

df5dx4=(f5(x(1),x(2),x(3),x(4)+del*x(4),x(5),varargin{:})-...

f5(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(4));

%

df5dx5=(f5(x(1),x(2),x(3),x(4),x(5)+del*x(5),varargin{:})-...

f5(x(1),x(2),x(3),x(4),x(5),varargin{:}))/(del*x(5));

% define the J matrix

J=[df1dx1 df1dx2 df1dx3 df1dx4 df1dx5

df2dx1 df2dx2 df2dx3 df2dx4 df2dx5

df3dx1 df3dx2 df3dx3 df3dx4 df3dx5

df4dx1 df4dx2 df4dx3 df4dx4 df4dx5

df5dx1 df5dx2 df5dx3 df5dx4 df5dx5];

% determine the elements of f vector.

f11=f1(x(1),x(2),x(3),x(4),x(5),varargin{:});

f22=f2(x(1),x(2),x(3),x(4),x(5),varargin{:});

f33=f3(x(1),x(2),x(3),x(4),x(5),varargin{:});

f44=f4(x(1),x(2),x(3),x(4),x(5),varargin{:});

f55=f5(x(1),x(2),x(3),x(4),x(5),varargin{:});

% define the elements of f vector.

f=[f11;f22;f33;f44;f55];

end

% define the five non-linear equations

% first equation

function f=f1(H,OH,cT,HCO3,CO3,KH,K1,K2,Kw,pco2)

f =1e6*H*HCO3/KH/pco2-K1;

end

% second equation

function f=f2(H,OH,cT,HCO3,CO3,KH,K1,K2,Kw,pco2)

f = H*CO3/HCO3-K2;

end

% third equation

function f=f3(H,OH,cT,HCO3,CO3,KH,K1,K2,Kw,pco2)

f = H*OH-Kw;

end

% fourth equation

function f=f4(H,OH,cT,HCO3,CO3,KH,K1,K2,Kw,pco2)

f = KH*pco2/1e6+HCO3+CO3-cT;

end

% fifth equation

function f=f5(H,OH,cT,HCO3,CO3,KH,K1,K2,Kw,pco2)

f = HCO3+2*CO3+OH-H;

end

Execute the above code to obtain the solutions as,

H: 2.3419e-06

OH: 4.2701e-09

cT: 1.3260e-05

HCO3: 2.3375e-06

CO3: 5.0025e-11

Maximum relative error = 1.265e-12 percent

Number of iterations = 6

pH: 5.6304

Hence, the solution to the system of five nonlinear equations is [H+]=2.3419×106, [OH]=4.2701×109, cT=1.3260×105, [HCO3]=2.3375×106, [CO32]=5.0025×1011, and the pH of the rainwater is 5.6304.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Student Name: Student Id: College of Applied Engineering Al-Muzahmiyah Branch Statics (AGE 1330) Section-1483 Quiz-2 Time: 20 minutes Date: 16/02/2025 Q.1. A swinging door that weighs w=400.0N is supported by hinges A and B so that the door can swing about a vertical' axis passing through the hinges (as shown in below figure). The door has a width of b=1.00m and the door slab has a uniform mass density. The hinges are placed symmetrically at the door's edge in such a way that the door's weight is evenly distributed between them. The hinges are separated by distance a=2.00m. Find the forces on the hinges when the door rests half-open. Draw Free body diagram also. [5 marks] [CLO 1.2] Mool b ర a 2.0 m B 1.0 m
For the walking-beam mechanism shown in Figure 3, find and plot the x and y coordinates of the position of the coupler point P for one complete revolution of the crank O2A. Use the coordinate system shown in Figure 3. Hint: Calculate them first with respect to the ground link 0204 and then transform them into the global XY coordinate system. y -1.75 Ꮎ Ꮎ 4 = 2.33 0242.22 L4 x AP = 3.06 L2 = 1.0 W2 31° B 03 L3 = 2.06 P 1 8 5 .06 6 7 P'
The link lengths, gear ratio (2), phase angle (Ø), and the value of 02 for some geared five bar linkages are defined in Table 2. The linkage configuration and terminology are shown in Figure 2. For the rows assigned, find all possible solutions for angles 03 and 04 by the vector loop method. Show your work in details: vector loop, vector equations, solution procedure. Table 2 Row Link 1 Link 2 Link 3 Link 4 Link 5 λ Φ Ө a 6 1 7 9 4 2 30° 60° P y 4 YA B b R4 R3 YA A Gear ratio: a 02 d 05 r5 R5 R2 Phase angle: = 0₂-202 R1 05 02 r2 Figure 2. 04 X

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
1. How much money is Joe earning when he’s 30?

Pathways To Math Literacy (looseleaf)

Provide an example of a qualitative variable and an example of a quantitative variable.

Elementary Statistics ( 3rd International Edition ) Isbn:9781260092561

Find E(X) for each of the distributions given in Exercise 2.1-3.

Probability And Statistical Inference (10th Edition)

Evaluate the integrals in Exercises 1–46. 1.

University Calculus: Early Transcendentals (4th Edition)

Use the ideas in drawings a and b to find the solution to Gausss Problem for the sum 1+2+3+...+n. Explain your ...

A Problem Solving Approach To Mathematics For Elementary School Teachers (13th Edition)

Knowledge Booster
Background pattern image
Mechanical Engineering
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, mechanical-engineering and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Elements Of Electromagnetics
Mechanical Engineering
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Oxford University Press
Text book image
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:9780134319650
Author:Russell C. Hibbeler
Publisher:PEARSON
Text book image
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:9781259822674
Author:Yunus A. Cengel Dr., Michael A. Boles
Publisher:McGraw-Hill Education
Text book image
Control Systems Engineering
Mechanical Engineering
ISBN:9781118170519
Author:Norman S. Nise
Publisher:WILEY
Text book image
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:9781337093347
Author:Barry J. Goodno, James M. Gere
Publisher:Cengage Learning
Text book image
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:9781118807330
Author:James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:WILEY
Mod-01 Lec-01 Discrete probability distributions (Part 1); Author: nptelhrd;https://www.youtube.com/watch?v=6x1pL9Yov1k;License: Standard YouTube License, CC-BY
Discrete Probability Distributions; Author: Learn Something;https://www.youtube.com/watch?v=m9U4UelWLFs;License: Standard YouTube License, CC-BY
Probability Distribution Functions (PMF, PDF, CDF); Author: zedstatistics;https://www.youtube.com/watch?v=YXLVjCKVP7U;License: Standard YouTube License, CC-BY
Discrete Distributions: Binomial, Poisson and Hypergeometric | Statistics for Data Science; Author: Dr. Bharatendra Rai;https://www.youtube.com/watch?v=lHhyy4JMigg;License: Standard Youtube License