Computational Mathematics - Worked Examples and Problems With Elements of Theory

Reasonable utilization of modern computer techniques is out of the question without skillful application of approximate

103 98 13MB

English Pages [408] Year 1981

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Computational Mathematics - Worked Examples and Problems With Elements of Theory

Table of contents :
Front Cover
Title
PREFACE
CONTENTS
1. APPROXIMATE COMPUTATIONS AND ERROR ESTIMATION IN PERFORMING COMPUTATIONS
2. COMPUTING THE VALUES OF FUNCTIONS
3. NUMERICAL SOLUTION OF SYSTEMS OF LINEAR ALGEBRAIC EQUATIONS
4. NUMERICAL SOLUTION OF SYSTEMS OF NONLINEAR EQUATIONS
5. THE INTERPOLATION OF FUNCTIONS
6. NUMERICAL DIFFERENTIATION
7. APPROXIMATE COMPUTATIONOF INTEGRALS
8. APPROXIMATE SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
9. BOUNDARY VALUE PROBLEMS FOR ORDINARY DIFFERENTIAL EQUATIONS
10. NUMERICAL SOLUTION OF EQUATIONS WITH PARTIAL DERIVATIVES AND OF INTEGRAL EQUATIONS
APPENDICES
ANSWERS
REFERENCES

Citation preview

N. V. Kopchenova and I.A. Maron

COMPUTATIONAL MATHEMATICS Worked Examples and Problems with Elements of Theory

Mir Publishers Moscow

H. B. KonseHOBa, H A. MapoH

BbiHHCJurrejibHas M aieM am ka B nPU M EPA X H 3AAAHAX M3AaTe/ibCTB0 Hayna

N. V. Kopchenova and lAM aron

Computational Mathematics WORKED EXAMPLES AND PROBLEMS WITH ELEMENTS OF THEORY

MIR PUBLISHERS MOSCOW

Translated from the Russian by V. SHIFFER First published 1975 Second printing 1981

Revised from the 1972 Russian edition

Ha aMAUucKOM nsbitie ©

M3flaTeJibCTB0 , 1972

© English translation, Mir Publishers, 1981

PREFACE -■■V,

'T

Reasonable utilization of modern computer techniques is out of the question without skillful application of approximate and numerical analysis, which explains the remarkable growth of inte­ rest in the methods of approximate calculation. Computational mathematics as a teaching discipline has an increasing place in the syllabuses of engineering and economics faculties and colleges and with it the demand for textbooks in this discipline has grown. A particularly acute need for manuals on solving problems in computational mathematics is felt. The present book is an attempt to provide such a manual. The book has the following structure: each section begins with a brief theoretical introduction on setting the problem, giving working formulas, computational schemes, estimates of error, and a comparison of different methods from the angle of their labo­ riousness, their attainable degree of accuracy, and the convenience of solving them on a computer. There follows a detailed solution of model problems illustrating the appropriate algorithms. At the end of the section problems for independent practice are suggested. Answers are given for most of these problems. For better understanding of the essence of the matter, most of the problems for which solutions are provided have been selected so that the computations will not be especially, cumbersome. It is suggested that desk computers should be used in the initial stage of instruction, and for group study. The book is intended primarily for engineering students but mav also prove useful for economics students, for graduate engi­ neers, and for post graduate students and scientific workers in the applied sciences. The material, we would emphasize, does not go beyond the limits of the syllabus in computational mathe­ matics. The authors take this opportunity to express their deep gra­ titude to Kh.L. Smolitsky and I.M. Stesin for reading the manuscript. Their advice and remarks helped to improve the book. We also sincerely thank L.Z. Rumshisky for editing the whole work and for his part in the writing of chapters one and six. We

6

Preface

are aware that the work as it stands is not free of error, the more so that it is the first teaching manual of this kind published in our country. We shall therefore, be grateful for the advice and criticism of readers, which should be addressed to 117071, Moscow V-71, Leninsky Prospect, 15, “Nauka” Publishers Main Editorial Office for Physico-Mathematical Literature. The Authors

CONTENTS

P r e fa c e ......................................................................................................................... Chapter 1. Approximate Computations and Error Estimation in Performing C om p utations............................................................................................................ 1.1. Approximate Numbers, Their Absolute and Relative Errors . . . 1.2. Adding and SubtractingApproximateN u m b e r s ..................................... 1.3. Multiplying and Dividing Approximate Numbers................................... 1.4. Errors in Computing the Values of a F u n c t io n ............................ 1.5. Determining the Permissible Error of Arguments by Means of the Permissible Error of a F u n c t io n .............................................. 21 Chapter 2. Computing the Values of F u n ction s...................................... 25 2.1. Computing the Values of a Polynomial.Hoerner’s Scheme . . . 2.2. Evaluating Some Transcendental Functions with the Aid of Power S eries.................................................................................................. 27 2.3. Some Polynomial Approximations .................................................... 2.4. Using Continued Fractions for Computing the Values of Trans­ cendental F u n c tio n s...................................................................... 36 2.5. Using the Method of Iteration for Approximating the Values of a F u n c t io n ...................................................................................... 38 Chapter 3. Numerical Solution of Systems of LinearAlgebraicEquations 3.1. Basic Concepts.......................................................................................... 3.2. The Gaussian M eth od ............................................................................ 3.3. The Gaussian Compact Scheme. The Modification of Crout-Doolittle ......................................................................................................... 3.4. The Method of Principal Elements ................................................ 3.5. The Scheme of K h aletsk y..................................................................... 3.6. The Square-Root M e t h o d ..................................................................... 3.7. Computing D e te r m in a n ts..................................................................... 3.8. Computing the Elements of an Inverse Matrix by the Gaussian Method ..................................................................................................... 3.9. The Method of Simple Iteration ......................................................... 3.10. The Siedel M e th o d ................................................................................. 3.11. Applying the Method of Iteration for Correcting Elements of an Inverse M a t r ix ......................................................................................... Chapter 4. Numerical Solution of Systems of Nonlinear Equations . . . .

5 9 9 12 15 17

25 34

45 45 46 50 57 63 67 74 78 82 89 92 95

4.1. Newton’s Method for a System of Two E q u a tio n s.................. 95 4.2. The Method of Simple Iteration for a System of twoEquations 97 4.3. Newton’s Method Spread to Systems of n Equations in n Un­ knowns ......................................................................................................... 101 4.4. Applying the Method of Iteration to Systems of n Equations in n Unknowns.......................... •..................................................................... 104 Chapter

5. The Interpolation of F u n ction s................................................

106

5.1. The Statement of the Problem of In te r p o la tio n ...................... 106 5.2. Interpolation for the Case of Equally Spaced Points. Newton’s First and Second Interpolation F o r m u la s.................................. 107 5.3. The interpolation Formulas of Gauss, Stirling andBessel . . . 114 5.4. Lagrange’s Interpolation Formula. Aitken’s Scheme.................. 120 126 5.5. Inverse Interpolation.......................................................................... 5.6. Finding the Roots of an Equation by Inverse Interpolation . . . 132

8

Contents

Chapter 6. Numerical Differentiation.....................................................................

135

6.1. Formulas for Numerical D ifferentiation............................................. 6.2. Errors Appearing in Numerical D ifferentiation................................. 6.3. Choosing an Optimal Interval of Numerical Differentiation . . .

135 140 142

Chapter 7.1. 7.2. 7.3. 7.4. 7.5.

7. Approximate Computation of Integrals............................................. Quadrature Formulas with Equally Spaced P o in t s ......................... Choosing the Interval of Integration..................................................... Gaussian Quadrature F orm u la s......................................... ! . . Integrating with the Aid of Power S e r i e s ......................................... Integrals of Discontinued Functions. The Method of Kantorovich for Isolating Singularities......................................................................... 7.6. Integrals with Infinite L im its................................................................. 7.7. Multiple Integrals. The Method of Double Integration. The Method of Lyusternik and Ditkin. The Monte Carlo M e th o d .....................

149 149 157 164 168

Chapter 8. Approximate Solution of Ordinary Differential Equations . . . 8.1. Cauchy’s Problem. GeneralR em ark s.................................................... 8.2. Integrating Differential Equations with the Aid of Series . . . 8.3. The Method of Successive A pp roxim ation s..................................... 8.4. Euler’s M eth od .......................................................................................... 8.5. Modifications of Euler’s M eth o d ......................................................... 8.6. Euler’s Method Complete with an Iterative P r o c e ss..................... 8.7. The Runge-Kutta M eth o d ..................................................................... 8.8. Adams’ M e t h o d ...................................................................................... 8.9. Milne’s M ethod.......................................................................................... 8.10. The Method of A. N. Krylov for Finding t h e ‘‘Initial Interval”

198 198 199 207 212 217 220 222 231 240 243

Chapter 9. Boundary Value Problems for Ordinary Differential Equations 9.1. The Statement of P rob lem s..................................................................... 9.2. The Method of Finite Differences for Second-Order Linear Diffe­ rential Equations .................................................................................. 9.3. The “Passage” M e th o d ............................................................................. 9.4. The Method of Finite Differences for Second-Order Nonlinear Differential E q u a tio n s.............................................................................. 9.5. Galerkin’s M eth o d .........................................................................* * * 9.6. Collocation M e t h o d ............................................................ ! ! ! ! ! !

256 256

264 268 273

Chapter 10. Numerical Solution of Equations with Partial Derivatives and of Integral E q u a t io n s ..............................................................................................

277

10.1. The New M e t h o d .................................................................................. 10.2. The Net Method for Dirichlet’sP ro b le m ............................... 10.3. Iterative Method for Solving a System of Finite-Difference E q uation s............................................................................. Solving Boundary Value Problems for Curvilinear Domains 10.5. The Net Method for theParabolic-Type E q u a tio n ................... 10.6. The “Passage” Method for Heat Conductivity Equation ! ! ! 10.7. The New Method for a Hyperbolic-Type Equation 10.8. Solving Fredholm’s Equations by the Method of Finite Sums 10.9. Solving Volterra s Equation of the Second Kind by the Method of Finite S u m s ..................................................................... 10.10. The Method of Replacing the Kernel by a Degenerate One Appendices.............................................................................................. A nsw ers................................................................................. ^ References.........................................

173 180 185

257 258

277 278 282 294 298 305 308 315 | 323

3 2

^ 27

* *

^ 30

1 APPROXIMATE COMPUTATIONS AND ERROR ESTIMATION IN PERFORMING COMPUTATIONS

1.1 APPROXIMATE NUMBERS, THEIR ABSOLUTE AND RELATIVE ERRORS

In performing computations, as a rule, we deal with approxi­ mate values of quantities, i.e. with approximate numbers. The initial data themselves are usually given with some errors, which are then redoubled in the course of calculations by rounding errors, the use of approximate formulas, and so on. A reasonable error estimation enables us to decide on the number of digits to be retained in intermediate operations, as well as in the final result. The error of an approximate number a, i.e. the difference a —at) between it and the exact value a0 is usually not known. To estimate the error of an approximate number a means to establish an inequality of the form |a —a0| < A fl. (1) The number A,; is called the absolute error of an approximate number a (sometimes the term the limiting absolute error is used). The limiting absolute error of an approximate number is any number not less than the absolute error of that number. Hence, it follows logically that any number exceeding the limiting abso­ lute error of a given approximate number can also be called the limiting absolute error of this number. For practical purposes it is convenient to take for Aa the smallest number (under the given circumstances) that satisfies inequality (1). When writing absolute errors it is common to give two or three significant digits (when counting significant digits the zeros on the left should be neglected; for instance, the number 0.010030 has five significant digits). In an approximate number a one should not retain the digits which are to be rounded in its absolute error A,,.

Computational Mathematics

10

Example I. The length and width of a room measured accurate to 1 cm are: a = 5.43 m and b — 3.82 m. Estimate the error in determining the area of the room S=--ab — 20.7426 ma. Solution. By hypothesis, Aa = 0.01 m, A(, = 0.01 m. The extreme possible values of the area are equal to (a + 0.01) (6 + 0.01) = 20.8352 m*. (a—0.01) (b—0.01) = 20.6502 ma; comparing them with the above calculated value of S, we get the following estimate | S —S . K 0.0926, which enables us to indicate the absolute error of the number S in the form As = 0.0926 ma. Here it is reasonable to round the value of As , for instance, in the following way: As = 0.093 ma or As = 0.10 ma (absolute errors are usually rounded off to a larger number!). In this case the approximate value of the area can be written as 5 = 20.743 m*. or 5=2 0 .7 4 ma, or even 5 = 20.7 ma. Example 2. A computer is designed to receive numbers only with three significant digits. With what accuracy can the numbers n and -g- be introduced into it? Solution. Suppose j t « 3 .1 4 — a instead of it = 3.141592..., the error of the number a can be estimated by the number Aa = 0.0016. Suppose 0.333 = 6; the error of the number b can be estima­ ted by the number A6= The relative error 6a of the absolute error Aa value) of the number a,

0.00034 or Aj = 0.0004. of an approximate number a is the ratio of the number to the modulus (absolute i.e.

6«= i r r 0 ). The absolute error of the exponential function is Aw= a* Ina-A*. (5) The relative error of the exponential function is 6j, = A J n a .

(6)

Here the relative error of the function is proportional to the ab­ solute error of the argument. 2—2558

Computational Mathematics

18

Hence, for the function y = ex we get «, = 4,.

(c) Logarithmic function y ~ \ n x . The absolute error of the na­ tural logarithm of a number is equal to the relative error of the number itself: Av= —AX= 8X. (8) For the common logarithm t/ = logx; we have A„ = 0.4343 6,,

(9)

whence it follows that, when dealing with numbers having m cor­ rect digits, (m+ l)-digit tables of logarithms should be used. (d) Trigonometric functions. The absolute errors of sine and cosine do not exceed those of the argument: Asin x = | cos x | At ^ A*, Acos x = | sin x | Ax A*. (19) The absolute errors of tangent and cotangent are always more than those of the argument: Atanx —(1 ~h tan2x) A* ijs A*, Acot x — (1 -t- c o x) A* A*. (11) Example 1. The diameter of a circle measured to within 1 mm amounts to d = 0.842 nr. Compute the area of the circle. 7xd~ Solution. The area of a circle S = — Since the number jt can 4 be taken with any degree of accuracy, the error of computation of the area is determined by (he error of computation of d2. The relative error of d2 is V = 25* = 2 - ^ = 0.24%. In order, when rounding off the number ji, not to increase the relative error =8 + 264, the number n should be taken at least with four correct digits, even better with five. Then we get 5=—

. 0.842s m2 - 0.7854 •0.7090 m2= 0.5568 m2.

The absolute error of the result amounts to As = S8s = 0.557-0.0024 = 0.0014. We then round off the result to three digits (discarding the extra digit and using the following rule): 5 = 0.557 m», A,s = 0.002.

Ch. I. Approximate Compulations and Error Estimation in Compulations

19

Example 2. The angle x = 25°20' is measured accurate to I'. Determine sin* and its absolute error. Solution. First compute the absolute error of sinx, using for­ mula ( 10); for this purpo^ convert 1' into the radian measure: 1' =0.000291 radian, and compute A sia x - COS X • A , - cos 25°20' • 0.000291 = 0.00026. Therefore, for computing sinx four-place tables of trigonometric functions should be used, which gives sin x = sin 25^20' = 0.4279. 2. Functions of several variables. The absolute error of a diffe­ rentiable function y — f{ x lt x2, . . . . x„), caused by sufficiently small errors A*,, AiV . . . , A^ of the arguments xlt x4, . . . . xa, is estimated by the quantity ( 12)

If the values of the function are positive, then the relative error is estimated by the formula

Example 3. Evaluate the function u = xy‘lz3, if x = 37.1,

y = 9.87,

* = 6.052,

A* = 0.3,

A.y = 0.11,

A, = 0.016.

and Solution. Here the relative errors of the arguments are equal to _n_ = 1. 12%, 6x = 3^ = 0.81%, 6‘ -65!2 = 0'26%’ 987 The relative error of the function is 60 = 6x -F26v + 36, = 3.8%; therefore the computed value of the function must contain not more than two or three digits: u = 801 - 10s (here it is incorrect to write 801 000 which would have another meaning!). In this case the absolute error amounts to Aa = h6b = 80 M 0 3•0.038 = 30 • 10s. 2*

20

Computational Mathematics

Here it is advisable to round off the final result to two digits: u = 8.0- 10s, Au = 0.3-10\ Example 4. Compute the value 2 = In'(10.3 + 1/ + 4), considering all the digits of the approximate numbers *-=10.3 and +-=4.4 as correct. 5 Solution. The number y has the relative error = — 1.2%, therefore Vy has the relative error 0.6% and it should be written with three digits: V y = V J l= 2 A 0 , the absolute error of this root being equal to A^- = 2.10-0.006 = 0.013. The absolute error of the sum x + V y = 10.3 + 2.10= 12.4 is estimated by the quantity 0.05 + 0.013 = 0.063, its relative error being equal to ^— = 0.5%. Using formula (8), we see that the absolute error of the na­ tural logarithm is of the same value, i. e. Az = 0.005. Therefore 2 = In (10.3 + 2.10) = In 12.40 = 2.517. Here the result has three correct digits; rounding-off to correct digits is not advisable, since in this case it would be necessary to write the value of Az taking into account the round-off error: 2 = 2.52, A, = 0.008. Problems 1. Angles x are measured with the limiting absolute error Aa. Determine the absolute and relative errors of the functions y = sinx, y = cosx, and i/ = tanx. Using the tables, find the values of the functions, retaining only correct digits in the final result: (a) x — 1D20', Av - 1', (b) x = 48°42'31', A, = 5 \ ( c) * = 45\ Ax= l ' , (d) x — 50°10', Av = 0.05°, (e) x = 0.45, Ax = 0.5-10“2, (f) x = 1.115, A* = 0.1.10-3. 2. Compute the values of the following functions for the given values of x, and indicate the absolute and relative errors of the results: (a) (/ = x3sinx for x = ]/2, putting j / 2 « 1.414, (b) y — x In* for * = n, putting n«s:3.142, (c) y = ex cosx for a, = J/3, putting f/'3 « 1.732.

Ch. L Approximate Computations and Error Estimation in Computations

21

3. Compute the values of the following functions for the given values of the variables. Indicate the absolute and relative errors of the results, considering all the digits of the initial data as correct: (a) u = \n (xx-\-x\)y x ^ O .9 7 , = 1.132, (b) u =

** , *, = 3.28, *2= 0.932, * , = 1.132, X3

(c) u = x lx i ;-*,*., | *2*:1, *, = 2.104, *2=1.935, x3= 0.845. 4. Determine the relative error of computing the total surface of a truncated cone if the radii of its base circles R and r, and the generatrix / measured to within 0.01 cm are respectively equal to /? = 23.64 cm, r = 17.31 cm, / = 10.21 cm. 1.5 DETERMINING THE PERMISSIBLE ERROR OF ARGUMENTS BY MEANS OF THE PERMISSIBLE ERROR OF A FUNCTION

This problem has a single-valued solution only for a function of one variable y = f(x): if this function is differentiable and f (*) =5^ 0, then (i) i/ 't o i Ay' For a function of several variables // = /(*,, *?, . . . . *„) the problem is solved only when some additional limitations are introduced. For instance, if the value of one of the arguments is considerably more difficult to be measured or computed more accurately than those of the remaining arguments, then the error of just this argument should be brought in concord with the required error of the function. If the values of all the arguments can be equally easily deter­ mined to any accuracy, then the principle of equal effects is usu­ ally applied assuming that in formula (12) (Sec. 1.4) all the terms are equal; this yields the formula

Av. = ■ n

df dx{

- (t = l. 2, . . . . n).

( 2)

In practice we often come across the problems of the interme­ diate type, the above mentioned cases being the extremes. Let us now consider some examples by way of illustration. Example 1. To what accuracy must an angle * be measured in the first quadrant to get the value of sin* with five correct digits?

22

Computational Mathematics

Solution. If it is known that the angle * > 6° so that sin* > 0 .1 , then it is necessary to determine Aa. so that the inequality Asin * < 0.5- 10-i is fulfilled. To this end, according to formula (10) in Sec. 1.4, it is sufficient to take Ax < 0.5-10"*, i. e. to measure the angle * to within 1". If, in addition, it is known that .v >60° and, hence, cos* < 0.5, then it is advisable to make use of formula (1), whence A* = ~cos X Asin, > 2-0.5-10"5= 10-*, i. e. it is sufficient to measure x accurate only to 2". But if x < 6°, say, l ° < x < 6°, then 0.01 < sinx < 0.1, and to ensure five correct digits in the value of sinx we have to satisfy the inequality Asin* < 0.5-10"°, for which purpose we have to measure the angle x to within 0. 1". Example 2. To what accuracy must the radius P of the base circle and the altitude H of a cylindrical container be determined so that its capacity could be determined accurate to l°o? Solution. In the formula V = siR2H the number n can be taken with any number of correct digits and, hence, its error will not affect the result; therefore we may assume fv = 26^ + 6//. If we can ensure any accuracy in determining R and H . then the prin­ ciple of equal efiects may be used, whereby the shares of 2bR and bH are equal, each constituting 0.5%. Thus, according to this principle, the radius should be determined with the relative error equal to 0.25%, and the altitude with the relative error of 0.5%. In every day practice we encounter the contrary, when the radius of a container is determined less accurately than the altitude. For instance, if the radius is determined to an accu­ racy twice lower than that of the altitude, then we assume 6^ = 26H, and from the condition 2bR +

= 56„ = 1%

we find bff — 0.2%, ^ = 0.4%. As far as the number it is concerned, in all considered cases it should be taken with the relative error of the order 0.01% so that this error may be neglected in the final result. This means that we may take n -^3.142 with the relative error ^ 4 = 0.013?i 3142 * but not n = 3.14 with the relative error S— O14 = 0.051 %. Example 3. Find the permissible absolute error of the appro­ ximate quantities *=15.2, i/ = 57 for which it is possible to find

Ch. 1. Approximate Computations and Error Estimation in Computations

23

the value of the function u = 6x2(log x —sin2t/) accurate to two decimal places. Solution. We find u = 6x2(log x - sin 2t/) = 6 (15.2)2(log 15.2 —sin 114°) = 371.9, —= 12x (log*—sin 2y) + 6x • loge = 88.54, - = — 12x2cos 2 0) use the formula ax — ex,na. 2. Computing the sine and cosine values. For computing the values of the functions sinx and cosx use is made of the folio-

Computational Mathematics

30

wing power-series expansions X

sin x = £

(—1)*rjfe^Tv ( - °° < * < °°),

(4)

c o s* = ]£

(—

( 5)

k - 0

\

~r

>

(— o o < x < o o ) .

For large values of * series (4) and (5) converge slowly, but, taking into consideration the periodicity of the functions sin* and cos*, and reduction formulas for trigonometric functions, it is easy to conclude that it is sufficient to know how to compute sin* and cos* for ihe interval 0 < * < —. Here we can use the 4 following recurrent formulas: n

s in * = 2 u k + R n (*), k~ I

l^i

X,

( 6) 2 k (2k

Uk +i

1

)

^ = ^

^1 )»

n cos* = 2 vn + Rn (x), y. = C

+i = —(2ife~=*i) 2» °*

= 1» 2> •••» « — !)•

Since in the interval (o, the series (4) is an alternating series with terms monotonically decreasing in modulus, for the remainder term Rn the estimate 1*12/1+1 \R „ \< (2n-(- 1)! + holds true. Analogously for the series (5): ! | < | ., |. Hence, the process of computation of sin* and cos* may be terminated as soon as we find that where e is the specified permissible error. Example 2. Compute sin23°54' to within 10~4. Solution. We express the argument in radians retaining one extra digit: * —arc 23'54' - 0.41714. Using formula (6), we obtain ii j ==* — f 0 . 41714, « .= —

= -0.01210,

« .= —

+0.00011,

«4= ~ ^ y - = -0.00000.

Ch. 2. Computing the Values of Functions

31

Hence, rounding off the final result to four decimal digits, we find sin 23c54' -0.4052. Example 3. Compute cos 17^24' accurate to 10~5. Solution. x = arc 1724' —0.30369. Using formula (7), we have ox= 1.000000, vt = — y ~ vx = —0.046114, v3— —jpj v2= -f- 0.000354, vt — —— v3 — —0.000001. Hence cos 17=24' = 0.95424. 3. Computing the values of the hyperbolic sine and hyperbolic cosine. Use the power-series expansions oo

*2k—1 sinhx — 2 , (2fe—ijf

(— ° ° < x < 0O)>

... (8)

CD

cosh x — 2

—j

(— oo < x < oo)

(9)

and the following recurrent notation n

sin h x = 2 “*+ R»< A—i Ux—x, COSh* = 2

*=0

( 10)

uk+l —2k(2k + i ) Uk' +

X K o=U

(H )

v* + i = ( 2 * + l)( 2 * + 2)

For n~>\x | > 0 we have the estimates (see [12]) R*n< Example 4. Compute sinh 1.4 accurate to 10 #. Solution. Using formula (10) we get « , = 1.4000000, u.i = ^ ^ u l = 0.4573333,

and

32

Computational Mathematics

«3 = ^ u 2 = 0.0448187, «4 = g - t / 3 = 0.0020915,

u6= ^ u 4= 0.°000569, «„= u r n “ *= 0 0000010 Hence sinh 1.4 = 1.904301. 4. Computing the values of a logarithmic function. Use the expansion in a series in power of j ~ | : (0 < Z < -f- oo). ' " ‘ - - s k= E i s2k—\ i Vl+2 Let x be a positive number. Represent it in the form x = 2mz.

where in is an integer and l / 2 < ? < 1; then, putting f ~ z= | l-l -z s’ we get

x lnx = In 2,nz = m In 2 + In z = m In 2 — 2 £ 2^]_ t k —1 where 0 < £ < 1/3. Putting u-k~ 2f,

i

(^ — 1> 2, . . . , n),

we get the following recurrent notation lnx = ml n 2 — 2 2 «* + /?„. k=i a - i u ui S* u*+i— 2ft-fl U*‘

( 12 )

( I

The summation process is terminated as soon as the inequality < 4e is fulfilled, where e is the permissible error (see [121). ' Example 5. Find In 5 to within 10“«. Solution. We shall carry out the computations with two extra digits. Assume 5 = 2’ -0.625. Hence, z = 0.625 and !== — =-= 0 37^ ^"Fz = r S = 0 -23076923-

Ch. 2. Computing the Values of Functions

33

Form a column containing the first four summands: 1^ = 1 = 0.23076923, u2= ^ = 0.00409650, = ^ =0.00013089, ut = ^- = 0.00000498, the sum =0.23500160. By formula (12) we get 1n 5 = 3 •0.69314718—2-0.23500160 = 1.609438. P ro b lem s 1. Using power-series expansions, form the tables of the values of the following functions with the indicated accuracy e. (a) c*. x = 0.300 + 0.002ft (ft = 0, 1, . . . , 14), e = 10r6, (b) ex, x = 2.500 + 0.002ft (ft = 0, 1........... 14), e = 10-4, (c) «“*, x = 1.35 + 0.01ft (ft = 0, 1, . . . . 14), e = 1 0 -\ (d) e~x, x = 0.505 + 0.005ft (ft = 0, 1........... 15), e = 10-6, (e) e*\ x = 0.50 + 0.02ft (ft = 0, 1.........15), e = 10-s, ([) e - ' 1, x = 1.30 + 0.01ft (ft = 0, 1, . . . , 15), e = 10 -\ (g) e-**/*, x = 1.78 + 0.03ft (ft = 0, 1, . . . . 15), ' 2 /n x = 2.545 + 0.005ft (ft = 0, 1........... 15). 2. Taking advantage of the expansions of sinx and cosx in a power series, compile the tables of the values of the following functions accurate to 10”5. (a) sinx, x = 0.345 + 0.005ft (ft=0, 1, . . . , 15), (b) sinx, x = 1.75 + 0.01ft (ft = 0. 1, . . . . 15), (c) cosx, x = 0.745 + 0.005ft (ft = 0, 1, ...., 15), (d) cosx, x = 1.75 + 0.01ft (ft = 0, 1, . . . , 15), (e) 2i!L£t x = 0.4 + 0.01ft (ft = 0, 1........... 15), (f)

. x = 0.25 + 0.01ft (ft = 0, 1. . . . , 15).

3. Taking advantage of the expansions of sinh x and cosh x in a power series, compile the tables of the values of the follo­ wing functions accurate to e. , 15), (a) sinhx, x = 0.23 + 0.01ft (ft = 0, 1, ., 15), e== 10~4, e = 10-5, x = 2.30 + 0.05ft (ft = 0 , 1, (b) coshx for the same values of x. 3 -2 5 5 8

34

Computational Mathematics 2.3

SOME POLYNOMIAL APPROX MAT ONS

Computation with the aid of Taylor’s series gives a sufficiently rapid convergence, generally speaking, only for cmall valuer of | X — a'0 |. However, it is often necessary, with the mu of a poly­ nomial of a comparatively low degree, to choose an approxima­ tion which would ensure a sufficient accuracy' for all points of a given interval. In these cases use is made of expansions of fun­ ctions obtained by means of Cnebyshev s polynomials on a spe­ cified interval. Given below are a few examples of such expan­ sions accompanied by certain intervals for them to be used in, as well as by appropriate absolute errors e (see (25]). The values of a polynomial can be computed by Horner's scheme. 1. Computing the values of an exponential function in the in­ terval [—1, 1]. The following polynomial approximation is used: e * « 2 a * * * ( | x | < l ) ( e = 2 ‘ 10~7, (1) k=0 a0= 0.9999998, ax= 1.0000000, n2= 0.5000063. a3= 0.1666674, a, = 0.0416350, a5= 0.0083298, afl = 0.0014393. a7- 0.0002040. 2. Computing the values of a, logarithmic function. The follo­ wing formula takes place 7

l n ( l + x ) « 2 akxk ( O ^ x ^ l) ,

e = 2.2*10“7,

(2)

—0.999981028, *“a2= -0.499470150, n3 = 0.328233122, n4——0.225873284, a5= 0.134639267, a(l - -0.055119959, a7= 0.010757369. 3. Computing the values of trigonometric functions. Use the following polynomial approximations: 4

s m x ^ ^ a 2 k+\X2k+] (|* K jt/2 ), a, ■■=1.000000002, a7= —0.000198107,

a, - -0.166666589, a9 -0.000002608;

e = 6-10~9, a. - 0.008333075,

cosai«

( | * |< 1), e = 2-10- \ *=0 a0= 1.000000000000, a2= —0.499999999942, at = 0.041666665950, at = —0.001388885683, o8= 0.000024795132, a, #= —0.000000269591; (i t a n . v « 2 o^ +,xi,;+‘ (| x | < ji/4), e = 2-10-8, a, - 1.00000002, = 0.05935836,

(3)

a, - 0.33333082, a,, =-- 0.13339762, - 0.02457096, an =- 0.00294045, al3 = 0.00947324.

(4)

(5)

Ch. 2. Computing the Values of Functions

35

Example 1. Using a polynomial approximation, find the value of Y e to within 10~6. Solution. We carry out the computations by means of for­ mula (1), using Horner's scheme (see Sec. 2.1) for x ^ 0 .5 (see Table 2). Table 2

Horner's Scheme for Polynomial (1) 0.0014393 0.0001020

0.0083298 0.0007706

0.0416350 0.0045502

0.0002040

0.0015413

0.0091004

0.0461852

0.1666674 0.0230926

0.5000063 0.0948800

1.0000000 0.2974431

0.999999810.5 0.6487216----

0.1897600

0.5948863

1.2974431

1.6487214 = P (0.5)

0.0002040 4

Rounding off to six digits, we get e1/2« 1.648721 (see Example 1 in Sec. 2.2). Example 2. Using the polynomial approximation, find the value of sin 0.5 to within 10~8. Solution. We can carry out the computations by formula (3), using Horner’s scheme for *-=0.5. But since the polynomial of formula (3) contains only odd powers of x, it is more convenient to rewrite it in the form 4

2 aik+1xil,+l = (a, 4- a,*24 a.0x* 4- a7x64- a»*9) x k=0 and apply Horner’s scheme to the polynomial P ( |) = a1+ a3^ a s|H - a 7g3 + a ^ ,

£ = ** = 0.25.(6)

The computation of the value P(0.25) is given in Table 3. Mul­ tiplying the obtained value P (0.25) =0.958851087 by x ^=0.5 and rounding off the result, we get the required value sin 0.5 » « 0.47942554. Table 3

Horner's Scheme for Polynomial (6) 0.008333075 -0.166666589 -f- 0.000002608 —0.000198107 1.000000002 10.25 0.000000652 —0.000049364 0.002070928 —0.041148915 1----0.000002608 -0.000197445

3*

0.008283711 —0.164595661

0.958851087 = = P(0.25)

36

Computational Mathematics

P ro b le m s 1. Form the tables of the values of the following functions accurate to e for the given values of *. (a) e \ x = 0.725 + 0.001* (* = 0 , 1 , 2 , . . . , 15), e = 10-} 0.1000, 1 ) JJ 0.1718, lh N aof«i M " M; 0 .1!)(i() (2 0.0800) 0.1000. 1.0200 0.10002. W e

see

dial

here

already

the

t h i i •••)•

( 6)

Computational Mathematics

42

This formula is obtained by transforming the initial equation y = - p ^ to the form F (x , y) = -V-— x = 0. As the initial approximation we usually take 1 where x = 2mx 11 - j ^ x 1< 1. Here we also have an iteration process without division. 4. Computing cube roots. Let us have i j = \ / x . Applying for­ mula (2) to the equation F (x, y ) ^ y * — x = 0, we get an iteration formula for computing the cube root in the form __

IJn + l

f ^ y f i ~h X o i 2

l

6 \

(7)

yn

the initial approximation y0= 2E, where x — 2mx l, m is an integer and 1/2 1. Example 3. Compute jV5 to within 10~3. 5 Solution. Here x —5 = 23--g. The initial approximation yo=

2E = 2, 3 V* 1 4 ;

12

The further computations are tabulated below. Table 5 Computing n

0 1 2 3

Vn

2 1.7500 1.7100 1.7100

5

y%

3."';,

y\

4 3.0625 2.9241

12 9.1875 8.7723

8 5.3594 5.0002

Thus J /5 « 1.710. 5. Computing roots ot degree p . Let y= where x > 0 and p > 0 is an integer.

2^ 5

21 15.7188 15.0004

Ch. 2. Computing the Values of Functions

Applying formula (2) to the equation F(x, y) get \in+l *- lin

43

we

( 8)

The iteration process will be convergent if the initial approxi­ mation y0 > 0 is chosen so small that y% x = 0.007 + + 0.003* (* = 0, 1, 2.......... 15). 2. Using the method of iteration, form the tabie* of the values of the following functions accurate to 10~5: (a) 1 .7, .v-= 2 + * (* -A), 1, 2, . ... 15), (b) x V x for the same values of x, (c) V T + & , x = 0.3 + 0.002* (* = 0, 1,2, . . . , 15), (d) y x- + l/x for the same values of x. 3. Using the method of iteration, form the tables of the values of the following functions accurate to 10~3: (a) - 4 - , ,v = 3 -;-2* (*-+), 1,2, . . . . 15), V x

Computational Mathematics

44

(b) l/j/2 + x2, x - 0.3 f 0.002/5: (* = 0, 1,2, .. v, 15), (c) (2 x + l)/y T , *=3 .1 + 0 .0 0 5 * (* = 0, 1,2, . . . . 15), (d) l / ^ x ( x + l ) , x = 2 .3 + 0.002* (* = 0, 1 ,2 ......... 15). 4. Using the method of iteration, form the tables of the values of the following functions accurate to 10~8: (a) p/x, x = 3 + * (* = 0, 1,2, . . . . 15), (b) 3^_ for the same values of x. V x

5. Using the method of iteration, form the tables of the values of the following functions accurate to 10~6: (a) { /x , x = 0.05+ 0.02* (* = 0, 1, 2........... 15), (b) 1 /x for the same values of x, (c) x for the same values of x, (d) { / x for the same values of x.

3 NUMERICAL SOLUTION OF SYSTEMS OF LINEAR ALGEBRAIC EQUATIONS

3.1 BASIC CONCEPTS

Suppose we have a system of a linear algebraic equations in n unknowns +

• • • + ^lnXr , = b l>

a t l x l 4 ' a 22*2+ • • • ~ \ ' a i n x n ~ b i
b

(i = 3 , 4; / = 3, 4, 5).

(7) Dividing the first equation of (6) by the leading element a(323 * we get x ,+ b $ x t = b$, (8) (

)

J? + 2),+ w(n_ l )| where n is the number of unknowns. Thus, the time required for the performance of arithmetic ope­ rations in solving a system of linear algebraic equations by ihe Gaussian method is approximately proportional to the cube of the number of the unknowns. Example 1. Using the Gaussian method, solve the following system of equations 2.0a:, + 1.0*. —0.1*,+ 1.0x,-2.7, 0.4x, + 0.5x2-1-4.0x , —8.5x4= 21.9, ^ 0.3a:,— 1.0Xj+ 1.0*3+ 5.2*4 ——3.9, [ (12) 1.0a:14-0.2 a:2+ 2.5a:3— 1.0a:4= 9.9. Solution. Direct procedure. Dividing the first equation of system (12) by a,, = 2, we get a:, + 0 .5 a:2—0.05a::i + 0.5x4= 1.35. Hence, fr,2—0.5; b n — —0.05; /;I4 = 0.5; b , . ~ 1.35. Using for­ mula (4), compute the coefficients aj}> and form system (3). For

Ch. 3. Numerical Solution of Linear Algebraic Equations

49

i = 2 we have — m43a $ and enter them in Section VII. (11) Checking: compare the sum o',3'-| a'g with the number a'j>. Reverse procedure. We successively find the numbers x., x v, a' by the formulas ' ‘ 3 *’ 1 "'u-Vj =a'4l \ i>*Vx3JrOuXi = a $ , a $ x 2+ o"3’a', + K'Xi = aty, 011*1+012*2+013*3+0,4*4 = 013Computations by these formulas are carried out without recor­ ding the intermediate results. The final results are entered in Sec­ tion VIII of the table, as also are the solutions of the check system. The checking is as on page 52. The number of arithmetic operations in both schemes (Tables 6 and 8) is the same, since the same operations are performed though in an altered order, but the records of intermediate com-

Ch. 3. Numerical Solution of Linear Algebraic Equations

57

putations are considerably reduced which is of great importance when the computations are carried out on key computers. Problems Solve the following systems making use of either the Gaussian scheme or the Crout-Doolittle modification scheme. Carry out the computations with five decimal digits. /0.90\ * = ( 1.55 . \ 2.08/ /°.4\ * = 0.8 . \ 0.2 ) ( 19.07 \ . &= 3.21 . V—18.25 /

I. A =

2. A —

3. A =

f 28.3' 1.0^ i 5.3 —2.1 3.0 —2.0 - 3 6 .2 4.5 —6.0 4.0 —6.0 1.0 24.5 3.4 , b = —9.0 —7.3 6.0 3.0 4. A = 16.2 6.0 —4.0 1.0 2.0 —3.0 —3.0; „ 4-3, 1.0 6.5 1.0 - 4 . 0 /10.21 —p\ 5.42 \ I 8.64- -a 1.71 1.8 4 + a , 6 = 3.41-fP > 4.25 A = \ —6.39 \12.29 7.92 —a —3.41 / 4.21 \ 5. a = 0.5-k. k = 0, 1. . . ., 4. p = 0.2-fe, * = 0 ,1 . '-1 0 .6 5 + p \ 1.90\ /8.30 2.62 + a 4.10 12.21 \ 7.78—a 2.46 \ _ / 3.92 8.45 A= 15.45 —p }' 2.28 ’ “ 1 3.77 7.21-i-a 8.04 -8.35 / 1.69 6.99/ 3.65—a \ 2.21 5. * = 0 , 1, a = 0.2 •k. k = 0, 1. . . ., 4, p —0.2-k, 3.4 THE METHOD OF PRINCIPAL ELEMENTS

flll-G 4 - fl1 2 * 2 +

• • -

a 2i X 1 +

a 22x 2 4 - . . . •

^nlX\

^rn2X2

‘•

~\~a inXn — a i,

« + l»

~\~a 2nXn —

n+1*

• "b

^nnXn

^

« +1* >

( 1)

58

Computational Mathematics

Let us write the augmented rectangular matrix consisting of the coefficients of the system

Choose a nonzero (as a rule, the numerically largest) ele­ ment apQ (of matrix M not belonging to the column of constant terms (g=^=n-\- 1)), this element being called the principal element. Compute the multipliers

for all i=^=p. The row of M with index p which contains the principal ele­ ment is called the principal row. Then perform the following opera­ tion: from each ith nonprincipal row subtract termwise the prin­ cipal row multiplied by m,. We thus obtain a new matrix in which all the elements of the ^th column (with the exception of apq) are equal to zero. Discarding this column and the principal row, we obtain a new matrix M j with the number of rows and columns diminished by unity. Repeat these operations with matrix M t to get matrix M„, and so on. Thus, we obtain a sequence of matrices. the last of which is a two-term row matrix. It is also regarded as the principal row. Then combine into a system all the prin­ cipal rows beginning with the last. After an appropriate repla­ cement they form a triangular matrix which is equivalent to the initial one. And here the stage of computations, called the direct procedure, is terminated. Solving the system with the obtained matrix of coefficients, we find, step by step, the values of the unknowns x, (i = 1 , 2, . . . . n). This stage of computations is called the reverse procedure. All the above described computations can be arranged in one table, which will be similar to the Gaussian compact scheme, with a check provided for each stage of compu­ tations (see Example 1). The principal element is chosen so as to make the num­ bers m, as small as possible, and thus reduce the error of com­ putations. Therefore, when applying the Gaussian method on a computer, a scheme with the principal element chosen is usu­ ally used.

Ch, 3. Numerical Solution of Linear Algebraic Equations

59

N o te . tVhen carrying out com putational work on a computer, the choice of the principal element may turn out to be a rather laborious task if the num­ ber of equations in a system is large. Therefore, it is the standard practice to take the first row as the principal one, and the numerically largest element of this row at the principal element.

Example 1. Using the Gaussian scheme with the principal ele­ ment chosen, solve the system 1.1161*! + 0.1254.x2+ 0.1397*3 + 0 .1490*4 = 1.5471, 0.1582^-f 1.1675*2-| 0.1768*3 + 0.1871*, = 1.6471, 0.1968*, -I- 0.2071*., + 1.2168*3 + 0.2271*4 = 1.7471, 0.2368*, +0.2471*3 + 0.2568*3+ 1.2671*4= 1.8471. Solution. It is convenient to enter the results of all computa­ tions in one table (Table 9) in the following order. Table 9

The Gaussian Scheme with the Principal Element Chosen i

m.i

aii

°i2

°|3

aU

fl/5

I

I 2 3 4

0.11759 0.14766 0.17923

1.11610 0.15820 0.19680 0.23680

0.12540 1.16750 0.20710 0.24710

0.13970 0.17680 1.21680 0.25680

0.14900 0.18710 0.22710 1.26710

1.54710 1.64710 1.74710 1.84710

3.07730 3.33760 3.59490 3.85490

II

1 2 3

0.09353 0.11862

1.08825 0.12323 0.15436

0.09634 1.13101 0.16281

0.10950 0.13888 1.17077

1.32990 1.37436 1.41604

2.62399 2.76748 2.90398

III

1 2

0.07296

1.07331 0.10492

0.08111 1.11170

1.19746 1.20639

2.35238 2.42301

IV

1

1.06616

1.10944

2.17560

V

1 2 3 4

1

1.04059 0.98697 0.93505 0.88130

2.04059 1.98697 1.93505 1.88130

1 1 1

2 - ,0

Direct procedure: (I) Write down the coefficients of the system in Section I of the table a,y (f= 1, 2, 3, 4; / = 1, 2, 3, 4, 5).

Computational Mathematics

60

(2) Enter the sums of the coefficients of each row in the co­ lumn J$ = aiQ. (3) Find the principal element. In the given system it will be the coefficient a4 4 1.26710 (p = 4, q = 4); underline it. (4) Find the numbers m ( i = 1 ,2,3). To this end divide the elements of the column a(i by a44 and write down the results in the column m{ Section I: a *,

tn. = — an

0.14900_ 1.26710"

tn = a2 —4

0.11759;

~

a 44

0.18710 _____ 1.26710

0.14766;

0.22710

= 0.17923. au 1.26710 (5) Compute the coefficients of the new matrix. From each row i ( t = l , 2 , 3) subtract the principal row multiplied by the corresponding element m,-. Thus, for i = 1 we have m3

f l n = a u —/HA, = 1.11610 —0.11759-0.23680= 1.08825, a l* = a i4—m,a4. = 0.12540—0.11759-0.24710 = 0.09634, a‘,V = a, 3— m lai, = 0.13970—0.11759 •0.25680 = 0.10950, a a> = 0, an = a lr, — mlal.,= 1.54710—0.11759-1.84710= 1.32990, = «i6“ m ,a46 = 3.07730—0.11759-3.85490 = 2.62399. For t = 2, 3 proceed in the same way. The results are entered in Section II. Here the principal row is not written, nor the co­ lumn au, since it consists of zeros. 5

(6) Checking: find the sums 2 «;}’ and compare them with o}‘>, 5 , =1 for instance, 2 a1; = 2.62399 = a < > = 0 , < = 1.32990— 0.09353 • 1.41604 = 1.19746 Gl« = 2.62399—0.09353-2.90398 = 2.35238!

Ch. 3. Numerical Solution of Linear Algebraic Equations

61

For i — 2 the computations are performed analogously. The results are entered in Section 111, the columns ai3 and ait being left empty. 5

(10) Checking: the sum 2 au (f—1,2) must be equal to a,e; /=i this condition is met. (11) Choose the principal element and underline it. Now it will be a = 1.11170. (12) Find v

'

= — - — 0,08111 = 0.07296. Write down the result 1.11170

in the column m,- of Section 111. (13) Subtract the second (principal) row multiplied by m}** from the first row. We get — --- 1.07381 —0.10492-0.07296= 1.06616, a{V = aiy — m afi — m'va'g = 1.19746-0.07296-1.20639 = 1.10944, aj*> = u«> -=2.35238—0.07296-2.42301 =2.17560. Enter the results in Section IV. (14) Checking: !- a ‘« = 1.06616 + 1.10944 = 2.17560 = (15) Writing out the principal rows of each section, we get a system equivalent to the given one: 1.06616x, = 1.10944, 0.10492*! -f 1.11170*2= 1.20639, 0.15436*, + 0.16281*3+ 1.17077x3= 1.41604, 0.23680*, +0.24710*24 0.25680*, f 1-26710*,= 1.84710. Reverse procedure. The results of computations carried out in realizing the reverse procedure are entered in Section V. We get in succession: *, = 1.10944/1.06616=1.04059, *a= (1.20639 —0.10492 • 1.04059)/1.11170 = 0.98697, v, = (1.41604 —0.15436 • 1.04059—0.16281- 0.98697) 1.17077 = = 0.93505, *, = (1.84710—0.23680-1.01059 —0.24710-0.98697—0.25680 x 0.93505)/l.26710 = 0.88130. The reverse procedure is checked with the aid of the column 2 in the same way as on page 52.

Computational Mathematics

62

P r o b Ie m s

1. Solve the following systems using both the Gaussian method with the principal element chosen and the ordinary Gaussian method, carrying out all the computations with five significant digits. Compare the obtained values with the indicated exact values: (a) A =

X=

1 1.15 (b) A = [ 1.19

x —

\i.o o

2. Solve the following system using (a) the common Gaussian method; (b) the Gaussian method with the principal element chosen: x -F 592y = 437, 592* + 4308J/ = 2251. Carry out all the computations with four significant digits. For the following systems find the values of the unknowns with the indicated number m of significant digits using the Gaus­ sian method with the principal element chosen. m = 4.

b= —95.510 —96.121 -91.065 —7.343 12.269 86.457/

b=

m = 3.

m = 4.

'3.24 —2.18 5.09 —2.37 1.211i ' 28.38' 0.73 3.85 -6 .2 3 4.80 —5.93 —36.00 6. A = 2.88 5.73 —7.02 -9 .1 7 3.58 . b = 24.48 2.10 3.02 —0.78 3.85 —6.00 —16.23 1.20 —4.13 6.48 0.00 —3.24; 4.34J m = 3.

Ch.

63

3. Numerical Solution of Linear Algebraic Equations

2.6 3.0 -6.0 / 4.21 8. A = [ 2.31 \3.49 7. A = \

a = 0.25-6,

—4.5 —2.0\ 3.0 4 .3 ), m — 5. 3.5 3.0 \ / 30.24 22.42 + a 3.85 1.52 , &= |f 40.95--P ), m 31.49 4.85 28.72+ a / ^42.81 ' //

\

k = 0, 1, . . . ,4 ,

k — 0. 1, . . . , 5.

p = 0.35-fc,

/3.81 0.25 1.28 0.75 + a \ / 2.25 1.32 4.58+ a 0.49 \ 9. A = I 5.31 6.28-fa 0.98 1.04 • \9 .3 9 - f a 2.45 3.35 2.28 / /

6.47-fp \ 2.38 )’ \ 10.48 + p /

/

a —0.5-k,

4 ’2 1

k — 0, 1, . . . . 4, 3.5

\

P

m ~ 5’

0.5+ ,

5.

k —0, 1,

THE SCHEME OF KHALETSKY

Consider a system of linear equations written in matrix nota­ tion as A x = b, where A

(a,-y) is a square matrix (/,/') —1,2, . . . , » ) and ■*1,11+1 b= \

ln, n+1 are column vectors. Represent matrix A in the form of a product A —-BC, where /b n 00 . . . 0 \ j \ cvi . . . c, B J * » \ bnl

0 b n%b n3

0

•••

).

c=

0\



bn n )

Then the elementsbif and c(/ aredetermined

0

Cs

•••

1

from the formulas

bn = aH’ ( 1)

b ii = a ij — 2

*=1

b ik Ck)

(*

^)

C o m p u ta tio n a l M a th em a tics

64

and c ,= ^ ( 2)

(!< /< /)• X l b ik Ckj k= 1 Whence the desired vector * may be computed from the chain of equations B y = b, C x = y . (3) C‘j ~ bii ( a 't

Since the matrices B and C are triangular, systems (3) are readily solved, namely: D\ = ai, Vi = ( ai. n+1■ — ]£ bik y ^/b u

(«’ > 1)

(4)

and xn= yn, n *, =

*/«—

2

b- i+ \

cikx k

(i C « ) .

(5 )

From formulas (4) it is evident that the numbers y( are advan­ tageously computed together with the coefficient* c,-.. This method is known as the scheme of Khaletsky. This scheme uses the ordi­ nary type of checking by means of sums. Khaletsky’s scheme is convenient for machine computation since in this case the operations of “accumulation” (1) and (2) may be carried out without recording the intermediate results. Example 1. Solve the system 3x, + x 2 — *3-)- 2*4~ 6, —5*!+ ^ -4-3*3—4*4= —12, 2*, 4- *s— *«=1. x l —5*j 4- 3*s — 3*4 = 3. Solution. Write down the results of computations in Table 10. It consists of two parts: (1) the left-hand half which gives the scheme for recording the results of computations; (2) the right-hand half in which the results of computations are entered according to the indicated scheme. The table is filled in in the following order: (1) Write down the matrix of the coefficients of the system, its constant terms and the check sums in Section I of Table 10.



o-

CO

|

X

CM

1 1

CO

rX X X X CO CM

1

*

CM

— '"i

i i

The Scheme of Khaletsky

CO 11

CO

CO

|

o

H

Table 10

11

X 1I

r-~ X X X X o CO C nO CO CO CO O 11

IO d

X r-

CM 1 1 X 1--

X

CM

X CO

d

i X CM

LO CM 1

X

CM ~ lO o

X

CM r^. X X X X

r-X X X X

CO CO CO CO CO CO

d

CM

d

X

CM

X

1

, ,

1 1

CO

>1

o

CD

CO

0D

CO ;„{/, —b3tyt),b33 (1 --2 -2 —0.666667-0.75) 2 ——1.75, y* = ( « « “ ■ b u y I — b l2y , — b i3y 3)/ bu = = ( 3 - 2 —5.333333-0.75 -f 6-1.75) = 3, -v4- //4 - 3, x 3—y3—cHx, = — 1.754- 1.25-3 = 2,

Ch. 3. Numerical Solution of Linear Algebraic Equations x 2— y i

X l = 1) 1

— c 23x 3 — c 2 i x * = — 0 -75— 0 . 5-2 +

+ 2*2

+ 3*3

67

0 . 25-3 = — 1,

+ 4*4 =

= 2 + 0.333333 + 0.333333 -2—0.666667.3= 1. (9) Intermediate checking is done by means of the ^ column, which is involved in the same operations as is the column of con­ stant terms. P r o b le m s Solve the following systems, using the scheme of Khaletsky: 1. A =

-3.0 4 .6 \ 2.6 1.5

-3.5 7.3. /2.0 ' 3.0 2. A = 1.0 V2.5 2 —1 4 3. A = -3 1

1.0 —4.0 —3.25 —3.0 —4.3 8.0 —5.0 3.3 —20.0 —3.0 —4.0 2.0 1'l -1 4 -3 3 1 2 1 2 3 3 —1 * 4 1 3 2 3 —1 4 4; 3.6

THE SQUARE-ROOT METHOD

The square-root method (see [2], [ 12J, [26], [54]) is used for sol­ ving a linear system A x = b, (1) where /! = [«+] is a symmetric matrix, that is ('. / “ • 1. 2, . . . . n). This method is more economical and convenient as compared with the above considered methods of solving systems of the gene­ ral form. In practical applications of the square-root method, the direct procedure is used to compute successively the coefficients and

a

CJ*~

jr a"

0 —0 0

—o

o

—o

o

o

—Tu of UO

oo

o ’

O Tf- —

o

00

uo o

11

© OO o

1

1

N O O O N

uo uo o

IfO T f uo O O U ) CO ^

— —© Tf —■ ^ —1

00 CO

CO

CM

— d o *

d

s

"*

CM

1

1-

CO

OCN -

©

CM —

^

1

s

UO 1 1 1

1

Tf

CM CO 0 5 O CO Q OO UO O

7

CO

cm

o

05

Tj*

1

N O N C T )

«

^ ro oo O

1

uo 00 u o uo 00 uo CO o

1 1 1 1

a"

o

© U O LO UO uo

© 00

©

c o io o — o o cm i n oo © 00 © op — — ©

o uo © CO CM

© d

d

CO CO

0 0 rtCM — © © © © ©

©

©

© © d

§



© — —

s CO uo ©

7

0©0

co 00

N

M

uo C — © © — d

CO

© oo r© ©

©0© © ©© © 0CO ©—

o

CM

©

1

i

1 © in

uo uo CO

oo

© © 1

88

7 UO

CD CO 3

8

uo ©

fe

d o

in

!

© NCM

O

00

d i

r ------- N - 00

uo o CO N-

00

d UO 1

oo o

© N - — 00 N - — 00 N - — 00

*N

u o u o CM

0 0 — — CO CO (M OO r f

1 _ a"

i. - 25F>8

88§

I

.87222 .13890 .63889

Computing the Inverse of Matrix (3)

o

00

a

Table 15

o

CO

O © CO t o - t o u o o o © cm

1

:=T^8(28-76—2.184 - 1 . 9 5 0 - 2 . 0 I 5 ) - 1.14, ^ = 3^T(49 •72 — 0 •936 ~ 3 ■250 — 1•885) = 1•36i for k — 2 16.942 20.9 :

xiz)

23.992 19.8

y —0.1 lx j—0.12x2+ 1.04xs = 1.398,

J

(11)

carrying out three iterations. Indicate the error of the result obtained. Solution. The matrix of this system is such that the diagonal elements are close to unity, and all the remaining ones are con­ siderably less than unity. Therefore, for the method of iteration to be used it is natural to rewrite system (11) in the form v, = 0.795 —0.02x, + 0.05x2+ 0.10x3, I x „ = 0 .849 + 0.1 lx, — 0.03x2+ 0.05x3, | x3= 1.398 j-0 .1lx, + 0 . 12x2—0.04x3. j The conditions of convergence (4) for the obtained system are

Computational Mathematics

88

fulfilled. Indeed, 2 |Cjy | = 0.02+ 0.05-)-0.10 = 0.17 < 1, 2

Ic2/1 = 0.11 +0.03 + 0.05 = 0.19 < 1,

2 Ic3/1—0-11 +0.12 + 0.04 = 0.27 < 1. /=i As the initial vector 4r:

= — (27.46 — 0.900 —2.175 — 3.875) = 0.9674. In computing v^’ we use the values yJ1’ and y£1’: x ? = — (28.76— 1.575— 1.455—2.015) = 1.1977. Finally, using the values yJ1’, Yt1', yJ1), we get = 3TT (49.72—0.675—2.425— 1.560) = 1.4037. For / t - 2 and A:=3 computations are carried out in a similar way. We get; for k 2 10.76062 2 3 .7 5 1 8 0 Y12 “ = 0.8019, 1.9996, 2 0 .9 19.8 ~~ ( )

2 1 .19202 '

21.2

0.9996,

44.93981 32.1

~

1.4000;

for k = 3 16.72132 2 0 .9 ~ .(3> _

2

= 0.80006,

2*1.200528

21.2

1. 00002,

2 3 .7 5 9 8 4 4 19.8 4 4 .9 3 9 9 0 9 32.1

1.19999, 1.40000.

Table 16 contains the values of the unknowns of system 110) of Sec. 3.9 obtained as a result of the third iteration both by the Seidel method and the method of simple iteration; exact values are also listed. The comparison shows that here the Seidel method leads to the goal more rapidly.

Ch. 3. Numerical Solution of Linear Algebraic Equations

91

Table 16

Values of Unknowns of System (10) (from Sec. 3.9)

Method of simple ite­ ration Seidel method Exact values

x*



0.7978 0.80006

0.9977 1 .0 0 0 0 2

1.1975 1.19999

0 . 8

1 .0

1 .2

*4

1.3983 1.40000 1.4

Example 2. For the system 6

x , — * 2—

*3

= 11.33, ^

— *, + 6*.— *3=32, *i ■ *2 ] 6*3 ■ 42,

> j

(2)

the approximate values of the unknowns obtained with three significant digits by the Gaussian method are known: * ,« 4 .6 7 ,

* 2 « 7 .6 2 ,

* 3 « 9.05.

Applying the Seidel method, correct the solutions so that the values of the unknowns *,!*>-and * f tn differed by not more than 5-

10

- J.

Solution. Reduce system (2) to the form *[ —-£.-(11.33 + * a

x.),

*2= -g-(32-f-*, + *3). *3

=-g- (42 + * , + * 2)-

Taking as the initial approximation the values obtained by the Gaussian method * ‘•> = 4 .6 7 , *J0) = 7 .6 2 , x«> = 9 .0 5 ,

we get: for k = 1 * = 1 ( 1 1 . 3 3 + 16.67) = 4 .66667, jc‘»

= 1 ( 3 2 + 13.71667) = 7.61944, = 1 (42 + 12.28611) = 9.04768;

Computational Mathematics

92

for 6 = 2 x?> = —(11.33 -f 16.66712) = 4.66619, Af> = 1(32+ 13.71387) = 7.61897, x p = 1 ( 4 2 + 12.28516) = 9.04752. Since for the above system the condition (4) of Sec. 3.9 is ful­ filled fo ra = l , the obtained approximation has the error not exceeding y-5-10~ 4= 2.5-10-4. Thus, the following may be taken as the solutions: A-j « 4.666, 7.619, 9.048. P r o b l e m s

Solve systems 1 and 2 both by the method of simple iteration and by the Seidel method. Compare the rapidities of convergence of the iterations. Compare the obtained values with the indicated exact values of the unknowns. / 6.1 2.2 1.2 \ /16.55\ /l.5 \ 1. A —I 2.2 5.5 —1.5 , 6= 10.55 , * = ( 2 .0 . V1-2 - 1 .5 7.2 / \ 16.80/ \2 .5 / /3.82 1.02 0.75 0.81\ /1 5 .6 5 5 \ /2 .5 \ . / 1.05 4.53 0.98 1.53 \ / 22.705 \ / 3.0 \ I 0.73 0.85 4.71 0.81 ’ 23.480 / ’ ^ ^ \ 3.5‘ \0 .88 0.81 1.28 3.50/ V l6 .H 0 / V2.0/ 3. Solve the systems from Problems 3 to 5 (Sec. 3.9) bv the Seidel method. 3.11 APPLYING THE METHOD OF ITERATION FOR CORRECTING ELEMENTS OF AN INVERSE MATRIX

Let approximate values of the elements of an inverse matrix A ' 1 be obtained for a nonsingular matrix .4. Denote the matrix v.ith such elements by A~l\ for improving the elements of the inverse nnurix form the following iteration process: Fk-i = E — ADk_l (6 = 1 , 2, . . . ) , (1) £>*=-£>*.,(£ + / V t) (* = 1 , 2 , . . . ) . (2) It is proved (see [2|, 1121) that the iterations converge if the initial matrix Dn is sufficiently close to the initial matrix A -1.

Ch. 3. Numerical Solution of Unear Algebraic Equations

93

Iterations are usually continued until the moduli of the elements of matrix Fk are less than the specified number e, and then we approximately put A - ' * D k. The indicated iteration process turns out quite useful, since the exact methods of computing an inverse matrix often give notable errors due to inevitable rounding and a large number of arithme­ tical operations involved. Example 1. Correct the elements of the approximate inverse matrix obtained in Example 1 of Sec. 3.8. Proceed with the ite­ rations until the moduli of the elements of matrix Fk are less than, or equal to, 5-10~\ Solution. Using the Gaussian method we obtained the approxi­ mate inverse for the matrix (3) (see Sec. 3.8). Let us take it for the initial approximation D0: —0.21121 —0.46003 0.16284 0.26956N —0.03533 0.16873 0.01573 —0.08920 \ D0 0.23030 0.04607 —0.00944 —0.19885 —0.29316 —0.38837 0.06128 0.18513/ Find the matrix F0— E — AD0. The product AD„ was computed on page 80. Subtracting it from the unit matrix, we get 0.00\ 0.03 0.00 0.01 0.39 \ 0.25 0.03 0.02 F0 = £ —AD„ = 10-3- 8.08 10.17 0.18 —0.09 I 0.00 0.00 —0.48/ .0.00 Now we find the product DaF / —0.21121 —0.46003 0.16284 0.26956 / —0.03533 0.16873 0.01573 — 0.08920 x 0.23030 0.04607 —0.00944 —0.19885 \ —0.29316 —0.38837 0.06128 0.18513, /0.03 0.00 0.01 0.00\ / 0.25 0.03 0.02 0.39 \ = x 1 0 " '' I 8.08 10.17 0.18 —0.09 I \0.00 0.00 0.00 —0.48/ 1.19 1.64 0.02 —0.32\ 0.17 0.16 0.01 0.11 \ = 10~3 —0.06 —0.09 0.00 0.11 0.39 0.61 0.00 - 0 .2 4 /

94

C o m p u ta tio n a l M a th em a tics

Then, by formula (2) we find for £ = 1 0.16284 0.26956 —0.21121 —0.46003 — 0.03533 0.16873 0.01573 — 0.08920 Ox—D0-\-D0Fn a otaqa a r\i\£c\7 --0.00944 —0.19885 a iaqoc l”t" 0.04607 0.23030 —0.29316 —0.38837 0.06128 0.18513. / 1.19 1.64 0.02 —0.32\ 0.16 0.01 f 0.17 0.11 \ + 10_0.06 —0.09 0.00 0.11 \ 0.39 0.61 0.00 —0.24/ ' —0.21002 —0.45839 0.16286 0.26924N — 0.03516 0.16889 0.01574 — 0.08909 \ 0.23024 0.04598 —0.00944 —0.19874 r 0.29277 —0.38776 0.06128 0.18489/ To check whether the preassigned accuracy is reached compute the product of the matrices ADt: '2 ADl = E — 10-

4 0

Then 2 —1 4 —5 0 0 Since the numerically greatest element of the matrix F is equal to 5 -1 0 "\ we may write with the specified accuracy 1 A - 1 « D X. Fx= £ —ADt = 10-

Problems

1. For the matrix /2 4 .2 1 + a 2.42 3.85\ A = [ 2-31 31.49 1.52 , a = 0.2.n, n = 0 , 1...........10 \ 3.49 4.85 2 8 .7 2 + 0 / find the inverse A~l. Take the inverse matrix obtained in Pro­ blem 5 of Sec. 3.8 as the initial approximation, rounding off its elements to three decimal places. Continue the iteration process until the moduli of the elements of the matrix Fk become less than 10~6.

4 NUMERICAL SOLUTION OF SYSTEMS OF NONLINEAR EQUATIONS

4.1 NEWTON'S METHOD FOR A SYSTEM OF TWO EQUATIONS

Suppose we are given a system F (x, y) — 0, I ( 1) G(x, y) = 0. J According to Newton’s method successive approximations are computed by the following formulas: A?’ F (^n» yn) Fy ^/n) x - t 1 “ xY n J (x,„ y„) ’ " +l " J(Xn, Vn) ^ OOi* yn) (2) 1 1Fx(Xn* yn) F yn) 11 IIn J (x„, y„) ’ yn^\ — y„ j yn) j yti)^i^n* y ^ where (fi)_F (xrit yrl) Fy{xtl, (/„) _ F x { x n > y„) F (xn, y H) I Ayw ~ G 'x (x„, y„) G (xn, y„) | ’ * ~ 0 ( x at yn) G'y {xn, y n) ’ —