Numerical Methods: Solution of Algebraic Equations
AwiMuh
64 views
44 slides
Jun 14, 2024
Slide 1 of 44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
About This Presentation
Numerical Method Presentation
Size: 2.28 MB
Language: en
Added: Jun 14, 2024
Slides: 44 pages
Slide Content
Solution of Algebraic Equations Lecture October 7 and 14 , 2020 Numerical Methods Team Chemical Engineering Department Syiah Kuala University
Single Nonlinear E quation Consider the following nonlinear equation : F (x) = cos ( x ) – x = 0 Therefore, the problem is to determine the values of x that satisfy this equation. Fi gure of Plot of a cubic equation with three roots
Successive Substitution In order to apply the method of successive substitution, must be rearranged into the following form: x = g ( x ) This could be rearranged into the following form by solving for x: x = cos(x) With this method, an initial guess for x is used in g(x) to calculate an improved estimate of a root of f (x) = 0. then this new estimate of x is used again in g (x) and so on until difference between the assumed value of x and the calculated value using g (x) are appropriately close. Figure below shows several cycles of such an iterative search. Note that the intersection of first, x i is chosen as the starting point. Then g (x1) is used to determine x2 and g(x2) is used to determine x 3, that is x [ i +1] = g ( xi )
Note that each successive value of x becomes closer to the actual root. As shown in the following figure, there are conditions under which the method of successive substitution diverges from the solution instead of converging, it has been show. The method of successive substitution converges. Therefore, if g (x) contains a strong dependence upon x , the method of successive substitution will not work. So, when f (x)=0 is converted into the form of x = g( x) , care should be taken to ensure that most of the x dependence is removed from g (x) if the method of successive substitution is to be used.
Fig ure of Method of successive substitution (converging)
Consider finding the root of the following equation: f (x) = x 4 –e x +1= 0 First, let rearrange this equation into the same form as equation x = g ( x ) Then, x = (e x – 1) 1/4 U sing a starting point of x = 1 x 1 = (e 1 -1) 1/4 = 1.145 Then using x 1 yields x 2 = 1.2098. S imilarly, x 3 = 1.2385, x 4 = 1.2512, x 5 = 1.2567, x 6 = 1.2592, x 7 = 1.2607, x 8 = 1.2609, x 9 = 1.2610, x 10 = 1.2611, and x 1 1 = 1.2611. N ote that there is a steady movement from the initial guess toward the root similar to that shown in figure 2.8 . This is an example of monotonic convergence. There are cases in which the estimate of the root oscillates about the root as it converges. Oscillatory the estimate of the root oscillates about the root as it converges.
Fig ure of m ethod of successive substitution (diverging)
Example 1 Find the solution of the following equation : F(x) = x tan x -1 = 0 0 ≤ x ≤ Solution : Rearrange the equation to solve for x,i.e X = 1/tan x The recursion relation then becomes X i+1 = 1/tan x i = g(x i ) Using x 1 = /8 = 0.3927 as the starting point, the first value of g(x) is out of range, therefore, this formulation of the problem is divergent. If we solve for the x that is in the argument of tan, we obtain x= tan -1
Results: i xi g (xi) 1 0.3927 1.1966 2 1.1966 0.6961 3 0.6961 0.9627 4 0.9627 0.8044 5 0.8044 0.8934 6 0.8934 0.8417 7 0.8417 0.8712 8 0.8712 0.8541 9 0.8541 0.8639 10 0.8639 0.8583 11 0.8583 0.8615 12 0.8615 0.8596 13 0.8596 0.8607 14 0.8607 0.8601 15 0.8601 0.8605 16 0.8605 0.8603 17 0.8603 0.8604 18 0.8604 0.8603 19 0.8603 0.8603 20 0.8603 0.8603 The table shows the results for this case with a starting point x = /8. note that the converged solution is x = 0.8603 radians. These results indicate that > 1 and < 1
Example 2 Consider the flow system shown in Figure 2.10. The objective is to find the flow rate of water from reservoir A to reservoir B. From Bird et al. [12] the application of Bernouli's Equation to planes (1) and (2) results in: g Δ h + W + + i = 0 Assume that the pump is putting out hourspower and the line are one inch in inside diameter and are hydraulically smooth. Assume further that the friction factor is given by Blasius Formula f = Where, Re = Where, is the fluid density, and is the fluid viscosity , Friction loss factors
Fig ure of Flow system for example 2
Are required for the 90° elbows a sudden expansion at (2) and a sudden contraction at(1) therefore, (v)² = (v)² = (v)² (3) (v)² 4f = (v)² W = Using the density and viscosity of water and making the proper unit conversations, the original equation results in: 161 - + 4.249 + 1 = 0 Solution : 161(v) - + 4.249 + 1 = 0 161(v) - + + 1 = 0 (v) =
Newtons Method The linear approximation of f(x) is given is: f(x) = f’( ) +f( ) = - = - Fig ure of Newton’s method (converging)
Newtons method is quadratically convergent which means that when is near x* - x* = K( - x*)² Where x* is the root of the equation and K is a constant. When - x* is small then - x* will be considerably smaller. Therefore, when is near x* rapid convergence will result using newtons method:
Fig. 2.12 Newton’s method (diverging)
To this problem yields the following recursion relation : = - = 0 - = 1.0 Then using this value of in the recursion yields = 0.7504 Similiarly , = 0.7391, = 0.7391, and = 0.7391. note that x = 0.7391 is the converged value with four significant figures accuracy.
Example.2 Apply N ewtons M ethod to find the root of F(x) = x tan x-1 if 0<x< Solution : F(x) = x /cos² x + tan x = - For method of successive substitution. This rapid convergence of newtons method is the result of the quadratic convergence near x* discussed earlier.
Result for example:
Example.3 The Wilson correlation applied to binary mixture yields = ln( + ) + ln( + ) = + ln = -ln + 1- ln = -ln + 1- Note that and can be measured experimentally then and can be determined from the previous two equations. and can be determined from the previous two equations. and can then be used for other thermodynamic calculation ln = 3.496 ln = 1.643 = 1 - ln – ln(3.496) 1.643 = -ln +1-
(a) Use newtons merhod to solve for Alternately equation B could have been used to eliminate = 3.496 = ln + 1 – exp (1- )/5.17 (b) Use newtons method to solve for for this formulation solution Solution : The equation for the first formulation can be rearranged to F( ) = -0.643 – ln(-2.496-ln ) - = 0 F’( ) = ( ) = ( ) - -2.496 - ln ( ) > 0 (b) F( ) = -3.496 – ln( ) +1 - F’( ) =- - Using a starting point of equal to 0.1 the next valu is 0.0297. The next value is 0.0451 and so on. The coverged solution is 0.0501.
Secant Method The recursion relation for newton method is given by: = - = = - This is the recursion realtion for the secant method. Consider the application this equation into equation results in: F(x) = x³ - x - 4 = - Using starting points of = 0 and = 2 yields
= - = 1.333 Likewise, = 1.731, = 1.820, =1.795, = 1.796, and = 1.796. The product rate P is a nonlinear function of feed rate x, therefore, the problem is to choose x such that F(x) = P(x) - =0 The secant method can be applied directly for the solution of such a problem. That is, one can determine the steady state production for two then F ( ) = -0.6378, therefore again replaces then is calculated to be 1.007 and so on
Fig 2.13 Regula falsi method
Example.4 Apply the regula falsi method to find the root of: F(x)= x tan x-1 If 0<x< /2 Solution : Using the limits on x, we find that they bound the solution, F(0) = -1 F(/2) = + But = /2 is not workable. We shold use some value less than /2, e.g 0.72 (/2). That is F(0.7 /2) = 1.158 The result of the application of the regula falsi method are listed in the table,
RESULTS FOR EXAMPLE.4
S ystems of Nonlinear E quation s Consider the following two nonlinear equations containing two unknown variables, and : ( x ) = + ² - 36 = 0 (a) ( x ) = - - 16 = 0 (b) General problem of n nonlinear algebraic equations containing n unknowns ( , ,…., ) can be represented as ( , ,…., ) = 0 ( , ,…., ) = 0 : ( , ,…., ) = 0 o r it can be also written as ( x ) = 0, i = 1,2,…… n w here x = ( , ,…., ). Remember that the object is to find x that simultaneously satisfies all n nonlinear equations.
Newton’s Method This following figure shows equation ( x ) = + ² – 36 = 0 plotted in the ( , , ) space. Since is a function of and only, equation = 8( – 4) + 4( – 2) – 16 results in a surface in this three-dimensional space. Also note that the intersection of the surface with = 0 surface forms a circle.
Fig ure of three-dimensional plot of the Equation a
Note that the intersection of equation (x) = - – 16 = 0 with the (x) = 0 surface forms a parabola. Then the next figure shows the intersection of the lines generated from (x) = 0 and (x) = 0. N ote that the intersection of these two lines at points a and b in the following figure represents the solution to this problem, since these are the only points in which (x) and (x) are both equal to zero. Now consider how Newton’s method can be applied to the numerical solution of this problem. Let us assume that we have a starting point of = 4 and = 2, this point is shown as point d in the above figure.
Fig ure Solution of Equation (a) & (b)
We will approximate the surface at point d with a plane that is tangent to the surface at d , then: (x) ≈ ( – 4) x=(4,2) + ( -2) x=(4,2) + (4,2) Now calculating the numerical values for partial derivatives of (x) from Equation (a). (x) = 8 ( – 4) + 4( – 2) – 16 Thus, (x) = 8 ( -4) - 3 ( -2) – 6 = 0 Approximate (x) and (x), respectively they can be used to approximate the roots of the equation equal to zero. Resulting in: 8 ( -4) + 4( -2) – 16 = 0 8 ( -4) + 3( -2) – 6 = 0
Note that the terms of ( - 4) and ( - 2) remain intact in these expressions; therefore, define = - 4 and - 2 The equation becomes: 8 + 4 – 16 = 0 8 - 3 – 6 = 0 and can be calculated by simultaneously solving these linear equations, resulting in: = Then the new estimates for and are found by rearranging. So that = 5.286 = 3.429
f ( ) and f ( ) are approximated by tangent planes resulting in: f ( ) = 10.572( - 5.286) + 6.858( -3.429) + 3.700 f ( ) = 10.572( - 5.286) + 3 ( -3.429) + 1.655 Substituting: - 5.286 - 3.429 Results in: 0.2154 0.2074 Thus, the next estimate for the roots of equation: = 5.071 = 3.222 Note also that the values of f ( ) and f ( ) for the estimates are f ( ) = 0.0963 f ( ) = 0.0490
A lgorithm for this two-dimensional problem may be represented as a simultaneous solutions of the following equations: x=(j) x=(j) + ( ) = 0 x=(j) x=(j) + ( ) = 0 = + = + Note that the superscript ( j ) or ( j +1) indicates the number of linear approximation that have been used in searching for the roots.
Example 1
A continuously stirred tank reactor (CSTR) is used for the above reaction system. Reactor volume ( VR ) is 100 liters & volumetric feed to the reactor ( Q ) is 50 liters/second at a concentration of 1.0 mole/liter of component A . Since a CSTR is designed to operated at steady state and this system is assumed to be operated under isothermal conditions, steady-state mole balances define the performance of this system (i.e., concentrations coming out of the reactor). The following mole balances can be constructed:
Fig ure of CSTR for Example 1
Set of nonlinear equations: F = - C + C + V (- k C - k + k )/ Q = 0 F = - C + V (2 k C - k )/ Q = 0 F = - C + V ( k - k + k )/ Q = 0 F = - C + V ( k Q = 0 Solve these equations using Newton’s method: = -1 – V ( k + 1.5 k )/ Q = V (2 k )/ Q = V (2 k )/ Q = -1 – V (2 k )/ Q
= V (1.5 k )/ Q = V (2 k )/ Q = -1 – V (2k )/Q = V (2k )/Q = -1 Assume the following values for the starting point : C = 0.3 C = 0.3 C = 0.3 C = 0.3
Fig ure of Graphical results for Example 1
The figure shows converged values of concentration of A, B, C and D for different values of Q , the volumetric feed to the reactor. This problem becomes quite nonlinear for Q less than 11.4 liters/sec. Above 11.4 liters/sec, solutions were obtained relatively easily using the original guesses for concentrations, i.e. C = C = C = C = 0.3. Even using the converged solution for Q = 11.4 liter/sec as the initial guesses for Q = 11.3 liters/sec didn't result in a converged solution. Using N ewtons method for Q = 11.3 liters/sec resulted in negative values for the concentrations (extraneous roots). The reaction scheme is actually not realistic for Q < 12.5 there is generation of all the molar species, which is not physically realistic. For Q < 11.4 liters/sec, concentrations of all the chemical species are increasing at a large rate with respect to a decrease in Q , therefore, for Q < 11.4 the resulting set of algebraic equations is extremely nonlinear.
Example 2 Consider the following reaction system: A (g) + B (g) C (g) + D (g) K A (g) + C (g) 2 E (g) Kb = 3.2 Find the equilibrium gas composition (in mole fractions) if only two moles of A and one mole of B are initially charged to the reactor. Letting = degree of reaction one and = degree of reaction two yields the following expressions for the mole fractions: Y = (2 Y = (1 Y = ( Y = Y = 2
Since there is no change of volume upon reaction, the equili - brium constants of the two reactions can be written as = 2.667 = 3.2 Solve and using N ewtons method with the J acobian generated by finite difference approximations. Then use those values to find equilibrium gas composition. Solution : There are two nonlinear equations and two unknowns and using = = 0.5 as the initial guesses the following results are obtained using N ewtons M ethod. = 0.834 = 0.460
Y = 0.235 Y = 0.180 Y = 0.125 Y = 0.278 Y = 0.307 If e = 0.4 and e = 0.8 are used as the initial estimates, the following solution results: e = 0.738 e = -8.44 Note that the method converges, but it converges to extraneous roots. That is, negative extents of reaction are not physically realistic in this case. The initial guesses for e and e (0.4 and 0.8, respectively) were themselves not physically realistic since it can be seen from the reaction stoichiometry that e must be greater than e . As a result of the poor initial estimate, the method obtained extraneous roots.