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
= 14 15 16 17 18 19 20 21 22 23 24 25 26 A gas storage cylinder in an ordinary chemical laboratory measures 3.9 cm wide and 16. cm high. This is the label on it. olo Contents: N, gas Pressure: 7.93 atm If the cylinder is opened and the gas allowed to escape into a large empty plastic bag, what will be the final volume of nitrogen gas, including what's collected in the plastic bag and what's left over in the cylinder? Write your answer in liters. Round your answer to 2 significant digits. ?
dated metncpdf Thermodynamics An Engineering X E Module2-chap2propertiesofpure x O File C:/Users/DANIEL/Desktop/300L%202ND%20SEMESTER%20MATERIALS/Module2-chap2propertiesofpuresubstances-130703012604 phpap. ID Page view A Read aloud V Draw H Highlight O Erase 40 MEC 451 - THERMODYNAMICS Faculty of Mechanical Engineering, UITM Supplementary Problems The pressure in an automobile tire depends on the temperature of the air in the tire. When the air temperature is 25°C, the pressure gage reads 210 kRa. If the volume of the tire is 0.025 m3, Cetermine the pressure rise in the tire when the air temperature in the tire rises to 50°C. Also, determine the amount of air that must be bled off to restore pressure to its original value at this temperature. Assume the atmospheric pressure is 100 kPa. [ 26 kPa, 0.007 kg] 1. A 6 4 2:57 PM Lucky CORER 144 Tum lock 314 % 8 1/2 24 6 1/4 23 T K F pause B
In order to fnd the specifc heat c of an unknown substance, you place 75 g of the substance in a 30 g copper calorimeter that contains 65 g of water, all initially at 20 °C. You then add 100 g of water at 80 °C, and measure the fnal temperature of the system to be 49 °C. Assuming no heat is lost to the environment, what is c? [Answer: c = 2200 J/kg. K] 즈
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