ELEMENTS OF
NUMERICAL ANALYSIS
Academic Press Textbooks in Mathematics Consulting Editor: Ralph P. Boas, Jr., Northwestern University
HOWARD G. TUCKER. An Introduction to Probability and Mathematical Statistics EDUARD l. STIEFEl. An Introduction to Numerical Mathematics WILLIAM PERVIN. Foundations of General Topology JAMES SINGER. Elements of Numerical Analysis PESI MASANI, R. C. PATEL and D. J. PATIl. Elementary Calculus
ELEMENTS OF
NUMERICAL ANALYSIS
James Singer Department of Mathematics Brooklyn College Brooklyn, New York
NEW YORK
ACADEMIC PRESS
LONDON
COPYRIGHT
©
1964,
BY ACADEMIC PRESS INC.
ALL RIGHTS RESERVED. NO PART OF THIS BOOK MAY BE REPRODUCED IN ANY FORM, BY PHOTOSTAT, MICROFILM, OR ANY OTHER MEANS, WITHOUT WRITTEN PERMISSION FROM THE PUBLISHERS.
ACADEMIC PRESS INC.
II Fifth Avenue, New York, New York 10003
United Kingdom Edition published by ACADEMIC PRESS INC. (LONDON) LTD.
Berkeley Square House, London W.I
LIBRARY OF CONGRESS CATALOG CARD NUMBER:
PRINTED IN THE UNITED STATES OF AMERICA
64-18216
To Hand Rand
J
Preface
This book is written with two sets of readers in mind, the practicing scientific worker and the "pure" mathematician. The practicing scientific worker-the chemist, the physicist, the engineer, the economist, anyone who is concerned with the quantitative aspects of the physical, biological, social and applied sciences-knows only too well that much of his effort is directly or indirectly devoted to the determination of numerical results and to the derivation of natural laws, which are nothing but relations between numbers endowed with "dimensions." This book aims to tell him how to obtain a numerical result and how to judge the reliability or trustworthiness of his answer. The scientific worker will find many of the necessary formulas and many special tables to help him in his computations, he will find detailed descriptions of the methods and procedures, he will be aided by many illustrative examples worked out in the text, he will be guided by many remarks, observations, and words of caution. The "pure" mathematician is usually interested, if at all concerned, with the art rather than the practice of computation. This book attempts to give him a .coherent, systematic and, I trust, lucid treatment of the classical or traditional theory of mathematical computation. He will find careful and honest proofs where proofs are given; and he will learn that there is frequently an amazing amount of real mathematics behind a prosaic numerical answer, correct to five decimal places. It is my earnest hope, however, that as far as possible the two sets of readers merge into one. It has always been my contention that the scientific worker interested in a numerical answer would do well to delve into the foundations of his methods, to learn "why" as well as "how"; an understanding of the underlying concepts is a powerful tool when he must cope with new problems or with old problems in new dress. On the other hand, it is my hope that those not now intrigued with computation will nevertheless plunge in to help discover new and better methods and more sound results if for no other reason than the fun of it. For these reasons, the text not only includes set algorithms and tables, but attempts to give the reader some feeling for and insight into the subject so that he will be more than ready to strike out on his own. This book is intended as a first course in numerical computation. It is not geared to electronic computers although it will serve as an introduction for those interested in high speed calculators. The methods and procedures that vii
Vlll
PREFACE
are described can readily be modified, if modifications are needed, for use on electronic computors; but fundamentally, the procedures were intended to be carried out on desk calculators or even longhand. For an understanding of most of the text, the reader will need a good introductory course in calculus; for some portions, some advanced calculus and differential equations will be necessary; for some of the material, not even the calculus is necessary. The references listed at the end of the book are few in number; they have been listed either because they can be used for supplementary reading or because they themselves contain extensive bibliographies. Various tables, not readily found elsewhere, are included in the text, but the serious reader should supply himself with a set of ordinary tables including the usual trigonometric, logarithmic and exponential tables. The reader will find two chapters not usually covered in present day texts, one on geometric methods and nomography and one on curve fitting; he will also find many illustrative examples throughout the text. It is suggested that these be more than read; the reader should also work them out and compare his results with those in the text. In some cases, the examples worked out are merely illustrations of theory or algorithms previously discussed in the text; in some cases, the examples worked out serve as the vehicle for the explanations of new theory or modes of operation. The text can be covered thoroughly in two semesters. Those who desire a faster pace can cover a good portion of it in one semester and finish it in a second semester with further topics such as matrix solutions or partial differential equations that are omitted from this book. A final word addressed to the teacher. The examples, by and large, were intended to be worked out with the aid of desk calculators but if these are not available, the number of required significant figures or decimal places should be cut to prevent prohibitively long calculations. JAMES SINGER
Brooklyn, New York
Contents vii
PREFACE
Chapter 1 1.1
1.2 1.3 1.4 1.5
Chapter 2
Numbers and Errors I
Significant Figures Errors Accuracy and Precision Computational Errors The Inverse Problem
11 18
The Approximating Polynomial; Approximation at a Point
22
6 9
2.1 Introduction 2.2 Representation of a Function by a Polynomial 2.3 Power Series 2.4 Computation with Power Series 2.5 Asymptotic Series; Euler's Summation Formula 2.6 Other Methods of Approximation
Chapter 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 5.10 3.11 3.12 3.13
Chapter 4
The Approximating Polynomial; Approximation in an Interval
22 24 30 40 47 63 67
Introduction Polynomial through n + I Points; Determinant Form Polynomial through n + I Points; Lagrange Interpolation Formula Polynomial through n + I Points; Divided Difference Form Polynomial through n + I Points; Aitken-Neville Forms Magnitude of the Error in the Polynomial through n + I Points Equally Spaced Points; Finite Differences Polynomial through n + I Equally Spaced Points Extrapolation Subtabulation Nonpolynomial Approximation Additional Methods of Interpolation Inverse Interpolation
67 70 75 77 84 87 97 101 117 118 126 133 135
The Numerical Solution of Algebraic and Transcendental Equations in One Unknown; Geometric Methods
137
4.1 Introduction 4.2 Graphical Methods 4.3 Construction of Scales and Rules 4.4 Stationary Scales 4.5 Sliding Scales 4.6 Nomography 4.7 Nomography, General Theory
ix
137 138 141 148 lSI 154 160
x
CONTENTS
Chapter 5
The Numerical Solution of Algebraic and Transcendental Equations in One Unknown; Arithmetic Methods Horner's Method The Root-Squaring Method The Method of Iteration The Method of False Position (Regula Falsi); The Method of Chords Imaginary Roots
169 169 171 185 192 196
The Numerical Solution of Simultaneous Algebraic and Transcendental Equations
200
5.1 5.2 5.3 5.4
5.5 Chapter 6
6.1 6.2 6.3 6.4 Chapter 7
Introduction The Method of Iteration The Method of Chords Simultaneous Linear Equations
200
Numerical Differentiation and Integration
217
7.1 7.2 7.3 7.4
Introduction Numerical Differentiation in Terms of Finite Differences Numerical Differentiation in Terms of Ordinates Method of Undetermined Coefficients 7.5 Magnitude of the Error in Numerical Differentiation 7.6 Numerical Integration; Introduction 7.7 Numerical Integration in Terms of Finite Differences 7.8 Numerical Integration in Terms of Ordinates 7.9 Magnitude of the Error in Numerical Integration 7.10 Gauss' Formulas. Orthogonal Polynomials Chapter 8
217 223 235
242 246 257
258
269 279 281
The Numerical Solution of Ordinary Differential Equations
294
Statement of the Problem Picard's Method of Successive Approximations Power Series Approximations Pointwise Methods; Introduction Pointwise Methods; Power Series Pointwise Methods; The Runge-Kutta Formulas Pointwise Methods; Finite Differences Pointwise Methods; Iteration Using Ordinates First-Order Systems; Equations of Higher Order; Special Equations
294 299 303 310 311 315 320 330 339
Curve Fitting
351
Introduction The Straight Line Polynomial Graphs Other Graphs Inconsistent Equations
351
8.1 8.2 8.3 8.4 8.5
8.6 8.7 8.8 8.9 Chapter 9
203 209 210
9.1 9.2 9.3 9.4 9.5 BIBLIOGRAPHY ANSWERS
SUBJECT INDEX
352
366 370 375
382 383 393
ELEMENTS OF
NUMERICAL ANALYSIS
Chapter 1
Numbers and Errors
1.1. Significant Figures. In this chapter we develop some of the basic properties of numbers that are peculiar to the science (or art) of computation. The reader will please bear with us if we begin with some very elementary considerations. Numbers used by the scientific worker are usually written in the decimal notation. Let us recall that in this notation the successive places to the left of the decimal point are the unit's, ten's, hundred's, thousand's, ten-thousand's, etc., places and the successive places to the right of the decimal point are the tenth's, hundredth's, thousandth's, ten-thousandth's, etc., places. We use the convention of enumerating the digits of a number written in decimal form from left to right to simplify some of the later definitions; the first digit is then the one on the extreme left and the last digit is the one on the extreme right. The decimal representations of 22/5, 22/7, and 17 are different in character. The first decimal expression terminates or is finite, the second is nonterminating but periodic, the third is non terminating and nonperiodic. Since the scientific worker rarely if ever uses any but the first kind of decimal expression, we too, unless otherwise indicated, shall use only finite or terminating decimals. This implies that frequently a written number is only an approximation to some other number. (We remark that any number, be it 22/5, 22/7, y2, or 17, is exact; it becomes "inexact" or "approximate" only when it is considered as an evaluation or representation of some other number.) We now pave the way to a better understanding of these approximations. DEFINITION 1. The numerical unit of a number written in the decimal notation is the name of the place occupied by the last digit, except in the case of a whole number which terminates in one or more zeros (all to the left of the decimal point). The numerical unit in the exceptional case, if not implied by the context, must be specifically stated and may be either the name of the place occupied by the last nonzero digit or the name of the place occupied by anyone of the zeros to the right of the last nonzero digit.
1. NUMBERS AND ERRORS
2
For example, the numerical units of the numbers 3.04, 0.0700, 67, are hundredth, ten-thousandth, and unit, respectively. The numerical unit of 67,000 may be a thousand, hundred, ten, or unit and if not implied by the text must be explicitly stated. The last illustration indicates that two numbers may be numerically equal but can have different numerical units. We wish to emphasize this point. Consider the numbers 3.04 and 3.040. They are numerically equal but differ in form; the numerical unit of the first is a hundredth; that of the second is a thousandth. It is convenient to extend the concept of a numerical unit. We shall regard it not only as the name of a place in the decimal representation of a number but also as a number which is an appropriate power of 10. Thus, the numerical units a thousandth and a hundred will be represented by the powers 10-3 and 102 , respectively. If the numbers above are written in the forms 3.04 = 304 X 10- 2 ,
= 700
0.0700 67 67,000
=
67
X
103
=
670
=
X
67
102
=
X
X
10-4 , 10°,
6700
X
10
=
67,000
X
100,
the power of lOin each case indicates the numerical unit. In general, any number n can be written in the numerical unit form (1.1:1)
n
=
n'
X
10",
where n' is a whole number and lOu is the numerical unit of n. (We use the notation 1.2:3 to signify that the corresponding formula, equation, or statement is in Chapter I, Section 2, and is numbered third in that section.) It follows, of course, that u, too, is an integer, positive, negative, or zero. If all the digits of a number are zero, as in 0.00, we put n' equal to zero. DEFINITION 2. The significant digits or figures of a number n are the digits in n' when n is written in the numerical unit form. Thus, 3.04, 0.0700, 67, and 0.00 have 3, 3, 2, and I significant digits, respectively. The number 67,000 may have 2, 3, 4, or 5 significant digits depending on the numerical unit. Omitting this exceptional case of an integer that terminates in one or more zeros, the number of significant figures of a number written in the decimal notation is ~e number of its digits excluding all digits that precede the first nonzero digit.
3
1.1. SIGNIFICANT FIGURES
The significant figures of a number are so named because they are the ones that specify the number of numerical units. We call the attention of the reader to another notation often used similar to the numerical unit form. It is frequently used in the printing of tables and in the tabulation of data and is called the scientific or standard notation or form. A number is written in the standard notation as n = nil X 10", (1.1 :2) where nil has the same digits as n' in the numerical unit form but has just one nonzero digit left of the decimal point. Thus, 3.04, 0.0700, and 67 are 3.04 X 10°, 7.00 X 10- 2 , 6.7
X
10,
respectively, in standard notation. The number zero shall be written as 0.00 X lOu in the standard notation. The standard notation is particularly useful for numbers like 0.0000720 or 95,000,000 (where the numerical unit is a million, say) which are written as 7.20 X 10-5 and 9.5 X 107 , respectively. Generally speaking, a number used by a scientific worker arises in one of three ways. It may, first of all, be a "pure" number, that is, one which is the result of a count, or one which is the result of a mathematical or other definition. As examples of pure numbers we have the number (three) of sides of a triangle, the ratio of the circumference to the diameter of a circle, the value of sin 23°, or e- /2 dt, the number of feet in a mile, the number of days in a week, the number of pounds in the maximum load of an elevator. Secondly, there are numbers that arise as values of direct measurements. (By a direct measurement we mean one in which the result is read off some measuring instrument such as the measurement of a distance by a ruler or the measurement of a temperature with a thermometer.) Thirdly, there are numbers that arise as results of computations performed on numbers of the first two types. But, as we know, relatively very few numbers can be written exactly as finite decimals, measurements are at best approximate, and calculations are subject at the very least to all the inaccuracies of the numbers involved. Hence a number used by a scientific worker is usually an approximation to some "true" value. It is therefore important that he should indicate in some fashion the goodness of the approximation, the reliability, or the margin of error of a stated number. This can be done
n
4
1. NUMBERS AND ERRORS
in a variety of ways. He may write 6.040 ± 0.003 to indicate that the correct value is in the range from 6.037 to 6.043, inclusive. Note that if one wants to indicate a margin of error of 0.0003, say, one should not write 6.04 ± 0.0003 but 6.0400 ± 0.0003. The scientific worker will also use 6.04- to indicate that the true value of a number is less than 6.04 but closer to it than to 6.03. Likewise, 6.04+ indicates a true value greater than 6.04 but closer to it than to 6.05. These methods of writing approximate numbers clearly indicate that the numbers are approximate and give the margins of their errors but as matters of notation they are just a bit clumsy. The scientific worker will most frequently write 6.04 with the intent and understanding that this does not represent the number 6.04 exactly but a number which is closer to 6.04 than it is to 6.03 or 6.05. Likewise, 6.040 indicates a number which is closer to 6.040 than it is to 6.039 or 6.041. The last notation determines a number with a margin of error equal to one-half the numerical unit; the preceding notation also determines a number with the same margin of error but also indicates whether the error is one of excess or default. The first notation like the last does not indicate the direction of the error but usually indicates a more precise margin of error. Let us note in passing that the margin of error is closely linked with the numerical unit of the stated number and is, in the last notation, just one-half of that unit. Thus the margin of error in 6.040 is onetenth the margin of error of 6.04. Since the number of significant figuns in a number and the numerical unit of the number are themselves closely related, one must beware of using more significant figures than are warranted in writing a number. Just how many one should use will appear shortly. The following definition will be useful. DEFINITION 3. If a number a with k significant figures is an approximation to a number n and is the best approximation to n of all numbers with k significant figures, then a is said to be correct to k significant figures as an approximation to n. Thus, 3.1, 3.14, 3.142, and 3.1418 are correct to 2, 3, 4, and 5 significant figures, respectively, when considered as approximations to 28/9, {/31, fT, and loglo 1386, respectively. It is desirable for some purposes to "round off" a number which is written in the usual decimal notation with k + m significant figures to one that has only k significant figures. We do this by deleting those of the last m digits that are to the right of the decimal point and substituti'rig zeros for those that are to the left of the decimal point. No further change
1.1. SIGNIFICANT FIGURES
5
is necessary if the m deleted or replaced digits represent less than onehalf unit in the kth place; but if the deleted or replaced digits represent more than one-half unit in the kth place, the kth significant figure is increased by unity. (If the kth significant figure is 9, it changes to 0 and the preceding digit is increased by unity. Note the last illustration in the table below.) If the deleted or replaced digits represent exactly one-half unit in the kth place, usage varies. Some people treat this case like the preceding one and increase the kth digit by unity; others increase the kth digit by unity if it is odd and leave it alone if it is even. The reasoning behind this latter rule is specious; in actual practice, it matters little which system is used. ILLUSTRATIONS
Rounded off to: Number
32.0769 0.856025 123456 1234.56 1.34996 0.999777
5 significant figures
4 significant figures
3 significant figures
2 significant figures
32.077 0.85603 123460 1234.6 1.3500 0.99978
32.08 0.8560 123500 1235 1.350 0.9998
32.1 0.856 123000 1230 1.35 1.00
32 0.86 120000 1200 1.3 1.0
In particular, note that 1.34996 becomes 1.3 when rounded off to two significant figures and 1.35 when rounded off to three significant figures. If, however, we were given 1.35 and told to round it off to two significant figures, the correct answer is 1.4. Many authors write 1.33 to indicate 1.35-; rounded off to two significant figures, this number is 1.3. In brief, to round off a number with k + m significant figures to one with k significant figures is to rewrite it correct to k significant figures as an approximation to its original form. The numbers 3.14209 and 3.14285 are approximations to 1T = 3.14159 .... Neither one is correct to six significant figures. If they are rounded off to five significant digits to 3.1421 and 3.1428 (or 3.1429), respectively, they remain incorrect to five significant digits. But when they are rounded off to four significant digits to 3.142 and 3.143, respectively, the first becomes correct to four significant digits as an approximation to 1T. The latter becomes correct when rounded off to three significant digits. We are thus led to the following extension of Definition 3.
1. NUMBERS AND ERRORS
6
DEFINITION 4. If a number a with k + m significant digits when rounded off to k + 1 significant digits is not correct to k + 1 significant digits as an approximation to a number n but when rounded off to k significant digits is correct to k significant digits, then a is said to be correct to k significant digits as an approximation to n. Thus, 1.33530 is correct to four significant digits when considered as an approximation to sec 41 °30' = 1.3352 and is correct to two significant figures when considered as an approximation to t. Similarly, t expressed as a decimal would be correct to two significant figures as an approximation to sin 19°30' = 0.33381 and to three significant figures as an approximation to vo]TI = 0.33317.
EXERCISE 1.1 1. State the numerical unit of each of the following numbers and write each numerical unit in the form IOu.
a. 436 b. 750.2 c. 2.006 d. 0.05 f. 400.0 I. 0.00000 h. 1.976530 i. 1.000001
e. 0.000050 J. 883.09000. 2. Do the same for each of the following numbers; give all the possibilities if there are several. a. 956000 b. 906000 c. 1000000 d. 1000001 e. 999999 f. 3020010. 1. How many significant digits are there in each of the following numbers? a. 4029 b. 40.29 c. 53.670 d. 0.0002 e. 190 f. 2.000000 I. 2.000006 h. 3.0002 I. 83.10400 J. 0.08040. 4. Write each number in examples 1,2, and 3 in standard notation. 5. Round off each of the following numbers to four significant digits. a. 4.32974 b. 682.548 c. 28.9956 d. 102843.1 e. 0.0765402 f. 8976.49 I. 0.999996 h. 1.35000 I. 407.391 J. 32.1089. 6. Write each of the following numbers correct to four significant digits. a. 22/7 b 'IT c. 100000/3 d. cos O· e. cos 25' f. VO:OOS09 I. {/6~00000685 h. IO! I. 'ITa J. the number of inches in a mile. 7. Write each of the numbers of example 6 correct to the nearest tenth. S. The first number in each of the following pairs is an approximation to the second number. Write each approximation as a decimal if not already so written and state the number of correct significant figures in the approximations. a. 563.201,563.257 b. 0.00632,0.00636 c. 52,000,000,52,475,913 d. 4.732093,4.732102 e. 3800,3826.4 f. V3/IO, sin 10· I. 3/4, log 5.624 h. I, cos 30' I. 19/6, v'W J. {/3.87, 'IT/2.
1.2. Errors. It was pointed out in the last section that for a variety of reasons a number used by a scientific worker is usually an approximation to some true value. We propose to examine these errors a Htth further in this section.
7
1.2. ERRORS
The difference e between a number n and an approximation a to it is defined as the actual error in a; in symbols, e = n - a,
(1.2: 1)
whence (1.2:2)
n
=
a
+ e.
The relative actual error is defined by the statement (1.2:3)
and the per cent relative actual error is defined as 100,%.
(1.2:4)
It is to be noted that for a and n real, e may be positive, negative, or zero, whereas the relative errors are zero or positive only. Thus, the 'actual error committed in approximating 17 by 22/7 is e
= =
22/7
17 -
3.14159265+ - 3.14285714+
= -0.0012645-; the relative actual error is - 0.0012645- _ 000040+' r - 3.14159265+-' ,
and the per cent relative actual error is 0.040+%.
The actual error in approximating e=
= =
17 -
17
by 3.14 is
3.14
3.14159+ - 3.14 0.00159+,
and the relative actual error is - 0.00159+ _ 000050+ r - 3.14159+ - . .
1. NUMBERS AND ERRORS
8
Note that in these two illustrations the actual and relative actual errors can be calculated to as many significant figures as we wish provided that 1T is given with a sufficiently great number of correct significant figures. Let us now imagine that the mem bers of a class read, one by one, a barometer furnished with a vernier scale. Their readings will not be all alike and range, say, from 761.5 to 762.5 mm; let us suppose that it is decided to record the atmospheric pressure as 762 mm. This value, 762 mm, is, of course, an approximation to the true value of the atmospheric pressure and is the a of formula 1.2: 1. However, the true value n is not known and therefore the value of e is not known. The best we can say is that n is between 761.5 and 762.5 and that the actual value of e is at most 0.5. In general, if the true value of a number t is not known but it is known that it differs from an approximation a by an amount which is less than a positive number h, we have (1.2:5)
a- h
~
t
~
a
+ h.
We call h the margin of error or the maximum error of a; the ratio (1.2:6)
m =
I~ I
is called the maximum relative error of a; and (1.2:7)
is called the per cent maximum relative error. Note that the maximum relative error has the approximate number in the denominator whereas the relative actual error has the exact value in the denominator. The approximate number must be used here because the exact value is not known. Some authors use the approximate value in all cases, but it seems more natural to use the exact value when it is known. To illustrate these definitions, suppose that the height of a mountain is given as 6703 ft but is in error by 6 in. or less, that is, the margin of error or the maximum error is 6 in. The true height of the mountain is between 6702.5 and 6703.5 ft; the maximum relative error is approximately 0.0000746 or 0.00746%. Again, suppose the width of a paper is measured as 10.0 in. with the true value so mew heres between 9.95 and 10.05 in. The maximum error is 0.05 inches and the maximum\ relative error is 0.005 or 0.5 %. Thus, the maximum error in the first
1.3. ACCURACY AND PRECISION
9
case is 120 times as great as it is in the second, but the maximum relative error is about (1 /67)th of the maximum relative error in the second case. Let us also recall that whenever we write a number in the decimal notation and the actual error or margin of error is not stated or otherwise implied, it will be assumed that the margin of error is one-half of the numerical unit. EXERCISE 1.2 1. Each pair listed below is a number followed by an approximation; give for each pair the actual error, the relative error, and the per cent relative error. /a. V 2, 1.4 b. e,2.7
c. V150, 49/4 e. {/19700,27 I. inches in a meter, 40
d. 1902 ,36000 f. 1000/909, 1.1 h. tan 9°39', 0.17
J.
millimeters in an inch, 25.
2. What is the maximum error and the maximum relative error in each of the following numbers?
a. 17.03 b. 0.3200 c. 47 d. 8043 e. 9500 i. 1.9 ;. 2. f. 0.00003 g. 8765.1 h. 0.301 3. Find the value of." - tan 72°20.5' correct to three significant figures. 4. Find the numerical difference between (e/2)v'aand (V 2)"/ 2 correct to three significant figures.
1.3. Accuracy and Precision. table.
Consider the entries in the following
Number
Approximation
Actual error
Relative error
."
22/7 76/5 4,100,000
-0.0013-0.0013+ 625
0.0004+ 0.00008+ 0.00015+
------
Vi31 45'
Which is the best approximation? If we compare the first two rows, we would say that 76/5 is a better approximation to V23T than 22/7 is to 1T because their actual errors are about the same and the relative error of 76/5 is only about ith oUhe relative error in 22/7. Also, 76/5 is a better approximation to V231 than 4,100,000 is to 45 4 because its actual and relative errors are smaller than the corresponding errors of 4,100,000. Thus, 76/5 appears to be the best approximation to its true value. Which is the poorest approximation? Here there is legitimate
1. NUMBERS AND ERRORS
10
doubt, for while the actual error in 4,100,000 is much greater than the actual error in 22/7, the relative error is smaller. Since there is no compelling reason to choose one type of error over the other as a criterion of the goodness of an approximation, we adopt two measures for the degree of closeness, precision and accuracy. DEFINITION 1. Of two given approximations to two given numbers, the one with the numerically smaller actual error is called the more precise; and the one with the smaller relative error is called the more accurate. Hence, 22/7 is the most precise of the three approximations above and 4,100,000 is the least precise; 76/5 is the most accurate and 22/7 the least accurate. In the case of measurements or in the case of numbers whose maximum errors are known but whose actual errors are not, we state this rule:
2. Of two given approximations to two numbers of which only the margins of errors are known, the one with the smaller maximum error is called the more precise, the one with the smaller maximum relative error is called the more accurate. In short, precision is gauged by the actual or maximum error while accuracy is gauged by the relative or maximum relative error. Thus, in the illustrations at the very end of the last section, the mountain approximation is the more accurate but the less precise. Also, to give the precision of a result we state the actual or maximum error; to give the accuracy we state the relative or maximum relative error. Let all the significant figures of an approximation a to a number n which is known exactly or to within its margin of error be correct, and let lOu be the numerical unit of a; then the actual error satisfies the condition DEFINITION
(1.3:1)
and the maximum error h satisfies the condition (1.3:2)
h
=
5.10.. - 1 •
Also, the relative error r satisfies the condition (1.3:3)
T
~
5 . 10..- 1
In I
'
and the maximum relative error m is given by (1.3:4)
m=
5 . 10..- 1
Ia I
1.4. COMPUTATIONAL ERRORS
11
which becomes, if we put a
=
(1.3:5)
m =
a' . lOu, 1
2Td!'
We see at once from the forms of the right-hand members of relations 1.3:3 and 1.3:5 that the greater the number of correct significant figures in the approximation a (and hence the smaller the numerical unit lOU), the smaller the values of these two fractions. That is, the upper bound for the relative error and the value of the maximum relative error decrease as the number of correct significant figures increases. We shall frequently omit the adjectives "actual" and "maximum" and talk merely of the errors and the relative errors when the context makes the meanings clear. REMARK. It should be pointed out that the terminology regarding "accuracy" and "precision" is not uniform either in usage or in the literature. Some authors reverse the meanings of the two words as they are used here; some use them with slightly different meanings; some use the' two words more or less interchangeably. The words are also used, in different but allied context, to designate the reliability of the arithmetic mean of a series of measurements of the same quantity.
EXERCISE 1.J 1. Determine the accuracy and precision of a 12 in. ruler if it actually is 12.01 in. long. 2. Determine the accuracy and precision of a weight intended to be 1000 gm but actually is 999.2 g. J. The thickness of a sheet of paper is measured as 0.004 in. by use of a micrometer which can be read to the nearest thousandth of an inch. What are the precision and accuracy of the measurement? 4. The Empire State building is 1250 ft high to within 6 in. A 3-in. cylinder is ground with a tolerance of one one-thousandth of an inch. Which measure is the more precise? The more accurate? 5. Assume that the error is spread evenly over the ruler of Example I. Three distances measured with this ruler are found to be 3 in., 6 in., and 2 ft, respectively. What are the precision and accuracy of each measurement? 6. Is the number of correct significant digits in a stated measurement directly related to the accuracy or to the precision of the measurement? Explain your answer.
1.4. Computational Errors. (1.4: 1)
The well-known formula
T= 2n~;
expresses the time of a complete swing of a pendulum in terms of its length and the acceleration of gravity. Students evaluating T from the
12
1. NUMBERS AND ERRORS
results of recorded data or, more generally, students and others making similar calculations are frequently perplexed with a variety of questions concerning the number of significant figures to be used or kept. The answers to most of these questions can be found in the answers we will give to the two following questions. First, how precise or accurate is the result of a calculation performed upon numbers whose errors or maximum errors are known? And second, how precise or accurate must each of a set of numbers used in making a calculation be in order to obtain a result of preassigned precision or accuracy? We attack the first of these questions in the present section and the second in the next section. We first wish to remark, however, that the number of significant figures used to express a measurement depends directly on the construction and capability of the measuring instrument and on the quality of the magnitude that is being measured. Suppose we are using an ordinary cheap protractor to measure an angle. The very best we can do with it is to determine a carefully drawn angle to the nearest half degree. If the angle were drawn freehand with chalk on a blackboard, the nearest multiple of 5° would be precise enough. If, furthermore, the measure of such an angle where 25°, say, and it were necessary to indicate one-third of the angle, the measure of the smaller angle should be written as 8°; neither the drawing nor the instrument justify the use of 8!0, and he who uses 8.33333° is obviously living in a world of illusion. Also, one should suit his instrument to the character of the magnitude to be measured. Thus, to measure the length of a shadow (in order to find the length of a flagpole, say) it is quite unnecessary to have a steel tape graduated to sixty-fourths of an inch. A close examination of a shadow, even one cast by a pole on a bright day, will reveal that its edge is rather nebulous; the best we can do is to obtain its length correct to the nearest eighth of an inch. Similarly, in the notoriously crude calorimeter experiments it is unnecessary to use thermometers capable of measuring a variation in temperature of one-thousandth of a degree. We turn now to the study of the first of the two questions just raised, namely, how precise or accurate is the result of a calculation performed on approximate numbers? Or, to put the question in lither words, how many significant figures shall we use in writing the result of a computation performed upon approximate numbers? Let Xl , XI , •.• , Xn be the numbers involved in the computation and let y be the result of the computation; y is then some function of the x's which we write as (1.4:2)
13
1.4. COMPUTATIONAL ERRORS
We can regard the x's as independent variables and y as a variable dependent on them; we assume that the function I and its partial derivatives Ix 1 ,Ix2 , "', Ix • exist and are continuous, at least in a neighborhood of the values under consideration. If we assign the (positive, negative, or zero) increments LlXI , Llx2 , "', Llx" to Xl' X2 , "', X,,, respectively, y takes on an increment Lly and we have (1.4:3)
whence
If we now consider Xl , X 2 , "', Xn as approximations to the respective "true" values Xl + LlXI , X2 + LlX2 , "', X" + Llx" occuring in the computation, then Lly given by 1.4:4 is the error in the result of the computation due to the errors LlXI , Llx2 , "', Llx" , respectively. We seek a more easily estimated form for this error. The right-hand member of the equality 1.4:4 can be put into the form
+ ... + [f(Xl , X2 , ... , X"-l , X" + Jx,,) -
f(Xl 'X 2 , "', Xn-l , x,,)].
It follows from the Law of the Mean that the successive brackets on the right-hand side of this equality are equal to
fzt(x 1 , X2 + 82 Jx 2 , Xa (1.4:5)
+ Jxa , "', x" + Jx,,) Jx 2, f".(x 1 'X 2 , Xa + 8a JXa , X4 + Jx, , "', .:t" + JXn) JXa ,
respectively, where all the 8's are positive quantities less than unity.
14
1. NUMBERS AND ERRORS
Since the partial derivatives that occur here are continuous functions, they are, in turn, equal to
(1.4:6)
where El , E2 , ... , En are functions of the x's and their increments that approach zero as LlXl , LlX2 , ... , Llxn approach zero. Hence (1.4:7)
Lly
= !"I(xl , ... , xn) LlXl
+ !.,z(xl , ... , xn) LlX2
+ ... + !"n(x xn) Llxn + El LlXl + E2 LlX2 + ... + E" Llx" . l , ... ,
We now rename LlXl ,Llx2 , ... , Llxn; we call them dx1 , dx2 , ... , dXn , respectively, and then define the "total differential" dy by (1.4:8) dy
= !"I(Xl' ... , x,,) dXl + !"z(Xl' ... , x,,) dX2 + ... + !"n(Xl' ... ,x")dx,,.
Then dy and Lly differ by the amount (1.4:9)
which ordinarily is small compared to dy. Consequently, the value of the total differential dy given by 1.4:8 is a good estimate of the error committed in the computation on the approximate numbers Xl , X 2 , ••• , Xn . We remark that each term on the right-hand side of 1.4:8 may be positive or negative since, apart from the partial derivatives, the differentials may be positive or negative. Hence, to find the maximum error in y, we put 1.4:8 in the form (1.4:10)
I dy I ~ 1!"I(xl' ... , x,,) II dX1 I + 1!"a(x1 ,
..• ,
x,,) II dx2 1
+ ... + I!"n(xl , ... , x,,) II dXn I· We obtain from 1.4:2 and 1.4:8,
\
(1.4:11)
an expression for the relative error dy/y in terms of the relative errors dXl/X l , dX 2/X 2 , ... , dxn/xn , where for the sake of brevity we omitted
1.4. COMPUTATIONAL ERRORS
1S
from the!'s the arguments Xl' X2 , ••• , X" . Since the preceding remark applies here too (indeed, the relative error was defined as an absolute value), we rewrite the preceding formula as (1.4: 12)
I; I~ IXl;Zl II ~:1 I+ IX;ZI II ~21 + ... + IXn~Zfi II ~n I·
We summarize the preceding results. If the absolute values of dx l , dX 2 , ... , dXn are the maximum errors in the approximate numbers Xl' X2 , ••• , Xn , respectively, and if y is the result of the computation
1.4: 1 performed on these numbers, then the maximum error I dy I in y is given by formula 1.4: 10 and the maximum relative error I dy/y I is given by formula 1.4:12. More precisely, the right members of 1.4:10 and 1.4: 12 are good estimates of the maximum magnitudes of the respective errors. If, in particular, y is a function of a single variable X, then (1.4:13)
dy = f'(x) dx,
(1.4:14)
where the primes indicate differentiation with respect to x. We also note the algebraic identities
dy =y;,
(1.4:15) (1.4:16)
I
dy
1=
Iy II; I·
We illustrate the use of formulas 1.4: 10 and 1.4: 12 by an example .. EXAMPLE. Determine T, its maximum error, and its maximum relative error from formula 1.4: 1, given 1T = 3.1416, 1 = 51.32 cm, g = 980.62 cm/sec2• (It is understood that all significant figures are correct. Also, it should be remarked that this well-known formula from physics is itself inaccurate. The present discussion makes no attempt to gauge the errors resulting from the inexactitude of the formula; we are here supposing that the formula is exact and we wish to determine the errors in T due to the errors in 1T, I, and g.) The errors in 1T, I, andg are d1T = 0.00001, dl = 0.005, and dg = 0.005 respectively. Note that for the purpose of this discussion, 1T must be
1. NUMBERS AND ERRORS
16
considered a variable. Taking the total differential of T and replacing each term by its absolute value, we find 1
I dT I ~ I!gi (21g I d1T I + 1Tg I d/l
(1.4:17)
+ 1T/I dg I).
On substitution, we find the error to be I dt I ::::;; 7.8 X 10-6 • Hence, T = 1.437388 ± 0.000078. The relative error is 0.000054- or 0.0054-%. The error and relative error are usually written with at most two significant figures. An alternate method for calculating the error and relative error is based on formula 1.4: 16 and usually involves far less computation. We first calculate the relative error and then the value of the error. Since the relative error of a product is equal to the sum of the relative errors of the factors and the relative error of a quotient is equal to the sum of the relative errors of the dividend and divisor-see examples 2(b) and (c) at the end of this section- and since the relative error of a square root is equal to one-half the relative error of the radicandexample l(b)-the relative error in T is equal to the relative error in 1T plus one-half the sum of the relative errors in I and g. We obtain by this shorter method the same results as before.
EXERCISE 1.4 All numbers in examples 3-19 are correct as far and only as far as they are written unless otherwise implied or known to be exact. Give all numerical answers with as many correct significant figures as possible. 1. Derive for each of the following functions an expression for the error in y in terms of x and the error in x and an expression for the relative error in y in terms of x and the relative error in x. •• y = x"; c. y = sin x (x in radians); e. y = In x = log. x;
g. y
=
e";
b. d. f. h.
vx;
in particular, y = y = cos x (x in degrees); y = loglo x; y = aZ , a > O.
2. Prove: •• if s = XI ± X2 ± ... ± x .. , then I ds I < I dXI I + I dX 2 I + ... b. if P = XIX2 ... x .. , then I dp I < ~;:'I I pIx, I I dx, I and I dp/p I c. if q = x/y, then I dq/q I < I dx/x I + I dy/y I .
+ I dx .. I; < ~:"I I dx./x, I;
1. The length of a side of a square is 23.4 mm. Find its perimeter, the length of a diagonal, and its area. 4. The radius of a circle is 9.S in. Find the circumference, the area, and the length of a chord 7 in. from the center.
17
EXERCISES
5. The hypotenuse c of a right triangle is 13.4 cm, one leg a is 9.2 cm. Determine the precision and accuracy of sin A calculated from the formula sin A = a/c.
6. Find the area of a triangle whose sides are 23.4 ft, 30. I ft, and 45.9 ft. 7. The diameter and length of a right circular cylinder are 4.13 and 12.90 in., respectively. Find the accuracy and precision of the total area and the volume.
8. A solid sphere of radius 2.50 in. is made from a metal that weighs 0.223 Ib/cu in. Determine the accuracy and precision of the weight. M
9. Find the accuracy and precision ofF given by the formulaF = 53.74, , = 200, and k is a constant, known exactly.
M
10. Determine the accuracy and precision of F given by the formula F = 9.2, a = 3.0, x = 1.2" = 6.1.
=
kmM/,2 if m =
=
0.32,
Ma'/,' if
11. An equation for simple harmonic motion is s = a cos t. What are the maximum and relative maximum errors in s if a = 23.8, and t = 0.9? 12. The distance s in centimeters of an oscillating point from an origin is given by s
=
~e-'cos (~+ 8) 22'
where t is time (in seconds) and 8 is an initial angle (in radians). If t and 8 are 2.0 sec and 0.3 rad, respectively, find the maximum error and relative maximum error in s. 11. The cosine of an angle is computed from the sine by use of the identity cos 2 8 = I - sin· 8. Show that for angles close to 45° the maximum error in cos 8 is approximately equal to the maximum error in sin 8. In general, prove that the maximum error in cos 8 is approximately equal to the maximum error in sin 8 multiplied by tan 8 and that the maximum relative error in cos 8 is approximately equal to the maximum relative error in sin 8 multiplied by tan 2 8. 14. Solve the equation 1.37x'
+ 2.05x
- 3.21
=
O.
15. Find the error in a root, of the equation aoxn errors in the coefficients ao , al , ... , an .
+ a1Xn - 1 + ... + an
=
0 for given
16. The earth is an oblate spheroid with equatorial radius 3963.3 mi, polar radius 3949.9 mi. Find its volume. (An oblate spheriod is formed by the rotation of an ellipse about its minor axis. If a and b are the major and minor axe~, respectively, of the ellipse, the volume of the ellipse is given by the formula V = ~1Ta2b.) 17. If air resistance is proportional to the square of the velocity, the velocity v in em/sec of a body falling from rest is given by gt v = ktanh k , where g is the acceleration of gravity, k is the maximum velocity, and t is the time. If = 5275 cm/sec, g = 980.6 cm/sec·, find the velocity at the end of 1.0 sec. When is the velocity 500 cm/sec? 1000 cm/sec ? 2000 cm/sec? 5000 cm/sec ?
k
18. The standard length Ho of a mercury barametric column in millimeters, at a temperature O°C, at a point at latitude L, and at a height h ft above sea level, is given by Ho
=
760
+
1.9456 cos 2L
+ 0.00004547h.
1. NUMBERS AND ERRORS
18
Find the standard lengths of barametric columns at the following places: Latitude
Place
Altitude (ft)
- - - - - - - - - - - - - _ ..
40°36' N 40°44' N 40°44' N 71 °23'30" N 29°56'53" N 38°55'15" N 51°30' N 0°35'20" S
Brooklyn Foot of Empire State b'ldg Top of Empire State b'ldg Pt. Barrow, Alaska New Orleans Washington, D. C. London Mt. Cotopaxi
50 46.7 1296.7 Sea level Sea level 150 100 19,498
19. Find the value of the following determinant; assume all numbers are exact.
32.1
D
=
I -1.6 35.0
I
5.3 7.0 12.7 7.2 . 5.8 7.4
What is the maximum error in D if the element 7.0 is correct only to the nearest tenth? If the element 7.2 is correct only to the nearest tenth? What are the maximum and minimum values of D if every element is correct only to the nearest tenth?
1.5. The Inverse Problem. In the preceding section we estimated the maximum error and the maximum relative error in the result of a calculation due to stated errors in the numbers involved. In this section we discuss the inverse problem, namely, how precise or accurate must the numbers used in a calculation be to obtain a result of preassigned precision or accuracy? We answer this question and explain the various methods by means of an example. EXAMPLE. The time T is to be calculated from formula 1.4: 1. If the values of 1 and g are about 51.3 cm and 980.6 cm/sec2, respectively, just how precisely must the values of 1T, I, and g be taken if the error in T is not to exceed 0.0001 sec? We refer first to formula 1.4: 17 which we now write in the form (1.5:1)
I dT I ~ 21tg-11 d1T I + 1THg-! I dll
+ 1T1!g-i I dg I ~ 0.0001.
This time, I dT I (~0.0001), I, and g are the known quantities; I d1T I, I d/l, and I dg I are the quantities to be determined. Essentially, then, we are faced with the algebraic problem of solving a single linear equation in three unknowns, I d1T I, I d/l, I dg I, in which the coefficients are not exact. We simplify the problem by supposing for the moment that the coefficients are exact. Elementary algebra tells us that we have a double infinity of solutions or that we are free to impose two additional
19
1.5. THE INVERSE PROBLEM
conditions on drr, dl, dg. These conditions can be imposed, of course, in a great variety of ways. One method of imposing two additional conditions is to demand, quite arbitrarily, that each term of the middle member of 1.5: I contribute equally to the error dT in T. This is equivalent to stating that (1.5:2)
21!g-! I drr I = rrHg-I I dll = rrl!g-il dg I ~ 0.000033.
Substituting 51.3 for I and 980.6 for g, and solving, we find I drr I ~ 0.000073, I d/l ~ 0.0024, I dg I ~ 0.045. These results mean that if rr is taken as 3.1416, so that the error in rr is actually less than 0.00001, if I (about 51.3 cm) is measured to within two-thousandths of a centimeter, and if g (about 980.6 cm/sec S) is determined to within four-hundredths of a centimeter per second per second, then the error in T will be at most 0.0001 sec. Roughly, the error in T will be within the prescribed bounds if the values of rr, I, and g are each taken correctly to five significant figures. The values for I drr I, I d/l, and I dg I were calculated on the assumption that the original values for I and g were exact. Since we found out that both I and g had to be measured somewhat more precisely, it is natural to ask: are the answered affected? That is, what are the errors in I drr I, I d/l, and I dg I due to the errors in I and g? We have
I drr I = 0.0000167Hgl; whence d I drr I = 0.0000167(-
! l-ig! I dll + ! l-lg-ll dg I).
We find by substituting the values of I, g, dl, and dg in the right-hand member of this equality that the value of d I drr I, that is, the error in I drr I, is indeed insignificant compared to drr itself. Similar results hold for d I d/l and d I dg I. Hence the inexactitude of the coefficients in 1.5: 1 does not affect the answers. Reference to the inequalities 1.5: 1 and 1.5:2 shows that for a fixed I and g, multiplication of dT by an arbitrary constant has the effect of multiplying each of I drr I, I d/l, and I dg I by the same constant. That is, the error in T will not exceed O.OOOlk if the errors in rr, I, and g do not exceed 0.000073k, 0.0024k, and 0.045k, respectively. The example we have just completed exhibits the general procedure. To determine the maximum errors in the quantities Xl' Xs , "', Xn that will yield an error in y which does not exceed a preassigned limit, where y and the x's are related by the equality 1.4:2, equate each of the terms of the right-hand member of 1.4: 10 to (I/n)th of the allowable
20
1. NUMBERS AND ERRORS
error in y and solve for 1dX I I, 1dX 2 I, "', 1dX n I. This method uses what is known as the principle of equal effects. A second but essentially equivalent method uses the formula 1.4: 12. In this case we first compute y and then the relative error 1 dy/y I. We then impose the condition that each term of the right-hand member of 1.4:12 contribute equally to the allowable error 1dy/y I. Since this method is similar to the preceding one and yields the same results, it needs no further elaboration. The preceding two methods for determining the unknowns take the easiest way out, so to speak. A third and somewhat more reasonable method would go about as follows. The number 7r can be obtained to any practical degree of precision by merely looking it up in a table; we may then assume that for the problem at hand, d7r is zero. Assuming further that the length of the pendulum and the acceleration of gravity can be obtained with equal precision, we put dl equal to dg. Under these assumptions, 1.5: 1 becomes (1.5:3) whence
1dT 1 ~ 7r(I-tg-l 1
d 'g
1
+ lig-i) 1dg 1~ 0.0001,
~ O.OOOll!gi """"
7r(1 + g) .
On substituting the given numerical values for I and g (and using 3.142 for 7r, a value which does not effect the first two significant figures in dg), we find 1dll = 1dg 1 ~ 0.0068. It follows that the error in T will not exceed the allowable limit 0.0001 if the length I and the acceleration of gravity g are each determined to within six units in the third decimal place and if the value of 7r is taken correct to six significant figures. Comparing these results with those previously obtained, we see that this time I need be determined somewhat less and g somewhat more precisely than before. In general, we would use the principle of equal effects to determine the allowable errors in the quantities Xl' X2 , "', Xn involved in the computation of a result y that are necessary to yield an error dy in y which does not exceed a preassigned limit if and only if we have absolutely no guide to the imposition of conditions on the errors dX I , dX 2 , "', dX n . Whenever possible, however, the last method should be used. It assumes, of course, that one is familiar with his instruments, both physical and mathematical and that the user knows what numbers can be easily obtained with great precision and what numbers can be obtained only with great difficulty. Even when this information is
21
EXERCISES
lacking, it may be desirable at times to weight the errors sought according to some arbitrary but reasonable plan rather than use blindly the principle of equal effects. EXERCISE 1.5
The examples referred to below are the examples of Exercise 1.4. In each case, state clearly the assumptions made regarding the distribution of the errors. 1. How precisely must the length of the side be measured (example 3) to determine the perimeter to within 0.02 mm ? The area to within 5 sq mm ? How precisely must the side be measured to determine the perimeter to within 0.03 % ? The diagonal to within 0.03 % ? The area to within 0.03 % ? 2. How accurately must the radius be measured (example 4) to determine, to within one part in a thousand, the circumference? the area? the chord? 3. How precisely must a and c be measured (example 5) to ensure five correct significant figures in sin A ? 4. How precisely must the sides be measured (example 6) if the area is desired to within 10 sq in.? 5. How precisely must the radius be determined and to how many significant figures must the weight in pounds per cubic inch be known (example 8) if the total weight is desired to within 0.1 oz ? 6. How accurately must m, M, and r be determined (example 9) if F is desired to within 0.35 % ? 7. How precisely must a and t be known (example 11) if s is desired to within 5 % ? 8. How precisely must t and 8 be measured (example 12) if s is desired to within a thousandth of a millimeter?
t. What are the allowable errors in the coefficients (example 14) if each root is desired correct to three decimal places? if each root is to have a maximum relative error of 0.0006 ? 10. How precisely must the values of b, A, and B be determined if a, given by a =
bsinA sin B '
is desired with a maximum error of 0.005 if, approximately, b B=53°12'?
=
42.36 em, A
11. Find R, its maximum and relative maximum errors if
R
G- I
=
Jc-G '
and J = 778, c = 0.339, G = 1.25. Ii is known that c can be determined about twice as accurately as either J or G; use this information to determine the allowable maximum errors (actual and relative) in J, c, and G so that R is correct to within one part in a thousand.
Chapter 2
The Approximating Polynomial; Approximation at a Point
2.1. Introduction. The scientific worker soon becomes aware that some compromise with reality is necessary in almost every attempt to develop and formulate the principles that describe the quantitative aspects of natural phenomena. The world and its workings are so complex that it is usually impossible to write down, exactly, the mathematical laws they obey. It is almost always necessary to simplify by idealization and neglect. Thus, in the attempt to describe the apparently simple phenomenon of a body falling through air, it is necessary to neglect or at least to idealize air resistance. The scientific worker realizes his limitations and is ever faced with the problem of balancing the advantages of simplicity with the disadvantages of inaccuracy. Nor is pure mathematics entirely free from the necessity of similar compromise. Indeed, it is frequently convenient and sometimes imperative that a function (2.1:1)
y
= f(x)
be replaced by a simpler function (2.1 :2)
y = a(x)
so that the properties and values of f(x) can be studied or obtained from the corresponding properties or values of a(x). We give two instances below. If we put (2.1 :3)
f(x) = a(x)
+ E(x),
then by analogy with equality 1.2:2, we may regard a(x) as an approximation to f(x) and E(x) as the error function. Again, it is necessary to balance the advantage of simplicity gained with the disadvantage of precision lost. As soon as it has been decided what the type of the simple, approximating function a(x) shall be-for the most part, a(x) will be a polynomial-our ability to weigh the advantages and the opposing disadvantages will depend on the ease with which a(x) can be obtained 22
2.1. INTRODUCTION
23
and used and on our ability to estimate E(x) [the error must always be an estimate, for if it were known exactly, f(x) would be known exactly and there would be no need for a(x)]; it is this twofold problem which is our main concern in this and the next few chapters. To appreciate some of the reasons why it is advisable at times to replace a function by a simpler one, consider the differential equation d 28 1dt 2
= -gsin8
which arises in the study of a swinging pendulum. This equation is difficult to solve as it stands, but if we replace the function sin 8 by the function 8, the new equation is quite easy to solve (and as a matter of fact, leads to the formula 1.4:1). It turns out that the replacement causes a negligible error if 8 and consequently sin 8 are small in absolute value. Another instance in which one function is replaced by anotherthis time the replacement is usually performed quite unconsciouslyis afforded by the process of interpolation. The reader is familiar with the method of evaluating, say, log 2.956 (=0.4707) from a four-place table of common logarithms which lists log 2.95 = 0.4698 and log 2.96 = 0.4713. A superficial analysis of the process reveals that log x has been replaced or approximated by a first degree polynomial; the process is, indeed, frequently called linear interpolation. We delve into this interpolation process somewhat further. Suppose that ten-place common logarithm tables were used instead of four-place tables. We have log 2.95 = 0.4698220160, log 2.96 = 0.47129 17111, whence, by linear interpolation, we obtain log 2.956 = 0.4707038331. However, the value of log 2.956 correct to ten decimal places is 0.4707044297, a result quite different from the preceding one. Why the discrepancy? Why do we get an answer correct to four decimal places when we use a four-place table but an answer correct to only six decimal places when we use a ten-place table? To understand this apparently unnatural situation, let us note first that 0.4698 and 0.46982 20160 are rounded-off values; they are approximations to and are not the exact value of log 2.95. Therefore, since the computations of log 2.956 involved the use of these rounded-off values, We should expect some errors in the answers. Furthermore, log x was replaced by a linear polynomial in each of the computations; since log x is not a linear polynomial, we should expect some error in the answers due to the replacement. Now, it happens that the replacement error is small and negligible compared to the rounding-off error when
24
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
four decimal places are used but large and dominant when ten places are used. (Note that the rounding-off error in a number correct to four decimal places is at most 0.00005, at most 0.00000 00000 5 when the number is correct to ten decimal places.) It is for these reasons that linear interpolation was adequate when a four-place table was used and inadequate when a ten-place table was used. What can we do, then, if we wish to compute log 2.956 correct to ten decimal places by use of a ten-place table? Since in linear interpolation log x was replaced by a first degree polynomial, it is reasonable to try the substitution of a polynomial of higher degree for log x. As a matter of fact, if log x is approximated by a suitable third degree polynomial, the cubic will yield the value of log 2.956 correct to ten decimal places. The succeeding sections will develop and elaborate the underlying concepts. 2.2. Representation of a Function by a Polynomial.
(2.2: I)
y
Let
= f(x)
be a function of x. For the reasons indicated in the first section, it is desirable at times to replace f(x) by a polynomial
(2.2:2) whose degree does not exceed a preassigned n and which approximates f(x) as well as possible. For the sake of brevity, a polynomial of degree not greater than n will be called a polynomial of max-degree n. For the present, we evade the question of what is meant by "as well as possible." Since Pn(x) has n + I coefficients that are at our disposal, we can impose an equivalent number of conditions for the determination of the polynomial. Let us suppose first that A : (xo , Yo) is a point on the graph of y = f(x). The max-degree n being given, we obtain in this section a polynomial whose graph approximates as well as possible in some intuitive sense the graph of y = f(x) in the neighborhood of point A. It would seem natural to require that the graph of the polynomial pass through A, that its tangent coincide with the tangent to the graph of y = f(x) at A, and that its radius of curvature coincide with the radius of curvature of y = f(x) at A. These requirements will be satisfied if
We use primes to designate differentiation and drop the subscript n from Pn if there is no danger of misunderstanding.
25
2.2. REPRESENTATION OF A FUNCTION BY A POLYNOMIAL
The generalization is clear. Let us choose the a's in 2.2:2 so that
We assume that f(x) possesses all the derivatives in question, but it remains to show that the conditions just imposed uniquely determine the a's. It follows from 2.2:2 that to satisfy these conditions we must solve the linear equations ao
+ a 1x O + a1
+ ... + +2aro + ... + a2x 02
anxo"
= f(x o),
nanx~-1
= f'(x o),
for ao , a1 , "', an . We solve the last equation for an , then the preceding one for an-I, and so on. It develops that the a's are uniquely determined and are given by ao
= f(x o) -
xof'(xo) +
1
2
a1 = IT f'(x o) -
;,2- f"(x o) =t= ... + (-1 )"~!" p")(xo),
;0 f"(xo) +
n~
... + (-1 )"-1 n~!
j
(2.2:4) ........................................................................................... . ~-1 ~
pn-l)(xo)
= Tn--=-l)! =
nxo " n!- j< )(xo),
f'")(x )
----;;r-o .
If we multiply these equations by 1, X, X2, "', x n , respectively, and then sum the right-hand members by diagonals that slope up and to the right, we find that
(2.2:5) Pn(x)
= f(x o) + (x -
xo)f'(xo) + (x
-;t )2 f"(xo) + ... + (x -:!.'t o
o)" f'n)(x o)
is the required polynomial. How well or in what sense does this polynomial approximate f(x)? The form of the approximating polynomial is strongly suggestive of a
26
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
Taylor's Theorem expansion. Indeed, if f(x) possesses an (n derivative, we have by Taylor's theorem (x - x )11 (2.2:6) f(x) = f(x o) + (x - xo)f'(xo) + ... + nl 0 P1l)(xo)
+ l)st
f(1I+U(x + 8(x _ x » + (x(n- +XO)1I+l I)! 0 0 ,
It follows that the error E(x) made in replacing f(x) by P1I(x) is
(2.2:7)
E(x) = f(x) - P1I(x)
=
(x - xo)1I+l f (1I+U(x (n + I)! 0
+ 8(x _ x » 0
0<8<1.
,
The expression for the error term can be put into the equivalent but slightly more compact form
(2 2 8) . :
E(x)
=
(x - xo)1I+l f (1I+U(X) (n + 1)1 '
where X is a number between x and xo' It might have been anticipated that the polynomial of max-degree n given by the first n + I terms of the Taylor expansion of a functionf(x) would be an excellent approximating polynomial in some sense. We elucidate a bit. Let p(x) be given by 2.2:5 and let q(x) be any other polynomial of max-degree n. For the sake of simplicity, put p1l+l)(X) (n + I)!
= g(X),
then f(x) - p(x) f(x) - q(x)
=
(x - XO)1I+lg(X) (x - XO)n+lg(X) + r(x) ,
where r(x) is of max-degree n but is not identically zero. Write r(x) in the form r(x) = (x - xo)k t(x), where t(xo) =1= 0, and 0 ~ k ~ n. Then f(x) - p(x) f(x) - q(x)
(x - XO)n+lg(X)
+ (x -
XO)kt(X)
(x - XO)1I+l-kg(X) (x - XO)n+l-kg(X) + t(x) .
Consequently
(2.2:9)
lim f(x) - p(x) = O. f(x) - q(x)
"' ...."'0
2.2. REPRESENTATION OF A FUNCTION BY A POLYNOMIAL
27
This means that for values of x close to Xo the error made by replacing /(x) by p(x) is smaller in absolute value than the error made by replacing /(x) by any other polynomial of max-degree n. The reader will have noticed that in deriving a polynomial that approximated a given function we stressed the form 2.2:5 rather than the form 2.2:2 wherein the coefficients are replaced by their values given in 2.2:4. Although the latter seems to be the more natural form, there are reasons for preferring 2.2:5. Not only is the form 2.2:5 simpler in appearance and easier to use, but it possesses a virtue not shared by 2.2:2. If a function /(x) is approximated first by a polynomial Pn(x) of max-degree n and then by a polynomial Pn+l(x) of max-degree n 1, and they are written in the form 2.2:5, Pn+I(X) is precisely Pn(x) plus an additional term; whereas if form 2.2:2 is used, every coefficient of Pn(x) must be modified to yield Pn+l(x), except in the special case when Xo = O. Hence we will almost always use form 2.2:5.
+
EXAMPLE 1. Approximate y = loge x = In x by polynomials of respective max-degrees 1, 2, 3 in the neighborhood of the point (1,0). Here, Xo = 1; and we have y' = X-I, y" = _x-2, y'" = 2x-3 • Hence /(1) = 0, /,(1) = 1,/"(1) = -1, /"'(1) = 2, and
= Y= Y= y
x - I, (x -
I) - l(x - 1)2,
(x -
I) -
! (x -
1)2
+ -l (x -
1)3,
are the required approximating polynomials. EXAMPLE 2. Approximate the same function as above in the neighborhood of the point (5, In 5). This time we have Xo = 5 and /(5) = In 5 = 1.61, /,(5) = 1/5, /"(5) = -1/25, /,"(5) = 2/125. Hence the approximating polynomials are
Y = 1.61
1 + S(.'t 1
5), 1
Y
= 1.61 + S (x - 5) - 50 (x - 5)2,
Y
= 1.61 + ~ (x - 5) - 5~ (x - 5)2 + 3~5(x - 5)3.
The reader will find it instructive to graph y = In x and the six polynomial curves on the same set of axes.
28
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
Examination of the error term 2.2:8 explains why the goodness of the approximation in the neighborhood of Xo increases with an increase in the degree for a fixed Xo and with an increase in Xo for a fixed degree in the case of the function y = In x. Indeed, we have for this function, j (n+U(x)
nl . = __
x n +1
'
whence E x = (x - xo)n+l . _1_ = __1_ ( x - x'l)n+l n( ) n+1 Xn+l n+1 X .
txo
Suppose that x is restricted to the interval < x < 2xo . Since X is between x and Xo , the value of X which makes I En(x) I greatest is either x or Xo according as x < Xo or x > Xo . In either case, the absolute value of the fraction (x - xo)/X is less than unity; hence En(x) approaches zero as n tends to infinity (x itself being fixed). Also, if the difference x - Xo and n are fixed, En(x) again approaches zero as Xo increases since X will likewise increase. EXAMPLE 3. Approximate y = sin x in the neighborhood of the origin by polynomials of max-degrees 1, "',6. We leave the ca:lculations to the reader; the results are y= x, x3 Y = x - 3! ' x3 x5 y=x-3T+5f;
the polynomial of max-degree 2n turns out to be the polynomial of degree 2n - 1. The reader should graph y = sin x and the three polynomial curves on the same set of axes. The error in P6(X) is (x 8 sin X)/6!, where X is between 0 and x. EXAMPLE 4. If sin x is approximated by the fifth degree polynomial just above, through what interval may x range if the value of sin x determined by the polynomial is to be correct to five significant figures? Suppose x is positive; we have (x8 sin X)/6! < 0.000005, whence x8 < 6!(0.000005)/sin X. Since we desire an upper bound for x, the right-hand member of the last inequality must be made as small as possible; hence we replace sin X by unity. We then obtain x ~ 0.39+. That is, if x deviates from 0 rad by not more than 0.39 rad, about 22.4°,
29
EXERCISE
then the value of sin x determined by the fifth degree polynomial will differ from its true value by not more than a half unit in the fifth decimal place. We see from the answer that sin X could have been replaced by ! instead of unity; this would have extended the allowable range of x about 20 , a refinement not usually called for in practice. EXERCISE :1.2
t. Approximate
VI + x
2
at x
0 by a polynomial of max-degree 2.
=
2. Approximate sin x 2 by the "best" parabola at x = 1. Evaluate sin (0.81) from your answer and compare it with the value taken from a table. 3. Approximate y = eZ /2 by a polynomial of max-degree 4 at x = O. Find the value of e from your answer and compare it with the actual value. 4. Approximate y = eZ( I - X)-l at x = 0 by a polynomial of max-degree 2 and estimate the magnitude of the error at an arbitrary point. 5. Approximate f(x) = x· - 2xs by a polynomial p(x) of max-degree 3 at x = 1. In how large an interval about x = I will p(x) differ from f(x) by an amount less than 0.1 ? 6. Approximate f(x) = eZ/1 - x' by a polynomial of max-degree 3 at x = O. Use the polynomial to approximatef(l). Estimate the error in the approximation and determine the actual error.
vx
vi
+ In by a polynomial of max-degree 3 at x = 1. Use 7. Approximatef(x) = the polynomial to approximate f(1.5) to three decimal places. Estimate the error in the approximation and determine the actual error. 8. Approximate loglo(x + 3) by a polynomial of max-degree 3 at x = O. Through what interval may x range if the value of log(x + 3) computed from the polynomial is to be correct to three significant figures ? 9. Approximate y = cos 2x - In (x + I) at x = 0 by a polynomial of max-degree 3. Estimate the maximum error in the range I <: x <: 2. What is the actual error at x = 1.5?
to. Approximate cos (x/2) by a polynomial p(x) of max-degree 4 at x = O. Through what interval may x range if the absolute value of the error, I cos (x/2) - p(x) I, is not to exceed 0.000005 ? U. Approximate cos 28 at 8 = .,/6 by a polynomial of max-degree 4. Through what interval about .,/6 may 8 vary if the approximation is allowed to differ from the actual value by less than 0.01 ? t2. Approximate each of the functions at the indicated points by polynomials of maxdegree 5 and calculate the errors (use formula 2.2:8). Draw the graphs of the functions and their approximating polynomials in the neighborhoods of the given points. a. sin 2x, (.,/4, I). b. x 8 - 2x + I, (1, 0). c. In cos x, (0, 0). d. In (sin x/x), (0, 0), where sin x/x is defined to be unity at x = O. e. ellna , (0, I).
t l. Show that the error tenn given by 2.2:8 is equal to (2.2:10)
E(x)
=
-
I nl
fa-a. t nf'n+1l(x 0
t) dt.
30
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
2.3. Power Series. of x
It was observed in the last section that a function y = f(x)
(2.3: I)
is, in a certain sense, best approximated by a polynomial
of max-degree n at a point A : (xo , Yo) on the graph of the function, provided that pn)(xo) exists. If pn+l)(x) exists in the neighborhood of A, the inherent error of the polynomial approximation is given by (2.3:3)
E(x)
= (x - .xO),,+lJ<,,+l)(X) (n+ 1)1
'
where X is between x and Xo . It also developed that while the approximation was good for a particular x in the neighborhood of A, it rapidly became bad as x left the vicinity of the point. A question then naturally arises: Is it possible to find an n so that Pn(x) approximates f(x) to within any preassigned margin of error in an interval of arbitrary extent around the point A ? The answer is: sometimes, yes; sometimes, no. A more definite and complete answer is furnished in books that discuss power series, a special case of the more general infinite series. We must refer the reader to these books as we can give here only the briefest review of the subject. An expression of the form (2.3:4)
where Xo and the a's are arbitrary constants is called an infinite power series in x - Xo • The a's are called the coefficients of the infinite power series. As a rule the adjective "infinite" is usually omitted and we refer to 2.3:4 as a power series. It is implied in the expression for a power series that there is no last term. A power series determines in an obvious fashion the sequence of polynomials
(2.3:5)
Po(x) = ao, Pl(X) = a o + al(x - xo), P2(X) = a o + a1(x - xo) + a2(x -
XO)2,
2.3. POWER SERIES
31
The power series is said to converge to the number k or to have the value k at x = x' if the sequence of numbers (2.3:6)
Po(x'), Pl(X'), P2(X'),···, Pn(x'), ... ,
converges to the limit k. If the power series does not converge at x', that is, if the sequence 2.3:6 does not approach a limit, the power series is said to be divergent at x = x'. It can be shown that if the power series converges for a value x', then it converges for any x satisfying the inequality (2.3:7)
1
x - Xo 1 < 1 x' - Xo
I.
We now define a number R called the radius of convergence of the power series. It may happen that the power series converges for no value of x other than x = Xo , for which value it must obviously converge to ao . In this case we say that the power series is nowhere convergent (this term is used although, as we have just said, the series does converge for x = x o) and we put R = O. It may happen that the power series converges for every value of x; in this case we say that the power series is everywhere convergent and we put R = 00. Finally, it may happen that there is a finite positive number r such that the power series converges for every x satisfying the inequality 1 x - Xo I < r, and diverges for every x satisfying the inequality 1 x - Xo 1 > r. The various possibilities at I x - Xo I = r do not concern us here. In this case we put R = r. In all cases, R is called the radius of convergence of the power series. As illustrations, we exhibit the three power series (xo = 0 in each case):
1+
+ 2!x2 + ... +
l!x
n!xn
+ ... ,
xn 1+-+-+···+-+··· I! 2! n!' X
X
x2 x2
xn
1 + T+"2 + ... + 11 + ... , which have the respective radii of convergence 0, 00, I; however, we offer no proof. If a power series is convergent at each point of an interval, the series is said to be convergent in the interval. The interval from Xo - R to Xo + R is called the interval of convergence of the power series. A power series defines, within its interval of convergence, a function f(x) if f(x') is defined as the value of the series at x = x'; we write
I X-Xo 1< R.
32
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
The conditional inequality I x - X o I < R may be omitted in discussing a function defined by a power series, but it must be clearly understood that any statement concerning such a function may hold only for x's within the interval of convergence. For example, we have (again without proof) e:D=
1 - In(1 - x)
X x2 1 +-+-+
I! x
xn ... +-+ ... n!'
2! x2
xn
= 1 + -1 + -2 + ... + -n + ...'
I x 1< 1.
The functionf(x) defined by 2.3:8 is, within its interval of convergence, (a) continuous and single-valued, and (b) differentiable, and its derivative can be obtained from the power series by term by term differentiation, and (c) integrable, and its integral (between limits within the interval of convergence in the case of a definite integral) can be obtained from the power series by term by term integration. It can also be shown that (d) f(x) possesses derivatives of every order and each can be obtained by term wise successive differentiation of the power series.
The series obtained by termwise differentiation or integration have the same radii of convergence as the original series. Also, if f(x) is given by 2.3:8 and also by f(x) = bo + b1(x - xo) +
... + bn(x -
xo)n
+ ... ,
and if neither radius of convergence is zero, then ai = hi , i = 0, 1, 2, ... , that is, a function (e) f(x) can be represented as a power series in x - Xo in one and only one way. Finally, if f(x) is given by 2.3:8, then (2.3:9)
_ pn)(xo)
~-1i!'
n = 0, 1,2, ... ,
where !'O)(xo) = f(x o) and O! = 1. The reader will immediately recognize this last expression as the coefficient of (x - xo)n in the approximating polynomial for f(x). Indeed, the polynomials of 2.3:5 are exactly these approximating polynomials. The successive coefficients of the right member of 2.3:8 are calculated by use of formula 2.3:9 and the resulting power series is
2.3. POWER SERIES
33
called, as the reader most certainly already knows, the Taylor expansion of f(x). If Xo = 0, the power series is called the Maclaurin expansion of f(x). The direct calculation of the successive coefficients of the Taylor expansion by means of 2.3:9 is often quite laborious. We then mention briefly some of the results of the so-called Algebra of Power Series and indicate other means to facilitate the computations. Let f(x) be given by 2.3:8 and the function g(x) by (2.3:10)
then within their common interval of convergence, (2.3: 11) f(x) ± g(x)
=
("0
± bo) + (a l ± bl)(x -
xo) +
... + (aft ± b,,)(x -
xo)"
+ ... ;
and (2.3:12)
where
(2.3:13)
Co
=
Cl
= aobl + albo ,
C.
= aob. + albl
"ob o ,
+ a.bo ,
Also, (2.3:14)
f(x) = d g(x) 0
+ d1(x -
x ) +0
... + d,.(x -
x )" 0
+ ... ,
where bodo
+ bldo bod. + bldl + b.do
bodl
(2.3:15)
If ao =F- 0, it follows from the first of these equations that division will be possible only if bo =F- 0.
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
34
We list below some of the better known or more useful power series and their radii of convergence with some brief explanations. (2.3:16.1) .
sm x
=
~
~
~nB
3f + Sf ± ... + (_l)n (2n + I)! + ... ;
x-
R =
co.
R =
co.
=
co.
(2.3:16.2)
x.
cos X = I - 21
x2n
X4
+ 4! ± ... + (-I)n (2n )1 + ... ;
(2.3:16.3)
x
e'"
x.
= I + If + 2! + ... +
xn n!
+ "',
R
(2.3:16.4)
In(1
+ x) =
x.
2
x-
x3
+3
=f ...
x n+1
+ (-I)n -n:tT + "',
R=1.
(2.3:16.5)
In x
=
(x-I).
(x - I) -
2
± ... + (-I)n
(X_I)n+l
+ ...
n+I'
R=1.
The power series listed above can be determined simply by direct use of formula 2.3:9. Before we extend the list, we define the binomial coefficient (~), where u is any number and r is a positive integer by
(U) =
(2.3:17)
r
u(u - I) ... (u - r r!
+ I) ;
it is convenient to put
(~) =
(2.3:18)
1.
We now have (2.3:16.6)
(I
+ x)" = I + (7) x + (;) x· + ... + (:) xn + "',
R
=
I;
It follows from the definition of the binomial coefficient that if u is a non-negative integer, the last power series reduces to a polynomial of finite degree. Putting u = -1, we obtain (2.3:16.6')
(I
+ X)-l
= I - x + x· =f ...
We may replace x senes (2.3:19)
Xo
+ (-I)nxn + "',
R=1.
in 2.3:8 by a function tp(x) to obtain the
2.3. POWER SERIES
3S
The series will represent the function only for such x's that satisfy the inequality I
Also, substituting (2.3.16.6")
sin x
sin 2 x
sin" x
= 1 + -11- + -2!- + ... + -n - +!...' Xl
for x in 2.3:16.6', we obtain
(1 + X2)-1 = 1 -
x 2 + x4 ...
+ (-I)"x2" + ... ,
R=1.
The coefficients of the Maclaurin expansion of x/(eX - 1) are of great importance and hence we pay some attention to this series. We have, after some simplification, x x" 1+-+"'+ + ... 2! (n + I)! If we put X
BI 1!
B 2!
- - = B +_X+~X2+
eZ
-
1
0
B" ... +-x"+'" n!
(the factorials are written as part of the coefficients for reasons of future simplicity and the letter B is used in honor of James Bernoulli), then, from the equalities 2.3: 15,
1 Bo
=
TIor 1 Bo 1 BI 21 or+ TIl!
1 Bo 3!
1 BI
1,
= 0,
1 B2
or + 2! 11 + TI 2f
=
0,
These equations may be written more elegantly. In particular, if we mUltiply the last one through by (n 1)1, we obtain
+
+I 1) O B + (n + (nn + n
1) B 1 + ... +
(n
+2 1) B,,-I + (n +1 1) B" = 0,
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
36
or
(nn++ 11) Bo + (n +n 1) Bl + ... + (n +1 1) Bn + (n +0 1) Bn+! = Bn+1' The last identity can now be written in the more concise symbolic form (2.3:20)
n
=
1.2 .....
where the left-hand side signifies the result obtained by expanding (1 + B)n+1 by the binomial theorem and then dropping the exponents on the B's to subscripts. Since each B is obtained recursively from the preceding B's. the value of a B. once determined. is fixed once and for all; we find (2.3:21)
=-
=
Be
= - 1/30. B 10 = 5/66. B12 = -691/2730.... ;
Ba
= B6 = B7 = ... = B 2n+! = ... =
1. Bl
1/2. B2
=
=
Bo
1/6. Be
-1/30. Be
=
1/42.
O.
The B's are called Bernoulli numbers; they occur frequently in power series and other computational formulas. Sometimes. the odd indexed Bernoulli numbers that are equal to zero are deleted; the remaining ones alternate in sign. The signs are dropped and the numbers are reindexed. We have. in the new classification. Bo
=
1. Bl
=
1/2. B2
=
1/6. Ba = 1/30.
Be = 1/42.....
We shall use the Bernoulli numbers as originally defined. Returning to the power series. we have (2.3:16.7) i 1 - -x - = 1i - -x + - x2 - --x8 e:D - 1 2 12 720
Bn + ... + (2n)! _Lx2n + ... •
R= 2.
We turn next to the expansion of tan x. It would be difficult to calculate more than a few terms of the expansion by direct use of formula 2.3:9; the series could be determined somewhat more easily by writing tan x = sin x/cos x. and using the expansions of sin x and cos x. However. the form of the general term of the series can be best obtained from 2.3:16.7; it can be shown that (2.3:16.8)
tan x
= x + -1 x8 + ... + (-1 )n-l 22n(22n 3
(2n)1
1) B
2n X
2n - 1 +
.. ,•
R = ,"/2.
37
2.3. POWER SERIES
It can also be shown that (2.3:16.9)
xcotx
1 1 -x2 - -oX' - ... 3 45
= 1-
22nB + (_I)n _ _2_n x2n + ...
(2n)I'
R =
and that
71;
(2.3:16.10)
_x_ = 1 + !x2 6
sin x
+ 2-x4 + ... + (_I)n-1 (22n -
2)B2n x2n + ... (2n)!'
360
R = 71.
All the signs in the expansion of x cot x are negative after the first one, all the signs in the expansions of tan x and x/sin x are positive. Proceeding further, if y = arcsin x, then (for the principal value of the angle)
dy dx 1
1·3
= 1 + 2x 2 + 22 . 2! oX' +
1·3·5 23. 3! xl
+ ....
Consequently,
or (2.3:16.11)
.
arcsin x = x
1 xl
1.3
(2n)!
Xi
x2n+!
+ 23+ 22 . 2! 5 + ... + (2nnl)2 2n + 1 + ... , R=l.
In a similar manner it can be shown that (2.3:16.12)
arctan x
xl
Xi
3 +5
=
x-
=
!(e'" - r"')
=f ...
x2n+!
+ (-I)n 2n + 1 + ... ,
R=l.
We also have (2.3:16.13)
sinh x
=X+ (2.3:16.14)
cosh x =
xl 3!
Xi
X2n+!
+ 5! + ... + (2n + 1)1 + ... ,
R=co;
! (e'" + e-"') x2
oX'
x2n
= 1 + 2f + 4f + ... + (2n)1 + ... ,
R=co.
38
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
Another series of importance for later developments is the Maclaurin x). Let us write expansion of x/ln(l
+
:---;.,-_x,............,. In(1 + x)
=
I
0
+ I 1x + 1_",2 + ... + 1" x" + ... . z-
The importance of the series lies in the properties of the coefficients rather than in the series itself. Since x
In(1
+ x)
X
x2
1--+-=f··· 2 3
'
the I's are determined by the following system of linear equations:
=
10
-1 /0+ / 1 1/0-i /l + 12
(2.3:22)
= 0,
= 0,
1 1 1 (-1)"--/0 + (-1)"-1-/1 + (-1)"-2--12
n+l
1
n
n-l
+ ... +1" = O.
We may regard In as being determined by the recursion formula _1 _.1 "'11"-1 31"-2
(2.3:23)
I" -
...
±
+ (_
"+1_1_ . 1) n + • 10 ,
where 10 = 1. We find (2.3:24)
= 16 = Is = 10
= 1/24, I, = -19/720, 3/160, 18 = -863/60480, 17 = 275/24192, -33953/3628800, Ie = 8193/1036800, 110 = -3250433/479001600. 1, II
=
1/2, 12
=
-1/12, 13
Hence (2.3:16.15) In(1
xii
+ x) = 1 + 2 x -
12 x 2
1
+ 24 xl =f ... + Inx" + ... ,
The last series can be obtained in another fashion. We have In(1
+ x) =
X
II (1 + x)t dt 0
R=1.
2.3. POWER SERIES
39
and Hence, (2.3:16.15') In(1
+ x) = 1 + X II0 (1t ) dt + x2 II0 (2t ) dt + ... + x" II0 (nt ) dt + ....
x
On comparison of the two expansions for x/ln(1 set of identities important for the sequel, n
(2.3:25)
+ x),
we obtain the
= 0,1,2, ....
These identities may, of course, be used in place of Eq. 2.3:22 for the evaluation of the I's. We derive here for future use some properties of the integral 2.3:25. By definition, (~) is a polynomial in t of degree n whose n distinct roots are 0, 1, 2, ... , n - 1, hence (~) does not change sign in the interval o < t < 1. Also, since (n
~ 1 ) = ~ ~ ~ (~),
(~) and (n;l) are of opposite signs (or are both zero) for t < n, n = 1,2,3, .... In particular, (_I)n-l(~) > 0 for 0 < t < I, 0 < n. Hence
(2.3:26) n- 1 1 (-1 )..-1 I.. n
+
n
< (-1)" I"+l < n + 1 (-1 )..-1 I.. ,
n
= 1,2.. ··,
or n
= 1,2, ....
We derive from the last inequalities the pairs of inequalities n-2
n-l
n-3 -n- 1 11"_21 < I /..- 1 I < n-4 - 2 11..- 3 I < 11..- 2 I < n-
n-2 - 1 11..-21 nn-3 - 2 11..-31 n-
--11 .._11 < 11.. 1 <--11 .._11 n n
< 1131 <
40
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
whence we obtain by multiplication n-2 n-3 n-4 1 - - . - - I . - - 2 ..... -3 11..- 11..- 2 ... 1311 121 n nnn-I
n-2
n-3
< I I .. 111..- 11..- 2 ... 131
2
< -n - ' -n-1 '- 2 .... '-311..-11..-2 "'13 1112 1. nHence
2
2
n(n - I) 112 I < 11.. 1 < -1121. n
Since 12 = (2.3:27)
l2' 1 6n(n - I) < 11.. 1 < 6n'
n
= 3,4, ....
It follows from several of the previous statements that the sequence (2.3:28)
is an alternating sequence and that
is a decreasing, null sequence. Weare now in a position to provide a partial but far-reaching answer to the question posed at the beginning of this section. If a function f(x) possesses a Taylor series expansion in powers of x - Xo whose radius of convergence is not zero, and if x is a value of x within the interval of convergence, it is possible to find a sufficiently large n such that the value of the approximating polynomial Pn(x) at x = x differs from f(x) by less than any preassigned positive margin of error. The value of n will depend on the preassigned values, x and the margin of error. 2.4. Computation with Power Series. We have just seen that if a function f(x) possesses a Taylor series expansion (2.4:1)
we can compute f(x) to any degree of precision (for any given x within the interval of convergence) by taking enough terms of the series. Hence power series afford us one of the most powerful tools we have for the evaluation of a function and they are frequently used by computers for the calculation of the entries in a table of the function. But in order to know how many terms are enough to insure that the
2.4. COMPUTATION WITH POWER SERIES
41
error does not exceed a preassigned bound, we must have an estimate of the error (2.4:2)
One such estimate has already been given in formula 2.2:8 (2.3:3) and, in another form, in formula 2.2: lO. However, it is sometimes advisable to obtain an estimate of the magnitude of the error directly from the power series itself for a twofold reason. In the first place, we can frequently obtain better estimates of the magnitude of the error from the power series then we can from formula 2.2:8. See example 2 below. Secondly, the (n + l)st derivative may be very difficult or laborious to compute compared with the difficulty or labor involved in estimating the error directly from the power series. See example 3 below. A special but often occuring type of series is the alternating series. A series is said to be alternating if it is of the form (2.4:3)
ao - al
+ a. -
as
± ... + (-1 )"a,. + ... ,
where all the a's are positive. It can be shown that an alternating series will converge if (2.4:4)
lim a"
"...
=
0,
",
and if from some term, say am, onward, the condition (2.4:5)
holds. (A sequence of constants satisfying the last condition is called a decreasing sequence; if the > signs are replaced by ~ signs, the sequence is called a monotonically decreasing or nonincreasing sequence. Increasing and monotonically increasing or nondecreasing sequences are similarly defined. A monotonic sequence is anyone of the preceding types.) Conditions 2.4:4 and 2.4:5 are sufficient to ensure convergence; the first condition is necessary but the second is not; the first condition alone is not sufficient. It is proved in texts on infinite series that if an alternating series converges to a number A, say, then (2.4:6) \
I E" I = IA -
~ (-1 )ia; I ~ I a,.+l I,
<-0
provided that an+l is in the monotonically decreasing portion of the series; that is, the absolute value of the error committed in deleting
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
42
from an alternating series the terms from an on is not greater than the absolute value of the very first term deleted, with the proviso just mentioned. EXAMPLE I. Compute sin 40° correct to five significant figures from the series 2.3: 16.1. We have 40° = 21T/9 = 0.6981317 rad. We deduce, if we use formula 2.2:8 for the error, since x = 0.7 (approximately), Xo = 0, pn+l)(X) = I (at most),
(0.7)fHl (n + 1)1
<
0.000005.
The first positive integral n for which this inequality holds (obtained by trial and error) is n = 7. Hence, a polynomial of max-degree 7 is necessary to attain the desired precision. On the other hand, we deduce, if we use 2.4:6 to estimate the error, (0.7)·,,+1 (2n + 1)!
<
0.000005,
whence n = 4. That is, the first four terms of 2.3: 16.1 are sufficient to yield sin 40° correct to five significant figures; a result equivalent to the preceding one. We have . 400 """ 0 6981317 _ (0.6981317)3 sm ""'. 31
+ (0.6981317)5 _ 5!
(0.6981317)1 7!
= 0.6427875, or, to five significant figures, sin 40°
=
0.64279.
The symbol ~ is read "is approximately equal to." Methods for estimating the error 2.4:2 which yield better results than formula 2.2:8 involve more intimate knowledge of power series. We illustrate one of the possibilities in EXAMPLE
x =
2.
Compute In 2 correct to five decimal places by putting
t in the power series I
In-I-x
x· x x' x" = x+-+ -+ -+ ... +-+ ... 2 3 4 n' 3
R=l.
2.4. COMPUTATION WITH POWER SERIES
43
A simple calculation shows that pnHI(x) = n!/( 1 - x)nH. Hence, the expression 2.2:8 for the error term becomes (xo is again 0), (n
x n +1 n! 1)1 (1 - X)n+1
+
x n +1
-
(n
+ 1)(1 -
X)n+1 •
t
We have x = i; further, X must be chosen between 0 and so that the magnitude of the error is as large as possible, hence X is also t. The error term consequently reduces to I/(n + I) and we must find the first n for which I/(n + I) < 0.000005. The first n is n = 200,000. On the other hand, we have
x n +1
x n +2
< - - + - - + ... n+I n+I x n +1 n+1
= --(1 + x n +1
x + x 2 + ... )
1
= n+I I-x· If x = t, the last expression becomes 1/2n(n + I) and we must now find the first n for which this is less than 0.000005. This time, n = 14. This estimate of the error gives us a far better result in the shape of a much smaller n than the previous one. By taking the first fourteen terms ofthe series we find In 2 = 0.693143+. If the error committed in neglecting terms from x 16/15 onward is 0.000002-, or less, the value of In 2 is 0.69314; but if the error is between 0.000002 and 0.000005, then In 2 is 0.69315. We must then compute one or two terms more of the series. Since 1/15 .216 = 0.000002+, In 2 = 0.69315, correct to five decimal places.
EXAMPLE 3. Evaluate 1/2e0.26 correct to five decimal places by use of the Maclaurin series for xe-Zl • The successive derivatives of this function soon become very unwieldy; hence it is desirable to compute the coefficients of the power series and to estimate the magnitude of the error committed by stopping at a certain term by other means. If in series 2.3:16.3 we replace x by -x2 and then multiply through by x, we obtain x3 11
x5 21
x7 31
x 2n +1 n!·
xe- Zl = x - - + - - - ± ... + (-I)n - - + ...
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
This is an alternating series and it can be easily shown that six terms are sufficient to yield, for x = t, 1/2e1J.26 = 0.38940, a value which is correct to five decimal places. In example 2 above we computed In 2 from the Maclaurin expansion of In [1/(1 - x)] by substituting for x. We saw that fifteen terms were necessary to obtain the answer correct to five significant figures. It is also possible to compute In 2 from series 2.3: 16.4 by substituting one for x (the series does converge at x = I). We obtain
t
1 1 1 In 2 = 1 - - + - - - ± 2 3 4
... +
1 (-I)" - - + ... n+l·
This time, however, about 200,000 terms are necessary to obtain an answer with the same degree of precision as before. The first series is thus far better suited for the calculation of In 2 than the second. A computer is often faced with a similar situation. He may discover that in attempting to evaluate a function J(x) for a particular argument i, say, from the Taylor expansion ofJ(x), far too many terms are necessary to obtain a value with a desired degr.ee of precision. The series converges too slowly. The computer can do several things to lessen the labor of computation. He may try to accelerate the rate of convergence by transforming the series into another one. It is not necessary to define here what is meant by the "rate of convergence" nor do we attempt to give here formal methods for the accomplishment of such transformations; the reader is again referred to the standard texts on infinite series. Another possibility that the computer may try is to replace the function used by another which will yield the same result. If, say, J(i) is wanted and the power series expansion of J(x) converges too slowly for x = i, it may be possible to find another function F(x) and a corresponding! such that J(i) = F(x) and such that the power series expansion of F(x) converges rapidly for x = x. Thus, we have just seen that a great saving in labor and in time will result if we replace In( I x) by In[I/(1 - x)] for the calculation of In 2. In this case, an even greater saving can be gained by adding the two series together to yield
+
In(1 + x) + In [1/(1 - x)]
= In[(1 + x)/(I ;x:3
x5
x)] x~" +1
)
=2 ( x+ 3 + S +···+ 2n+1 + ... ; R=l. We can calculate In 2 from the last series by putting x = l. This time, only five terms are necessary to obtain In 2 correct to five significant figures.
EXERCISES
45
Another method for avoiding long and tedious calculations illustrated in:
IS
EXAMPLE 4. Compute e6 correct to five decimal places from the series 2.3: 16.3. If 5 is substituted for x in the series, it can be shown by the method used in example 2 that 22 terms are necessary to compute e6 correct to five decimal places. We can, however, compute e correct to eight decimal places by substituting one for x in the series; we need only twelve terms. Raising e to the fifth power will yield e6 correct to five decimal places. But it should be remarked that unless a desk calculator is available, it is doubtful whether a real saving is hereby effected. The result is e6 = 148.41316.
EXERCISE 2.4
t. Evaluate, correct to five significant figures, of power series.
1: (ellt) dt for x =
2. Evaluate, correct to five significant figures, use of power series. 3. Evaluate, correct to four significant figures, 5 by use of power series.
f:
1.1, 1.3, 1.5,2, 3 by use
r,l dt for x = 0.1,0.2,0.5, 1,2, 5 by
f: \I' I + t dt for x 3
= 1.1, 1.3, 1.5, 2, 3,
4. Find the power series expansions of the functions below at the indicated points; find an expression for the general term. b. cos x, x = 90° (x in degrees); a. loglo(l + x), x = 0; c. x sin 4x I, x = 0; d. sin l x, x = o. 5. Use power series to evaluate, correct to four significant figures, sin xIx and its first three derivatives at x = 0.1, 0.2, 0.5, I, 2, 4. 6. We have
Four terms of the binomial expansion are sufficient to yield, correct to seven significant figures, \1'2 = 1.414214. Evaluate similarly by use of appropriate binomial expansions
each correct to seven significant figures. 7. We have seen that I
+x
In - I-x
=
(X3 + - + ... + -X -I-' H + I...) ,
2 x
3
2n+1
R=1.
46
2. APPROXIMATING POLYNOMIAL: APPROXIMATION AT A POINT
Since
~ = ~ (! + I-x 2x
for
I)/! (! - I) , 2x
x"# 0,
it follows that In! (! + I) 2x
~
In! (! - I) + 2 (x + 2x
=
3
XI'H~
+ ... +
2n+1
+ ... ),
x"# 0, R
=
I.
i'i' t, ... ,
Put x = in this series to compute successively In 2, In 3, In 4, ... , In 10. Find each value correct to seven significant figures.
8. Prove that
I I S E ln sec x = - - = I + - Xl + - x' + ... + (_I)n - - xln + ... cos x 2 24 (2n)I' where the Euler numbers Eo , E, , EI , ... , are defined by the symbolic recursion formula Eo
=
I;
(E + I)k + (E - Ih
k = 1,2,3, ....
0,
=
9. Prove that the I's defined by the system of equations 2.3:22 or by 2.3:23 are also given by I 10 = I, II = -(-1), I. = 1 ! 13 = -
-1 _~
-1
-1
-1
I,
-1
o
I
i
, -1 !-1 o o
I
-1
i
~"
! -1 o o o
....................................... It
=
(-1)'
( _1)1-1
( -1)1-1
( _1)1-3
( -1)'-'
t ( _1)'
t - I ( _1)'-1
t - 2 ( -1)1-1
t - 3 ( _1)1-3
t - I
t-2
t+ I
-1
to. It can be proved that the even indexed Bernoulli numbers defined in the text satisfy the inequalities (2n)!
(2n)1
I
2 (21T)ln
< (_I)n- BIn < 4 (21T)ln .
Use these inequalities to find expressions for the errors committed in truncating the series 2.3:16.7-10 at their nth terms. 11. Put x x f(x) =~+2. Provef(x)
=
f( -x) and then show that B ln +1
=
0, n
=
1,2,3, ....
t2. Let f(x) = Qo + QIX + ... + QnXn be a polynomial of degree n and let Xo be any constant. Divide f(x) by x - Xo to obtain the quotient qo(x) and the constant remainder bo so that
47
2.S. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
Similarly, obtain
=
qo(X)
(x - xo) ql(X)
ql(X) = (x - xo) q.(x) q"_I(X) q"_I(X)
= =
+b +b
l , l ,
(x - xo) q"_I(X)
+ b"_l , b".
Use these equations to prove that k
= 0, 1, 2, ... , n,
and therefore f(x) = bo
+ bl(x -
xo)
+ b.(x -
xo)S
+ ... + b,,(x -
x o)".
Hence justify Horner's method for the determination of the real roots of a polynomial equation.
tl. More generally, let f(x) be the polynomial of the previous example and let Xo, Xl , ... , X,,_l be any set of n constants. Form the sequence of equations f(x) = (x - xo) qo(x) qo(x) = (x - Xl) ql(X) ql(X)
=
(x -
q"_I(x) = (x q"_I(X)
Prove f(x)
=
bo
+ bl(x -
Xo)
+ b.(x
Xl)
+ CI(X -
XI)
qs(x)
+ bo , + bl , + bl ,
X,,-l) q"_I(X)
=
+ b"_l ,
b".
- Xo)(X - Xl)
+ ... + b,,(x -
Xo)(X - Xl) ... (X - X,,-l).
Furthermore if f(x) = Co
+ CI(X -
+ ... + c,,(x -
xo)(x - Xl)
xo)(x - Xl) ... (X - X,,-l),
prove b, = Cj, i = 0, 1,2, ... , n. Prove a similar result for the preceding example.
1.S. Asymptotic Series; Euler's Summation Formula. If y = f(x) is a function of x with an (n in the form
f(x}
= f(x o} + (x -
+ l)st derivative, thenf(x) can be expressed
xo)j'(xo) +
... + (x -:to)'1 pn)(xo) + E~(x},
where one form of the remainder En(x) is
E (x) n
=
(x - xo)n+lf(n+l)(X} (n + I)! '
where X is a number between x and x o . If, for a fixed x, say x = a, limn_HoC En(a) = 0, then the value of f(a) can be determined to any degree of precision by taking enough terms of the power series
f(a) = f(x o} + (a - xo)!'(xo} +
... + (a -
ntx}n pn)(xo} + ....
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
More generally, if we have a formula of the type
+ fleX) + ... + f ..(:oc) + E..(x),
f(x) = fo(x)
where the law governing the formation of the J/s and En(x) is known, and if for a particular fixed x the limiting condition just above holds, then J(x) can be determined to any degree of precision by taking enough terms of the infinite series f{:") = fo{x)
+ flex) + ... + f ..{x) + ....
For example, 111
el / z = 1 + l!x
+ -+ ... + -+ ... 2!x2 n!x"
is an infinite series (actually a power series in l/x) from which the value of e1 / Z , x =1= 0, can be calculated to any degree of precision by taking a sufficiently large number of terms. Again, we can compute the value of 1T/sin 1TX for any nonintegral value of x to any degree of precision by taking enough terms of the infinite series 1T 1 2x [ 1 . - = -+ sm 7rX x 12 - x 2
1 22 - x 2
± ... + (_1)"-1
Let us, however, consider the finite series with remainder f(x)
=
1 -.!.! x
+ x2!2
=F ...
+ (-I)" x"n! + (-1)n+18.. (nx+ I)! , ..+1
where 0 < 8n < 1. This time, the absolute value of the remainder term 8n( n + I)! / I Xn+l I will, if x is large, first tend to decrease as n increases but will then increase rapidly-unless 8 tends to zero even more rapidly-so that the series if continued indefinitely would diverge for every x. Hence given a particular value of x, say x = a, we cannot calculate J(a) to any preassigned degree of precision, the best we can do is to determine J(a) to within the minimum (absolute) value of the l)!/an+l. We may find in practice that this error error term 8n(n term is small enough to yield usable results. Thus, if x = 10, the value of J(lO) can be computed from the first nine terms of the series just above with an error E8(l0) < 9!/109 = 0.00036. For x = 100, the value of J(IOO) can be calculated with an error which is less than
+
9 . 10-41 •
2.S. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
49
More generally, consider the infinite series a
at
an
2 ao+-+-+"'+-+"', x x2 x"
(2.5:1)
where the a's are constants. The series may converge for some value of x, it may diverge for every value of x. Put
(2.5:2)
S,,(x)
=
ao
+ atx + ... + a" , x"
n
= 0, 1,2, " ..
The series 2.5: I is called an asymptotic (or semiconvergent) series and is said to be an asymptotic expansion (or representation) of a function f(x) if there exists a sequence of constants
such that
(2.5:3)
I/(x) - S,,(x)
I<
~::: '
n
= 0,1,2, ... ,
for every positive value of x, and we write
(2.5:4)
I(x) ,...., a
o
a a + ---.! + -.-! + ". + -a,. + " .. x x" X
2
The inequality means that the absolute value of the error made in approximating f(x) by 8,,(x) does not exceed K"+l/Xn+l. For a fixed x, the error may be numerically large, but the numerical value of the error will approach zero as x tends to infinity. Indeed, this stronger statement holds: the numerical value of the error multiplied by x" will approach zero as x tends to infinity. When we use 8,,(x) to approximate f(x) for a given (positive) x, we use the smallest n which will make the margin of error small enough for our purposes (if it can be done). Asymptotic series frequently arise in connection with the Euler summation formula which we discuss later but before we do that, one or two examples may be helpful. We consider first the so-called logarithmic integral (r'/t) dt, where we suppose that x is positive. Although this integ~al can be expressed as a known function plus a power series in x which converges everyw here - indeed,
r
f'" -e-tt dt = -c II)
In x
+x -
x2 --
2 . 2!
x3 x" +- ± ". , 3 .3! =f ". + (-1)"-1 n . n!
50
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
where C is a constant whose value is given in 2.5:13 [see T. J. Bromwich, "An Introduction to the Theory of Infinite Series" (rev. ed. by T. M. MacRobert), Macmillan, New York (1931); or K. Knopp, "Theory and Application of Infinite Series," 2nd ed., Hafner, New York, 1948] the power series converges so slowly for large value of x that it is practically worthless for the evaluation of the integral for such values of x. It is far better for the purposes of computation to express the integral in the form 21 =f ... + (_I)n-1 ( n .)I] - - - + ---.: +l(-I)nE f" -td t = e-" GIl x x3 xn ooe- I
2
where 0 e"
< En <
f"-t oo
e-I
dt
n ,
n!/xn+!. We have
2! (n - I)! = -X1 - -x112 + -x3 =f ... + (_1)n-1 + (-I)n En . xn
Put
f" e-tt dt, oo
=
f(x)
ell:
-
1 II S (x) = - - ---.:. X
n
x2
± ... + (_I)n-l (n-l)I ., xn
The inequality 2.5:3 holds and 1 11 2! (n - i)! f(x)"'---+-=f"'+(-I),,-1 x x2 x3 xn
Take x
=
5, say; then if n
=
1
4, 1
f(5) '" 5" - 52
Hence
f
oo
e-I
-
1
t
± ....
2
+ 53 -
6 54 = 0.16640.
dt = 0.1664Oe-6 = 0.00112,
with an error whose absolute value does not exceed e-6(4!/5 6 ) = 0.00005. The value of the integral, correct to five decimal places, is 0.00 115. Take x = 8, n = 3; then f(8)
and
f
oo
8
e-I
-
t
1
"'8 -
1 82
+ 823 = 0.11325,
dt = 0.11325e-8 = 0.00004,
51
2.5. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
with an error too small to affect the last decimal place. Again, it can be shown that 1 2' 4' - dt = - - --.:.. + --.:. =F ... + (-I)n - ' + (-I)n+lE f"" 1 + t2 x:x;3 x x2n+l (2n)'
rIO:
o
5
n ,
where E n
<
+ 2)! x2n+3
(2n
•
Once more, the resulting asymptotic series is very convenient for the evaluation of the integral for large values of x. We turn to the development of a summation formula due to Euler after we consider some preliminaries. We will need a set of polynomials
where Bk(X) is of degree k; they are defined by the statements (2.5:5a)
Bo(x)
=
I,
(2.5:5b)
Bk+l(X)
=
f Bk(x) dx,
(2.5:5c)
k
= 0, 1,2, "',
k
= 2,3,4, ....
If we make use of the defining relations for the Bernoulli numbers, B o , Bl , B2 , "', it is readily shown that Bo(x) Bl(X)
(2.5:6)
= =
I, X -!,
+ T~' Ba(x) = ixS - iX2 + l2 x, B2(X) = !X2 - ! x
B ( ) -!!.L k k X - k!O! x
+ (k _BlI)! I! x
k-l
k-2 Bk + ~_ (k _ 2)!2! x + .. . + O!k!
The general polynomial can be written in the symbolic notation (2.5:7)
k
= 0, 1,2, ....
These polynomials are named the Bernoulli polynomials (it should be noted that the terminology varies in the literature as it does for Bernoulli
52
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
numbers) and like the Bernoulli numbers, they occur frequently in many investigations. For some purposes it is convenient to replace the Bernoulli polynomials by periodic functions of period I that coincide with the polynomials in the interval 0 ~ x < I. A nonconstant function f(x) is said to be periodic if there exists a number p different from zero such that f(x) = f(x + p) for every x. If p is the smallest positive number for which this relation holds, f(x) is said to be of period p. The reader has already met periodic functions in trigonometry. Thus, sin nx is a periodic function of period 21T/n. To obtain the periodic functions we desire, let [xl be the largest integer which does not exceed x; the functions are then defined by k
(2.5:8)
= 0, 1,2, ....
In particular,
Pt(X) = x - [x] -
(2.5:9)
!.
The graphs of Bt(x), B 2(x) , Pt(x), and P 2(x) are shown in Figs. 2.5:£1 and 2. The Bernoulli polynomials are, of course, everywhere continuous and possess derivatives of all orders for all values of x; this is also true of the P's except that Pt(x) is discontinuous and non differentiable for integral values of x and P 2(x) is nondifferentiable for integral values of x. The definite integral of anyone of the periodic functions like the definite integral of anyone of the polynomials exists between any two finite limits. We are now ready to derive the Euler summation formula. If i is y
3 2
y·p,(x)
'3
"
"
"
"
" ·2 ·3
FIG. 2.5:£1.
,~
/
/5 ,1;
"
x
53
2.5. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
a non-negative integer, let write Yi = f(i). We have iIi f'(x) dx i-1
whence
i
i
i-I
r
J
i = 1,2, ... , n,
= i(yi - Yi-l),
-(Yo + Y1
=
f'(x) dx
y1 k) =
+ ... + Yn) + (n + I)Yn·
1-1
-I
FIG. 2.S: f2.
<
If i - I
±f i-1
i
i-1
x
<
f'(x) dx
i, then i = [x]
=
±r i-1
([xl
+ 1, and
+ I)f'(x) dx =
,-1
r
([xl
+ I)f'(x) dx.
0
Therefore n
~Yi =
(n
+ I)Yn -
i-O
n
I ([xl
+ I)f'(x) dx.
0
By an integration by parts, we find that nYn
=
r o
xf'(x) dx
+
r
f(x) dx,
0
whence we obtain by substitution into the last equation, iYi i-O
= Yn +
r 0
f(x) dx
+
r 0
(x - [xl - I)f'(x) dx.
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
54
But
.r:
t so that iYi
r
f(x) dx
=
i-O
f'(x) dx
t (Yn -
=
+ t (Yo + Yn) +
0
Yo),
r
(x - [x] - t)j'(x) dx,
0
which we write finally as
(2.5: 10)
iYi
r
r
+ t (Yo + Yn) +
f(x) dx
=
i-O
0
PJ(x)f'(x) dx.
0
This is the so-called Euler summation formula in its simplest form. Two examples will illustrate the usefulness of the summation formula, even in its simple form.
+
+
Let f(x) = 1/(1 x), then Yk = I/(k I), k = 0, I, 1 f(x) dx = In n. (In this example it is convenient to stop at the inde: n - I rather than at the index n.) Hence EXAMPLE l.
r-
2, ... , n - I, and ~
(2.5:11) The
1
t.{k"+T =
last
I P1(x) I ~ t
In n
equality has some for every x and
f
kk+1
then
0>
f
n-
0
f
n-
J
0
It follows that OO
PJ(X)
o (x
+
1)2 dx
exists and is between 0 and -
.
_. [~1 f:to k + 1 -
(2.5.12) C -!~
.
= n-+oo hm
t.
J PJ(x) (x + 1)2 dx.
n-
0
interesting
PJ(x) (x + 1)2 dx
J PJ(x) 1 (x + 1)2 dx ~ - 2
f
f
1) + 21 ( 1 + n -
(x
f
n0
consequences.
Since
< 0, 1
+ 1)2
dx = -
1(
2
1-
n1) .
J PJ(x) (X + 1)2 dx
Therefore the number C defined by
] _ 21-
In n -
foo PJ(x) 0
(x
+ 1)2
dx
exists. The number C is called Euler's constant; it can be shown that
(2.5: 13)
C = 0.577216-.
(See previously cited references.)
2.5. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
55
The statements 2.5:11-13 throw an interesting light on the growth of the harmonic series. In words, the sum of the first n terms of the harmonic series exceeds In n by an amount which, as n increases, constantly increases but approaches 0.6- as a limit. EXAMPLE
2.
j"-l f(x) dx o
Take f(x) = In(1 + x); + n In n. Hence
n-l
~ln(1
~
then Yk = In(1
+ k)
and
= 1- n
+ k) =
+ n In n + tIn n +
1- n
fn-1
p (x) -1 dx x+
_1
0
or (2.5:14)
+ t)ln n + 1 -
In n! = (n
+ fo-
n 1
n
p (x) -ldx.
_1
x
+
This equality too leads to some interesting and very important results. We shall prove in a moment that (2.5:15)
A-I
=
f
lim n-oao
n
-
0
1
f'"
Pl(X) dx = P1(x) dx + lox + 1
X
exists. Assume for the time being that the limit does exist, we rewrite 2.5:14 as (2.5:16)
In n!
=
(n
A
=
1
where ..
+ l)ln n -
+ fn0
1
n
+ An ,
P 1(x) dx x+l '
and we endeavor to determine A. The presence of n! in 2.5:16 suggests the use of Wallis' infinite product
which can be put into the form
where 0 is positive and limk-+'" Ok = I. Hence
.';;=~.~ .....
v
71
1 3
2k 2k - 1
'VI 2k 2+ 1 8't,
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
56
or (2.5: 17)
and therefore In.y;
=
+ !) In 2 + 21n k! -
(2k
! In(2k + I) + In Ok'
In(2k)! -
We use 2.5:16 to obtain In
.r
V1T
1 I = "!fIn 2 + (Ilk) + 2Ak -
A2k
+ In Ok,.
hence
We now let k -..
co,
then
(2.5:18)
which is the desired result. Before we proceed to the proof of the existence of A, we note that An can now be written as
=
A
I
"
+ fco 0
fco
P1(X) dx _ x+I
= In V21T - fco
P1(x) dx +I
n-1 X
P 1(X)1 dx,
n-1 X
+
and therefore 2.5: 16 can be rewritten as In n! = (n
+ !) In n -
n + In V21T -
fco
-
= In nn v2n1T - n -
P1(x)1 dx
n-1 X
fco
+
P 1(X)1 dx.
n-1 X
+
By changing the last equality to the exponential form, we obtain (2.5:19)
n!
= nn v2n1Te- n exp (-fCO
P 1(x) +I
dX).
n-1 X
This last important identity is one form of Stirling's formula, a formula which gives us the value of n! in terms of functions of n that are more readily computed. It can be shown that h-l P1(x)/(x + 1) dx is negative
2.5. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
57
[Exercise 2.5, example 7(a)], hence the last factor in 2.5:19 is greater than one and (2.5:20)
We shall now prove that the limit asserted in 2.5: 15 does indeed exist. We then employ the method used in the proof to extend and improve the simple Euler summation formula after we complement the inequality 2.5:20. We note first that the P(x),s like the B(x)'s satisfy the condition
= fPk(X) dx,
P k+1(x)
(2.5:21)
k
= 0, 1,2, ....
An integration by parts yields
and therefore ( P1(x)f'(x) dx
(2.5:22)
= ~t(/'(n) - 1'(0» - ( =
since, from 2.5:7, 8, P.(n)
Pl(X) _ f"-1 x+ 1 dx -
(2.5:23)
o
p.(O)
~ 12
=
=
B.(O)
p.(x)f"(x) dx, B./2!. In particular
(! _)1 + f"-1 _p.~ ( 1)2 dx. n
0
x+
.r
Since p.(x) is bounded, and (x + 1)-. dx exists, the limit of the integral on the right-hand sideD of 2.5:23 and hence the limit of the integral on the left exists as n -- "'. This is what we wanted to prove. We go on to use the very last equality to rewrite 2.5: 14 as In n!
=
(n
+ !)1n n + 1 -
1 (1n- 1) + f"-1 (xp.(x) + I). dx.
n + 12
0
From 2.5:15-18-23, we obtain
. /-
In v 2'7T - 1 = or
f'o"
f'" xPl(X) + 1 dx = 0
p.(x) + I). dx
(x
1
- 12 + • /-
f'" (xp.(x) + I). dx, 0
II
= In v 2'7T - 12 .
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
58
Hence In n!
= (n + l)ln n + 1 - n + • ,-
+ In v 21T -
11 12 -
foc "-1
1 _ " •,- In n v 2n1T - n + 12n -
A(~ - 1) P 2(x) (x + I). dx
foc"-1
p.(x) + 1)2 dx
(x
or
This is another form of Stirling's formula. It can be shown that is positive [example 7(b)]; the last factor in 2.5:24 is then less than one and
fn'-l P2(X)/(X + 1)2 dx
(2.5:25)
n!
< nn v2n1T exp (l~n - n).
We combine the last inequality with 2.5:20 into the single statement (2.5:26)
n" v2n1T rn
< n! < n" v2n1T exp (l~n - n).
We are now ready to improve the simple Euler summation formula. The equality 2.5:22 is easily extended to (2.5:27)
5:
Pk(X)J
(y~k) - y~k)
-
5:
Pk+l(X)J
The simple Euler summation formula then yields
f f(x) dx + Yo -
""
~Yi =
i-O
0
=
5:
=
f
f(x) dx
n '"( )
0 J' X
+
5:
dX
B
-rt(y" - Yo) •
+ Yo - ~t (Y1l -
+ ~. (Y,,' -
B1 (y,,- Yo ) + B. + Yo - TI 2! ( y"' -
Pa(X)J<3)(X) dx,
and, in general,
Yo)
+ f"0 P 1(x)f'(x) dx Yo') -
5:
p.(x) rex) dx
Yo ') - Bs 3! (" y" - Yo")
59
2.5. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
where
This is the important Euler summation formula. Since all the B's with odd subscripts greater than one are equal to zero, it is more usual to write the formula as (2.5:28)
~Yi =
B f f(x) dx + 1(Yo + y,,) + ~ (2;)1, (y~2i-1)
" "
i=O
k
0
;-1
-
y~2i-l') -
R2k ,
'J'
where (2.5:29)
R2k
=
£:
P2k(X)J<2k'(X) dx
= -
£:
P 2k+1(X)J<2k+1'(X) dx.
Before we illustrate the use of the formula, it would be well to get some estimate of the magnitude of the remainder R2k . It can be shown that m,.., 0,1,2, ''';
for even subscripts we have the better bound
I P2m(x) I ~ 1(~:n)!I,
m = 0, 1,2, " ..
Hence (2.5:30)
I R2k I ~ (2:)2k
£: I
J<2k'(X) I dx,
and also (2.5:31)
An important special case in which we can get an estimate of the magnitude of the remainder frequently arises in practice. Suppose that the differences y~j-l) - y~j-l), j = 2,4,6, "', all have the same algebraic sign (or, more generally, have the same algebraic sign after a certain point, for j = 2t, 2t + 2, 2t + 4, "', say), then since the odd-indexed B's after Bl are all equal to zero, and the even-indexed B's alternate in sign, the terms that actually appear in the sum on the right-hand side of Euler's formula 2.5:28 will themselves alternate in sign (at least after a certain point). Hence if k is allowed to tend to infinity, we obtain an alternating series. Now, the differences y~j-l) - y~j-l) will
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
60
certainly have the same algebraic sign for j = 2, 4, 6, ... , if all the derivatives of f(x) tend monotonically to zero; if, in addition, f(x) is of constant sign and itself tends to zero (for x > 0), then it can be shown that I R2k I is less than the absolute value of the first term neglected, that is,
I R2k I <
(2.5:32)
I(2kB2k+2 (yI2k+U + 2)1"
EXAMPLE 3 (Extension of example 2). pk+l)(x) = (-I)k k!/(l + x)k+l have jlk+U(n - I) = (-I)k k!/nk+l. Hence , _
In n. - n In n - n
yI2k+l») 0
I
•
Since f(x) = In (I + x), we and pk+l)(O) = (-l)k k!,
B2i (2i - 2)1 + 1 + 1"2" In n + ~ ~ (2 ')' 2i-! i-I ,. n
(2i - 2)!
-
+ (2k)' f,,-1 •
(I
0
P2k+l(X) X)2k+l
+
From 2.5:27 we obtain
fo
,,-1 PI (x)
x
+1
dx
=
i
i-I
B2i
(2i)1
) dx.
(2i - 2)! - (2i - 2)!) n2t 1
'f,,-1
+ (2k ).
P 2k+1(X)
(x
0
+ 1)2k+l
d X.
If we allow n to become infinite, then 1 - f<Xl P 1(x) dx I . /2n v 'TT - 0 x+I - -
~ B2i t{ (2i)!
(2' 2)' (2k)' f<Xl P 2k+l(X) dx ,- . + . 0 (x + 1)2k+l '
and (2k) ' f"-1 .'
0
(I
P 2k+ 1(X) d - 1 . /2- - 1 ~ B2i (2' - 2)' + X)2k+l X - n v 'TT + t{ (2i)!' . -(2k)' f<Xl .• "-1
P2k+l~) dx
(x
Consequently, In n., -- In n" •v /-2 n'TT - n
B2i -+- i~ ~ (2' _ I) 2'. 2i-l -I' , n
or (2.5:33)
n., -- n".v /-2 n'TT e-" exp
where, for a fixed k, Stirling's formula.
Ak,n -
[~ ~ (2i _ i-I
-
(2k)' f<Xl •
B2t2i . n2t- 1 I)
(
+ 1)2k+l
P 2k+l(X) 1)2k+l
,,-1 x
+
•
d x,
+ A k... ],
0 as n - <Xl. This is the general form of
61
2.S. ASYMPTOTIC SERIES; EULER'S SUMMATION FORMULA
EXAMPLE 4. Let f(x) = x P , where p is a constant not equal to 0 or I. Then, by Euler's summation formula 2.5:28, n
~jP i-I
nPH k B ( P ) P 2HI = __ + -1 n P + t=1 ~ ~ (2i - I)!. n P+ 1 2 (2,). 2, - 1 - (2k)!
(~)
£:
P2k(X) Xp - 2k dx,
or n-I
pH
~jP = _n_
P+ 1
;-1
1 _ -nP
- (2k)!
2
B + ~~ (. P ) nP- 2;H k
;-1
(~)
£:
2,
2, - 1
P2k(X) Xp - 2k dx.
If, in particular, p is a positive integer, the series on the right can be carried out as far as the term in n or n2 according as p is even or odd. In either case, the final integral is equal to zero and we have
~jP = ;-1
_1_ ~ (P ~ P+ 1;_0 '
1) Btn P- HI ,
which can be written in symbolic notation as
1 - - [(n -p+l
n-I
~J.p ~
,-I
EXAMPLE 5. . sm t
+ B)PH -
B pH· ]
Let f(x) = sin tx and take n = I. Then, by 2.5:28,
cost sint B· = -1 - - + -+~ ~(-I)t-1 ~ (t lt - I cos t -
t
t
2
tIt-I)
(2,).
t-I
+ (-1 )kH t2i: (
P2k(X) sin tx dx,
or
! sin t = i (l -
cos t)
k
B .
i=O
I •
~ ( -1)t (2. I); t lt - I + (-1 )k+lt 2k
f P!k(X) sin tx dx, I
0
which can be put into the form
! cot! t =
k B ~ (-I)t (2i)~ t 2t- 1 + T k·
In virtue of 2.5:30, Tk - 0 as k - 00, hence the sum on the right can be extended to an infinite series. If we multiply through by t and then replace it by x, we obtain the series 2.3:16.9.
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
62
EXERCISE 2.5
1. Evaluate
r: (te')-I dt, correct to five decimal places, by use of asymptotic series.
2. Use the asymptotic expansion of
[o ~dt I +t l
to evaluate the integral as precisely as possible for x
=
5 and x
3. Use the Euler summation formula 2.5:10 withf(x) = a for the sum of an arithmetic progression.
=
10.
+ dx to derive the formula
4. Derive the formula for the sum of an arithmetic progression by use of formula 2.5:28. 5. The table below gives the values of -
f
PI(X)
n- I
---dx
+ 1)1
(x
o
for integral values of n greater than unity. Use this table, a table of the natural logarithms, and formula 2.5: II to find, correct to three decimal places, the values of 10
a.
I
~-; I-I J
n
2 3 4 5 6 7 8 9 10 11 12 13 14,15 16,17 18-22 23-35 36-",
1000
I
I-I
J
~~
b.
-
ro
I
100
I
c. ~ -;. 1-100 J
-PI(x) -dx (x 1)1
+
0.0569 0.0681 0.0720 0.0739 0.0749 0.0755 0.0759 0.0762 0.0764 0.0765 0.0766 0.0767 0.0768 0.0769 0.0770 0.0771 0.0772
2.6. OTHER METHODS OF APPROXIMATION
63
6. Evaluate the entries of the table above.
[.
Hlflt: evaluate
7. a. Prove
J"""
r
Pi (x)
.
It t-l
Pl(X)
- - - . dx. (x + I)
]
.
- - dx +I
19
p.(x)
dx'
negative.
n_1X
b • P rove
n-l
--+ I)·
(x
19
.. pOSitive.
2.6. Other Methods of Approximation. In Section 2 of this chapter we developed a method for the representation of a function y = f(x) by a polynomial Pn(x) = ao + a1x + ... + anxn of max-degree n. We wished to find an approximating polynomial which, in some sense, represented the function as well as possible in the neighborhood of a point (xo ,Yo) on the graph of y = f(x). To this end we imposed the n + 1 conditions
i = 0, 1, "', n,
(2.6:1)
for the determination of the coefficients of Pn(x). It was then shown that if Pn(x) was the polynomial so determined and qn(x) was any other polynomial of max-degree n, then
(2.6:2)
lim f(x) - Pn(x) = 0. f(x) - q,,(x)
"' ...."'0
The last equality describes the sense in which Pn(x) is the best approximating polynomial. On the other hand, suppose that f(x) is defined in a neighborhood of Xo and that there exist polynomials Pi(x), i = 0, 1, "', n, such that for each i
(2.6:3)
lim f(x) - Pt(x) f(x) - q.(x)
=
0,
"' ...."'0
where qi(X) is any polynomial of max-degree i distinct from Pi(X). It can be shown that the first n derivatives of f(x) exist and the conditions 2.6: 1 hold. In summary: If the function y = f(x) possesses an nth order derivative at x = xo , then for each i in the range 0, 1, "', n there exists a polynomial Pi(X) of max-degree i such that Pi(X) approximates f(x) at x = Xo better than any other polynomial qi(X) of max-degree i in the sense of condition 2.6:3; and conversely, if for each i in the range 0, 1, "', n there exists a polynomial Pi(x) of max-degree i such that Pi(X) approximates f(x)
64
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
at x = Xo better than any other polynomial qi(X) of max-degree i in the sense of condition 2.6:3, then f(x) possesses an nth order derivative at x = Xo. It is thus clear that if y = f(x) fails to possess an nth order derivative at a particular point, we must look elsewhere for methods of determining the "best" approximating polynomial of max-degree n and we must seek other criteria for the goodness of the representation. In particular, what polynomial of max-degree I approximates the function (2.6:4)
y
= f(x) =
i (x + I x I) = i (x + vXi)
well at the origin? The function is everywhere continuous and possesse a first derivative everywhere except at the origin (at which point it is continuous). It follows from the discussion above that there is no polynomial of max-degree I which is the best representation at the origin in the previous sense. In casting about for other criteria for goodness of representation it might be well to examine the geometric significance of condition 2.6:2. Essentially, the condition states that for any x sufficiently close to xo , the segment of a vertical line intercepted between the graphs of f(x) and P..(x) is shorter that the corresponding intercept between f(x) and q..(x). When this criterion fails, it is then natural to ask if there exists a P..(x) such that the average segment intercept is smaller than the average segment intercept determined by a q..(x) in an interval about Xo • In whatever sense "average" is understood, it is tied up with some sort of an integral; in particular, we may examine the integral
f
"'o+1I
(f(x) - Pn(x)) dx.
"'0- 11
For a given h, does P..(x) exist such that P..(xo) = f(x o) and such that the absolute value of the integral is smaller than the corresponding value for a q..(x) , different from P..(x)? A moment's reflection will convince us that our question is too naive. Since the integral represents the algebraic area between f(x) and Pn(x) in the interval from Xo - h to Xo + h, the integral may well be equal to zero for a great many different polynomials of the same max-degree. We must then replace the integrand f(x) - P..(x) by some closely associated integrand which is non-negative. In view of this requirement, we consider and examine the integrals (2.6:5)
f
"'o+1I "'0- 11
If(x)
- Pn(x) I dx
2.6. OTHER METHODS OF APPROXIMATION
6S
and
f
"'o+ll
(2.6:6)
(f(x) - p..(X))2 dx.
"'0-1&
For a given (small) h, does there exist a Pn(x) which minimizes the value of the integral 2.6:5? the integral 2.6:6? In either case, can a Pn(x) be found which is independent of h ? Can we find a Pn(x) such that
•
(2.6:7)
hm
1&-+0
J"'0+1& 1 f(x) "'0-1& "'0+1& f "'0-1&
1f(x)
- P..(x) 1 dx
=
0,
- q..(x) 1 dx
or such that
f "'o+1& (f(x) •
(2.6:8)
hm I&~O
p..(X))2 dx
"'0-1&
=0, (f(x) - q..(X))2 dx
J"'0+1& "'0-1&
where qn(x) has the same meaning as before? We do not propose to answer these general questions but we shall examine the function 2.6:4 in the light of these criteria. Take n = I; is it possible to find a Pl(X) = mx (the constant term is zero since the line must go through the origin) such that
(2.6:9)
A
=
r
! x + 1x I) -
(I
mx 1dx
-1&
is a minimum? We have A
=
r
1-mx 1dx +
• -/&
r
1(1 -
m) x 1dx
0
f
= - 1m 1
o
fl&
-1&
1x 1dx + 11 - mi. 0
x dx
h2
= (I m 1+ 11 - m I) 2 . Now 1 - 2m
Iml+ll-ml=
11
2m -1
for for for
m < 0, 0:::;; m :::;; 1,
m> 1.
2. APPROXIMATING POLYNOMIAL; APPROXIMATION AT A POINT
66
Hence for any m between 0 and 1 inclusive, the integral A is equal to Ih 2 and this is the minimum value that the integral can have. In this case, then, it is not possible to find a unique polynomial mx which minimizes A, given by 2.6:5, nor is it possible to find a unique Pl(X) to satisfy 2.6:7. We then turn to a consideration of the integral (2.6:10)
B=
r
(i(x+ Ixl)-mx)2dx.
-II
We have
f
B = m2 o x2 dx
+ (1 -
-II
h3
m2 -
=
(1 - 2m
3
f" x dx 2
0
+ (1
=
m)2
h3
- m)2-
3
+ 2m2 ) -h3 • 3
It follows at once that for an arbitrary but fixed h (#0) B is a minimum when m = t. In this case, we can minimize the integral 2.6:6 and furthermore, our answer is independent of h; we cannot, however, satisfy the limit condition 2.6:8. We do not pursue these considerations any further. EXERCISE 2.6
1. Graph, on the same set of axes, the function 2.6:4 and its approximating polynomial Y =
IX.
2. Determine, where possible, and discuss as in the text, approximating polynomials of max-degree I, at the orgin, for the functions = 1 x I; b. y = 1 x I/x for x 0, y = 0 for x = 0; c. y = -x for x < 0, y = Xl for x ;;;. o.
a. Y
*
3. Same as example 2a and 2b, but find polynomials of max-degree 2. 4. Prove the assertion made in the second paragraph of this section concerning the existence of the first n derivatives of f(x}.
Chapter 3
The Approximating Polynomial; Approximation in an Interval
3.1. Introduction. The main theme of the preceding chapter was the construction of a polynomial, P(x), that approximated a given function, f(x), well in the neighborhood of a point on the graph of the function. However, even a superficial analysis indicates that as we leave the immediate vicinity of the point, the error tends to grow larger and larger. For this as well as other reasons, it is desirable to develop methods of constructing polynomials which approximate a given function well throughout an interval. If our concern is to replace f(x) by p(x) in some process, we refer to p(x) as an approximating polynomial, but if our only concern is to determine f(x) by evaluating p(x) for corresponding values of the argument x, it is common to refer to p(x) as an interpolating polynomial. In this respect, Weierstrass proved the fundamental theorem: if a function f(x) is single-valued and continuous in the closed interval [a, b] (a ~ x ~ b), and if E is any preassigned positive number, then there exists at least one polynomial p(x) such that I f(x) - p(x) I < E for all x's in the interval. Although the existence of the polynomial is proved, its degree may be enormous if E is small or the interval large. It is then perhaps simpler to find a suitable polynomial whose degree does not exceed a preassigned bound. We start with the method discussed at the end of the last chapter. Let (3.1: 1) y = f(x)
be a real, single-valued and continuous function; we endeavor first to approximate f(x) throughout an interval [a, b] by a polynomial (3.1:2)
P..(x) = ao + a1x
+ a2x2 + ... + a..x"
of preassigned max-degree n where P..(x) is determined by the condition that (3.1:3) lA = If(x) - P..(x) I dx
t
12
67
68
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
be a minimum, or by the condition that Is =
(3.1:4)
r
p..(X))1 dx
(f(x) -
a
be a minimum. We prove first by an example that the two conditions are not equivalent. Take f(x) = Xl, Po(x) = c, [a, b] = [0, 1]. Then
=
IA
=
fI I
Xl -
o
r'·
e I dx
(e - Xl) dx
o
+
r_ VC
(Xl - e) dx
= 1- e + tel;
l
hence 1A is a minimum when c = Is
On the other hand,
=
(Xl - e)ldx
=
1- ie + e l
which is a minimum when c = i. The condition that the integral 1A given by 3.1:3 be a minimum usually lead to an unwieldy problem because of the absolute value. We illustrate the use of the second condition by two examples.
+
+
+
EXAMPLE 1. Hf(x) = t(x I x I), find the parabolay = ao alx al x 2 which minimizes the integral Is given by 3.1:4 in the interval [-1, 1]. We have (the subscript S is omitted)
J
o
= -I (ao + alx + a2x2)1 dx
= i + 2ao2 -
ao + t ana2
+ f 0(ao + (al I
+ iall -
ial
+ fall -
Now IDO
= 4ao - 1 + tal'
I al·-"3 - 4 a1 - g3'
laB
=
tao
1) X + a2x2)1 dx
+ tal - t,
t a2·
69
3.1. INTRODUCTION
where Ia = oIloai' and j
laoao
=
4, I 40al Ial40 -.4: 3
'
I asa. -- 3"' 4
where I alZ, = o2IIoaioaj . Sufficient conditions for a minimum are lao
(3.1:5)
= I al = I al = 0,
14040
l40al
l40aa
lal ao
lalal
lalaa
laaao
lalal
1a1a•
>0.
·. . fi ed 1·f a o = 32' 3 16 15 Th ese con d ItlOns are satls a l = 32' a 2 = 32' an d therefore y = l2 (3 + 16x + l5x 2 ) is the required polynomial. It is suggested that the reader graph this parabola and y = t(x + I x I) on the same set of axes. EXAMPLE 2. If f(x) = sin x, find the parabola y = a o + alx + a2x2 which minimizes the integral Is given by 3.1:4 in the interval [0,11]. We have (again we omit the subscript S)
I
=
(Sin x - (a o + alx
+ ar 2))2 dx.
This time we calculate the partial derivatives before we integrate; we obtain lao
= -2 =
lal
r o
(sin x - (a o + alx
-2 (2 -
= -2
r
• 0
= -2 (
'TT2 _
;2
x(sin x - (a o + a 1x
= -2 ('TT - ~0'TT2 lal
~1
ao'TT -
+ a2x2)) dx
-
;1'TT3 -
x 2 (sin x - (a o
= -2 ('TT2 - 4 -
'TT 3 ),
+ ar2)) dx ~ w4),
+ a1x + a2x2)) dx
;0 wi - 7w4 -
~ 'TTO).
70
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
We find on imposing the conditions 3.1:5 that 12 ao = w3 (172 - 10) = -0.050,
60
a 1 = -rr4 (12 - r) = a2
1.312,
60
= -rr5 (172 - 12) = -0.418,
and therefore the equation of the required parabola is Y
12 [r - 10 + :5; . (12 = w3
172 ) X
+ 1752 (172 -
12) x2]
= - 0.050 + 1.312x - 0.418x2 • The reader should graph the parabola and sine curve on the same set of axes. EXERCISE 3.1 1. If f(x) = I x I, find the polynomials of max-degree 1 and max-degree 2 which minimize the integral Is given by 3.1:4 in the interval [-1, 1]; in the interval [-1, 2]. Draw the graphs of the given function and your answers. 2. Same as example 1, but withf(x)
=
e'".
3.2. Polynomial Thr.ough n + 1 Points; Determinant Form. In the preceding section we saw that it is possible to approximate a function throughout an interval by a polynomial by imposing the condition that a certain integral be as small as possible. As a rule, the polynomial is a good approximation, but unless its degree is small, it can be found only by the expenditure of much time and labor. Another method of determining a polynomial that approximates a function well throughout an interval is based on the requirement that the graphs of the polynomial and the function have a number of common points in the interval, or what is the same thing, that the polynomial graph pass through a certain number of points chosen on the function graph. The polynomial obtained in this manner does not, as a rule, approximate the given function as well as the polynomial obtained by the previous method but the loss is more than made up for by the facility with which the new polynomial can be obtained. Moreover, the polynomial derived from the new requirements lends itself much better to many of our later developments than does the old polynomial.
3.2. POLYNOMIAL THROUGH n
+
1 POINTS; DETERMINANT FORM
71
Our immediate general problem is then to find a polynomial
(3.2:1)
Y = P..(x) = a o + alx
+ ... + a,.x"
of max-degree n whose graph passes through each of the n
+I
points
i = 0, 1, ... , n.
(3.2:2)
These points may be assumed to be quite arbitrary (although it will develop in a moment that the abscisses must be distinct) or they may be chosen on the graph of the function
(3.2:3)
= f(x).
Y
In the latter case, our requirement stated in algebraic terms is that
(3.2:4)
Yi
i = 0, 1, ... , n.
= P..(Xi) = f(Xi),
Our second general problem is to determine how well the polynomial approximates the function and to learn how to use it to interpolate for values of the function. To find the required polynomial we substitute in turn the coordinates of the n + I points for x and y in the polynomial equation; we obtain the n + I linear equations
+ alxO+ ... + a,.xo" = Yo , a o + alx l + ... + a,.Xl" = Yl' ao
(3.2:5) Solving for the a's we get
i = 0, 1, ... , n,
(3.2:6) where
X~-l
Yo
x~+1···
xu"
Xl .•• X~-l
YI
x~+1···
xt"
X.. ...
Y..
x~+1
Xo ...
Di= and
D=
X~-l
1 Xo ... xo" 1 Xl··· Xl" 1 x .. ... x ....
... X....
72
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
However, a unique solution will exist only if D =1= O. To determine the circumstances under which this holds, we note that the expansion of D is a homogeneous polynomial in the x's of degree In(n + I). Moreover, the determinant and hence the polynomial vanish when Xi = xi' i =1= j, hence Xi - Xi is a factor of D. There are tn(n + I) such linear factors. A simple calculation shows that D = IIi>i (Xi - Xi)' It follows that D will be different from zero if the x's are distinct. Indeed, since a polynomial is a single-valued function, this condition might have been anticipated. (D is the famous Vandermonde-Cauchy determinant and appears in a great many different places in mathematics.) The coefficients of the polynomial y = p,,(x) are thus determined by the a's of 3.2:6. The polynomial, however, can be written in a much neater form. The determinant Di is equal to the determinant 0 0 .. ·0 Xo ... X~-l
Xi 0
.. ·0
0
0
Y
Xi+l ... Xo" 0
Xl ... X~-l
... Xl" YI Xi+l I ............................................. Xi X" ... X~-l y" XHI ... X "
Xi I
"
Hence
Xi Di
"
"
is equal to
o
0 0 .. ·0
Yo
Xo ... X~-l
XOi
x~+l .. • xu"
YI
Xl ... X~-l
Xli
x~+l .. · xt
x,,'" X~-l
X"i
x~+l .. · x,,"
Y"
1
The latter determinants, for different values of i, differ only in their first rows; hence summing them from i = 0 to i = n, we see that the polynomial p,,(x) can be written as the quotient of two determinants, y = p,,(x) = -E/D, where
o E =.
1 1
X
x2
Yo
Xo
X02 ... xo"
y"
1
X"
X,,2 ...
.. ·x"
x,,"
3.2. POLYNOMIAL THROUGH n
+
1 POINTS; DETERMINANT FORM
The preceding polynomial equation can be written as Dy and hence can be put into the form
(3.2:7)
y
1
Yo
1 Xo
x2 ···x" X02 ... xo"
y..
1 x..
X ..2 •••
X
73
+E =
0
= O.
x....
This is the determinant form of the polynomial 3.2: I which we were seeking. REMARK. We repeat that the n + I points may be assumed to be points within some interval on the graph of a function y = f(x), but since the function f(x) does not enter into the determination of the polynomial P..(x), the n + I points are quite arbitrary subject to the condition that they have distinct abscissas; in particular, the x's and the corresponding y's may be the observed or measured values of some magnitudes in a laboratory experiment or some natural phenomenon. We summarize this section in the THEOREM. If (xo, Yo), (Xl' YI)' ... , (X.. ,Y.. ) are n + I points with distinct abscissas, there is one and only one polynomial of max-degree n, y = P..(x), whose graph passes through these points, that is, such that y., = P..(Xi), i = 0, I, ... , n. EXAMPLE 1. Let y = f(x) = i(x + 1X I). The points of each of the three sets (-1,0), (0,0),(1, I); (-I,O),(-l,O),(O,O),(i,i),(I, I); (-I, 0), (- i, 0), (- 1, 0), (0, 0), (1, i), (i, i), (I, I), are equally spaced on the graph of the function. The equation of the parabola determined by the first set of three points is y
o o 1
X
x'l.
-1
1 = 0, 0 0 1 1
or y = lx + lx2. The equations of the curves determined by the second and third sets can be similarly found; they are y = x/2 + 7X2/6 - 2x4/3, y = x/2 + 37x2 /20 - 27x4/8 + 8Ix8 /40, respectively. The reader should draw the graphs of the three polynomials and compare them with the previously drawn graph of the parabola obtained by the former method. EXAMPLE 2. Find the equation of the parabola which coincides with the sine curve y = sin X at x = 0,17/2,17.
74
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
The values of y corresponding to the given values of x are y 1, 0; hence the equation of the parabola is
=
0,
X x2 0 0 'TT 'TT2 =0 2 4 'TT 'TTl
y 0
0 or y = 4x/'TT - 4X2/'TT2.
EXAMPLE 3. Find the equation of the cubic curve which intersects the logarithmic curve y = loglo x at x = i; 1, 2, 4. The equation of the cubic is
1 X Xl x3 1 l -1 .l8 1 1 1 1 = 0, 1 2 4 8 1 4 16 64
y -log 2 0 log 2 2 log 2 or y = log 2( -104
+ 147x -
49x2 + 6x3 )/21. EXERCISE 1.2
Note: all required equations in this exercise are of the form y = Qo + Q1X + Q1Xl + ... + QnXn and are to be found by means of determinants. 1. Find the equation of the parabola determined by the points (-I, -I), (1,0), (3, S). 2. Find the equation of the cubic determined by the points of the preceding example and (4, 0).
1. Find the equation of max-degree 3 determined by the points (-2, -17), (0, -I), (1,4), (4,7). 4. Find the equation of max-degree 3 determined by the points
(-2,-17),
(0,-1),
(1,4),
(4,8).
5. Find the equation of the parabola which coincides with y .,,/2. Draw the graph of each curve using the same axes. 6. Find the equation of the parabola which intersects y graph of each curve using the same axes.
=
=
e' at x
sin (xI2) at x
=
=
0, .,,13,
-I, 0, I. Draw the
7 .•• Find and graph the equation of max-degree 2 which coincides with y = I x I at -1,0, I.
x
=
x
=
b. Find and graph the equation of max-degree 2 which coincides with y = I x I at
1,2,4.
3.3. LAGRANGE INTERPOLATION FORMULA
75
3.3. Polynomial through n + 1 Points; Lagrange Interpolation Formula. We proved in the preceding section that there is one and only one polynomial of max-degree n whose graph passes through n + 1 arbitrary points with distinct abscissas. The determinant form 3.2:7, however, lends itself neither to arithmetic computation nor to most theoretic developments, hence it is desirable to obtain the polynomial Y = P..(x) in other more suitable forms. It turns out that a polynomial of the form
(3.3:1) n
= ~Li(X)Yt' i~O
where the L's are polynomials of degree n in x is quite suitable for computational and theoretical needs. Since Yk = P..(Xk), the forms of the polynomial multipliers of the y's will be determined if we impose the conditions that Lk(xj) be 0 or 1 according as j does not or does equal k. Since Lk(x) is a polynomial of degree n, it must have the form A(x - xo)(x - Xl) ... (X - xk_l)(X - xk+l) ... (X - X.. ), where A is a constant. Since Lk(Xk) = 1,
A=
1 (Xk - xo) ... (Xk - Xk-l)(Xk - Xk+1) ... (Xk - x,,)
.
Hence
(3.3:2) (3.3:3)
.( ) _ L ,x -
(x - xo) ... (x - Xt_I)(X - Xi+1) ... (x - x..) , (Xt - xo) ... (Xi - Xi-I)(Xt - Xi+1) ... (Xi - x,,) i = 0, 1, "', n, Y = p,,(x) (x - Xl) ... (x - x,,) (x - xo)(x - X2) ... (x - x,,) = (xo - Xl) ... (xo - x,,) Yo + (Xl - XO)(XI - Xl) ... (Xl - X,,) YI
+ ... +
(X - Xo) ... (X - X"-l) Y (X" - Xo) ... (X" - X"-l) ".
The form 3.3:3 is called the Lagrange Interpolation formula and the coefficients of the y's given by 3.3:2 are called the Lagrange coefficients. This form of the approximating polynomial is very useful and important since many of our later developments will be based on it. EXAMPLE. The polynomial through the points (- 2, 3), (0, 0), (1, 4). (5, -1) is given by
Y=
(x - O)(x - 1)(x - 5) 3 + (x (-2 - 0)(-2 - 1)(-2 - 5) (0
+ 2)(x + 2)(0 -
1)(x - 5) 0 1)(0 - 5)
76
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
(x -f 2)(x - O)(x - 5) 0)(1 - 5) 4
+ (I + 2)(1 or
y
=
(x + 2)(x + (5 + 2)(5 -
1 420 (1256x
O)(x - I) 0)(5 - I) (-I),
+ 597x· -
I 73x3).
The Lagrange coefficients, 3.3:2, may be given other useful forms. Let k be anyone of the integers 0, 1, .... n and let a, b "', g, h be the remaining integers in any order whatsoever. It follows that (3.3:4.0) L () I kx =
x - Xk Xa
+ Xk -
+ ... + (3.3:4.1)
= x - Xa Xk - Xa
+
(x - Xk)(X - xa) (Xk - Xa)(Xk - Xb)
(x - Xk)(X - xa)(x - Xb) Xa)(Xk - Xb)(Xk - xc)
+ (Xk -
(x - Xk)(X - xa) ... (x - Xg) . (Xk - Xa)(Xk - Xb) ... (Xk - x h) ,
II +
x - Xk Xk - Xb
+
(x - Xk)(X - Xb) (Xk - Xb)(Xk - xc)
(3.3:4.2)
(x - xa)(x - Xb) (Xk - Xa)(Xk - Xb)
I+ I
x - Xk Xk - Xc
+ ... +
j.
(x - Xk)(X - xc) ... (x - Xg) (Xk - Xc)(Xk - x,,) ... (Xk - x h) ,
(3.3:4.(n - I)) = (x - x,,)(x - Xb) ... (x - Xg) (Xk - Xa)lXk - Xb) ... (Xk - xo)
II +
(3.3:4.n)
(x - xa)(x - Xb) ... (x - xg)(x - Xh)
= (Xk - Xa)(Xk - Xb) ... (Xk - Xg)(Xk - x h) . The last form is the same as 3.3:2; we have included it for the sake of completeness. To verify that anyone of the other forms holds, add the first two terms within the braces, add the result to the third term, add that result to the next term, and so on; multiply the final result by the fraction in front.
77
3.4. DIVIDED DIFFERENCE FORM
EXERCISE 3.] 1. Find the polynomial equations of lowest degree determined by the following sets of points. Use the Lagrange Interpolation formula.
a. (-I, 2), (0,-1) b. (-2,7), (1,9) c. (3, 4), (2, 4) d. (-I, -I), (1,0), (3,5) e. (-1,0.2), (1,2.3), (4, -6.8) f. (-I, -I), (1,0), (3,5), (4,0) g. (-2, -17), (0, -I), (1,4), (4,7) h. (-2, -17), (0, -I), (1,4), (4,8) I. (-4,3), (1,7), (-2,0), (5, -I), (7,0) ;.(-2,-13), (10,11), (0,1), (4,17), (6,19). 2. Do examples 5, 6, and 7 of Exercise 3.2, this time using the Lagrange Interpolation formula. ]. Alongside is an abbreviated table of natural logarithms. Find the polynomials, P..(x), that coincide with the logarithmic function at x equal to
a. b. c. d. e.
402, 402, 401, 401, 400,
403, 403, 402,' 402, 401,
n = I; 404, n = 2; 403, 404, n
= 3; 403, 404, 405, n = 4; 402, 403, 404, 405, n
=
5.
x
Inx
400 5.9914645471 401 5.99396 14273 402 5.99645 20886 403 5.99893 65619 404 6.00141 48780 405 6.00388 70671
f. Use ordinary (linear) interpolation to find In 402.6. g. Use each of your answers to a, ... , e, in turn, to find In 402.6. h. Compare your answers to f and g. What is the value of In 402.6?
4. Prove l:~=OLi(X) Xit = xt, 0 < k ..; n, where Li(X) is defined by 3.3:2. [Hint: use
3.3:3 with y = xlt]. S. Derive the Lagrange Interpolation formula 3.3:3 directly from 3.2:7 by expanding the determinant in terms of the elements of the first row.
3.4. Polynomial through n + 1 Points; Divided Difference Form. The polynomial through n + I points can be put into yet another form which is frequently superior to the Lagrange form for computational purposes. The means used in deriving the third form are so useful In so many places that we give this method special attention. As before, let (3.4:1)
be a set of n (3.4:2)
+ I points with distinct abscissas. i-::pj,
The fraction
78
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
will be designated by the symbol (3.4:3)
and is called the first-order divided difference of the y's. In particular, etc. Also, For the sake of convenience in writing some expressions later on, we put (3.4:4)
so that the fraction 3.4:2 can be written in the form (3.4:2.1)
and we have (3.4:5)
Similarly, we define a second-order divided difference of the y's by the symbol
i, j, k all distinct;
(3.4:6)
a third-order divided difference by the symbol (3.4:7)
[
XiXjXkXm
]
=
[XtX/Xk] Xi -
[x;x~m] Xm
,
i,j, k, m all distinct.
In general, we define an rth-order divided difference of the y's, r ::::;; n, by the symbol (3.4:8)
+
where io , i1 , ... , ir are r I distinct integers in the range 0, I, ... , n. In actual practice, the subscripts in 3.4:8 are almost always consecutive integers.
* The context will make it clear whether the symbol [x] signifies the zeroth order divided difference or the greatest integer in x.
79
3.4. DIVIDED DIFFERENCE FORM
It is convenient for many applications to exhibit the numbers 3.4: I and the divided differences determined by them in the form of a triangular array known as a divided difference table. The x's and their corresponding y's are written in two vertical columns, the first-order divided differences are written in a third column, the second-order divided differences in a following column, and so on. The complete array for n + I number pairs then contains n + 2 columns, the last one consists of but a single entry, the only nth-order divided difference. The divided difference table for (xo ,Yo), ... , (X4 ,Y4) will look as follows: Xo
Yo
Xl
Yl
[XoXl] [XoXIXI] [XIXJ XI
[XoXIXIXS]
[XIXsXS]
Y. [XsXs]
Xs
[XoXIXsXsXC] [XIXaXsXc]
[XsXsx,]
Ys [XsxJ
X,
y,
As a concrete illustration, the divided difference table for the values (-2,234), (0, to), (5, 13135), (-1,31), (2, -86), 1S:
-2
234
0
10
-112 391 2625 5 13135
50 441
2184 -1
31
25 150
741 -39
2
-86
If the x's are arranged according to size, the array takes on the form: -2
234
-1
31
-203 91 -21 0
-25 -9
10
2
891
-86 4407
5 13135
25 150
-48
80
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
We remark that a divided difference table need not be carried out to completion; we may truncate it at any column. Note also that each divided difference in the table is the vertex of a triangle whose opposite side is in the y column. Thus, in the array above, [X I X 2X 3X4] is the vertex of a triangle whose sides are the vertical column YI' Y2' Ya, Y4'
the descending diagonal [Xl]'
[X IX2],
[X IX2X3], [XIXraXJ,
and the ascending diagonal [X4] , [xaxJ,
[Xr3X4] ,
[X IXraX4]·
It follows readily from the definition of the divided differences that [XoXI] =
Yo Xo -
~~=
h
(xo - XI)(XO- X2)
Xl
+ Xl YI - Xo
+ (Xl -
~
XO)(XI - X2)
+ (X2 -
h
XO)(X2 - Xl)
A simple induction proof yields
As an immediate consequence of the preceding formula, we see that a divided difference is a symmetric function of the x's and their corresponding y's; the value of a divided difference is therefore independent of the order in which the x's are written within the brackets. It is for this reason that we find the two 25's and the two ISO's in identical places in the two arrays exhibited above. The subscripts in formula 3.4:9 can be chosen more generally. Let i j ,j = 0, 1, ... , r,• be r• 1•distinct integers and (Xi I ,Yi), j = 0, • • I 1, ... , r, r + 1 pOints with distinct abscissas; then
+
(3.4:10)
Yt. + ... + -:----.,..,.....---:----;------:(x. - X· )(x. - x, ) ... (x. - x· ). 1,
'0
I,
.1
I,
',.-1
81
3.4. DIVIDED DIFFERENCE FORM
Let a difference table be constructed for the n + I points 3.4: I, where X o , Xl , ... , Xn occur in that order in the first column. Each divided difference in the table is adjacent to two divided differences that precede it and, unless it is the last or first entry in its column, to two that follow it. The sequence of divided differences (3.4: 11) (where, since the order of the x's written within a pair of brackets is immaterial, they may be rearranged so that the subscripts occur in natural consecutive order) is called a sequence chain if the first term of the sequence is one of the y's, the last term is the one and only divided difference of the nth order, and the intervening terms have the property that each is adjacent in the difference table to its predecessor and to its successor. Of the 2n possible sequence chains (we leave it to the reader to prove that there are exactly 2n distinct sequence chains), we take special note of four: first, the sequence chain (3.4:12) whose terms form the uppermost descending diagonal of the difference table; second, the sequence chain (3.4:13) whose terms form the lowest ascending diagonal. Then, if n is even and equal to 2m, say, we mark the sequence chains (3.4:14)
[x m],
[xmxm+l]'
[Xm-IXmXm+l]'
[X m-IXmXm+lXm+21 • ... , [XoXl ... xn],
(3.4:15)
[x m],
[Xm-IXm],
[xm_IxmX",+l]'
[xm-~m-IXmXm+l]'
if n is odd and equal to 2m (3.4:14')
[Xm],
(3.4: 15')
[xm+1]'
... , [XoXl ... xn];
+ I, we note the sequence chains
[xmXm+l]' [xmxm+l]'
[xm-IXmXm+l]' ... ,
[XoXl ... xn],
[xmxm+lxm+2]' ... , [XoXl ... xn]·
In either case, the terms of the last two sequence chains we have marked for special attention start with the middle y or y's of the difference table and zigzag to the final nth order divided difference. Because of the manner in which new subscripts are introduced into the successive divided differences 3.4:12-15, 14', IS', we call the sequence chain 3.4: 12 a sequence chain of forward divided differences, 3.4: 13 a sequence chain of backward divided differences, and the remainder,
82
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
sequence chains of central divided differences. More briefly, we shall refer to chains as forward, backward, or central sequence chains. The sequence chain 3.4: II is now used to build the polynomial equation
The law of formation of the polynomial is rather 0 bvious and consequently need not be explicitly stated. Since each divided difference is a constant, the polynomial is of max-degree n. Since there are 2" sequence chains, there are ostensibly 2" polynomials of the form 3.4:16. However, we shall prove that all of these polynomials are identically equal to each other and, indeed, each is the polynomial through the n + I points (3.4: I). Before doing so, we call attention to the four special forms of the polynomial corresponding to the four special sequence cnains noted above; we write explicitly only the first of these polynomials, to others are left to the reader. (3.5:17) y
= [xo]
+ [XoXI](X - xo) + [XoXIX2](X - xo)(x - Xl) + ... + [XoXI .•• x..](x - xo)(x - Xl) •.. (X -
x..- I ).
To prove the statement made above, we have, from 3.4:4 and 3.4: 10,
Now multiply the first of these identities by I, multiply the second of these identities by x - Xi o ' the third by (x - Xio)(x - Xi), ... , and the (n + I )st by (x - Xio)(x - Xi 1) ... (X - Xi n_l ); then add all the products.
83
3.4. DIVIDED DIFFERENCE FORM
The result is an identity whose left-hand side is the polynomial of 3.4: 16. The right-hand side can be written as
I+
x - Xi 0 XiO - Xii
I
Yi o
+
i
Y
I
+
(x - xd(x - xd 0 I + (XiO - Xil)(XiO - Xi a)
I+
X - Xi 0 I Xii - XiO
X - Xi I Xii - Xiz
+ ... +
... + (x - xd ... (x -
Xi
0
(XiO -
Xii) ...
(XiO -
n_1
)!
Xi n)
)!
(X - Xi ) ... (X - Xi I A_I (Xii - Xi.) ... (Xii - Xi n)
+ ........................................... . (X - XiO)(X - Xii) ... (X - Xi n _ l ) + Yin (X.In - X·10 )(X.In - X.) ... (X.1ft - X·'n-l). 11
But by formulas 3.3:4.0 - 4.n, the coefficient of Yi k is precisely Lik(X); hence the right-hand side is the Lagrange interpolation polynomial and our assertion is proved. That is, the polynomial equation 3.4: 16 is the equation of the polynomial of max-degree n through the points 3.4: 1. EXAMPLE. The equation of the polynomial through the five points given at the beginning of this section is
Y
+ 39lx(x + 2) + 50x(x + 2)(x - 5) + 25x(x + 2)(x - 5)(x + I) = -86 - 39(x - 2) + 741(x,- 2)(x + I) + 150(x - 2)(x + I)(x + 25x(x - 2)(x + I)(x - 5) = 10 - 2lx + 9lx(x + I) - 25x(x + I)(x + 2) + 25x(x + I)(x + 2)(x - 2), =
234 - 112(x + 2)
5)
etc. n
The divided difference form, 3.4: 16, of the polynomial through the points
+I
(3.4: 18)
in that order, has one noteworthy feature. It determines the sequence of polynomials
Y
= =
Y
=
Y
(3.4: 19)
[XiJ,
+ [XioXil](X [Xio] + [Xtox;J(x [XiJ
Xi o)' Xi o) + [XioXiIXil](X - Xio)(x - Xii)'
84
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
of max-degrees 0, 1,2, ... , respectively, determined by the first, the two, the first three, ... , points, respectively, of 3.4: 18. This suggests that to find by interpolation the value f(x') from a table of f(x), the most precise result can be obtained by choosing the points 3.4: 18 so that (3.4:20)
and stopping the process when succeeding terms no longer affect the answer (or when we run out of points). See the second half of Section 6.
EXERCISE 3.4
t. Write out the complete divided difference table for each set of points of example I, Exercise 3.3. 2. Write out the divided difference table for the set of points (0, sin 0°), (10, sin 10°), ... , (90, sin 90°), as far as the column of third order differences. (Obtain the values of the sines from any five-place table.) 3. Do examples 1,2,3 of Exercise 3.3 using divided differences. 4. Prove
[XoXl ••. x,,] =
,,-I
I
Xo
Xo
x.
X,.
Xo
t
•••
ft.-I
x"
Yo
Y.
....:...._....;:..-=---:--....;:..-....:...;;;..-
I
Xo
xo·
...
xo"
Xl
XII...
Xl"
S. If y = f(x) = I/x, then [XoXl ... x,,] = (-I)"/xoxl •..
X" •
6. If y = f(x) = x", then [XoXl •.. x,,] = 1. 7. If y = f(x) = x"+1, then [XoXl •...~,,] = Xo
+
Xl
+ ... + X".
8. The divided difference of the sum of two functions is the sum of the corresponding divided differences. 9. A divided difference of cf(x) equals c times the corresponding divided difference of f(x), where c is a constant.
to.
Derive the equality 3.4:9 by mathematical induction.
3.5. Polynomial through n + 1 Points; Aitken-Neville Forms. The polynomial through the n + 1 points (3.5: 1)
+
3.S. POLYNOMIAL THROUGH n
1 POINTS; AITKEN-NEVILLE FORMS
8S
can be obtained in yet another form. Let
(3.5:2) be r
+I
of the n
+I
points, and, introducing a new notation, let
(3.5:3) be the polynomial through the first r points of 3.5:2 and
(3.5:4) the polynomial through the last r points of 3.5:2. Then
(3.5:5) is the polynomial through all r for 0 ~ j ~ r, Y(Xi j )
=
(Xij -
Xio)
+ 1 points q(Xi,) - (Xi j X - X i.
of 3.5:2. Indeed, we have -
Xi.) P(Xi j )
io
Hence
(3.5:6)
In particular, if we put {Xk} = Yk' then {Xio}
= Yio ' (x -
{XioXil }
Xio){Xil } -
(x -
Xil){Xio}
= ----'---=-------'-_..:.... 1
=. X·
'I
Xii -
Xio
I
Xio
X -
-x·'0 x-x. I
'I
{x;o}
{x} l i
,
86
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
are the polynomials through the first, the first two, and the first three points of 3.5:2, respectively. Analogous to the divided difference table, we can form polynomial tables; in particular, the tables (illustrated for n = 5): Xo
{Xo}
Xl
{Xl}
XI
{XI}
{XoX.}
{XoX1X.}
Xa X,
{Xa}
{XoXa}
{XoX1Xa}
{X,}
{xoX,}
{XoX1X,}
{XoX1XaX,}
{XoX1X.XaX,}
X,
{X,}
{xoX,}
{XoX1X,}
{XoX1X.X,}
{XoX1X.XaX,}
Xo
{Xo}
Xl
{Xl}
{XoXl} {XoX1XaXa} {XoX1X.XaX,xa}
and
{XoXl} {XoX1X I} {XiX.} XI
{XI}
{XoX1XaXa} {X1X.Xa}
{X.Xa} Xa
{Xa}
X,
{X,}
X,
{X,}
{XoX1X.XaX,} {XoX1XaXaX,X,}
{X1XaXaX,} {X1XaXaX,X,}
{XaXaX,} {xaX,}
{x.x.x,x,} {XaX,X,}
{x,x,}
In each table, the sequence of polynomials at the top of each column, after the first, is precisely the sequence of polynomials 3.4: 19. The process of interpolation based on the first table is due to Aitken, the process based on the second is due to Neville. The particular virtue of these forms of the (n + I)-point polynomial lies not in the form of the polynomial itself which is, as a matter of fact, rather unwieldy, but in the simple and repetitive nature of the process of interpolation that ensues.
3.6. COMPUTATIONAL FORMS
87
3.6. Magnitude of the Error in the Polynomial through n + 1 Points. Computational Forms. We found, in the last four sections, four different ways of writing the polynomial (3.6: 1)
of max-degree n whose graph passes through the n
+ 1 points
(3.6:2)
with distinct abscissas. If no further information is available concerning the n + I points, nothing further can be said about Pn(x) as far as approximation or interpolation is concerned. But if it is known that the n + I points also lie on the graph of a function (3.6:3)
y
= f(x),
then it is natural to regard Pn(x) as an approximation, in some sense, to f(x). In particular, we may regard Pn(x) as an interpolating polynomial for f(x), that is, for a value x' of x, f(x') can be approximated by evaluating Pn(x'). We will then want an estimate of the magnitude of the error E(x) = f(x) - Pn(x) at x = x'. To this end, put y' = f(x'). Construct the polynomial through the n + I points 3.6:2 and the point (x', y') by the method of divided differences. If Pn+l(x) is this polynomial and if x' is the last entry of the first column of the difference table used in its construction, then it follows from the form of equation 3.4: 16 that (3.6:4)
Since f(x') = Pn+l(x'), we have f(x') - Pn(x') Consequently,
= Pn+l(x') - Pn(x').
(3.6:5)
The magnitude of the error in approximating f(x') by Pn(x') will then be determined if a value for [XOXI ... xnx'] can be found. We proceed to attack this problem. The form of the identity 3.6:5 suggests an examination of the function
This function vanishes for the n + 2 distinct values xo , Xl , "', Xn , x' (we may suppose that x' is distinct from the other x's, otherwise, E(x') = 0); hence by Rolle's theorem, tp'(x) will vanish for at least
88
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
n + 1 distinct values of x; tp"(X) will vanish for at least n distinct values of x; and so on to tp(n+ll(x) which will vanish for at least one value of x, say X. [We assume thatf(x), and consequently tp(x), possesses all the necessary derivatives.] But from the definition of tp(x) it follows that tp(n+lI(X) = j«n+ll(x) - [XoXl ... xnx'](n + 1)1,
since Pn(x) is a polynomial of max-degree n and the coefficient of the divided difference is a polynomial of degree n + 1 whose leading coefficient is unity. Hence , j«n+lI(X) [XoXI'" xnx] = (n + I)! '
(3.6:6) and substituting error E(x'),
(3.6:7)
E(x')
In
3.6:5, we obtain the desired expressIOn for the
= f(x')
- Pn(x')
=
j«n+lI(X) (n + 1)1 (x' - xo)(x' -
Xl) ...
(X' - xn),
where X is some value between the smallest and the largest of the numbers Xo , Xl , "', Xn ,x'. (Compare this result with the error term in the previous case, formula 2.2:8.) The number X is not known in actual practice, hence it is customary to replace pn+lI(X) by the maximum absolute value of pn+ll(x) in the interval in question. As a rule, this replacement causes an exaggerated estimate of the error. Formula 3.6:6 deserves some special comment. Let us first rewrite it as
(3.6:8)
[XoXl ... xn]
=
j«nl(X) - - I-
n.
.
This formula reduces for n = 1 to the Theorem of the Mean for derivatives, hence the formula may be thought of as a generalization of the theorem. Furthermore, if f(x) is a polynomial of max-degree n - 1, then
and if f(x) is a polynomial of max-degree n, then
where an is the coefficient of xn in f(x).
89
3.6. COMPUTATIONAL FORMS
The last two results are restated and rounded out in the THEOREM.
If
are arbitrary but distinct numbers and
XO ' Xl , ••• , X"
Yo, YI , ... , y" are the corresponding y's determined by the polynomial y = ao + alx
+ ... + a"x",
then
(3.6:9) and conversely, if y = f(x) is a single-valued function defined for every x, and if for every set Xo , Xl , ••• , X" of n + 1 distinct numbers and the corresponding set Yo, YI , ... , y" determined by f(x) Eq. 3.6:9 holds, then f(x) is a polynomial of max-degree n whose leading coefficient is an . The proof of the converse is immediate. Let p,,(x) be the polynomial of max-degree n determined by Xo , Xl , ••• , X" and the corresponding Yo = f(x o), YI = f(x l ), ... , y" = f(x,,). Let x' be a number distinct from Xo , Xl , ••• , X" • Since by assumption all nth-order differences are constant, all (n + l)st-order differences are zero, and hence, by 3.6:5, p,,(x') = f(x:); or f(x) = p,,(x). We illustrate some of the preceding ideas by two examples. EXAMPLE 1. The following values are taken from a table of the exponential function:
y:
eZ
\_0-2-.7-18-7-.3-28-9-54-.5-:-8
The divided difference table is: 0
1.000 1.718 2.718
1.477 4.671
2
7.389
4
54.598
1.209 6.311
23.605
Hence y
=
1 + 1.718x + 1.477x(x - 1)
+ 1.209x(x -
1)(x - 2)
is an interpolating cubic for eZ through the four given points. For = 3, the cubic yields the value 22.27 which is not a particularly good
X
90
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
approximation to e3 = 20.09. The maximum error as predicted by formula 3.6:7 is I 55(3 - 0)(3 - 1)(3 - 2)(3 - 4)/4! I = 14-. EXAMPLE
2.
We obtain from the same table:
I
x y
=
eZ
0.6 1.822
~
0.7
0.8
2.014
2.226
1.0
2.718
The divided difference table is: 0.6
1.822
0.7
2.014
1.92 1.00 2.12 0.8
2.226
0.33 1.13
2.46 1.0 2.718
The interpolating cubic is y
=
1.822
+ 1.92(x -
0.6)
+ 1.00(x -
0.6)(x - 0.7)
+ 0.33(x -
0.6)(x - 0.7)(x - 0.8);
at x = 0.9, Y = eO. 9 = 2.460. The estimated maximum error is 12.718(0.9 - 0.6)(0.9 - 0.7)(0.9 - 0.8)(0.9 - 1.0)/4!
I=
0.0001-.
Actually, the answer, 2.460, is correct to four significant figures. The error given by formula 3.6:7 in approximating f(x') by p,,(x') is the error inherent in the method of polynomial approximation. There are, however, still other sources of error. In the first place, the coordinates of the n + 1 points 3.6:2 may not be exact. If the points arise as recorded data of some experiment, then both the x's and the y's are likely to be inexact; if the y's are values of a function taken from a table for the corresponding x's, then the y's alone are inexact. Again, there are the accumulative errors inherent in all computations. In all cases, if we assume that the approximate numbers are written so that all their significant figures are correct, the errors due to computation and inexact data can be computed by the methods of Chapter I. Although these errors, which for want of a better name we shall call the computational errors, are usually negligible, they should be considered, particularly when the number of points is large.
91
3.6. COMPUTATIONAL FORMS
It should be further remarked and carefully noted that the estimation of the error committed in approximating f(x) by p,,(x) at x = x' as given in formula 3.6:7 depends on the existence of p"+ll(X) in the neighborhood of x = x'. If the (n + l)st derivative does not exist, the formula, of course, can not be used. There is, however, an important special case where we can say something definite about the magnitude of the error even though p"+ll(x) does not exist, or if it exists, is not known. Let us refer back to the equality 3.6:5; it is an expression for the error which involves the unknown quantity [XOXI ... X"X']. If we assume, as we did, that f(x) possesses an (n + l)st derivative, we are led to the evaluation of [XoXl ... X"X'] given by 3.6:6. If the abscissas Xo , Xl' "', x" ,X' all lie within an interval [a, b], say, then X also lies in [a, b]. If these abscissas are replaced by n + 2 other (distinct) abscissas lying in [a, b], then the corresponding X' will also be in [a, b]. If the interval [a, b] is sufficiently small, f'n+ll(x) will not vary greatly for different points within it; that is, P"+ll(X) and p"+ll(X') will be almost equal. In other words, the right member of 3.6:6 determined by the particular set of n + 2 abscissas XO, Xl , "', X" ,X' may be taken as a good approximation to the (n + l)st order divided difference determined by any set of n + 2 distinct points within the interval [a, b]. These observations lead us to the following conclusion. Suppose that we can prove, or have reason to believe, that for a given function f(x) and for any set of n + 2 distinct numbers Xo , Xl , "', X" , X' within an interval [a, b] there exists a positive constant K such that the inequality
(3.6:10)
1
[XoXl ... xnx']
1
< (n : I)!
holds, then we have (3.6:11 ) 1
E(x')
1
= If(x') - Pn(x') 1 .::;:; (n :
I)! 1 (x' - xo)(x' -
Xl) ...
(X' - Xn) I·
This last expression for the magnitude of the error does not involve the (n + l)st derivative. Another method of approach is also of interest. The statement (3.6:12)
f(x)
= Pn(x) + pn+ll(X) (x - xo)(x(:- :l~;!" (x - xn )
is an identity provided that the (n + l)st derivative exists and X is properly chosen. A consideration of the derivation of X reveals that it is a function, usually multivalued, of X O , Xl , "', X" and x. Since
92
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
Xo , Xl , ... , Xn are constants in a particular problem, X may be regarded as a function of X only and hence j«n+l)(X) is a function, usually multivalued, of x. Let tp(x) be one branch of this function, then we may write
f( )
(3.6:13)
=
X
() Pn X
( ) (x -
+ cp X
xo)(x -
(n
Xl) ... (X -
+ 1)1
Xn)
•
The last form was obtained on the assumption that pn+l)(x) existed in a certain interval [a, b]. On the other hand, we can write the form just above whether the derivative does or does not exist and we have there a usable estimate of the error in approximating f(x) by Pn(x) provided we know something about tp(x). In particular, if in the interval [a, b], I tp(x) I < K, we are back to the estimate given in 3.6: 11. The determinant 3.2:7, the Lagrange interpolation formula 3.3:3, the divided difference form 3.4:16, and the last entry, {XoXl ... x n }, in the Aitken-Neville tables are all the polynomial through the n + 1 points (xo , Yo), ... , (x n , Yn). Each form has its particular uses, advantages, and disadvantages. The determinant form is easy to differentiate and is convenient for some special purposes, but as a rule, it is seldom used for either approximation or interpolation because of its unwieldy nature. The Lagrange form is good for further theoretical purposes and is most convenient for interpolation for a single value of the argument. The divided difference form is also good for further developments and is convenient for interpolation if many values are desired. The AitkenNeville process is cumbersome if the polynomial is wanted, but is convenient for interpolation for many values of the argument. The various methods and convenient forms for the arrangement of the computations, are exhibited in the example below, an elaboration of example 2. EXAMPLE 3.
Find e0,8, given:
__X_I y =
e~
0.6
0.7
0.8
1.0
1.3
I 1.82212 2.01375 2.22554 2.71828
1.4
3.66930 4.05520
The Lagrange form yields, for the interpolation, (2)(1)(1)(4)(5) (3)(1)(1)(4)(5) (1)(2)(4)(7)(8) 1.82212 - (1)(1)(3)(6)(7) 2.01375 (3)(2)(1)(4)(5)
+ (4)(3)(2)(3)(4) 2.71828 =
2.45960.
(3)(2)(1)(4)(5)
+ (2)(1)(2)(5)(6) 2.22554
(3)(2)(1)(1)(5) (7)(6)(5)(3)(1) 3.66930
(3)(2)(1)(1)(4)
+ (8)(7)(6)(4)(1) 4.05520
93
3.6. COMPUTATIONAL FORMS
Some ISO steps are required (each addition, subtraction, multiplication, and division is counted as one step; the tabulation or recording of a number is not counted), but many of the steps here can be done mentally. If this form were to be used for the evaluation of ez for several values of x, the fractions -1.82212/(0.1)(0.2)(0.4)(0.7)(0.8), ... , which remain constant, would be calculated first, and then the multipliers (x - 0.6)(x - 0.7) ... (x - 1.4), ... , for each value of x. After the fractions are evaluated, each y can be found with the expenditure of about 65 steps, most of which can be done mentally. To evaluate eo.B by means of divided differences, we first form the array:
0.6
1.82212
0.7
2.01375
1.91630 1.00800 2.11790 0.8
2.22554
0.36167 0.10254
1.15267 2.46370
1.0 2.71828
0.43345 0.11789
3.17007
1.3
0.01919
1.41274
3.66930
0.51597 1.72232
3.85900 1.4 4.05520
Then (we will use the forward difference form 3.4: 17), we evaluate 1 I' x 1 x -
Xo 1
x -
II
Xl
(x - xo)(x -
Xo
x -
(x - xo)(x -
Xl)
X"_l Xl) •••
(x -
X"_l)
Here, for x = 0.9, 1 1 0. 3
1
0.21
1 0:31 0.06
0.1 0.006
I I
-0.1 -0.0006
-0.4 0.00024
The entries in the second row are multiplied into the corresponding entries of the uppermost descending diagonal of the divided difference table, and the results added to yield 2.45960. It takes 45 steps to compute the difference table and about 20 more steps to reach the final result. Since the same divided difference table can be used to evaluate additional values of ez (in the range 0.5 ::::;;; x ::::;;; 1.5), only 20 steps are necessary to calculate each additional value.
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
94
The tables for the Aitken and Neville processes are: 0.6 0.7 0.8 1.0 1.3 1.4
0.3 0.2 0.1 -0.1 -0.4 -0.5
1.82212 2.01375 2.39701 2.22554 2.42725 2.71828 2.49424 3.66930 2.61377 4.05520 2.65952
0.6
0.3
1.82212
0.7
0.2
2.01375
2.45759 2.46183 2.46926 2.47201
2.45966 2.45984 2.45991
2.45960 2.45960
2.45960
and
2.39701 2.45749 2.43733 0.8
0.1
2.22554
2.45966 2.46038
2.47191 1.0
-0.1
2.71828
1.3
-0.4
3.66930
1.4
-0.5
4.05520
2.45960 2.45960
2.45951 2.45778
2.40127
2.45960 2.45984
2.47016 2.12570
respectively. Each takes about 65 steps to reach the answer 2.45960, and, because of the nature of the process, will take exactly the same number for the calculation of additional values. Note that a column of differences 0.9 - 0.6 = 0.3, 0.9 - 0.7 = 0.2, ···,0.9 - 1.4 = -0.5, has been inserted between the column for x and that for {x}. In the Lagrange and divided difference processes, we obtain, so to speak, the interpolating polynomials first and then we substitute the value of the argument; in the Aitken-Neville processes, the answer is obtained by immediate use of the value of the argument. All the methods are repetitive in nature and hence are convenient for the computor and lend themselves for automatic machine computation; the AitkenNeville processes are repetitive in "purest" form since, after the evaluation of the differences, each stage is a calculation of the form (ab - cd)/e. The error inherent in polynomial approximation can, of course, be estimated by the methods of the first half of this section, but the divided difference and Aitken-Neville processes have built-in error indicators. The top entries in the columns of the Aitken-Neville tableaux and the successive sums in the last stage of the divided difference
EXERCISE
9S
process are precisely the values of the polynomials of 3.4: 19 for the given value of the argument. Hence, if these values are unaltered at the end, as in the example above, we are assured that the error inherent in the interpolation process is too small to affect the last significant digit. Since rounding-off errors may mount up, some computers use one, sometimes two, significant digits more in their computation entries than in the given data to reduce the rounding-off errors; the final answer is, of course, written with the proper number of digits. This was not done in the example worked out above; the final answer is, nevertheless, correct as far as it is written. EXERCISE 1.6
t. Find by use of the determinant form, the Lagrange formula and the method of divided differences, the cubic polynomial determined by each set of points. a.(-3,-I), (-2,2), (1,-1), (3,10); b. (- 3.10, -1.05), ( -1.98, 2.13), (1.01, -0.83),
(2.64, I Q.42).
2. Find by use of the Lagrange formula and the method of divided differences, the polynomial of. max-degree determined by each set of points.
a. (-5,87), (-1,7), (0, -3), (2, -II); b. (-5, -8.345), (-3, 1.756), (0, -2.003),
(1,7.984).
1. Find, by any method, the polynomial P.(x) which has the same values as x' at x = -I, 0, I, 3. Approximate 2' by evaluating P3(2) and estimate the error. What is the actual error? Approximate 2 5 by the Aitken-Neville processes using the given values of x and the corresponding values of y. 4. Find the polynomial equation y = pz(x) whose graph intersects the graph of y = sin x at x = 0, .,/4, .,/3. Use pz(x) to approximate sin (.,/6), sin (.,/2), sin 200. Estimate the respective errors and determine the actual errors. Find each of the required values by the Aitken-Neville processes from the given data.
Sa. Find the equation of the parabola which intersects the cosine curve at 100, 20 0, 400 (use a five-place cosine table). Calculate the value of cos 300 from the polynomial equation. What is the actual error? the predicted error? b. Same problem as a, but this time use the equation of the quintic which coincides with the cosine curve at 0 0, 100, 200, 400, 500, 600. c. Same problem as a, but this time use the equation of the parabola which coincides with the cosine curve at 20 0, 25 0, 35 0. 6. Find the missing entries and estimate their margins of error wherever possible.
x a.--y
=
e z/Z
I-I
i 0.6065
x_i_a
b. _ _ y = r/Z 11.0000
0
2
1.0000
2.7183
1.2
1.4
1.8221
2.0138
3
7
5 12.1825 1.6
1.8 2.4596
2.0
96
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
arcsin k
c.
r.'1 o
d.
6°
5°
d~
VI - k' sin ' ~
I
Day 1 Altitude of star 46°15'
1.5738 2
7°
8°
1.5767
1.5785
3
46°25'
4 47°02'
7. The following table is self-explanatory:
vx correct to: (I)
2 sig fig (2)
3 sig fig (3)
4 sig fig (4)
5 sig fig (5)
6 sig fig (6)
7 sig fig (7)
8 sig fig (8)
900 950 1000 1050 1100 1150 1200 1250 1300
30 31 32 32 33 34 35 35 36
30.0 30.8 31.6 32.4 33.2 33.9 34.6 35.4 36.1
30.00 30.82 31.62 32.40 33.17 33.91 34.64 35.36 36.06
30.000 30.822 31.623 32.404 33.166 33.912 34.641 35.355 36.056
30.0000 30.8221 31.6228 32.4037 33.1662 33.9116 34.6410 35.3553 36.0555
30.00000 30.82207 31.62278 32.40370 33.16625 33.91165 34.64102 35.35534 36.05551
30.000000 30.822070 31.622777 32.403703 33.166248 33.911650 34.641016 35.355339 36.055513
x
•• The positive square root of 930 is computed by linear interpoilltion to 2. 3..... 8 significant figures. respectively. by successive use of the entries in columns 2. 3... ·.8. At what point does the error inherent in linear interpolation exceed the rounding-off error? Obtain your answer by use of the appropriate formula and check it by evaluating v930 from as many entries as are necessary in the last column. b. Calculate V1010 from the entries in column 4. c. Calculate V1258 from the entries in column 6. d. Calculate V1034 from the entries in column 8. e. The following pairs of square roots are evaluated from the entries in column 7:
vi0i2. V1013; ViOi2.T. VlOI2.2; v'i0i2.i4. V1o'i2.i"S; V1012.136. VI012.1361.
V1012.1362;
V1012.13606.
VI012.13607;
VI012.137;
VI012.136064.
V1012.136065. At what point is it no longer possible to distinguish between the two values in a pair? How many significant figures do the entries in a table of square roots need to distinguish between the roots of the last pair? ... A table of natural sines to five decimal places is given with entries at one degree intervals. What is the maximum error of linear interpolation. both direct and inverse? b. Same as problem a. if entries are given for every minute. c. Same as problem a. if entries are given for every second. 9. Same as problem 8. if entries are given to ten decimal places.
3.7. EQUALLY SPACED POINTS; FINITE DIFFERENCES
to.
97
Same as problem 8, if a log sin table, to five decimal places, is used.
t t. Same as problem 8, if a log tan table, to five decimal places, is used. t2. Linear interpolation is inaccurate for log sin x for very small angles. What degree interpolation will suffice for interpolation in the range 10 < x < r if a five place table with entries at minute intervals is used?
t3. If y = f(x) has a continuous nth derivative, and x, approaches Xo , i prove lim [Xo:&l ••• x,,] = j1n'(xo)/nl. [Hint: use 3.6:8.]
=
I, 2, ... , n,
t... If y = f(x) has a ,. + 1 times, to be the [xo:&o ... X1Xl distinct.
••
continuous nth derivative, define [xoxo··· xo], where Xo occurs limit in the preceding example. Use this definition to define x"xt ...], where x, occurs n, times, i = 0, I, ... , k, and Xo , Xl , ••• Xt are
tSa. Form the complete divided difference table for the function Xi for the values x = I, I, 1,2,4,7. b. Form the complete divided difference table for the function V x - I for the values x = 5,5,5,10,17,17. t6. Find the polynomial equation y = p(x) of max-degree 3 whose graph intersects the graph of y = In x at x = 2, 5, and which is tangent to it at x = 1. [Hi,.t: use the divided difference table for x = I, 1,2,5.] t7. Find the polynomial of max-degree 4 which has third order contact with cos x at x = O. Compare your answer with the Maclaurin expansion of cos x.
3.7. Equally Spaced Points; Finite Differences. It frequently happens that the abscissas of the n + I points 3.6:2 are equally spaced, particularly when the y's are tabulated values of a function for successive values of the argument x. The points themselves will be called equally spaced when the abscissas are equally spaced. In these cases, the formulas of the preceding sections can be rewritten in more convenient forms. Let the notation be chosen so that Xo < Xl < ... < x".' and let the x's be equally spaced so that
i = 0, 1, ... , n - 1,
(3.7:1) say. Then
(3.7:2)
Xi
=
Xo
+ ih,
i = 0, 1, ... , n;
and
(3.7:3)
i, j = 0, 1, ... , n.
Divided differences are usually replaced by the more convenient finite differences when we work with equally spaced points. They are defined as follows: a first-order finite difference is defined by
(3.7:4)
98
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
a second-order finite difference is defined by
(3.7:5) and, in general, an rth-order finite difference is defined by
(3.7:6) Finite differences are more convenient than divided differences because they do not involve divisions. There is a finite difference table for finite differences analogous to the divided difference table discussed in Section 3.4. The general finite difference table will have the appearance of the array: Xo
Yo ..::IYo
x, Y,
..::IzYo ..::Iy,
Xz
..::1 3"0 ..::I.",
Yz ..::IYz
X3 Y3
For example, the finite difference table for the previously given data '\ 0.4
x Y =
e~
0.6
1.492
0.8
1.0
1.822 2.226 2.718
IS:
x
Y
0.4
1.492
0.6
1.822
..::Iy
..::I."
..::I 3y
0.330 0.074 0.404 0.8
2.226
0.014 0.088
0.492 1.0 2.718
A finite difference LlrYk in a finite difference table is a vertex of a triangle whose other two vertices are Yk and Yr+k . Each of the formulas 3.7: 13-15 below can then be interpreted as an expression for a vertex of this triangle in terms of the elements of the side opposite.
3.7. EQUALLY SPACED POINTS; FINITE DIFFERENCES
99
It follows directly from the definitions of the divided and the finite differences and from 3.7:3 that [xoxll = LJYo/h, [xoxlx21 = LJ2Yo /2!h 2; by induction it can be shown that -..., ... x ] _ .1'yo [x 17'"1 , rlh' .
(3.7:7)
Although finite differences for y's corresponding to nonconsecutive or nonequally spaced x's can be defined, they are rarely used and it is not necessary to express the more general divided difference 3.4:8 in terms of finite differences. However, the subscripts in 3.7:7 can all be raised (or lowered, if it is convenient to use negative subscripts) by an arbitrary integer, hence we can rewrite it in the more general form [ X12x 12+1 ... x 12+'] _- .1'YI2 rlh' ,
(3.7:8)
where a is any integer. It follows from 3.4:9 and 3.7:3 that (3.7:9)
1 r . -..., ... x] ~(-I)'-i Y. [x 17'"1 , h' i-O ~ ·I( - I·)1. • I r
Combining the last equation with 3.7:7, we obtain (3.7:10)
.1'Yo =
±
(-I)'-i
i-o
(~) Yi ,
r = 1,2, ... , n,
I
an expression for the rth-order finite difference in terms of the y's. This expression can be written in the symbolic form (3.7:10')
.1'Yo
= (-1 + y)"
r = 1,2, ···,n,
where (-1 + y), means the expression obtained by expanding (-1 + y)' by the binomial theorem and then changing the exponents on the y's (including the exponent 0) to subscripts. Conversely, to express y, in terms of the finite differences Yo , LJyo , ... , LJ'yo (we may regard Yo as a Oth-order finite difference), we eliminate Yo, Yl , ... , y,-l from the r + 1 equations obtained from 3.7:10 by putting r = 0, 1, ... , r in turn; we obtain (3.7:11)
r
= 0, 1, ... , n,
100
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
which can be put into the symbolic form (3.7:11')
Yr
=
(1
+ .dYYo ,
r
=
0, 1, ... , n.
In a similar manner we can obtain the formula (3.7:12)
r
=
0, 1, ... , n,
r
=
0, 1, ... , n.
which in symbolic notation becomes Yo = (-.d
(3.7: 12')
+ yy,
Formulas 3.7:10--12 can be slightly generalized by stepping up, or down, each subscript by the same integer. We obtain (3.7:13)
r
=
(3.7:14)
r
= 0, 1, ... , n;
(3.7:15)
r
= 0, 1, ... , n.
1,2, ... , n;
From formula 3.7:7 and the theorem in Section 3.6, we have immediately the corresponding: If Xo , Xl Yo, Yl' ... , y" y = a o alx THEOREM.
and
+
+ ... +
(3.7:16)
and conversely.
are equally spaced numbers 'With Xi+l - Xi = h, the corresponding y's determined by a"x", then
, •.• , X"
are
.d"yo = n!h"a,.;
3.B. POLYNOMIAL THROUGH n
+
101
1 EQUALLY SPACED POINTS
EXERCISE 3.7
t. Form the complete finite difference table for each of the following sets of numbers.
••
(-3,1.76),
b. (10, 7S.54),
c.
d.
xl
~I ~I
e.
(3,2.S9) (II, 95.03), (12, 113.10), 3.2
3.0
(13, 132.73) 3.4
-3.025
- 3.000
-2.965
-2
-1
0
yl
Xl
(0,0),
0.S102
0.S059
9.1
~12.43
3.S
3.6 -2.922
-2.S74 2
0.8025
0.S036
0.S019
9.2
9.3
9.4
9.5
9.6
2.47
2.49
2.46
2.44
2.45
1. Obtain the values of log sin x from a five-place table; then form the complete finite difference table for log sin x for each of the following sets of values of x: •• 20°,40°, 60°, SO°, 100° b. 2",4°, 6°, So, 10° c. So, SOlO', S020', S030', S040' d. So, SOl:, S02', S03', S04'. e. Discuss the effecta of polynomial approximation errors and rounding-off elrors on the entries of the tables. 3. Derive the identity 3.7: 10 directly from the definitions 3.7:4-6, that is, without using divided differences.
3.•. Polynomial through n + 1 Equally Spaced Points. In this section we obtain the expressions for the polynomials through n + I points when the latter are equally spaced. Although the preceding formulas can be used, the new expressions will be simpler. When we deal with equally spaced points, it is frequently advantageous to replace the variable x by a variable u linearly related to x by the equation
(3.8:1)
or
u
1
= h (x -
xo)'
Hence
(3.8:2)
x-
Xt
= (u -
i) h,
i = 0, 1, ... , n.
If we substitute the values given by 3.7:3 and 3.8:2 in the Lagrange coefficient 3.3:2, we obtain, after simplification,
(3.8:3)
Li(X)
=
.H
(-1)
u(u - 1) ... (u - i
+
1)(u - i - I ) ... (u - n) il(n _ i)1 '
i = 0, 1, "., n;
102
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
or
i = 0, I, ... , n.
(3.8:4)
The Lagrange interpolation formula then becomes
(3.8:5)
Y
u )n
+ I) (n + 1 ~
= (n
( -I )n-i
u_ i
(n)i Yi·
Note that this form of the interpolating polynomial through the n + 1 equally spaced points cannot be used for u = i because of the presence of u - i in the denominator; we know, however, that y = y., for u = U i . EXAMPLE 1.
Find the value of eo.? from the following set of values:
_x_/ y
Here, yields
Xo =
=
e'l
0.4
_0_.6_ _ 0._8_ _ __
1.492
0.4, h = 0.2,
x =
1.822 2.226 2.718
0.7,
U =
I,
n =
3. Formula 3.8:5
1.5) 3 (_I)H (3 y=4 ( 4 ~1.5-i i)Yi=2.014,
which is correct to four significant figures. Extensive tables have been prepared which list the values of Li(x) for various ranges of U and n (see, for example, Natl. Bur. Standards, "Tables of Lagrangean Interpolation Coefficients," Columbia Univ. Press, New York, 1944). The use of these tables greatly facilitates the process of interpolation. We next obtain the equation of the polynomial through the n + 1 equally spaced points in terms of finite differences. It follows at once from 3.8:2 that
(3.8:6)
(x - xo)(x - Xl) ... (X - X,_l)
= u(u - I) ... (u - r = rl (:) hr,
+ I) hr
r = 1,2, ... , n
+ 1.
Using this and 3.7:7 in 3.4: 17, we find that
(3.8:7)
Y
n . (U).. = ~.1·Yo
i-O
'
We also have from 3.7:3 that (x - xa)(x - xa+l) ... (x - Xa+,_l)
(3.8:8)
=
(u - a)(u - a-I) ... (u - a - r
+ I) hr
r= I,···,n-a+ 1.
3.S. POLYNOMIAL THROUGH n
+
1 EQUALLY SPACED POINTS
103
Using this and 3.7:8 in that form of the interpolating polynomial generated by the sequence chain 3.4: 13, we obtain (3.8:9)
(U -
n
=
Y
k.1 iYn_i
n
+. i-I) •
i-O
'
In a similar manner we derive the formulas below from the formulas 3.8:8, 3.7:8, and 3.4:14, 15 for n = 2m: (3.8:10) Y
=
~ 2' ~.1 IYm_i
m - 1+
(U -
2i
i-O
~.1 m
2' I
2i
Ym-i
(U -
m
2i
+ i)
+ ~.1 m
and from 3.4:14', 15', for n = 2m (3.8:10') _ Y -
m - 1+
(U -
2i _ 1
i) .'
i-I
(3.8:11) _ Y -
i) + ~ ~.1 I-Ym+1_i
mI' A2i (U - m 2i- + ') ~ ~ Ym-i ~
(U -
2i-1
Ym-i
m - 1+
2i _ 1
i) .'
+ 1, m+l
~
+ ~~
(U Ym+1-i
A2i-1
m-
2i -
1
. + ') .' 1
(3.8:11') _ Y -
m I ' .12i (U - m 2i- + ') Ym+1-i
~
-4 1=0
The variables Xo , Xl , in the respective orders
... , Xn
XO '
xI
Xn ,
Xn _ 1 , .. ',
,
... ,
Xn ; Xo; X m +2
, ... , X n ,
Xo;
Xn;
Xm+l ,
Xm+l , Xm_ l ,
X m - 2 , ••• , X o , X m +2,
Xn;
,
X m +2 ,
X m _ l , ••• , X n ,
Xm+ l ,
,
Xm_ l ,
Xm ,
Xm+l,
appear in formulas 3.8:7, 9-11, 10'-11'
Xm_ l ,
Xm , Xm
m I ' ~ .12i+1 (U - 2im+- I + ') . + 1=0 -4 Ym-i
Xm
... , X o ,
XO'
Formula 3.8:7 is known as Newton's Interpolation formula with forward differences; formula 3.8:9 is known as Newton's Interpolation formula with backward differences; the remaining formulas are known as the Gauss' formulas or central difference formulas. We wish to stress the fact that for a given n, Eq.3.8:7, 9-11 (or 10' and 11') are only different forms of the same polynomial through
104
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
the n + 1 points 3.6:2. Why, then, do we bother with this multiplicity of forms? We postpone the answer for a moment and turn first to the equation for the magnitude of the error. The magnitude of the error in the general case was given in formula 3.6:7. If in that formula we use 3.8: 1 and 3.8:6, we obtain the following expression whose absolute value is an upper bound of the magnitude of the error for equally spaced points, (3.8:12) where, as before, X is a value between the smallest and largest of the numbers Xo , Xl , ... , Xn , X' and where u = (x' - xo)/h. Let us again remark that consideration should be given not only to the error above inherent in polynomial approximation but also to the computational errors due to the use of inexact values of the coordinates of the n + 1 points and to those that accumulate in the process of computation. Formula 3.8:12, like formula 3.6:7 from which it was derived, is meaningless if the (n + l)st derivative does not exist. We recall that the expression 3.6: 11, which may be rewritten as (3.8:12') can then take the place of 3.8:12. We illustrate the use of the preceding formulas by an example. The values of y = sinh x for x = 1.50, 1.60, "',2.60 are taken from a table of hyperbolic sines. We wish to compute the values of sinh 1.52, sinh 2.03, sinh 2.54. We form first the finite difference table on the next page. (In practice, it is usual to omit the decimal point and the zeros in front of the first significant figure in writing the numbers in the difference columns.) We use 3.8:7 for the computation of sinh 1.52; we have x' = 1.52, Xo = 1.50, h = 0.1, u = 0.2, n = 5; (i) = 0.2, Gt) = -0.08, (3) = 0.048, (4) = -0.0336, = 0.025536; whence
m
sinh 1.52
= 2.12928 + 0.2(0.24629) - 0.08(0.02377) + 0.048(0.00271) -0.0336(0.00026)
+ 0.025536(0.00003)
= 2.17676. The answer is correct as far as it is written.
3.8. POLYNOMIAL THROUGH n
Ay
sinh x
x
+
105
1 EQUALLY SPACED POINTS
A2y
A8y
Aty
Aiy
1.50 2.12928 0.24629 0.02377
1.60 2.37557 0.27006
0.00271 0.02648
1.70 2.64563 0.29654 1.80 2.94217 3.26816
2.00
3.62686
0.00326 0.03271
0.35870
0.00359
0.39500
0.00395
0.43525
0.00435
0.47985
5.46623
-0.00001
0.00482 0.00046 0.00528 0.05470
0.58397 2.50 6.05020
0.00007 0.00047
0.04942 0.52927
2.40
0.00004 0.00040
0.04460
2.30 4.93696
0.00003 0.00036
0.04025
2.20 4.45711
0.00004 0.00033
0.03630
2.10 4.02186
0.00003 0.00029
0.02945 0.32599
1.90
0.00026 0.00297
0.00012 0.00058
0.00586 0.06056
0.64453 2.60
x'
6.69473
We use formula 3.8:9 for the evaluation of sinh 2.54. We have = 2.54, xo = 2.10, h = 0.1, u = 4.4, n = 5; sinh 2.54 = 6.69473
+ 0.64453 (-~.6) + 0.06056 (°24) + 0.00586 Cj4)
+ 0.00058 (244) + 0.00012
et)
= 6.30039. The result is in error by one unit in the last decimal place. If we omit the suspicious last term (just why it is suspicious will develop later), we get the value 6.30040 which is correct to all five decimal places. Finally, we compute sinh 2.03 by use of formula 3.8: 10' (formula 3.8:11' may also be used). We have x' = 2.03, xo = 1.80, h = 0.1, u = 2.3, n = 2m + 1 = 5; sinh 2.03 = 3.62686 + 0.39500 (Oi 3) + 0.03630 3) + 0.00395 (l j3)
(°2
+ 0.00036 C43) + 0.00004 e53) = 3.74138.
106
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
The last term can be omitted without affecting the answer which is correct to six figures. We compute sinh 1.8276 as an additional illustration. We use formula 3.8: 10' again with x' = 1.8276, Xo = 1.60, h = 0.1, u = 2.276, n = 2m + 1 = 5; we obtain sinh 1.8276 = 2.94217
+ 0.32599 (;76) + 0.02945 (;76)
+ 0.00326 (;76) + 0.00029 (;76) + 0.00004 e·~76) = 3.02909. The correct result to five decimal places is 3.02907. The solutions of the preceding examples require some further explana- . tions in answer to some questions which undoubtedly have arisen in the minds of some readers. Why was the finite difference table truncated at the column of fifth differences? Or, what is essentially the same question: why was a polynomial of degree 5 used? Why should the entry 0.00012 have been suspicious? Which entry should be called xo? Which formula should be used? We endeavor to answer these questions in turn. We recall the theorem given at the end of Section 3.7 concerning the differences of a polynomial and also the statement that in evaluating a function f(x) at x = x' by computing Pn(x'), where Pn(x) is the approximating polynomial of max-degree n, there are two principle sources of error, first, the inherent error found in all polynomial approximation and, second, the computational error due to inaccurate data and the accumulation of errors of computation. One expression for the inherent error was given in formula 3.8: 12; an upper bound for the computational error is usually readily found. Let us suppose, as in the data given for the examples just worked out, that the entries for f(x) are all given to the same number of decimal places and that each is correct as far as it is written. Then the error in each y is at most one-half unit in the last decimal place, the error in each Lly is at most one unit in the last decimal place, the error in each Ll2y is at most two units in the last decimal place; in general, the error in each Llry is at most 2r - 1 units in the last decimal place. Now, if we use formula 3.8: 12 for the data given above, taking n = 5 and various values for u, it develops that the absolute value of the inherent error is less than one-half unit in the sixth decimal place. On the other hand, the computational error may be as large as 16 units in the column of fifth differences. Inspection of the preceding difference
3.8. POLYNOMIAL THROUGH n
+
1 EQUALLY SPACED POINTS
107
table confirms these observations and explains why the table was truncated at the column of fifth differences. The entries in that column were more or less erratic but fairly constant implying that in the use of a fifth degree polynomial, the inherent error will be negligible compared to the computational error. (A similar reason explains why ordinary or linear interpolation is usually adequate in the use of the ordinary trigonometric tables.) We conclude from the preceding observations that a difference table should be carried out until a column is reached in which the entries are more or less constant (but read the remarks further on on page 113). The last column will determine the degree of the polynomial to be used. An entry in the last column which deviates greatly from the other entries should be avoided if possible. The deviation is usually due to rounding-off and computational errors and may result in an error slightly larger than necessary. This is why the entry 0.00012 was suspicious in the table on page 105. We present the two difference tables below to illustrate the relation between the number of decimal places and the degree of the approximating polynomial. Each was carried out until a column of more or less constant entries was obtained. To obtain a value for sinh x with a precision approximately equal to the precision of the given values, a polynomial of degree 3 should be used in the first case and one of degree 8 in the second. We also observe that the number of the column of (more or less) constant differences will also depend on the size of the argument interval h; the reader should construct examples to illustrate this relation. In general, we find that for a given function and for a. given range of the argument, the smaller the argument interval and the fewer the number of significant figures required, the smaller will be the degree of the interpolating polynomial necessary. We turn next to the choice of the entry to be called Xo • In the examples worked out above, we chose six points quite arbitrarily provided only that Xo < x' < X5 , where x' was the value of the argument for which we were interpolating. There was no compulsion about the choice of Xo , indeed, it was not necessary to satisfy the preceding inequality although it will develop that greater precision will result if it is satisfied. However, it is convenient for the sake of simplicity and greater precision to rewrite formulas 3.8:7, 9-11,10', II' by introducing a new variable t and raising or lowering all subscripts in such a manner that the two arguments in the table that bridge x' are called Xo and Xl when we use forward differences (or when we use a central difference formula that starts with a forward difference) and X-I' Xo when we use backward differences (or when we use a central difference formula that starts
108
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
x
sinh x
.:Iy .:Iay.:lay
1.50 2.129 247 23
1.60 2.376 270 1.70 2.646
3 26
296 1.80 2.942
4 30
326 1.90 3.268
3 33
359 2.00 3.627
3 36
395 2.10 4.022
4 40
435 2.20 4.457
5 45
480 2.30 4.937
4 49
529 2.40 5.466
6 55
584 2.50 6.050
6 61
645 2.60 6.695
x
sinh x
.:Iy
.:lay
.:lay
.:I'y
.:I 6y
.:Ily
.:I7y .:lay
1.50 2.129279455 246288498 1.60 2.375567953
23775483 270063981
1.70 2.645631934
2702890
296542354 1.80 2.942174288
2967897 29446270
325988624 1.90 3.268162912
32708872
2.00 3.626860408
327364
36298838
363291
40252095
2.20 4.457105171 2.30 4.936961806 2.40 5.466229214 2.50 6.050204481
70 492
4953 53016
547535 5844621
60552480 644527747
4461
494519
54707859 583975267
422
48063
5297086
19
4039
446456
49410773
35 403
43602
4802567
529267408
3636
402854
44608206
61 368
39563
4356111
479856635
307 3268
35927
3953257
435248429
2961 32659
3589966
394996334 2.10 4.021856742
29698 294705
3262602
358697496
2.60 6.694732228
265007
26478373
3.8. POLYNOMIAL THROUGH n
+
109
1 EQUALLY SPACED POINTS
with a backward difference). The successive arguments of the table are then named ... , X_a, X_B , X_I' X o , Xl , X B , •.• , respectively. Formula 3.8:7 is rewritten as (3.8: 13)
where x' = Xo + th, or t = (x' - xo)/h. The only change has been the renaming of the variable u. For the revision of formula 3.8:9, we put t = u - n + 1, whence X = Xn - l + tho We also have
If in 3.8:9 we replace the binomial coefficients by their equivalents from the preceding identity and reduce all subscripts by n, we obtain (3.8:14)
where x' = X-I + th, or t = (X' - x_l)/h. Formulas 3.8:10 and 3.8:10' can be coalesced. We put, in either case, t = u - m and reduce the subscripts by m. We obtain (3.8: 15)
Y
[nIB]
= ~
.
.:jB·Y _ i
(t - 2·1 + i) + I
i-O
[("+1)/B].
~
.:jB.-IYI _ i
(t -2·1_+1i) ' I
i-I
where X = Xo + th, or t = (x - xo)/h, and where [n/2] means the largest integer not greater than n/2, etc. Formulas 3.8: 11 and 3.8: 11' can also be coalesced. In the first case, put t = u - m + 1, and after substitution reduce the subscripts by m; in the second case, put t = u - m, and after substitution reduce the subscripts by m + 1; in either case we get (3.8:16)
_
Y-
[ .. /B] ~ ABi
~~
;-0
Y-i
(t - 1 + i) + [(.. 2· ~
+1)/B] ~ A2i-1
'
i=1
~
Y-i
(t - 2 + i) 2· - 1
'
'
where X = X_I + th, or t = (X - x_l)/h. It should be carefully noted that whereas formulas 3.8:7, 9-11, 10', 11' all represent the same polynomial, formulas 3.8:13-16 will yield in general different polynomials since they represent polynomials through different sets of points. It should also be noted for future use that two polynomials given by the latter (or equivalent formulas) will be identical if, whatever the notation, the highest order differences
110
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
occuring in each are identical. This is important because it may be convenient to raise or lower the subscripts for some purposes. Thus, if the final term of one polynomial involves J6Y _ 2 and the final term of another polynomial involves J5y8 , but if J5Y _2 and J6Y8 represent the same entry in the difference table (implying, of course, that different entries were named Xo in the two cases), then the two polynomials are identical. The notation of the last group of four formulas was chosen in such manner that the variable t always equals the difference between the argument for which we are interpolating and the preceding argument in the table, divided by the tabular difference between two successive arguments; hence 0 :::;;; t < 1. We have thus answered our question concerning the argument to be called Xo' It is the argument in the table that precedes x' when we use a formula that starts with a forward difference, 3.8:13 or 3.8:15, and the argument in the table that follows x' when we use a formula that starts with a backward difference, 3.8:14 or 3.8:16. We move on to the question of which formula to choose. We see that we have no choice for the calculations of sinh 1.52 and sinh 2.54 in the examples worked out above provided that we use the formulas in terms of t and only the information given in the table on page 105. Formula 3.8:13 must be used for the computation of sinh 1.52 since we do not have the necessary finite differences for the other formulas; similarly, formula 3.8: 14 must be used for the computation of sinh 2.54. However, either one of these two formulas or either one of the central difference formulas 3.8: 15 and 3.8: 16 can be used for the computation of sinh 2.03. Which one? Inspection and study of the error term3.6:7 is the most convenient form-indicates that since the factor pn+1l(X)j(n + I)! is not apt as a rule to vary considerably with the choice of x' within the interval from Xo to Xn , the magnitude of the error will depend on the productg(x' ) = (x' - Xo)(x' - Xl) ... (X' - x n ). The particular equations y
=
(x
+ 3)(x + 2)(x + I) x(x -
I)(x - 2)(x - 3)
= x(x2 - 1)(x2 - 4)(x 2 - 9), Y
=
(x
+ 3)(x + 2)(x + I) x(x -
I)(x - 2)(x - 3)(x - 4)
= x(x2 - 1)(x2 - 4)(x2 - 9)(x - 4), indicate the behavior of the polynomial in the general case. Their graphs, drawn in Fig. 3.8:fl, show that for a random choice of x'
3.8. POLYNOMIAL THROUGH n
+
1 EQUALLY SPACED POINTS
111
within the interval from Xo to Xn the product g(X') will tend to be smaller when x' is chosen in the middle rather than at an end of the interval. It is not necessary to state the facts more precisely; these considerations indicate that the product (x' - xo) ... (x' - xn) will be numerically least when for a given x' ::f=. Xi , the argument Xo is so chosen that x' lies in the middle interval or in one of the two middle intervals.
y
y
700 300
600 500
200
400 300 200
·200 -300 -200
-400 -500 -600
-300
y = x(x 2 -IJ(x 2 - 4)(x 2 -9J(x-4)
FIG. 3.8:f1.
As a consequence, one of the central difference formulas will usually give the best results and should therefore be used. We now see too why it was necessary to develop the multiplicity of forms for the interpolating polynomial. Before we close this section we derive some new expressions for the polynomial through n + 1 equally spaced points that are advantageous
112
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
for some special applications. If n is even, say n = 2m, formula 3.8: 15 may be written as _ y - Yo
1.12• (t - 2i1 + i) + .12.-1Yl-. (t 2i- -1 +1 i) I\' +~ ~ I y-.
.-1
or (3.8:17)
The last expression is known as the Newton-Stirling formula; it involves even order differences and the averages of odd order differences. Similarly, if n = 2m + 1, formula 3.8:15 may be rewritten as (3.8:18)
_ ~ (t - 2i1 + i) fl"1~(.12··Y-. + .12') t -I .12 ·Yl-. + 2i + 1
y - ~
i+l
I
Y-• . '
This expression is known as the Newton-Bessel formula; it involves odd order differences and averages of even order differences. Formula 3.8:15, n = 2m + 1, may also be rewritten as (3.8:19)
This expression is one form of the so-called Laplace-Everett formula; its virtue is that it involves only differences of even order. REMARKS. We conclude this section with some remarks and observations on interpolating or approximating polynomials. Let y = f(x) be a [a, b]. (single-valued) function defined throughout the interval I Let
=
(3.8:20)
be the sequence of polynomials whose general term Pn(x) is the polynomial of max-degree n determined by the n + 1 points
equally spaced in the interval I so that the first abscissa is a and the last is b. The sequence 3.8:20 is called the polynomial interpolation sequence for f(x) in the interval 1. This sequence is analogous to the
3.8. POLYNOMIAL THROUGH n
+
1 EQUALLY SPACED POINTS
113
sequence of polynomials given in 2.3:5, but there is one important difference. In the earlier case, the polynomial Pn(x) was precisely the polynomial Pn-l (x) plus the term an (x - xo)n; no such simple relation exists between Pn(x) and Pn-l(X) in the present case and hence there is no simple transition from the infinite sequence to an infinite series. Let x' be in the interval 1. The polynomial interpolation sequence is said to converge to f(x) at x = x' if the sequence of constants
Pl(X'), P2(X'), ... , P..(x'), ... , converges to f(x'). The polynomial interpolation sequence is said to converge to f(x) throughout the interval I if it converges to f(x) at each point of the interval. The general theory of the convergence of polynomial interpolation sequences is beyond the scope of this text; we content ourselves with the remark that the convergence of the polynomial inte~polation sequence implies that the error term, 3.8:12 or 3.8:12', approaches zero as n tends to infinity. Or, in other words, the convergence of the polynomial interpolation sequence implies that if n is sufficiently large, the corresponding difference table will certainly contain a difference column whose entries are mote or less constant (assuming that computational errors are negligible). In the preceding observations, it was supposed that the points were all contained within a given interval I, hence as the number of points increased, the distance h between two successive points necessarily decreased. There is a corresponding theory for the case where h is kept fixed and I is made to increase with increasing n; but again, this study is beyond the scope of this text. It may be of interest to know some of the reasons the polynomial interpolation sequence fails to converge either at a point or uniformly throughout an interval. Since the graph of a polynomial is of a very special type, it cannot accomodate itself to certain peculiarities of the graphs of some functions. Thus, if f(x) or its graph is periodic or almost periodic, if it has a discontinuity, an asymptote, or a vertical tangent, or if its slope increases very rapidly with increasing x, to mention only some of the possibilities, it is not reasonable to expect a polynomial to be a good approximation to the function except over a very small range. We give several examples to illustrate the phenomenon of nonconvergence; note that the difference tables do not and will not contain columns of more or less equal numbers. The reader will find it instructive to calculate approximating polynomials for the various examples, interpolate for certain values of the functions, and then compare his answers with the results obtained directly from the functions.
114
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
EXAMPLE
1.
Periodic function, y = sin(x
x
y
..::Iy
..::I."
..::I 3y
+ i)1T. ..::ICy
0 -2 -I
4 -8
2 -4
2
16
-2 3
-I
8 -16
4 2
-8 -4
4 -2 5
EXAMPLE
2.
-I
Discontinuous function, y = 1/(2x
x
y
-3
-0.2000
-2
-0.3333
-I
-1.0000
0
1.0000
..::Iy
..::Ily
+ 1).
..::I 3y
..::I 4y
-0.1333 -0.5334 -0.6667
3.2001 2.6667
2.0000
-5.3334 -2.6667
-0.6667 0.3333 0.2000
3.2001
0.1429
-3.6573 -0.4572
0.0762 -0.0571
3
8.5335
0.5334 -0.1333
2
-8.5335
3.8. POLYNOMIAL THROUGH n
+
1 EQUALLY SPACED POINTS
115
3. Asymptotic function, y = 1/( I + x 2 ). This function has received consideral attention in the literature.
EXAMPLE
x
y
.dy
.d1y
.day
.d'y
.diy
-4 0.0588 0.0412 -3 0.1000
0.0588 0.1000
-2 0.2000
0.1412
0.3000 -I
0.5000
0
1.0000
I
0.5000
-0.1412
0.2000
-1.2000
0.2000 -1.2000
0.5000 -1.0000 -0.5000
3.6000 2.4000 -3.6000
1.2000 -1.2000
0.2000 -0.3000
2 0.2000
-1.0588
0.0000
0.0000
-0.1000
1.0588 -0.1412
0.2000 0.1412 0.0588
3 0.1000 -0.0412 4 0.0588
EXAMPLE
4. x
Function with vertical tangent, y = {ix. y
-4
-1.5874
-3
-1.4422
.dy
.dly
.day
.d'y
.d'y
0.1452 0.0371 0.1823 -2
-1.2599
0.0405 0.0776
0.2599 -I
-1.0000
0
0.0000
0.7401 1.0000
1.4422
4
1.5874
0.0000 -0.7401
-0.7401 0.2599
3
1.4026 1.4026 -2.0246
0.6625 -0.0776
0.1823
-0.6220 0.0405
-0.0371 0.1452
1.4026
-0.740\
1.0000
1.2599
-2.0246 -1.0426
0.0000
1.0000 2
0.6220 0.6625
116
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
EXAMPLE
x
5.
Function with rapidly increasing slope, y = rl. y
1.0
2.718
1.1
3.353
..:Iy
..:I1y
..:I'y
..:I1y
..:Ily
..:Ily
..:I 7y
0.635 0.233 0.868 1.2
4.221
0.097 0.330
1.3
5.419 7.099
1.5
9.488
1.6
12.936
1.7
17.993
1.8
25.534
1.9
36.966
2.0
54.598
2.1
82.269
2.2
126.469
2.3
198.343
2.4
317.348
2.5
518.013
0.020
0.482 1.680
1.4
0.055 0.152
1.198
0.075 0.227
0.709 2.389
0.123 0.350
1.059 3.448
0.077
0.550
0.125
0.875
7.541
0.370
2.309
0.883 2.004
0.770 1.653
3.657
11.145 8.312 19.457
1.450 3.103
6.760 15.072
47.131 119.005
0.390
1.121
4.655
27.674 71.874
0.493
2.651 6.490
44.200
0.235
0.628
3.839
16.529
0.095 0.258
1.530
10.039 27.671
0.163
0.902
6.200 17.632
0.081
0.207
1.407
11.432
0.034 0.082
0.532
3.891
0.019 0.048
0.325
2.484
0.001 0.029
0.200
1.609 5.057
0.028 0.048
34.529 81.660
200.665
EXERCISE 3.8
t. Find, from a table of square roots or otherwise, Vx correct to four decimal places for x = 400, 402, 404, 406, 408, 410. Find, by interpolation, V401, v405.2, V409.25. Estimate the errors of the approximations and determine the actual errors. 2. Copy the values of tan x from a five-place table for x = 20°, 25°, 30°, 35°, 40°, 45°,50°,55°,60°. a. Use an appropriate finite difference formula and as many of the above values as are necessary to find tan 21 ° to five decimal places. b. Find tan 42" by use of three different formulas.
3.9. EXTRAPOLATION
117
3. Use appropriate finite difference formulas and as many entries as are necessary from the corresponding tables below to find the required values as precisely as possible. a. Find lOOe-e.oz, lOOe- B.33 , lOOe-B.U6. b. Find the values of y for x c. Find the values of y for x
= 1.371, 1.403, 1.468, 1.4296. =
O.oI 1,0.019, 0.028, 0.0193, 0.0117,0.0284,0.02015.
d. Find the values of 1= 2/vwf:e-t"dtforx = 0.13,0.41,0.92,0.137,0.149, 0.925,0.1371,0.4192,0.9258. e. Find fo{2.015), fo{2.381), fo{2.407), fo{2.926); ].(2.115), J,(2.507), J,(2.604), J,(2.834).
b
a x
lOOe-z
6.0 6.1 6.2 6.3 6.4 6.5
0.2479 0.2243 0.2029 0.1836 0.1662 0.1503
x y=tanx
1.37 1.38 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47
4.9131 5.1774 5.4707 5.7979 6.1654 6.5811 7.0555 7.6018 8.2381 8.9886 9.8874
c x
0.0100 0.0125 0.0150 O.oI 75 0.0200 0.0225 0.0250 0.0275 0.0300
y
=
e
d (I +x)-ZO
0.819544 0.780009 0.742470 0.706825 0.672971 0.640816 0.610271 0.581251 0.553676
x
I
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
0.00000 0.11246 0.22270 0.32863 0.42839 0.52050 0.60386 0.67780 0.74210 0.79691 0.84270
x
fo{x)
].(x)
2.0 0.2239 0.5767 2.2 0.1104 0.5560 2.4 0.0025 0.5202 2.6 -0.0968 0.,4708 2.8 -0.1850 0.4097 3.0 -0.2601 0.3391
4a. Estimate the error due to linear interpolation in the several parts of example 3. b. How can one determine if linear interpolation is adequate for a given table? 5. Where possible, do example 3 using Lagrange coefficient tables.
6. Derive formulas 3.8; 17-19.
3.9. Extrapolation. In all of the examples of the previous section, a functionf(x) was calculated for an argument x' which was between the smallest and largest arguments in the table used. The process of calculating f(x' ) where x' is smaller than the first argument or larger than the last argument of the table is called extrapolation. When x' is smaller than the first argument of the table, we name the first argument Xo and use the forward difference formula 3.8:7; when x' is larger than the last argument of the table, we name the last argument Xn and use the backward formula 3.8:9. In either case, the factor (x - xo)(x - Xl) ... (x - x n ) in the error term and consequently the error term itself grows rapidly in magnitude as the interval between x' and the nearest entry of the table increases.
118
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
1. Compute sinh 1.32 from the difference table on page 105. We use formula 3.8:7; we have x' = 1.32, xo = 1.50, h = 0.1, u = -1.8, also = -1.8, = 2.52, = -3.192, = 3.8304, = -4.443264. Hence EXAMPLE
m
m
m
m
m
sinh 1.32 = 2.12928 - 1.8(.24629) + 2.52(.02377) - 3.192(.00271) + 3.8304(.00026) - 4.443(.00003) = 1.73807.
The result correct to five decimal places is 1.73814. 2. Compute sinh 2.70 from the same table. This time we use formula 3.8:9; we have x' = 2.70, xo = 2.10, h = 0.1, u = 6, n = 5; (1£1") = (U-~+l) = (U-~+2) = (U-~+3) = (U-~+4) = I, whence EXAMPLE
sinh 2.70
= 6.69473 + 0.64453 + 0.06056 + 0.00586 + 0.00058 + 0.00012 = 7.40638.
The result correct to five decimal places is 7.40626. Had we used the larger table on page 108, we would have obtained 7.406263142. The two italicized figures are incorrect; they should be 06. EXERCISE 3.9 Extrapolate for the values below by using appropriate finite difference formulas and the tables from the corresponding examples of Exercise 3.8. Estimate the error in each case and, where possible, determine the actual error.
1. v'395, v'399, v'412, v'415. 2. Tan 15°, tan 18°30', tan 61°10', tan 70°15'. 3a. lOOe-', lOOe-I.8, lOOe-I.I, lOOe-I.711.
b. Tan 1.35, tan 1.367, tan 1.475, tan 1.5. c. (I + x)-ao for x = 0.009,0.04,0.05. d. I for x = 1.1, 1.3, 1.5, 2. e. 10(1),10<1.5),10<1.9),10(3.1),10(3.5),10<4.0); U1.95), U1.98), U3.02), 1.(3.15).
3.10. Subtabulation. It is frequently desirable and sometimes necessary to extend a table of values of a function to include values intermediate to those already tabulated. For example, it may be desirable to extend a table giving sin x at intervals of one degree to a table giving sin x at intervals of one second. The process of this inserting new entries in a table is called subtabulation.
119
3.10. SUBTABULATION
To be definite, suppose it is desired to extend a table giving values of y
(3.10:1)
= f(x)
for successive x's that differ by the amount h to a table giving values of the function for successive x's that differ by the amount H, where (3.10:2)
H
=
h
q a positive integer.
q'
In one sense the problem has already been solved. Indeed, if Xo and Xl are two particular arguments, the values of f(x) to be interpolated can be found from several of the formulas of the preceding section, for example, formula 3.8:13, by taking t = l/q,2/q, ... , (q - I)/q, in turn. In this connection, we draw particular attention to formula 3.8: 18, which becomes if t =
-t,
".
(3.10:3)
.
1
2·) ti (' -2i "!) "2"l( A2·'Y + A'Yl-t .
Y = ~
LI
-i
LI
The successiye differences that appear in this formula fall in every other column of the difference table and are in the same horizontal rows as the entries Yo = f(x o), Yl = f(x 1 ). The formula is then especially effective for interpolating to half intervals and should be used whenever possible. To lessen the labor of computation even further, we give in the table below the values of the binomial coefficients occurring in the formula for i = I, ···,6:
1
- "8 2 3
4 5
6
=
-0.12500 00000
3 0.02343 75000 128 5 - = -0.0048828125 1024 35 0.0010681152 32768 63 - 262144 = -0.0002403259 231 4194304
0.00005 50747
120
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
All the fractions and the first three decimals are exact, the last three decimals are rounded-off numbers. Although, as we have remarked above, the problem of subtabulation may be considered solved, another method of attack is far more expeditious when a great many new entries are to be added to a table. We use small letters, Xi' Yi = !(Xi)' to represent the entries in the original table and capital letters, Xi' Y i = !(Xi ), to represent the entries in the enlarged table. Specifically, we fix on some particular argument to be called Xo and put
(3.10:4)
Xl =
Xo
+ h-q =
X2 =
Xo
+ -2hq =
Xo
+ H,
Xo
+ 2H,
m ·H, X i=XO+-=xo+' q
so that
(3.10:5)
and (3.10:6) (3.10:7)
Y; = !(Xi ),
i = 0, 1,2, ... , k = 0, 1,2, ....
The first method of subtabulation was a process in which Yo, Y I , Y 2 , ••• , were calculated directly from Yo , YI , Y2' ... , and their differences; in the present method, the differences of Yo, Y I , Y 2 , ••• , will first be calculated and then Yo, Y 1 , Y 2 , ••• , will be computed from them. The advantage of the second method lies in the great saving it affords in computational labor when new entries are to be added in a wholesale fashion. We form first, from the original entries, a difference table beginning
3.10. SUBTABULATION
121
with Yo , Llyo , etc.; suppose that (for some fixed n) the nth-order differences are more or less constant (at least for a certain range). We then solve for LI Yo, Ll2Yo , Llsyo , ... , in terms of Yo, Llyo, Ll2yo , .... Note carefully that LI Yo, Ll2Yo , ... , refer to differences formed from the enlarged table whereas Llyo, Ll2yo, ... , refer to differences formed from the original table. We have, using formula 3.8: 13, and writing Q for l/q,
i = 0, 1,2, ....
(3.10:8)
We now use formula 3.7:10 in the form r
.1ryo
= ~ (-I)'-i (~) i=O
Yi ,
r = 1,2, ... , n,
I
to obtain
or
= 1,2, ... , n.
r
It can be shown, however, that (3.10:9)
for j
< r;
consequently the preceding double sum may be abbreviated to r = 1,2, ... , n.
(3.10:10)
We calculate LlYo , Ll2YO ' ••• , from the preceding identity by taking r = 1,2, ... , in turn, and then find Y 1 , Y 2 , •.• , by additions using the relations
= .1Y1 = Y1
Y2
=
+ .1 Yo , .1 Yo + .1 2 Y O ' Y 1 + .1 Y 1 , Yo
122
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
We use the relations 3.10:7 as a check not only for ordinary arithmetic mistakes but for errors due to rounding-off, computation, etc.; as soon as there is a discrepancy which may affect the precision of the desired results, a new set of differences must be computed. Because of the piling up of computational errors, it is usually advisable to use several decimal places more in the actual calculations than are required in the final entries. As an illustration of the method of subtabulation, we extend that portion of the table of square roots which begins:
x
300 301 302 303 304 305
y =
vi
17.3205081 17.3493516 17.3781472 17.4068952 17.4355958 17.4642492
by inserting the square roots of 300.1, 300.2, ... ; we desire the answers correct to five decimal places. We carry out the subtabulation by a two-step process, first, we subtabulate for the square roots of 300.2, 300.4, ... , and then we will find the square roots of the remaining numbers. The difference table determined by these values is:
x
y
300
17.3205081
301
17.3493516
Ay
Aly
A3y
288435 -479 287956 302
17.3781472
303
17.4068952
304
17.4355958
305
17.4642492
3 -476
287480
2 -474
287006
2 -472
286534
123
3.10. SUBTABULATION
revealing that the third-order differences are more or less constant; hence we take n = 3. The value of q is 5 so that Q = 1. We need the the following values for use in formula 3.10: 10:
(~) = (~) = (~) =
0.2,
ef)=
- 25
-0.08,
ef)=
8 125
ef)=
7 125
1
"5
= -= 2 25
6 125
0.048,
3
=
-0.12, 0.064,
=
0.056;
note that these values are exact. Formula 3.10: 10 yields JYo =
G)(~) Jyo + (~)(~) J2yo + (~)(~) Jayo
(3. 10: lla)
= 0.2 Jyo - 0.08 J% + 0.048 Jayo ; J2YO = -
![(i)(~) -
(;)ef)]
J2yo
+ [(i)(~) -
(;)ef)] Jayo!
(3.1O:11b)
Jayo =
[(i)(;) - (;)(2f) + (;)ef)] Jayo
(3.10:11c)
We remark again that the coefficients of the differences in these equations are exact. We stop at Jayo because if a third degree polynomial is a (in the neighborhood of x = 300) if we good approximation to use the interval h = 1, the degree will certainly not increase if we use the smaller interval H = 1. Actually, we find (Yo = Yo = 17.3205081) AYo = 0.0057725, A2Yo = -0.0000019, Aayo = 0.0000000, so that a second degree polynomial is adequate. These numbers are not exact since rounded-off numbers were used in their calculations.
vi
124
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
We then determine the square roots of 300.2, 300.4, ... , from the difference table:
300.0
17.3205081
300.2
17.3262806
57725 -19 57706 300.4
-19
17.3320512 57687
300.6
-19
17.3378199 57668
300.8
-19
17.3435867 57649
301.0
-19
17.3493516 57630
301.2
17.3551146
-19 57611
301.4
-19
17.3608757 57592
301.6
-19
17.3666349 57573
301.8
-19
17.3723922 57554
302.0
17.3781476
which is formed as follows. We write the entries in the topmost diagonal in their proper places, then compute 17.3262806 by adding 17.3205081 and 0.0057725, then 0.0057706 by adding 0.0057725 and -0.0000019, etc. Short cuts, abbreviations, and convenient forms for performing and rearranging the tabulations will naturally suggest themselves to the computer whether he carries out the computations longhand or on a calculating machine_._ The value of v'301 from this table agrees with the value given in the original brief table but the value of v'302 differs from its original value by four units in the last place. Since we are going to use only five decimal places, the values given in the extended table will be correct when the decimals are rounded off. However, to compute v'302j~, v'302.4, ... , it would be better to start afresh; we use 3.1O:IIabc with Yo = Yo = I 7.3781472 and find LI Yo = 0.0057534, Ll2Yo = -0.0000019, Llsyo = 0.0000000. Using these values and proceeding as above, we determine v'302.2, v'f02A, etc. Finally, we calculate v'300J, v'300~j, ... , from the enlarged table by use of formula 3.8:13 which becomes in this case, since n = 2,
EXERCISE
125
= t,
y
v300.3
=
t
= Yo + iJYo/2 - iJ2Yo /8.
We find V300J = 17.3233946, 17.3291661, etc. These numbers too are rounded off to five
decimal places for inclusion in the final table. EXERCISE ].10 1. Expand the following table to include the cube roots of 150.1, 150.2, correct to five decimal places.
150 151 152 153 154 155
,154.9,
5.313293 5.325074 5.336803 5.348481 5.360108 5.371685
2. Expand the following table to include the reciprocals of all integers between 100 and 150 correct to five decimal places. n
lIn
100 105 110 115 120 125 130 135 140 145 150
0.0100000 0.0095238 0.0090909 0.0086957 0.0083333 0.0080000 0.0076923 0.0074074 0.0071429 0.0068966 0.0066667
]. Expand the following table to include values of the sine function at intervals of ten minutes; write answers correct to five decimal places. x
sinx
0° 5° 10° 15° 20° 25° 30° 35° 40° 45°
0.0000000 0.0871557 0.1736482 0.2588190 0.3420201 0.4226183 0.5000000 0.5735764 0.6427876 0.7071068
126
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
3.11. Nonpolynomial Approximation. For the reasons indicated at the close of Section 3.8 as well as for other reasons-for example, electrically controlled and operated machines lend themselves most readily to sinusoidal curves-it is frequently desirable to approximate a function y = f(x)
(3.11:1)
by a function (3.11:2)
y
=
a(x)
which is not a polynomial. We illustrate some methods in this section but we do not propose to give a detailed discussion of either the methods or the errors involved. The function (3.11:3)
C(x) = ao + at sin 21T (x - xo)
p
+b
t
cos
21T
p (x -
xo)
+ ... + an sin n 21T (x p
xo)
+ ... + bn cos m 21T p (x -
xo),
where ao , "', an, bo , "', bm and Xo are constants, is everywhere continuous and periodic with period p and hence is suitable for approximating the function y = f(x) at a point (xo, Yo) if the function f(x) is itself continuous and periodic with period p. As a rule, m is chosen to be n, n - 1, or n + l. The function C(x) has n + m + 1 arbitrary constants and hence can be determined by the imposition of an equivalent number of conditions. EXAMPLE
1.
Approximate
(3.11:4)
y
=
e slll '"
at x = 0 by a function of type 3.11:3 for n = m = 1 and for n For n = m = I, we take Xo = 0 and put
=
m
=
3.
(3.11:5)
(The function to be approximated has the periodp = 21T.) We determine the three constants ao , at , and bt by equating the values of es1nz and Ct(x) and the values of their first and second derivatives at x = Xu • We obtain Ct(x)
= 2 + sin x - cos x.
3.11. NON POLYNOMIAL APPROXIMATION
127
The graphs of y = C 1(x) and the given function should be drawn by the reader; they show the periodicity of the two curves and indicate that C 1(x) is a good approximation to e s1nx from about -21T/9 to about 71T/18 (roughly from -40° to 70°) in the period interval from -1T to 1T. For n = m = 3, we start with Ca(x) = ao + a l sin x
+ a2 sin 2x + aa sin 3x + hI cos X + h2 cos 2x + ha cos 3x.
(3.11:6)
Since we need six derivatives, it is convenient to write es1nx as a power series in x, namely, Y =
esln", =
1+ x
+ x2!
2
-
3X4
8x 5
3x6
56x7
"4! - Sf - 6f + 7! + ....
We obtain on substituting 0 for x, equating the values of corresponding derivatives, and solving, Ca(x) = 1!0 (200
+ 210 sin x -
6 sin 2x - 6 sin 3x
+ 45 cos x - 72 cos 2x
+ 7 cos 3x).
The graphs of y = Ca(x) and the given function show that this time the approximation is good from about -41T/9 to about 111T/18 (-80° to 110°) in the period interval from -1T to 1T. EXAMPLE
x
= 0 for
2. Approximate 3.11:4 by a function of type 3.11:3 at n = 3 if all the b's are O.
We put (3.11 :7)
Since A~'(O) and A~4)(0) are identically equal to 0, we impose the conditions
We find Aa(x) =
3~ (30 + 35 sin x -
sin 2x - sin 3x).
Aa(x) approximates es1nx well only in a short interval about x = 0 and about x = 1T.
128
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
EXAMPLE
3.
Approximate P2(X) = !(x - [X])2 - !(x - [x])
(3.11:8)
+ l2
by a function of type 3.11:3 at x = i if n = m = 2. This function was discussed in Section 2.5. Since the function periodic with period 1, we take (3.11:9)
C2(x)
= a o + a1 sin 217(X -
+ b1 cos 217(X -
IS
!) + a2 sin 2 . 217(X - !) !) + b2 cos 2 . 217(X - i)
as the approximating function. Since P2(X) coincides with B2(x) = tx2 + l2 in the interval from 0 to 1, the latter may be used for the calculation of the derivatives at x = l- By differentiating, putting x = i, and equating the results to the corresponding derivatives of P 2(x), we obtain
tx
C2(x)
1
= 48172 (15 - 2172 - 16 cos 217(X -
!) + cos 41T(x - !».
It appears that the approximation is good from about x = ! to about x = ! in the period from 0 to 1. Questions similar to the ones asked in the sections on polynomial approximation and power series can be raised here too. Is it possible to find a function of type 3.11:3 with n sufficiently large so that it will approximate a given periodic function to within a preassigned degree of precision for all (real) values of x? If n is allowed to tend to infinity, under what circumstances will the resulting infinite series converge? What periodic functions can be represented exactly by such infinite series? These questions will not be answered here; they lead into the domain of Fourier series and the interested reader is referred to the texts in that subject for further ·study. EXAMPLE 4. Approximate 3.11:4 by a function of type 3.11:3 which coincides with y = es1nz at x = 0, 17/3, 17/2. Since we are given three points (0, 1), (17/3, elv'a), (17/2, e), ony = es1nz whose coordinates are to satisfy the equation of the approximating curve, the a priori form of the equation of this curve must contain three arbitrary constants. We start with
(3.11:9a)
3.11. NONPOL YNOMIAL APPROXIMATION
129
If we impose the conditions that this equation be satisfied by the coordinates of the three points, we find Q
o=
V3e -
2elvs + 1
v3-1 2elv's - e - 1
QI
=
bi
1vs = 1 - V3e - 2e + 1 = -0.302.
v3-1
=
= 1.302
1.416
v3-1
Hence CI(x)
= 1.302 + 1.416 sin x
- 0.302 cos x
is the required equation. Its graph and the graph of y = es1nz should be drawn on the same set of axes by the reader. The diagram indicates what we might have expected from the choice of points, the approximation is good from x = 0 to x = 7r/2 (in the period interval from 0 to 27r) but not good in the rest of the interval. To secure a better over-all approximation, we take five points scattered from x = 0 to x = 27r as in EXAMPLE 5. Approximate 3.11:4 by a function of type 3.11:3 which coincides with y = es1nz at x = 0, 7r/3, 7r/2, 7r, 37r/2. We wish to determine the constants in
(3.11:10) so that the graph of this equation passes through the five points (0,1), (7r/3, elvs), (7r/2, e), (7r,I),
(37r/2, e-I ).
Substituting the coordinates of the points into C 2(x) , equating corresponding values, and solving, we obtain C 2(x)
=
1.272 + 1.175 sin x - 0.057 sin 2x - 0.272 cos 2x.
Its graph and the graph of y = es1nz indicate that C 2(x) is a good approximation to y = es!nz for all values of x. It might be well to remark that because of the periodicity of the trigonometric functions, we are now more likely to run into a system of inconsistent linear equations (in the a's and b's) than we were in polynomial approximation. For example, no curve whose equation is of
130
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
the form A3(X) = ao + al sin x + a2 sin 2x + a3 sin 3x can coincide with y = eBlnx at x = 0, 17/2, and 317/2. Indeed, these points impose the conditions ao ao al - as ao - a l as
+
+
= 1, = e, = e- l •
Adding the last two of these equations and dividing the sum by 2, we get ao = !(e + e-l ), a result inconsistent with the first equation. It is desirable for some purposes to approximate either at a point or throughout an interval a non periodic function by a finite trigonometric series. We illustrate some of the possible procedures in the two following examples. EXAMPLE 6. (3.11:11)
Find the function of type As(x)
= a l sin x + a2 sin 2x + as sin 3x
which approximates (3.11:12)
y =
lx
at the origin. (It may seem strange to require an approximation to the simple linear function y = lx by the relatively complicated function 3.11: 11. The justification is found, as we stated previously, in the use of electrical machines where sinusoidal curves are easier to obtain than straight lines.) We impose the conditions y'(O) = A~(O),
whence y
= ~ (45 sin x -
9 sin 2x
+ sin 3x).
A diagram shows that the approximation is good from x = -17/3 to x = 17/3. EXAMPLE 7. Find the function of type 3.11:11 which coincides with 3.11:12 at x = 17/4, 17/3, 17/2. Substituting the coordinates of the points (17/4,17/8), (17/3,17/6), (17/2,17/4) into Eq. 3.11:11, and solving, we find that y = 17(0.2639 sin x - 0.0715 sin 2x
+ 0.0139 sin 3x)
is the required equation; it is a good approximation to y =
lx
from
3.11. NONPOL YNOMIAL APPROXIMATION
131
-1T/2 to X = 1T/2. Of course, no part of this graph or the graph of the preceding answer is a straight line segment, but these graphs deviate in the neighborhood of the origin. very little from the line y =
tx
EXAMPLE
8.
Approximate
(3.11:13)
y = f(x) = (x 2
-
1)10
by an exponential function of type y = a(x) = be·'"
(3.11:14)
at x = 2, where band c are constants. Since the two constants band c are to be determined, we impose the conditions a(2) = f(2), a'(2) = 1'(2), or
= 59,049, = 40 . 39 = 787,320.
be2• = 310 bee2• ~
Solving for
and c, we find the required equation to be y
= 1.5489 . 10-7 e'0"'/3.
The table below shows some comparative values of f(x) and a(x) for values close to x = 2: x
f(x)
a(x)
f(x) - a(x)
1.8 1.9 2.0 2.1 2.2
3181 1467·10 5905·10 2126.101 6971.101
4103 1557·10 5905·10 2240.101 8498.101
-922 -900 0 -114.101 -1527.101
Error (%)
29 6 0 5 22
EXAMPLE 9. Determine a function of exponential type which coincides with 3.11:l3 at x = 1.5, 1.8, 2.0. The desired function is of the form y = ao + a1fiZ + a2e2:i;. It is readily seen that the function is given by
_ (e'" - e1.8)(e'" - e2 ) 1 2510 + (e'" - e1 .5 )(e'" - e2 ) y - (e1.5 _ e1.8 )(e1. 5 _ e2 ) · (e 1.8 - e1.5 )(e1.8 - e2 )
+ (6'" (e 2
-
e1.5)(e'" - e1.8) e1.5)(e2 - e1.8)
2.2410
310
•
Simplification will reduce this equation to the required form.
132
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
EXERCISE 3.11
1a. Approximate Y = x - xl at x = 0 by a function of type 3.11:3 of period 2 for = O. n = I. 2. 3. b. Estimate the maximum value of the error in the interval [ - I. I] for each of your answers. m
la. The function Y = eC08b is periodic of period 'fT. Approximate it at x = 0 by a function of type 3.11:3 for each of the 15 combinations of nand m in the range O. 1.2.3. omitting n = m = O. b. Same as a. but at x = 'fT12. c. Graph the given function and each of the answers. 3a. Approximate y = I Ix at x = I by a function of type 3.11: 14. b. Determine the errors at x = 0.8. 0.9. 1.1. 1.2.
4&. Approximate y = x + x· + lOx' at x = 0 by a function of type ae"'" + c. b. Through what interval about x = 0 may x range if the error is not to exceed 0.1 ? Sa. The function
is periodic of period 2. Approximate the function in the interval [0. 2] by a function of type 3.11:3 for each of the eight combinations of nand m in the range O. 1. 2. omitting n = m = O. choosing. for each case. an appropriate number of points in the interval. b. Graph the given function and each of the answers.
6a. Approximate y = eC08Z in one period interval by a function of type 3.11:3 for each combination of nand m such that n + m = 4. using five points whose coordinates satisfy the given equation. b. Graph the function and each of the answers. 7. Determine a function type axe"" which coincides with xl at x = 3 and 5. What are the errors at x = 2. 4. 6 ? 8. Determine a function of type aJ! which coincides with x! at x = 3 and 5. What are the errors at x = 2. 4. 6 ? 9. Let (xo • Yo). (Xl. Yl) ..... (X n • Yn) be a set of n + 1 points with distinct abscissas; let a(x) be a function such that a(x_) is defined. i = O. 1..... n. and a(x_) #- a(x/) fori #- j. a. The function (3.11:15)
y=
[a(x) - a(xl)] [a(x) - a(xs)] ... [a(x) - a(xn)] [a(xo) - a(xl)] [a(xo) - a(x.)] ... [a(xo) - a(x n )]
~
[a(x) - a(xo)] [a(x) - a(xa)] ... [a(x) - a(xn)]
+ [a(xl) - a(xo)] [a(xl) - a(x.)] .. , [a(xl) - a(xn )] ~ + ................................. . [a(x) - a(xo)] [a(x) - a(xl)] ... [a(x)
is of the form
+ [a(x n) -
a(xo)] [a(x n )
-
(3.11:16) and is satisfied by the coordinates of the n
- a(xn_l)]
a(xl)] ... [a(x n) - a(xn_l)]
+ 1 points.
~
133
3.12. ADDITIONAL METHODS OF INTERPOLATION
b. Put aj define
=
a(xj), i
=
0, I, ... , n; let io , ;1 , ... , i" be a permutation of 0, I, ... n; and
The function (3.11:17)
Y = (Xjo>
+ (XjOXjl> [a(x) - a(xjo)] + (XjOXjlXjl> [a(x) - a(xjo)] [a(x) - a(xjl)] + .............................. .
+ (XjO ... Xj > [a (x) - a(xj \] ... [a(x) ne'
- a(xj
n-l
)]
is of the form 3.11: 16 and is satisfied by the coordinates of the given n + 1 points. c. Compare the functions 3.11:17 determined by various permutations of the subscripts with the function 3.11:15. 10. Find the functions 3.11:15 and 3.11:17 for the following functions and points: a. a(x) = e"; (0, 2), (1, 3), (2, - 2).
b. a(x) = e"1;
(I, I),
+ sin x;
c.
a(x) = x
d.
a(x) = cosx;
e.
a(x) = Xl;
(2,10), (-1, I),
(-1,2),
(-3,1),
(3,100). (0, I),
(2, 3).
(0,0),
(2,4),
(3,0).
(-1,0),
(1,4),
(5, -1).
3.12. Additional Methods of Interpolation. We discussed in the previous sections methods of interpolating in which values of a function were obtained by substituting for the function an approximating or interpolating function. These methods can frequently be replaced by other less laborious methods when auxiliary tables are available. We know, for example, that in using an ordinary five-place table for the logarithms of the trigonometric functions tabulated at minute intervals of the argument, linear interpolation is not accurate for certain ranges. In particular, linear interpolation is not accurate for log sin 8 when 8 is between 0° and 3°. Auxiliary tables, the so-called S, T, CS, and CT tables are then constructed for more accurate interpolation. We have log sin 8
= log 8" + S,
134
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
that is, the logarithm of sin 8 is equal to the logarithm of the number of seconds in 8 plus the S number for that angle. A full explanation of the use of these tables can usually be found in the trigonometry texts. Again, suppose that we are interpolating for hyperbolic sines and a table of hyperbolic cosines is available, as it usually is since the two functions are ordinarily tabulated together. It is well known that sinh(x + h) = sinh x cosh h
+ cosh x sinh h,
h5
h2n - 1
.
smh h
h3
= h + 3f + Sf + ... + (2n -
cosh h = I
h2
h4
I)!
h 2n - 2
+ 2f + 4f + ... + (2n -
2)1
+ "', + "',
where the two infinite series are everywhere absolutely convergent. Hence sinh(x + h)
h2
h4
= sinh x (I + 2f + 4f + ...) + cosh x
(h
h3
h5
+ 3f + Sf + .. -) .
Suppose that the tabulated values of the functions are given correct to five decimal places and that the argument interval is 0.1. If x' is between the arguments Xo and Xl of the table and we put x' = Xo + h, then 0 < h < 0.1. Consequently, hlj2! < 0.005, haj3! < 0.00017, h4j4! < 0.000004. It follows that if we put sinh(x
+ h) =
h h4 h (I + 2! + 41) + cosh x (h + 3\)' 2
sinh x
3
the error will not affect the fifth decimal place in the evaluation of sinh X for 0 ~ X ~ 5. The number of terms necessary in the factors multiplying sinh x and cosh x will depend on the argument interval, that is, on h, the number of decimal places used, and on the size of x; the number of necessary terms increases with increasing h, x, and the number of decimal places. EXAMPLE 1. Given sinh 1.5 = 2.12928, cosh 1.5 = 2.35241, find sinh 1.52. We have h = 0.02, hlj2! = 0.0002, haj3! = 0.000001, h4j4! = 0.000000. Hence sinh 1.52 = 2.12928(1.0002) + 2.35241(0.020001) = 2.17676. EXAMPLE
sinh 2.54.
2.
Given
sinh 2.5 = 6.05020,
cosh 2.5 = 6.13229;
find
3.13. INVERSE INTERPOLATION
135
This time h = 0.04, h2/2! = 0.0008, h3 /3! =0.000011, h4/4! = 0.000001; and sinh 2.54 = 6.05020(1.000801) =
+ 6.l3229(0.040011)
6.30041.
EXAMPLE 3. Given sinh 1.8 = 2.98217, cosh 1.8 = 3.10747, find sinh 1.8276. We have h = 0.0276, h2/2! = 0.000381, h3 /3! = 0.000004, h4/4! = 0.000000; and
sinh 1.8276 = 2.94217(1.000381) =
+ 3.10747(0.027604)
3.02907.
Compare these values with the ones previously obtained as well as the amount of labor necessary in finding them. It is suggested that if nonlinear interpolations are to be performed, the computer might do well to investigate these other methods before he uses the methods furnished by the interpolating polynomials. The precise form in which interpolation is to be carried out in these other methods will depend, of course, on the nature of the function and the availability of the necessary auxiliary tables. These methods cannot be used if the function f(x) is unknown as in the case of recorded data of an experiment. 3.13. Inverse Interpolation. In the preceding pages we considered the problem of evaluating y = f(x) for an assigned argument x' not found in the data or in a table. The process of determining an argument x' which will yield an assigned value f(x') not found in the data or in the table is called inverse interpolation. When linear interpolation is inadequate, the most obvious and natural method of performing an inverse interpolation is the process of merely interchanging the roles of x and y. This method, however, has a serious drawback. Since the successive changes in y will rarely be uniform, the formulas for equally spaced points cannot be used and we must resort to the Lagrange interpolation formula or an equivalent one. In any case, the calculations will involve divisions by numbers very close to zero and will, as a rule, lead to inaccurate results. Of the remaining methods of inverse interpolation, other than the ones that use auxiliary tables and apply only to particular functions, the most common and the most efficient is the method that leads to the solution of a polynomial equation. An example will illustrate the process. Let us use the difference table on page 105 to find sinh- 1 4.00000.
136
3. THE APPROXIMATING POLYNOMIAL; APPROXIMATION IN AN INTERVAL
We use formula 3.8:16; we havey = 4.00000,yo = 4.02186, X_I = 2.00, h = 0.1. Hence (we put n = 4), 4.()()()()()
= 4.02186 + 0.39500
e~
1)
+ 0.04025 G) + 0.00395 G)
1) ' + 0.00040 (t + 4 or 2t 4
+ 62t 3 +
1813t 2
+ 37623t -
37314
= o.
Various methods of solving this equation will be developed in the succeeding chapters. It turns out that t = 0.947, whence from X = X_I + th, sinh-l 4.00000 = 2.0947. The result is correct as far as it goefl
Chapter 4
The Numerical Solution of Algebraic and Transcendental Equations in One Unknown; Geometric Methods
4.1. Introduction. In this and succeeding chapters we discuss various methods of calculating one or more of the roots of an equation or of a system of equations. The methods fall roughly into two classifications. The first class consists of the geometric methods in which solutions are found by means of diagrams. These methods are subdivided into the ordinary graphical methods and the nomographic methods. A graph is a diagram used to solve a particular equation. A nomogram is a diagram or a set of diagrams used to solve many equations all of the same type; for example, a literal equation for any set of numerical values of the coefficients within assigned limits. The graphical method is usually quick but inaccurate. The second method consists of the arithmetic methods in which solutions are obtained by definite computational processes. These methods are subdivided into the literal methods, the iterative methods, and the algorithmic methods. The literal methods are methods in which formulas are found for the roots in terms of literal coefficients and in which solutions are obtained by substituting for the letters given numerical values. For example, we have the well-known formula, s - 4ac)/2a, for the roots of the quadratic equation x = (-b ± axs bx c = O. This method is the algebraic counterpart of the geometric nomographic method; it is very efficient but can be used only in a very limited number of cases. The method of iteration, in its simplest form, is a repetitive process in which a root of f(x) = 0 is found by use of a related function
+ +
vb
137
138
4. GEOMETRIC METHODS
the more useful, particularly when a very precise or accurate result is desired. Needless to say, the two methods are often used in conjunction in a problem. A graph is frequently used to determine the number of (real) roots, to locate them, and to indicate any potential source of trouble such as two or more almost equal roots; an arithmetic method is then used to determine the required root or roots to the desired degree of precision. 4.2. Graphical Methods. (4.2:1)
Let f(x)
=0
be an equation whose (real) roots are sought and put (4.2:2)
y
= f(x).
If the graph of this equation is drawn in a rectangular coordinate system in the usual manner, the roots are the abscissas of the points of intersection of the graph and the x-axis.
1.
EXAMPLE
Find the real roots of the equation x2
-
3.61ogl oX - 2.7
= 0,
where the coefficients 3.6 and 2.7 are exact. y
4
O~+---------~----------~------------L3X
-I
-2
FIG. 4.2:f1.
139
4.2. GRAPHICAL METHODS
The function is defined in the real domain only for positive values of x; the graph of y = Xl - 3.6 loglo x - 2.7 for x between 0 and 3 is shown in Fig. 4.2:fl. It appears that there are two roots, one between 0.1 and 0.2 and the other between 1.9 and 2.0. If the roots are desired y
y 1.0
0.25
-010
FIG. 4.2:f2.
more precisely, we draw the graphs for the ranges 0.1 ::::;; x ::::;; 0.2, 1.9 ::::;; x ::::;; 2, on a larger scale. See Fig. 4.2:f2. The roots appear to be about 0.182 and 1.93. If the roots are wanted to yet more decimal places, the relevant portions of the graph are drawn on a still larger scale. See Fig. 4.2:f3. At this stage, the graphs differ from straight lines by so little that it is sufficient to plot the points representing the function at the end points of the interval and join the endpoints by a line segment. Appropriate scales should be used throughout. The roots, from Fig. 4.2:f3, are approximately 0.1817 and 1.9310. Alternate method. It may be more convenient in some cases to y y
0.03
0.02 0.02 0.01 0 -0.01
FIG. 4.2:f3.
It
4. GEOMETRIC METHODS
140
y
9
8 7 6
5 4
3
",,,,.""
2
/'
.,---y=x 2
'"
----y = 3.6 log lOX
I
+ 2.7
o1 ,"
--~~~--~----~2~----~3-------x
-I
-2
FIG. 4.2:f4.
determine the roots of f(x) = 0 as the abscissas of the points of intersection ofthe graphs of y = fl(X) and y = f2(X), wheref(x) = fl(X) - f2(X). Thus, in the preceding example, the roots can be determined as the abscissas of the points of intersection of the graphs of y = X2 and y = 3.61og1o X + 2.7. The work is shown in Fig. 4.2:f4-f6.
y 0.2 0.12
-0.4 -0.6
-08
,
0.16 ....
-0.2
,,/
, ,,
0.20
It
," ,, "
-1.0
FIG. 4.2:f5.
141
4.3. CONSTRUCTION OF SCALES AND RULES
y
y
0.10
3.770
0.08 0.06 0.04 0.02
,,
0 -0.02
FIG. 4.2:f6.
EXERCISE 4.2 Find, graphically, the real roots of the following equations, correct to the indicated number of decimal places.
1. x 3 2. Xi
-
J. 2x 4. e- Z
= 0,
X 3 3x - I = 0,
4Xl -
-
v;+4
=
(3 dp). (3 dp).
0,
(3 dp).
I x - - = 0, x = 0,
+3 -
5. 2z - Xl 6. x cos x = 2 + 2x 7. r - 10 cos x = 0,
(2 dp). (3 dp).
(3 dp).
Xl,
(3 dp. Find all positive roots and the three
largest negative roots).
8. e- j sin
(i + 2t)
9. cosh x = 10. loglo(1
Xl
+ x)
(as in preceding example).
= 0.1,
+ -xI , =
arcsin
(2 dp). '
v' I
-
Xl,
(2 dp. Find all positive roots and the three largest negative roots).
4.3. Construction of Scales and Rules. The reader is undoubtedly quite familiar with the Cartesian coordinate systems used in the preceding section. In such a system, the coordinates of a point in the plane are determined by coordinate systems set up on the axes. In this and the following sections we propose to study in greater detail some of the basic concepts involved in constructing and using coordinate systems on lines and curves. We start with some formal definitions.
142
4. GEOMETRIC METHODS
A scale is a curve, called the carrier curve, usually but not necessarily a straight line or a circular arc to whose points numbers are attached. The number attached to or associated with a point is called the coordinate of the point; the totality of such numbers is called the coordinate system of the scale. A rule is a scale or a set of scales used in conjunction for measuring or calculating purposes; however, usage is not uniform in this respect and the terms "scale" and "rule" are often used interchangeably. Certain points of a scale or rule are distinguished by dots, strokes, or other means; such points are called marks. Only the marks of a scale or rule will have their coordinates explicitly indicated, but not every mark need have its coordinate actually shown. Those marks that do have their coordinates explicitly shown are called the numbered marks of the scale or rule. A coordinate system on a scale or rule is frequently established on a curve by use of distance. Let 0 be a fixed point on a curve on which a scale is to be constructed and let a convenient but arbitrary unit of distance be chosen. We suppose that the curve is well behaved so that distance can be measured along it from 0 and that the usual conventions are observed with regard to algebraic signs. If s stands for the distance measured along the curve from 0 to a point P whose coordinate is x, the coordinate system of the scale is determined by an equation of the form s = f(x),
(4.3:1)
where f(x) is a real, single-valued function of x. The point 0 from which distance is measured is called the origin of the scale; the point, if any, whose coordinate is zero is called the zero point. A scale is called uniform if the distance between points PI and P 2 is equal to the distance between the points Ql and Q2 (all distances are measured, of course, on or along the curve) if and only if the difference between the coordinates of PI and P 2 is equal to the difference between the coordinates of Ql and Q2' The simplest of all scales is the linear scale; it is a uniform scale determined by the function (4.3:2)
s
= a + dx,
where a and d are given numbers. The linear scale is then a curve graduated by equidistant marks whose coordinates form an arithmetic progression. Some examples are shown in Fig. 4.3:£1. Familiar rules based on the linear scale are the common foot rules, thermometers, barometers, clocks, and the like.
4.3. CONSTRUCTION OF SCALES AND RULES
o
4
2
6
-12
-8
-4
I
I
I
6.4
II
n
lOI
-3
7
I
I
8
9
10
0 I
6.8
6.6
II
-2
5
143
I
I
I
I
7.2
II
I
12
4
I
7.0 I
II
II
74 I I
I
I
2345
~
2
o
-I
6
-2
3
7
FIG. 4.3:f1.
A scale is nonuniform if its defining function 4.3: I is not a first degree polynomial. We give four examples of nonuniform scales on a straight line. 0.5 :0.8 1.4 1.8 0i j 11.2! 16: 2
A.. I
(a)
........... u
2.5
•. ; i I.
3
3.5
. I
• I.
•
I
s,1If (b)
u
-2
2
0
x1·,,1
(e)
I •
II
I
I
2.5
I
I
~
u
s'log,olf (d)
I 2 3 4 5 6 7 8 9 10 15 20 ~A~-L~~I~'~'~lIwl~-LI~,~I~,~I~,~Ilul~du,~I~·~,uul~lIu'ud~·~
..
u
FIG. 4.3:f2.
4. GEOMETRIC METHODS
144
Consider the function (4.3:3)
where x is non-negative. A unit distance represented by a line segment u is chosen, see Fig. 4.3:f2a, and a point on the scale line is arbitrarily selected as the origin. The origin is indicated on the scale by the inverted vee, A.. The coordinate system of the scale is then determined. Note that only points to the right of the origin have coordinates; points to the left are not part of the scale. The scale determined by the function (4.3:4)
s
= -x1
is shown in Fig. 4.3:f2b together with the unit distance. Note that no point on the scale has the coordinate 0, that is, there is no zero point, and the origin has no coordinate. We show next in Fig. 4.3:f2c the scale determined by the function (4.3:5)
s = e"'.
This time there is a point whose coordinate is zero, but the zero point is not the origin. As the last example of a scale on a line, we picture in Fig. 4.3:f2d the one defined by (4.3:6)
In all of these illustrations the unit segment was placed so that its left end coincided with the origin of the scale. A scale is frequently named after its defining function; thus, we refer to the scales in Fig. 4.3:f2 as the square scale, the reciprocal scale, the exponential scale, and the logarithmic scale, respectively. Scales not on a straight line are often constructed by the use of parametric equations and generalized coordinate systems. Let XX' and YY' be two distinct lines intersecting in a point 0; the lines are called the x- and y-axes, respectively. The lines are usually but not necessarily chosen perpendicular to each other. Establish an x-scale on the x-axis and a y-scale on the y-axis using the point 0 as the origin in each case; the scales are usually but again not necessarily chosen as linear scales but each of the defining functions is to be so chosen that a given point of either scale has at most one coordinate. Let P be an arbitrary point in the plane, let A be the point on the x-axis such that PA is parallel to the y-axis and B the point on the y-axis such that PB is parallel to
4.3. CONSTRUCTION OF SCALES AND RULES
145
the x-axis. If Xo is the coordinate of A on the x-scale and Yo the coordinate of B on the y-scale, we call Xo and Yo the planar coordinates of P and write them in the usual manner as (xo , Yo). These notions are, of course, obvious generalizations of the familiar Cartesian coordinate systems. It may happen, however, that due to the choice of the x- or y-scales, a point P of the plane lacks one or both of its coordinates. Furthermore, if Xo and Yo are given numbers, there need not exist a point whose coordinates are (xo , Yo). Another method of constructing a scale is now open to us. Let a coordinate system be established for the plane and let (4.3:7)
x
= /(t),
y = g(t),
be a pair of parametric equations, where /(t) and g(t) are single-valued functions of the parameter t. For a given value to of t, we have Xo = /(to), Yo = g(to); that is, to determines the pair of coordinates (xo , Yo). Hence, as t runs through a given range of values, the points determined by the corresponding pairs of coordinates will fall on a curve C (but note the possible misbehaviors outlined in the preceding paragraph). We can now establish a coordinate system on C by assigning to each point as its scale coordinate the value of the parameter t which gave rise to that point. As an illustration, consider a usual Cartesian coordinate system; that is, a system in which the x- and y-axes are perpendicular lines scaled by the same linear polynomial function with zero points at the ongm. c
FIG. 4.3:f3.
4. GEOMETRIC METHODS
146
If we take
x = t 2,
Y
it
=
3,
we get the scale on the carrier curve C shown in Fig. 4.3:f3. If we take x = t - 2, Y = 51og1ot, we get the scale on the carrier curve C shown in Fig. 4.3:f4. y 10
II' -5
15
II
-5
y'
FIG. 4.3:f4.
y I
10
\~
5
o
II'·~-+~~+-----~--~--~~~~~~~~II
0.5
i 0.7
0.6
:0.9 I 0.8
2
3
4
y'
FIG. 4.3:f5.
5
6 7 8910
15
EXERCISE
147
It is to be emphasized that the resulting scale depends as much on the coordinate systems used for scaling the axes as on the parametric equations. Thus, if we scale the y-axis by means of the function y, but the x-axis by means of the function 10 loglo x, the scale C determined by the last pair of parametric equations will look as in Fig. 4.3:f5. Note also that different sets of parametric equations may yield the same carrier curves but different scales.
EXERCISE 4.3 Construct scales on straight lines determined by the functions given in examples 1-10 for the indicated ranges of the variables. State or clearly mark the unit of distance in each case.
x'"
1.xl -3x+l, 2. 1/(x 3. tan
4. ek
-5'" 5. 0", x '" 100.
+ 1),
lx,
- ../2 '"
x '" ../2.
O"'x'"
,
5. loglo x,
1.
0.5 '" x '" 1.
6. loglo x,
1 '" x '" 10,000.
7. loglo loglo x,
10 '" x '" 10,000.
-2'" x
8. sinh x,
'" 2. 15", P '" 25.
9. 2.30pl.I, x .. 10. -sin-, .. x
-2.0 '" x '" 0.1.
Construct the scales determined by the following pairs of parametric equations for the indicated ranges. Use ordinary Cartesian coordinates with the same scales on the x- and y-axes.
11. x
= 3t, Y =
12. x =
Vt+1,
1 - t;
-10", t '" 10.
y = 5';
0", t '" 2.
13. x = 2 cos w, y = 3 sin 2w; 1
14. x =
v'~II-+I'
0", w '" 2. u
y =
-v'' ' 'u=I=+=I-=
-20", u '" 20.
Let the x- and y-axes intersect to form the given angles; scale the axes by use of the given functions with the intersection point as the common origin and the given relation between the unit distances, u and v, on the x- and y-axes, respectively; then construct the scales determined by the parametric equations for the indicated ranges.
1.f8
4. GEOMETR'C METHODS
16 .../2;
lx, y8; U = v.
17 .../2; x,loglo y;
2u
x
v.
= 4t, Y = 2t;
-1
1.
x = t, Y = e';
0
18 .../2;
x, 2y;
u = v.
x = sin t,
y = cos t;
0< t
19 .../6;
x,2y;
u = v.
x = sin t,
y = cos t;
0< t
20 .../3;
x,3y;
u = v.
x
=
0< t
=
=
2t, Y
sin t;
< 2.. . < 2.. . < 2...
21. The equation s = kf(t) (k > 0) will determine on a carrier curve identically the same scale as the equation s = f(t) if the unit of distance used in the first case is (1Ik)th the unit used in the second. What happens if k < O?
4.4. Stationary Scales. Scales can be used in conjunction in a variety of ways to exhibit a functional relation between variables or to help in the solution of numerical problems. One of the most obvious methods is to place two (or more) scales side by side, or to graduate the "upper half" of a horizontal line with one scale and the "lower half" with another scale, or the right- and left-halves of a vertical line. If the two scales are determined by s = f(x), s' = F(y), respectively, and if the origins coincide and the units of distance are equal, then the coordinate x of a point is related to the coordinate y of the same point by the equality (4.4:1)
f(x)
= F(y).
Solving this equation for x and y in turn, we obtain (4.4:2)
x
=
cp(y),
(4.4:3)
y
=
t/J(x).
The last two equations as well as 4.4: I expression the relationship between the x- and y-coordinates of a point. We give several examples to illustrate these principles. If the log scale, Fig. 4.3:f2d, is placed against its own distance scale as in Fig. 4.4:f1, we have y = loglo x, X = 1011. Again, take two uniform linear scales, s = F, s' = Ie + 32; we have F = Ie + 32, e = 32). See Fig. 4.4:f2.
t(F -
I
2
3
4
5 6
7 8 9 10 01 'I I I I I 0.1 02 03 0.4 05 0.6 0.7 0.8 0.9 1.0 1.1
20
30
70 90 40 50 60 : 80; 100
r i I r "':1""""'1""""'1' 1,1,1'1 '1""""'1""'1"'1' 1,'01'1,1.1 o 1.2 1.3 14 1.5 1.6 1.7 1.8 1.9 2.0
y:
I
FIG. 4.4:£1.
I
I
I
I
\
149
4.4. STATIONARY SCALES
-40 -30 -20 -10
10 20 30 40 50 60 70
0
eo
90 100
1..'ii" ,.1",.1, 1"'1"1"'1"1,,,,,,,"''''1''''''''''1'''''''''1''''"I'" '" '" "( ifll , f i l l " 'r (,'" orll
-40
0
50
100
150
200
FIG. 4.4:f2.
As an example of three scales used in conjunction, we take s = t, s' = 981t, s" = 5275 tanh 0.1 86t. Label the three scales the t-, the v-, and the v'-scales, respectively. The v-scale gives the velocity in centimeters per second of a body falling in a vacuum, the v' -scale I:
o
I 2 3 4 5 6 7 " , , , , , , , ' , , , , , , , " , , , , ' " ' , , , , , , , , I,
8
10
9
,, ,,' , ,' ,, , , ' ,
o
1000 2000 3000 4000 5000 6000 7000 BOOO 9000 10,000
o
1000 2000
:.~ 1 ' \ " " ' " " '" 3000
,,' , ',' , , , , " '
4000
5000
FIG. 4.4:f3.
gives the velocity in centimeters per second of a body falling in such a manner that the air resistance is proportional to the square of the velocity in each case the body falls from rest and the time is given by the t-scale. See Fig. 4.4:f3. 10,000
/
9000
/
8000
/
7000
~
..
~
/
6000
/
5000
/
~
"
> 4000 3000 2000 1000
0
V
/
/ 2
- f..--
~V
v
f..--
V
3
4
5
Time (seconds)
FIG. 4.4:f4.
6
7
8
9
10
4. GEOMETRIC METHODS
150
It should be pointed out that scales used in conjunction in this fashion are merely an abridgment of the usual graph. Stationary scales take little space and are easy to read, but graphs usually portray quite vividly relations, tendencies or properties not immediately evident on a set of numerical scales. Compare the preceding stationary scale with the equivalent graph, Fig. 4.4:f4. EXERCISE 4.4
t. Construct a double scale on a horizontal line by graduating the "upper" half using the first function and graduating the "lower" half using the second function. Use the same origin and unit of distance for each of the two scales; label each half of the line and indicate the unit of distance. A range is given for one variable in each case; choose a range for the other variable so that the two associated scales are roughly the same length. a.
$
=
x,
sin x,
$'
b.
$
=
c.
$
= loglo
d.
$
=
Xl
+
=
y3;
$'
X,
I,
=
$' $'
e.$= -~,
-10 cos y;
!(e'
x
0< x
< <
10. fr.
< x < 100. < 4. -10 < y < O.
= In y; =
<
0.1
+ r')
0< y
$'= -~;
2. Construct a double scale on a line to exhibit each of the relations below for the indicated ranges. If necessary, use several lines to show the complete range.
< T < 250. < 100. 0.1 < x < 10. 5 < V < 150, at intervals of 0.5 for - 5 < x < 5, at intervals of 0.1 for x.
a. C
= 0.213T!, b. y = 1.32 + 4.59x - 0.007x·, c. y = x + loglo x, d. PVI.Oi = 30,
e. y
= eO. 3lz sin
-50
0< x
x,
V.
3. Construct, on parallel lines, single and double scales to exhibit each set of relations for the indicated ranges.
3 - 2t + 2t l + t 3 , v = -2 + 4t + 3t l ; b. S = 2r + !",I,
a.
$
=
1
c. Tl TI
Ta
= = =
+ 0, + pO.I, Tl/(Tl + T.);
<
5.
2.
0< t
P
2p
20
< p < 300.
4. Construct a double scale showing the length of a circular arc and its chord in a circle of radius 100 for angles ranging from 0° to 90° at intervals of one degree. 5. Let h be the measure in feet of the sag of a 50-ft flexible chain which is suspended at points A and B at the same distance above the ground. Construct a scale showing corresponding values of h and the distance AB as AB varies from 0 to 50 ft if the chain forms an arc of a parabola.
4.5. SLIDING SCALES
151
4.5. Sliding Scales. The stationary scales described in the preceding section enable us to solve equations of the form y = f(x) but are not suited for the solutions of equations of the form y = f(x i , X2 , ... , x n ). Some limited equations of this type can be solved by means of sliding scales or rules of which familiar examples are the ordinary logarithmic slide rule and the vernier scale. Let two scales A and B be determined by the equations
(4.5:1) (4.5:2)
s s'
= f(x), = F(y),
respectively, where the same unit of distance is used for the two cases, and construct a rule so that one scale slides against the other. A typical setting is illustrated in Fig. 4.5:fl, where 0 and 0' are the respective 0 A: B:
,
p.
Po
,
P,
I
I
I
0'
0,
O.
,
,
FIG. 4.5:£1.
origins. If the points PI and P 2 with coordinates Xl and X 2 , respectively, on the A scale coincide with the points QI and Q2 with coordinates YI and Y2 , respectively, on the B scale, we have P I P2 = QIQ2' OP2 - OPI = O'Q2 - O'QI ,
and therefore, (4.5:3) All of the results of the present section are derived from the last equation. We note several particular cases. If f(x) = F(x), that is, if scales A and B are constructed by means of the same function, the preceding equation becomes (4.5:4) If on scale B the point QI is the origin 0', which mayor may not have a coordinate, and if the point Po on A which is coincident with 0' has the coordinate xo , then 4.5:3 and 4.5:4 become
(4.5:5) (4.5:6) respecti vel y.
f(X2) - f(x o) = F(Y2)' f(X2) - f(x o) = f(Y2)'
4. GEOMETRIC METHODS
152
In Eq. 4.5:3 and 4.5:4 any three of the numbers Xl' X 2 , YI , Y2 , will determine the fourth; in Eq. 4.5:5 and 4.5:6, any two of the numbers Xo , X 2 , Y2, will determine the third. We apply these conclusions to several examples. Suppose that log scales are constructed on A and B so that
= f(x) = logloX, s' = f(y) = IOgloY· s
Equation 4.5:4 yields log X2
-
log Xl
=
log
= logY2 ,
logY2 - logYI.
Hence X2
YI
Xl
and, since all numbers are real,
or (4.5:7)
Xl
X2
YI
Y2
That is, for any setting of the scale B against the scale A, coordinates of coincident points are in a constant ratio. (The value of the ratio depends, of course, on the setting.) Also, Eq. 4.5:6 yields log X 2
-
log Xo
=
logY2,
log
=
logY2'
X2
Xl
(4.5:8)
X2
-=Y2' Xo
(4.5:9)
Equations 4.5:7-9 imply that two log scales constructed so that one can slide against the other can be used to find the fourth term of a proportion when we are given three of them; and in particular, we can find the quotient and product of two numbers. Thus, by setting the scales as in Fig. 4.5:f2, we find that 1.6 2 4 6.5 -1- = 1.25 = 2.5 = 4.05 = etc.
4.5. SLIDING SCALES
153
2
3
4
5
"'I!!.!""I""II)'.!'''''! iii'
i
Iii
I
Iii
i
i
Ii
iii
2
6
7
I,
I
,Iiii,""j , 3 4
FIG. 4.5:f2.
(some ratios will be only approximately equal to others because of errors in reading; we can expect at best only approximations whose closeness will depend on the precision of the rule); also, 6
T.6 =
~:~ =
3.75,
etc.,
5.94,
and 1.6 X 3 = 4.8,
1.6 X 5.1 = 8.16,
etc.
As another example, construct scales on A and B determined by
, s
1
=-. y
Equation 4.5:6 then yields
or
The last equation is soon recognized as the fundamental equation of the famous work problems, the lens problems, and the resistance in series problems amongst others. A typical setting is shown in Fig. 4.5:f3; the setting yields etc.
100 10
I
I
5 4
3
2
I
0.9
! ! I I... , I" I" ! ! II'!""!" " ! ' " ' ' I i I
I
I
100 10 654
I
"
3
!
I
2
FIG. 4.5:f3.
I
O.B
!
0.7
I !
0.9
4. GEOMETRIC METHODS
154 EXERCISE 4.5
1. Construct two sliding scales F and T by use of the distance functions s = log fl, = log t, respectively, for the ranges I < f < 22, 0.001 < t < 5. (These scales, if marked with the f-numbers and shutter speeds of a camera, will give, for any particular setting, the equivalent shutter speeds for the various f-numbers.)
s'
2. Construct a scale A and a sliding scale B using the respective equations s = x and s' = (9/IO)y. If the zero mark 0' of the B scale falls between the marks m and m + I of the A scale, and the mark k of the B scale coincides with the mark m + k of the A scale, < k < 10, then 0' is k-tenths of the way from m to m + I. Hence explain the construction and use of a vernier scale.
o
1. The stationary scale of a transit is graduated to show quarter degrees. Show how to construct a sliding vernier scale to take readings to the nearest minute.
4.6. Nomography. Scales can be used in conjunction in yet another way to solve numerical problems. A method which is particularly effective when it is necessary to solve a number of problems all of the same type and where great precision is not demanded is furnished by the nomogram. A nomogram is a set of three or more fixed scales placed in definite positions relative to each other; the scales are so constructed that a coordinate on one scale is a preassigned function of the coordinates collinear with it on two other scales. We explain the construction and principle behind a simple type of nomogram. Let a, b, and c be three vertical lines (vertical scales are somewhat more convenient than horizontal scales in nomographic work) spaced so that the distance between a and b is to the distance between band c as r1 : r2 , where r 1 and r2 are positive numbers. Let a line of origins and an arbitrary line meet a, b, and c in 0, 0', 0" and A, B, C, respectively; Fig. 4.6:fl. It is readily shown that O'B
(4.6:1)
= r20A + r1o"e . r1 + r2
If distances on the vertical lines are directed so that the positive distances are those oriented upwards, say, then formula 4.6: I will hold no matter what the respective positions of the transversals ABC and 00' 0" are. Construct scales on a, b, and c by use of the equations
(4.6:2)
s
= fey),
s' = cp(x),
s" = F(z),
respectively; take 0, 0', and 0" as the three origins and use the same unit of distance in all three cases. It follows that
(4.6:3)
4.6. NOMOGRAPHY
155
This equality is fundamental for the construction of certain nomograms; we illustrate its application by several examples. EXAMPLE 1. Take 71 = 72 and put
A
C
8
4
4
4
3
3
3
2
2
2
10
8 7 6 5 4
3
0
D
0'
b
0"
c
0
0
0
-I
-I
-I
-2 Y
FIG. 4.6:fl.
-2 If
FIG. 4.6:f2.
r
2
-2 y
If
r
FIG. 4.6:f3.
EXAMPLE 2. Put 71 = 72 and take
4. GEOMETRIC METHODS
156
of the third variable. Since the logarithm of a product is equal to the sum of the logarithms of the factors, a nomogram of the above type can also be constructed if a function of one variable is equal to a function of another variable multiplied by a function of the third variable. EXAMPLE 3. Construct a nomogram for the solution of the equation V = 7Tr2h, which expresses the volume of a circular cylinder in terms of the radius of the base and the altitude. The volume for a given radius and altitude can be obtained readily enough by use of a slide rule, but if a great many volumes were required for varying radii and altitudes, a nomogram will prove to be a timesaving device. The given equation yields log V = log r2 + log 7Th. (4.6:4) Again putting r 1 = r 2 and comparing Eqs. 4.6:3 and 4.6:4, we see that cp(V) = i log V, /(r) = log r2 = 2 log r, F(h) = log 7Th = log 7T + log h
= 0.497 + log h.
The nomogram is exhibited in Fig. 4.6:f4. 10 9
8
4000 3000 2000
6
10 9
5
8 7 6
4
5 4
3
3
2 2
h
v
FIG. 4.6:f4.
157
4.6. NOMOGRAPHY
Let us suppose that the volumes to be computed are for radii that range from 5 to 15 cm and for altitudes that run from 3 to 500 cm. Examination of Fig. 4.6:f4 shows that the nomogram is, on the one hand, not extensive enough, and, on the other hand, contains much that is useless. It is then desirable to reconstruct the nomogram to accomodate volumes for the desired ranges of rand h; for greater precision, it is advisable to make the rand h scales as large as possible and approximately of the same lengths. This usually can be done by suitable choice of r 1 and r 2 • We go back to Eq.4.6:3, multiply through by r 1 + r 2 , and put (rl + r 2 ) cp(V) = log V,
= rlF(h) = rJ(r)
Hence /(r) = F(h)
=
2 log r, 0.497
+ log h.
21;: r , 0.497
+ log h . r1
The length of the usable portion of the r-scale is /(15) - /(5)
2
0.954
2
2
= -r (log 15 - log 5) = -r - ;
the length of the usable portion of the h-scale is F(500) _ F(3) = 0.497
+ log 500 _ r1
0.497 + log 3 = 2.222; r1 r1
hence the lengths of the two scales will be equal if
r1 r2
2.222
= 0.954·
For our purposes, it is sufficient and convenient to take integral values for r 1 and r 2; the values r 1 = 2, r 2 = I, will do here. Using these values, we find cp(V) = 1log V, /(r) = 210g r, F(h)
=
! (0.497 + log h) =
0.249
+ ! log h.
We choose the origins so that the line joining the point with coordinate
4. GEOMETRIC METHODS
158
5 on the T-scale and the point with coordinate 3 on the h-scale is horizontal. The corresponding nomogram is shown in Fig. 4.6:f5. 500 400peO
400
300p00 300
200,000 15
200
14
IOOPOO
13 12
eo.oo
150
60,000 50,000 40.000
100 80 70 60 50
30.000
II
20,000 10
40
10peO 9
8000
30
6000
20
4000
8
3000
15
2000
7
10 8
1000 800
6
6 5
600 500 400 300
4 3 h
V
FIG. 4.6:f5. EXAMPLE 4. Construct a 5 ~ P ~ 75, 200 ~ V ~ We have log K = log P 4.6:3 (in which we replace
nomogram for K = P/V0-98 for the ranges 1000. = 0.96 log V; comparing this equation with x by K, y by P, z by V), we see that
cp(K)
= log K,
f(P)
=--
Tl
+ Ta Iogp, T2
F(V)
= -0.96 Tl + Ta log V. T1
The length of the desired portion of the P-scale is /(75) - /(5) =
Tl
+ Ta (log 75 -log 5) = T2
1.18 T1
+ T2; T2
4.6. NOMOGRAPHY
159
that of the V-scale is F(200) - F(IOOO)
= -0.96 r1 + r 2 (log 200 - log 10(0) r1
= 0.67r1 + r2. r1
[Note that since r 1 and r 2 are positive, the coefficient of log V in F(V) is negative, hence the coordinate of a point increases as the point descends on the V-scale. It follows that F(200) - F(lOOO) and not F(lOOO) - F(200) is the positive distance on the V-scale.] We find on equating the two lengths that r 1 : r 2 = 0.67: 1.18. The values r 1 = I, r2 = 2, which yield
=
log K, f(P) = l.S log P, F(V) = -2.88 log V, cp(K)
will be adequate for our purposes. The nomogram, not fully graduated, is shown in Fig. 4.6:f6. 200 0.5 0.4
75 70
250
0.3
60 50
300
0.2
40
350 0.1 0.09 0.08 0.07 0.06 0.05
30 25 20
400
500
0.04 15
10
0.03
600
0.02
700 800
0.01 0.009 0.008 0.007 0.006
5 p
K
900 1000 V
FIG. 4.6:f6.
4. GEOMETRIC METHODS
160 EXERCISE 4.6
Construct monograms for the following relations and indicated ranges.
= 3.2x1 + 0.54 log w; s = 3 + 2t - sin A; v = 2zp; V = 1TTlh; 5. w = O.OIIDIP;
t. 2. 1. 4.
y
6. T
7. 8.
9. 10.
0", x '" 2, -5'" t '" 50, -I'" x '" I,
I '" w '" 1000. -1.5 '" A", 1.5. I '" P '" 10. I '" h '" 25. 50", P '" 300.
3 '" T ' " 10, 0.1'" D '" 2.0,
= Vp/v;
3", P '" 10,
100R S = 130.6 + 0.0794G ' sin ex ,..1 = 1.026 + sin fJ z = x"; I -I; t l = ".gl + Vf + 0.6fl
I '" v '" 50.
10", R '" 30,
70", G '" 90.
10° '" ex '" 90°,
0° '" fJ '" 90°.
10", x '" 20,
0.5'" Y '" 2.5.
100", g '" 300,
2 '" f '" 10.
4.7. Nomography. General Theory. We discussed in the preceding section a method for constructing a three scale nomogram which exhibited a functional relation of the form (4.7:1)
B(x)
= A(y) + C(z).
It is possible to construct nomograms with more than three scales, with scales on intersecting lines, with scales on curves other than straight lines, and so on. These various nomograms can be used to exhibit various types of functional relations of more complicated forms or involving more variables than the relation above. We do not propose, however, to discuss these concrete nomograms any further-the interested reader should consult texts on nomography-but we do wish to devote this section to an introduction to the general theory of three scale nomograms based on the use of parametric equations. Let the three sets of parametric equations (4.7:2)
x
y
= ft(u), = gl(U),
x = f2(V), y = g2(V),
x
= f3(W),
y
=
g3(W),
define three scales, say A, B, C, in the same Cartesian plane. We assume throughout this section that the x- and y-axes are scaled in the usual manner by the same linear distance function. Let P:(x 1 , Yl)' Q: (X2 'Y2)' R: (xa ,Ya) be three points on the respective scales A, B, C, and let their x, Y coordinates be determined by the respective scale
4.7. NOMOGRAPHY. GENERAL THEORY
161
coordinates u' , v', w'. It is well known that P, if and only if
Q, and R will be collinear
(4.7:3) hence, if and only if (4.7:4) The entire theory of three scaled nomograms has its foundation in this determinant equation. We show how the parametric Eqs.4.7:2 and the preceding determinant equation lead to nomograms by several examples. EXAMPLE I.
Take x = 1, y=w.
= 0,
x
= -1,
x
y
= u,
y = v,
Equation 4.7:4 becomes (we drop the primes on u, v, and w) u 11 v 1 1 w 1
-1
1 o or v
=
!(u
= 0,
+ w).
We recognize this nomogram as the one previously given in Fig. 4.6:f2. EXAMPLE 2.
Take x = 0, y = -l/v,
x = l/u, y = l/u2 ,
x y
= -l/w, = o.
Then Eq. 4.7:4 becomes
I or
l/u
o
-l/w
I
l/u2 1 -l/v 1 = 0, 0
1
1 1 1 -+-+-=0. vw uv u2w
4. GEOMETRIC METHODS
162
Multiply through by u1vw, then (4.7:5)
ul
+ uw + v = o.
The first pair of parametric equations determines a scale on a parabola, the second determines a scale on the y-axis, the third a scale on the x-axis. The nomogram is shown in Fig. 4.7:£1, where the coordinates
-0.5
u u
W~--r---'--.-r-r,-~~~9n-'-.-r-r-'r---.--'W
0.5
0.6
-0.6
-0.5
2 1.5 1.2 1.0
0.8
0.6 0.5
FIG. 4. 7:t I.
on the vertical and horizontal scales are the v and w coordinates, respectively. A line joining the point with scale coordinate w to the point with scale coordinate v will intersect the parabola in points whose u coordinates satisfy Eq.4.7:5. We have here, then, a nomogram for the solution of a quadratic equation (real roots only).
163
4.7. NOMOGRAPHY, GENERAL THEORY
EXAMPLE 3.
Take x
y
= -rl' = F(u),
x
=
r2
X=
,
y = G(V),
0,
y = H(w),
where r1 and r2 are constants. Equation 4.7:4 becomes
l
F(u) r2 G(v) H(w)
- r1
°
II
I = 0, I
or (4.7:6)
H(w) = _r_2-F(u) r1
+ r2
+ _r_l- G(v). r1 + r2
Except for the change in notation, this is exactly the functional relation of the nomogram developed at the beginning of Section 4.6; compare Eq.4.6:3. The problem of interest and importance, however, is not to discover what nomogram will arise from some arbitrary choice of the functions in the parametric equations 4.7:2 but to determine what these functions should be to yield a desired nomogram. In the application of nomography in engineering and elsewhere, we always begin with some equation we wish to solve and our job is to find a suitable nomogram, that is, to determine suitable functions for Eq. 4.7:2. We consider the determinant Fl(U)
(4.7:7)
G1(u) H 1(u) G2(v) H 2(v) F3(W) G3(w) G3(w)
IF (v)
I
2
where the functions in the first (second, third) row are constants or functions of u (v, w) only, and the value of the determinant is not identically equal to zero. By adding suitable multiples of the first and second columns to the third, we can arrange to obtain a determinant whose elements in the third column are not identically zero; if we then divide each element in the first (second, third) row by the last element in that row, and then equate the result to zero, we obtain Eq.4.7:4. It is possible, of course, to transform the determinant 4.7:7 into the left member of 4.7:4 in many ways. For example, the value of the determinant
164
4. GEOMETRIC METHODS
is U 2 + uw + v. If we divide the first row of the determinant by -u 2 , the second by v, and the third by w, we obtain after an interchange of columns the determinant in example 2. On the other hand, if we add the second column of 4.7:8 to the third, and then divide the elements in the first row by I + u, we obtain the determinant u2 u -1+u l+u v 0 w 1
(4.7:9)
The first two columns of this determinant yield the parametric equations u2 X=---
1 + u' u
y=
1 + u'
x = v,
X=
y = 0,
y=l.
w,
These equations, in turn, yield the three scaled nomogram shown in Fig. 4.7:f2 which can also be used for the solution of the quadratic equation 4.7:5.
u
-5
-4
-5
-4
-3
-2
-I
w-~~~~~~~~~~w 5 2 3 7 2
u
FIG. 4.7:f2.
3
4
5
6
7
4.7. NOMOGRAPHY. GENERAL THEORY
165
In changing a determinant from the form 4.7:7 to the form 4.7:9 we must be careful not to mix the variables; we must, therefore, not add multiples of one row to another, etc. H we equate the expansion of the determinant 4.7:7 to zero, we obtain
(4.7:10)
F1(u)[G 2(v) H a(w)-H 2(v)GS(w)]
+ G (u)[H (v}Fa(w) -F (v)Ha(w)] 1
2
+ H (u)[F (v) Ga(w) 1
2
2
G2(v)Fa(w)] = O.
If now (4.7:11)
9'(u, v, w)
=
0
is the functional equation for which we wish to construct a nomogram, the problem of determining appropriate scales becomes the problem of choosing suitable expressions for the functions in 4.7: 10. We illustrate a general method by constructing a nomogram for the functional relation
(4.7:12)
f(u)
= g(v) h(w) + k(w),
where f(u), g(v), h(w), and k(w) are given expressions. We first rewrite the given equality in the form
(4.7:13)
f(u) - g(v) h(w) - k(w)
=
0;
and then ask if it is possible to find a nomogram where the u and v scales are on parallel lines, say on vertical lines. This requires that we put
(4.7:14) F 2(v) = a;
the equality 4.7: 10 then becomes
(4.7:15) A comparison of this equality with 4.7: 13 suggests that we put either Gt(u) or Ht(u) equal to f(u) and the other equal to a constant. Since in the determinant 4.7:7 Ht(u) is in the position of the element which ultimately becomes a constant, we put
(4.7:16)
G1(u) = f(u), H 1(u)
= b =F o.
4. GEOMETRIC METHODS
166
The equality 4.7: 15 can then be written as
For further guidance, we compare the last equality with 4.7:13. We will proceed yet another step toward the desired form if we put Hs(v) equal to a constant, say (4.7:18) The equality 4.7:17 can then be rewritten as (4.7:19)
The road is now clear; we put (4.7:20)
whence (4.7:21)
bF3(w) _ h(w) CF3(W) - aH3(w) _ k(w) abG3(w) CF3(W) - aH3(W) .
Put H3(W) equal to a nonzero constant, (4.7:22)
then adh(w) F3(W) = ch(w) - b '
(4.7:23) G3(w)
= -
dk(w) ch(w) - b .
The equalities 4.7:14, 16, 18,20,22,23 determine the nine functions of 4.7:7 or 4.7:10. The determinant equation becomes
o (4.7:24)
a adh(w) ch(w) - b
f(u) g(v) dk(w) ch(w) - b
b c d
=
O.
4.7. NOMOGRAPHY. GENERAL THEORY
167
If c =1= 0, the equality can be written as
,,/(u)
0
if c
g(v)
a c ah(w) ch(w) - b
(4.7:25)
= 0;
c k(w) ch(w) - b
= 0, 4.7:24 becomes
(4.7:26)
o
/(u)
b
a
g(v)
o
ah(w) k(w) - - b - -b-
=
o.
If we add the first column to the third and then divide each row by its last element, the last equation becomes /(u) -b-
0
g(v)
(4.7:27)
=0.
a k(w) ah(w) - b
ah(w) ah(w) - b
The equality 4.7:25 leads to the parametric equations x
= 0,
Y
=
a
oX
=-, c
y
=
X=
ah(w) ch(w) - b '
(4.7:28)
/(u)
-b-'
g(v)
-c-'
y
= -
k(w) ch(w) - b '
which determine the scales for the nomogram. The arbitrary but nonzero constants a, b, and c determine the distance between the vertical scales and the distances between units on each of the three scales; convenience will dictate their choice in any particular problem. The equality 4.7:27 leads to similar results. We remark, first, that the preceding result is not at all unique and, second, that the reader possessed with some ingenuity can frequently circumvent the lengthy process leading to the determination of the
4.
168
GEOMETRIC METHODS
functions in the equality 4.7: 10. Thus, in the preceding example, the form of Eq. 4.7: 13 suggests the partial determinant
I -I -II g(V)
k(w)
h(w)
with j(u) to be placed in the first row. A few moments of experiment will yield the determinant
I
/(U)
g(v) k(w)
0
-I h(w)
-II
0 -I
which can be transformed easily into the left member of either 4.7:25 or 4.7:27.
Chapter 5
The Numerical Solution of Algebraic and Transcendental Equations in One Unknown; Arithmetic Methods
5.1. Horner's Method. All of the arithmetic methods of evaluating the real roots of f(x) = 0 depend directly or indirectly upon the fundamental theorem: If f(x) is single-valued and continuous in the interval a ~ x ~ b, and if f(a) and f(b) are of unlike signs, then f(x) = 0 has at least one real root between a and b. The first algorithmic method to be considered is the well-known Horner's method. It is very efficient but can only be used to find the real roots of a polynomial equated to zero. Since the method is described in detail in all advanced algebra texts, we give it here only in outline and illustrate with an example. The roots are first located between successive integers by means of the fundamental theorem; the use of the graph of the function is highly recommended. If two or more roots are close together, it may be necessary to locate them between successive tenths, or hundredths, or thousandths, and so on. If the positive root r is sought and r is between the integers t and t + I, the given equation is transformed into a second equation whose roots are those of the original equation diminished by t; this second equation is transformed into a third equation whose roots are those of the second equation multiplied by to. The last equation will have a root r' between 0 and to such that [r'] (the largest integer not exceeding r') is the tenth's digit of the original root. The process is continued in the same manner until as many decimal places as desired are obtained. It will be noted in forming the successive equations that the coefficient of x and the constant term soon differ in sign and become numerically large in comparison with the other coefficients. One can then find the next few decimal places by dividing the constant term by the negative of the preceding coefficient. Just how many places one can find correctly in this manner will depend on the number of places already obtained and the particular equation. 169
170
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
To find the negative root of an equation, find the corresponding positive root of the associated "negative" equation, f( -x) = O. EXAMPLE.
Find the root between 2 and 3 of the equation
+ 3x -
x3 - 3x2
6=
o.
The work is shown below. ~
1-3+3-6 +2-2+2 1-1+1-4 +2+2 1
+I+3 +2
1
+3
1 +30+300-4000 + 7 + 259 + 3913 1 + 37 + 559 + 7+308
J~
87
1 + 44 + 867
+ 7 1 + 51 1 + 510 + 86700 - 87000
L~
1 + 5100 + 8670000 - 87000000 + 9 + 45981 + 78443829 I + 5109 + 8715981 9 + 46062 1 + 5118
8556171
+ 8762043 9.765
8762043 I 85561710.000 78858387 67033230 61334301 56989290 52572258 44170320
L~_.
5.2. THE ROOT-SQUARING METHOD
171
The root is thus found to be 2.7099765-; correct to seven decimal places it is 2.7099759. The actual value of the root is I + {13. EXERCISE 5.1 1. Find, correct to three decimal places, the roots of
a. lx 3 - 14x" + 28x - 15 = O. b. x 3 + 3x" - 4x - 10 = O. C. x 3 - 6x· + Ilx - 5.75 = O. d. x' - 2x 3 - 4x" + 4x + 4 = O. e. 3x' - 8x 3 - 18x" + 72x - 80 = O. 2. Find, correct to four decimal places, the real roots of
a. x' - 6x 3 + lx" - 6x b. lx 3 - 6x" - 7x + 23
+ =
I = O. O.
5.2. The Root-Squaring Method. Another method for finding the roots of a polynomial equation is the so-called root squaring method, a procedure due to Dandelin, Lobachevsky, and Graeffe, each of whom apparently worked independently of the other two, but the last name is the one usually associated with the process. The method is not as efficient as Horner's method for finding the real roots of a polynomial equation, but can be used to find the imaginary roots or the roots of an equation with imaginary coefficients. In this method, the given equation, f(x) = 0, is transformed into another, F(x) = 0, whose roots are powers of the roots of the given equation; if the roots of F(x) = 0 are sufficiently spread apart, they are readily found from the coefficients and then the roots of f(x) = 0 are obtained. Let
(5.2:1) be the n roots of the equation
(5.2:2) that is to be solved. We assume that the coefficients bl , b2 , " ' , bn are real numbers; some modifications are otherwise necessary but these will be left to the reader. We also assume, without any real loss of generality, that bn *- O. The fundamental feature and underlying concept of the method is the derivation of a new equation
(5.2:3)
172
S. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
whose roots
(5.2:4) are related to the desired roots 5.2: I by the equalities
i = 1,2, "', n.
(5.2:5)
To obtain F(x) from f(x), we note that
(5.2:6)
f(x)
=
(x - '1)(X - '2) ... (x - Tn),
so that f( -x)
= (-x - '1)( -x - '2) ... (-x -
(5.2:7)
(-I)n f( -x) = (x
Tn), or
+ '1)(X + '2) ... (x + Tn).
We obtain by multiplying 5.2:6 and 5.2:7 together the equation
(5.2:8) The right-hand member shows that (-I)n f(x) f( -x) contains only even powers of x, hence, if we write for the moment, U = X2, then
(5.2:9) are the roots of
(5.2:10)
(-I)n f(x)f( -x) = g(u) = (u - '1 2)(U - '22) ... (u - 'n 2).
The coefficients in the polynomial g(u) can be obtained directly from the coefficients of f(x) by noting that f( -x) is also equal to (-I )n(xn + b1x n- 1 + ... + bn), or that
(5.2:11)
(-I)nf(-x) = xn
+ b1xn- 1 + ... + b...
We obtain by multiplying 5.2:2 and 5.2: II together,
(5.2:12)
(-I)n j (x)f( -x) = x2n - (b 12 - 2b2) x2(n-l) + (b 22 - 2b1b3 + 2b4) x2(n-2)
=F ...
+ (-l) n bn2.
We find by comparing this result with 5.2:10 that the roots of the equation
(5.2:13)
'1 2, '22, "',
'n 2
are
(-I)n f(x)f( -x) = g(u) = un - ,.un- 1
+ '2Un-2 =F
...
+ (-I)n'n
= 0,
173
5.2. THE ROOT-SQUARING METHOD
where
i = 1,2, ... , n,
(5.2:14)
and where bo = 1 and bi = 0 if j < 0 or j > n. In a similar way we can transform Eq. 5.2:13 into an equation whose roots are the fourth powers of the original roots, and so on. The mth transform can then be written in the form 5.2:3. The work is conveniently arranged as in the table below (illustrated for n = 6):
bo bo l
bl bl •
-2bob.
b. bsl -2b l ba
ba
b,
b,
ba
ba l
btl -2b ab, 2b.b,
b,s -2b,b,
bll
C,
C,
-2bab, 2b l b,
2bob,
-2boba Co
CI
Ca
C.
CI
Each Ci is the sum of the entries in the rectangle immediately above it. The method is illustrated in: EXAMPLE 1. Find the equation whose roots are the 8th powers of the roots of 2x' + 2x3 - 6x 2 - 4x + 1 = O. We rewrite the equation as x' - (-1) x3 + (- 3)X2 - 2x + 0.5 = O. and then enter the coefficients bo = 1, bI = -1, b2 = - 3, b3 = 2, b, = 0.5 as in the table below. It is not really necessary to divide by 2 to make the leading coefficient unity, but doing it reduces the size of the coefficients. Then, as above, we obtain the numbers written in the line marked (2); these are the successive coefficients (with alternating signs) of the equation whose roots are the squares of the roots of the given equation. The remainder of the table is filled out in a similar fashion. The equation whose roots are the 8th powers of the roots of the original equation is thus found to be x' - 244x3 + 7938.37Sx2
-
17sl.687Sx + 0.00390625 = O.
Let the notation for the roots 5.2: 1 be chosen so that (5.2: 15)
and put (5.2:16)
i = I, 2, ... , n - l.
174
S. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
(I)
-I
-3
2
0.5
I
9 4
4
0.25
6
3
I
7
(2)
(4)
14
0.25
7
49 -28
196 -98 0.5
-7
21
98.5
42
49
0.0625
0.0625
441 -197
9702.25 -1764 0.125
1764 -12.3125
0.00390625
244
7938.375
1751.6875
0.00390625
(8)
Then, froin 5.2:5, (S.2:17)
and i
(S.2:18)
=
1,2, ... , n - 1.
We have (S.2:19)
0
< I (Xi I ~
i
1,
=
1, 2, ... , n - I,
and
i = 1,2, ... , n - 1.
(S.2:19a)
We also recall the well known relations between the roots and the coefficients of the Eq. 5.2:3:
"
~ Ri = RI
+ R2 + ... + R,. =
BI ,
i-I
"
~ RiR ; = RIR2 + RIR3 i<1
(S.2:20)
+ ... + R"_IR" =
B 2,
175
5.2. THE ROOT-SQUARING METHOD
It follows from 5.2: 18 that (5.2:21)
i <j;
and then, from 5.2:20, Bl
=
B2
=
+ Pl*)' R 1R 2( 1 + P2 *),
Rl(l
(5.2:22)
where each f3* is a sum of terms, each term being the product of one or more f3's. Hence 2[RIR2 ... Rrr-t{l + PL)][R1R2 ... Rk+t(l R12R22 ... Rk2(1 + Pk *)2
+ P:+i)]
or (5.2:23)
where
f3* * is
a product of f3's.
Case 1. There are no equalities in 5.2: 15, and hence in 5.2: 17 and 5.2: 19. Since the coefficients in 5.2:2 are assumed real, there are, in this case, n distinct real roots such that no root is the negative of another. Since for every i, I (Xi I < 1, I f3i I can be made arbitrarily small for m sufficiently large and hence each f3* and f3* * can be made arbitrarily small for m sufficiently large. Hence, for m sufficiently large, we have, for any preassigned degree of precision, the approximations
(5.2:24)
176
S. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
(The last is, of course, a true equality and not an approximation.) Since the B's are known, the successive equations yield Rl , R2 , ... , Rn, in turn. The absolute values of the roots, 1ri I, i = 1,2, ... , n, are then calculated from 5.2:5. The algebraic signs of the roots are determined by substitution, root location, or other means. The equality 5.2:23 indicates that for sufficiently large m, 1 2Bk_iBk+i/Bk2 1 can be made arbitrarily small; that is, 1 2B k- i B kti 1 is small compared to Bk 2 • This means that in the root squaring process, all the double cross product terms (in this case) will ultimately become negligible. We illustrate the process in: 2. Find the roots of 2x' + 2x3 - 6x 2 - 4x + 1 = 0 correct to four decimal places. A table of values of the polynomial or a rough graph shows that the roots are approximately r l = -1.9, r2 = 1.5, ra = -0.8, r, = 0.2. The order of the roots is that of decreasing numerical value; we have r2/r l = 0: 1 = -0.79, ra/r2 = 0:2 = -0.53, r,/ra = O:a = -0.25, whence f3l = (0.79)2"', f32 = (0.53)2m, f3a = (0.25)2m. It is readily shown from 5.2:5 that if ri is calculated from an assumed value for Ri , the accuracy of ri is as least as great as the accuracy of Ri . This implies, first, that the work should be carried out using one or two significant figures more that required in the final answers; and second, the minimum value of m, in this example, is 6. In actual practice, one or two significant figures more than required in the final answer are used and the value of m is not determined beforehand but the calculations are continued until all double cross products become so small that they cannot affect the last significant figure desired. The work is shown in the table on page 177. In the table, a small number in the position usually reserved for exponents indicates that the base number is to be multiplied by the corresponding power of 10; thus, the entry 7.93838 a means 7.93838 X lOa = 7938.38. Also, within a box, the indicator of the power of 10 is written adjacent to the top number only and is to be understood for the other co-columnar numbers in the box. An asterisk (*) indicates a number too small to affect the last significant figure desired. The beginning of the table is taken from the table prepared for example 1. We have, from the row marked (64) in the table, EXAMPLE
1 rl 164
=
Bl
=
3.1671 X 1018 ;
hence logl r l 1 = 0.28907 and 1 r l 1 = 1.9457. (We now round off the numbers to five significant figures and replace the approximation signs in 5.2:24 by equality signs since presumably the values will be correct as far as they are written.)
S.2. THE ROOT-SQUARING METHOD
(I)
(2)
(4)
-I
-3
2
0.5
I 6
9 4 I
4 3
0.25
7
14
7
0.25
49 -28
196 -98 0.5
49 -7
0.0625
21
98.5
42
0.0625
441 -197
9702.25 -1764 0.125
2.44
(8)
177
1
5.95360 ' -1.58768
1764 -12.3125
0.00390625
7.93838
3
1.75169
3
3.90625
-3
6.30179 -0.08548
7
3.06848 8 -0.00006
1.52588
-II
7
3.068428
1.52588
-II
111
9.41520 11
2.32831
-10
* (16)
4.36592 '
6.21631
1.90613 • -0.12433
3.86425 - 0.00027
*
* (32)
1.78180 •
(64)
3.17481 -0.00773
18
3.16708
18
I '1'2 18'
logl
= 0.19802,
'3 I =
9.41520
11
2.32831
-10
1.49303
31
8.86460811
5.42103
-10
5.42103
-10
1.49303
* 8.86460
31
= B2 = 1.4930
X
= 1.5777; I '1'2'a 18' = Ba = 8.8646
lO31,
and 1'21
X
lO25,
9.91834 - 10, and I '3 I = 0.8286; I '1'2'3', 1M
logl "
111
* *
Similarly, logl '21
3.86398
I = 9.29354 -
= B, = 5.42lO
10, I " I
= 0.1966.
X
'lO-20,
III
178
(1)
(2)
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
-I
-27
21
254
I 54
729 42 508
441 13716 256 1896
64516 5376 51192 360 2160
55
1279
16309
123604
3.02500 00000 • - 2.55800 00000
(4)
(8)
(16)
1.63584 10000 -1.7939900000 0.2472080000
8
2.6598348100 -3.1617903200 0.62023 28000 -0.0298684800
8
1.52779 48816 -1.8391594064 0.38201 78592 -0.0228808800 0.00023 32800
4.67000 0000 •
8.90590 0000 '
8.84088 1000 8
4.80057 3440
2.18089 0000 • -1.781180000
7.931505481 • -8.257382854 0.96011 4688
7.81611 768613 -8.550685400 1.27048 3321 -0.034592152
2.30455 0535 - 2.40518 0268 0.30807 4245 -0.00787 2427 0.000027210
4.02256972 17 -4.00767 996 0.39919859
2.51325207 26 -2.53186642 0.26884368 -0.00165823
3.98398 786 •• -3.37188564 0.10517090 -0.00019 171 0.00000004
4.1408835 18
2.48571 10 .,
1.59768 084 • - 1.26847463
1.0837673 -0.8281767
8 17
1.7146916·· -1.6366230 0.14341 63
5.01323455
6.1787592 " -5.9387015 0.5283019 -0.0001054
7.1708145
31
5.1420581 -3.98900 70 0.0043634
83
OF
* 2.55590618
(32)
6.532655" -4.429698
2.214849" 4.905556 -3.92717 I 0.231483
8'
7.682542 5.902145 -5.126999 0.325249
u &6
* (64)
2.102957" a
17
1.99599295 18
6.34237 315 •
3.2920621
8
U
3.99710 000'
1.209868 "'
b
c
j
** **
1.100395 ••
1.15741 5 83 1.33960 9 -0.977634 0.00000 I
U8
* * 3.61966 u,
d k
e
** *
* * *
10
179
5.2. THE ROOT-SQUARING METHOD
-128
-948
180
1080
16384 481584 7560 58320
898704 46080 548640
32400 2047680
1166400
563848
1493424
2080080
1166400
3.1792456710 -3.6918636019 0.67848 04944 -0.0298365120
11
1.360260515
10
1.85030 8669 -1.660621655 0.149034674 -0.00242 3276
10
2.23031 52438 - 2.34569 78957 0.2883434112
1. 72960 7593
11
11
2.991542426·· -2.29305 1816 0.13062 2543
4.32673 28064 -3.4838595072
8.42872 2992
2.39811 306 ••
11
8.29113 153
1.13096 622 -0.33098080 0.00240446 -0.00000 235
al
6.87428 620 la -1.61296 323 0.00738889
5.75094 625 -3.06926116
5.26871 19 18
2.6816851
8.02387 53
a8
6.43825 75 -0.0755619 0.00000 13
77
2.77593 25 -0.0430350 0.0000005
11
87
11
7.104337128 •• -4.706224071
3.36298412
18
18
11
1.36048 89600
1.36048 8960 1. 1.85093 0210
1.85093 021
77
4.048391156 -0.000063
* * 4.048328156
2.732898
87
7.46873 1 171 -0.000456
1.17370 83
3.58137411
1.173708
17
1.377590
1"
186
17
* 7.468275
171
6.41099
f
g
h
* * *
* *
m
181
II
3.42594 26 18
7.1914350 II -3.6100609
1.28262 4 -0.641525
H
3.42594 264 18
* 6.362697
11
1.377590 I"
180
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
Since we approximated the roots at the very start, we know the proper distribution of algebraic signs; we have Tl = -1.9457, T2 = 1.5777, T3 = -0.8286, T" = 0.1966. Because of rounding off errors and the predilection toward mistakes, it is advisable to check answers obtained by the root squaring process. The given answers are correct to all four decimal places. Case 2. There are some equalities in 5.2: 15 and hence in 5.2: 17 and 5.2: 19; but we assume that the roots (and coefficients) of the Eq. 5.2:2 are all real. There are then multiple roots or roots whose negatives are also roots. Let us suppose, for example, that
(5.2:25)
1T,_1 1> 1T, 1= 1T,+11 = ... = 1T,+I_ll > 1Tn. I·
It can be shown that the approximations 5.2:24 for Bg , Bg+1 , ... , Bg+s- 1 are replaced by the approximations
(5.2:26)
The entries for the table for the transformed equations are evaluated as in Case I; this time, however, the double cross products directly underneath Bg2, B:+l , B:+S- 1 will not become small or negligible. We illustrate the procedure in:
+
EXAMPLE 3. Find the roots of x 8 + x 7 - 27x6 - 21x5 + 254x" 128x3 - 948x 2 - 180x + 1080 = 0, given that all roots are real. We rewrite the equation as x 8 - (-I)x7 + (-27)x 6 - 21x5 + 254x" - (-128)x3 + (-948)x 2 - 180x + 1080 = 0 and then evaluate as in example 2 the entries in the table on pages 178 and 179. The work was carried out to the 64th power equation although it should have been carried out further for greater precision. The letters underneath the coefficients of the 64th power equation indicate entries that would appear in all further tabulations; the single asterisks (*) indicate entries that have already become negligible or will become negligible at the next step; the double asterisks (**) indicate entries that will ultimately become negligible. In view of the discussion just above, it
5.2. THE ROOT-SQUARING METHOD
181
appears that there are two roots with equal absolute values, then three roots with equal (and smaller) absolute values, then a sixth root, and finally, two more roots of equal absolute values. Incidentally, because the number of significant figures decreases from step to step in this example, it is necessary to start with a large number of significant figures to get a reasonably reliable set of answers. If we change the usual notation and call the distinct roots of the final equation Rl , R2 , R3 , R" then the approximate equations 5.2:26 (for all eight roots, and again using equality rather than approximation signs) become R12 = 3R12R2 = 3R12R22 = R 12R23 =
B2 = B3 = B4 = B5 =
1.2099 1.1004 3.6197 4.0483
X
X
1084 , 1095 , 10125 , 10155 ,
= 7.4683
X
10174 ,
2R12R23R3R4 = B7 = 6.4110 R12R23R3R42 = B8 = 1.3776
X
10184 , 10194 •
R 12R23R3 = Be
Hence
1'1 I =
R~/84
X X
X
-+
B )1/84 =( = 3.165,
B )1/84 = (_3_ = 2. 994 I ' 2 I = Rl/84 2 3B2 , B )1/84 = (_8_ = 2000 I ' 3 I = Rl/84 3 B5 ., B )1/84 I '4 I = R!/84 = ( 2~8 = 1.414.
Substitution into the original equation will determine the signs of the roots. Since I '21 occurs three times and both 2.994 and -2.994 appear to be roots, the sign of the third corresponding root can be obtained from the sum (= -1) of all the roots, or otherwise. [It may be well to recall that if f'(x) is the derivative of f(x) with respect to x, then an s-fold root of f(x) = 0 is an (s - 1)-fold root of f'(x) = 0.] The actual roots of the equation are ± yTO, 3, -3 (a double root), 2, ± Y2. Case 3. There are equalities in 5.2: 15 due to the presence of imaginary roots. Multiple roots of the given equation f(x) = 0 can be detected by finding the highest common factor of f(x) and its derivative f'(x) and
182
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
can be obtained first. We may then suppose that the equation to be solved has no multiple roots. Let us assume further that no imaginary root has the same absolute value as any other root except, of course, as its conjugate which must also be a root. Let rf/ be an imaginary root and rf/+l its conjugate, and let rand 0 be the modulus and amplitude, respectively, of rf/' so that I rf/ I = I rf/+l I = rand rf/rf/+l = r2. It follows that R, + RHI = 2r2m cos 2mB, (5.2:27) R,R'+1 = r2m+!; and it can be shown that in place of the approximation for Bf/ given by 5.2:24, we have (5.2:28)
Hence, again using equalities in place of approximations, (5.2:29)
R,
+ R'+1 =
B,/B'_l'
R,R'+1 = B,+1/B,-l'
so that Rf/ and Rf/+l are the roots of the equation (5.2:30)
The existence of imaginary roots is readily determined from the root squaring tabulations. As in the case of real roots with equal absolute values, the cross product term 2Bf/- 1Bf/+l does not become negligible in comparison with Bf/2 since by a line of reasoning similar to the previous one it can be shown that its absolute value is approximately equal to Bf/2/2 cos 2 2mO. Hence, as before, the nonvanishing double cross product points to the presence of two roots with equal absolute values. To distinguish the present case from the one in which the two roots are equal, we note that if all the roots of f(x) = 0 are real, the roots of the very first transformed equation as well as the roots of all the later equations are positive. Hence, by Descartes' Rule of Signs, the actual coefficients of all the transformed equations must alternate in sign and therefore, in view of our notation, all the coefficients of the transformed equations that appear in the tabulations must be positive. The appearance then of one or more negative coefficients in the equations in the table whose roots are the second, fourth, eighth, ... , powers of the original roots would immediately indicate the presence of imaginary roots.
5.2. THE ROOT-SQUARING METHOD
183
In the rare cases where there are imaginary roots but all the coefficients remain positive, they may be detected when the suspected roots are substituted into the equation. This complication may arise if a root Tg = U + iv is such that v is very small so that both Tg and Tg+l are approximately equal to u. If a pair of imaginary roots has been detected from the tabulations, we find, as before, R 1 , ••• , Rg - 1 • Then Rg and Rg+l can be found from 5.2:30, and from them, Tg and Ta+l , using 5.2:27 or DeMoivre's theorem, or we can proceed as in example 4. We continue in a similar fashion until all roots have been found. 4. Find the roots of X4 - 5xa + 8x 2 - 3x - 3 = O. The root squaring tabulations are shown on page 184. We stop at the 64th power equation because after that point all coefficients with the exception of the coefficients of x 2 will be merely the squares of the previous corresponding coefficients. The appearance of negative signs in the coefficients of x 2 indicates the presence of imaginary conjugate roots. We have R t = I Tl 164 = 3.1451 X 1024 ; whence 10g1 Tl I = 0.38278 and I Tl I = 2.4142. Next, since T2 and Ta are apparently imaginary roots, we put I T2 I = I Ta I = T and we have, using 5.2:29, EXAMPLE
R2R3
Finally,
=
I T2Ta l84 = (T2)84 = 1.0800 x 1055/3.1451 X 1024 ; log T2 = 0.47712 and T2 = 3.0000.
= I TIT2Tal 84 I T, 18' = 3.4337 x 1()30; log I T41 = 9.61722 - 10, I T41 = 0.4142.
RIR2R3R4
A graph or substitution into the original equation shows that the two real roots are Tl = 2.4142, T4 = -0.4142. If we put T2 = u + iv, Ta = u - iv, then Tl
+ T2 + T3 + T4 = 5 =
2.4142 + (u
+ iv) + (u -
if) - 0.4142,
so that u = 1.5000. Then v = V;! - u2 = Y3-~ 2.25 = 0.8660 and T2 = 1.5000 + 0.8660i, Ta = 1.5000 - 0.8660i. The roots are correct as far as they are written; the roots are actually 1 ± y2, (3 ± Y3t)/2. The present method can be extended to cover the cases where the given equation has several sets of roots, real or imaginary, with repeated absolute values. The details of recognition and computation are left to the reader. Real or imaginary roots can also be found by the methods to be discussed in the succeeding sections.
184
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
(1)
(2)
(4)
5
8
(16)
9
6.4 -3.0 -0.6
1
0.9
1
2.8
1
8.1 -5.6
1
7.84 • -10.26 0.18
3.249 3 -0.504
2.5
1
-2.24 •
2.745
1.073
3
5.71
9 8.1 •
3
8.1 •
5.0176 ' -13.7250 0.0162
7.53503 I 0.03629
6.561
3
-8.6912 '
7.57132
6.561
3
8
1.15133 0.17382
8
7.55370 • -16.24805 0.00001
5.7324913 0.00011
4.30467
7
1.32515
I
-8.69434 •
5.73260 13
4.30467
7
1.75602 0.01739
11
3.28627
17
1.85302
16
1. 77341
11
-7.63396
11
3.28627
17
1.85302
16
3.14498 0.00015
II
5.82773 -11.65581
31
1.07996 I i
3.43368
30
3.43368
80
7.55915 -15.19311
11
*
* (64)
9 48
1
* (32)
-3
2.5 -1.6
6.25 • 4.48 (8)
3
3.14513
II
-5.8280881
* 1.07996 I i
EXERCISE 5.2
1. Find by the root-squaring method, correct to three decimal places, the roots of the equations of example I, Exercise 5.1. 2. Find by the root-squaring method, correct to three decimal places, all the roots of a. x' + Xl - 9x· - 6x + 18 = O. b. 9x' - 6x1 - 5x· + lx + 1 = O. c. 5x' - 16x' - 36xl + 110x· + 57x - 187 = O. 3. Find by the root-squaring method, correct to three decimal places, all the roots of the equations of example 2, Exercise 5.1. 4. Find by the root-squaring method, correct to three decimal places, all the roots of a. lx' - 4Xl - Xl + 12x + 18 = O. b. x' - 6x' + IOx3 + 11x· - 6lx + 70 = O. c. x' - lxl + 4x· - 28x + 196 = O.
5.3. THE METHOD OF ITERATION
185
5.3. The Method of Iteration. The method of iteration for finding the roots of an equation, unlike Horner's and the root-squaring methods, applies not only to polynomial equations but to equations of all types. In its pure form, an approximation to a root of an equation f(x) = 0 is substituted into a suitably chosen function 9'(x) to yield a better approximation, the latter is substituted into 9'(x) to yield a still better approximation, and so on until a result is obtained of satisfactory precision. Modifications of the pure form of the method will also be discussed. The process when properly used is usually very efficient and is well suited for computation on high speed machines. The method owes its validity to the following two theorems. THEOREM 1. Let 9'(x) be a single-valued function and ro an arbitrary constant. Let the sequence of constants
(5.3:1) be defined by the recursion formula n = 0, 1,2, ....
(5.3:2)
If the sequence 5.3:1 has a limit, say limn ...."" r n = r, and 9'(x) is continuous at x = r, then
(5.3:3)
r = 9'(r) ,
that is, r is a root of the equation
(5.3:4)
x = 9'(x).
The proof follows readily enough. Since 9'(x) is continuous at x = r, it is true that for any sequence such as 5.3: I which approaches r, the associated sequence 9'(ro), 9'(r1), 9'(r 2 ), " ' , will approach 9'(r). Since the latter sequence is identical with the sequence 5.3: I minus its first term in virtue of the definition 5.3:2, the two limits are equal or r = 9'(r). Theorem I is of consequence only if criteria or conditions are given which will assure the convergence of the sequence 5.3: I. A sufficient condition for convergence is furnished by the next theorem. THEOREM 2. A sufficient condition for the convergence of the sequence 5.3:1 is that the derivative 9"(x) and a constant m exist such that the double inequality
(5.3:5) holds for all x's.
I 9"(x) I < m <
1
186
S. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
The proof of this theorem is also immediate. Definition 5.3:2 yields for any positive integers nand k, Tn - Tn+k = 91(Tn - 1 ) - 91(Tn +k-l). Since 91'(x) exists, it follows from the Law of the Mean that 91(Tn - 1) - 91(Tn+k-l) = (T n - 1 - Tn +k-l)91'(S), where s is between Tn - 1 and Tn +k-l. Furthermore, from 5.3:5,
I Tn-l -
Tn+k-l
I
where the equality holds only if
I Tn-l -
~
Tn - 1 =
Tn+k-l
Tn+k-l .
I m,
Consequently,
(5.3:6)
Similarly, I Tn - 1
I ::::;; I Tn - 2 - Tn+k-2 1m, hence I Tn - Tn+k I ::::;; If we continue the reduction of the subscripts on the right, we find after n steps that I Tn - 2 -
-
Tn+k-l
Tn +k_2Im 2 .
n
(5.3:7)
= 1,2,3, ....
Since To - Tk is a constant and 0 < m < 1, the right-hand member of the last inequality can be made arbitrarily small by taking n large enough; hence the left member can be made arbitrarily small. It follows from a well-known theorem on sequences that the sequence 5.3: 1 will then converge which is what we wanted to prove. REMARK. If T = 91(T) and TO is any (real) number, the condition that 5.3:5 hold for all x's can be replaced by the weaker condition
(5.3:8)
I
Ix
for
1
to assure convergence of the sequence In 5.3:7, let k tend infinity, then (5.3:9)
IT -
Tn
-
T
I ~ I To -
To, Tl , T2 , •.• ,
I ~ IT -
TO
to
T
I,
T.
I mn.
This statement could also be derived just as 5.3:7 itself was derived if we start with T - Tl = 91(T) - 91(TO) = (T - TO)91'(S). The right-hand member of 5.3:9 gives a bound for the error in approximating T by Tn • We also have (5.3:10)
IT -
Tn
I ~ IT -
Tn-l
I,
that is, T' I is at least as close to the root T as T,,_1 • It remains to show how a given equation to be solved, (5.3:11)
f(x)
=
0,
5.3. THE METHOD OF ITERATION
187
can be put into the form 5.3:4 so that 5.3:5 or 5.3:8 holds and a root r of f(x) = 0 can be found by iterated substitution in 9'(x). We suppose that r is an isolated root of 5.3:11; that is, there is a neighborhood N r of r which contains no other zero of f(x) (in the contrary case, which we do not consider here, f(x) will have infinitely many zeros in any neighborhood of r). Consider (5.3: 12)
x
=
x - gf(x),
where g is an arbitrary nonzero constant, and (5.3:13)
x
=
x - g(x)/(x),
where g(x) is an arbitrary function of x which exists but is not equal to zero in N r • Then not only is r a root of either equation, but is, in N r , the only root of either equation. If 9'(x) = x - gf(x), then 9"(x) = I - gf'(x) [we assume that f(x) is differentiable]. Since r is known approximatelY,f'(r) will be known approximately, and hence if g is chosen approximately equal to I/f'(r), 9'(x) will satisfy 5.3:8. Similarly, if 9'(x) = x - g(x) f(x) , then 9"(x) = I - g(x) f'(x) - g'(x)f(x). Since for x close to r, f(x) is close to zero, 5.3:8 will hold if g(x) = I/f'(x). Summing up, the right-hand members of (5.3:14)
x
=
x _ I(x)
f'
and (5.3:15)
x
=
I(x) x - f'(x)
will be suitable forms for iteration if I' is a constant close to f'(r). EXAMPLE I. Find the real root of x3 - 3x2 to four decimal places.
+ 12x -
24 = 0 correct
Solution I. It is readily ascertained that the only real root is between 2 and 3. The "average" slope of f(x) = x3 - 3x2 + 12x - 24 in this interval is (/(3) - f(2»/(3 - 2) = 16, or we can take the value of 1U'(2) + 1'(3» = 16.5. If we take I' = 16 in 5.3:14, then 9'(x) = x - la(x3 - 3x2 + 12x - 24). Start with ro = 2; then r 1 = 9'(2) = 2.25, r2 = 9'(2.25) = 2.30, r3 = 9'(2.30) = 2.306, r, = 9'(2.306) = 2.3071, r6 = 9'(2.3071) = 2.3073. Further substitution produces no change in the fourth decimal place; hence 2.3073 is the required root correct to four decimal places.
188
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
Solution 2.
Use 5.3: 15, then x3
9'(x)
= x-
-
3x2 3X2 _
+ 12x - 24 6x + 12 =
ixS x-
x2
-
x 2 + 4x - 8 2x + 4
Again start with ro = 2; then r 1 = 9'(2) = 2.33, r 2 = 9'(2.33) = 2.307, ra = 9'(2.307) = 2.3073, with no further change, as before. EXAMPLE 2. Find the larger root of the equation f(x) = x 2 - 3.6 logloX - 2.7 = 0, correct to four decimal places (assume 3.6 and 2.7 are exact numbers). Solution 1. It can be ascertained from a graph, or otherwise, that the equation has two real roots, one between 0.1 and 0.2 and the other, the desired root, between 1.9 and 2. From f'(x)
= 2x _
3.61og e , x
we obtainf'(2) = 3.2. We use 5.3:14 to get ( )_
9' x - x -
x2
-
3.61og x - 2.7 . 3.2 '
whence, if we start with ro = 2, we find r 1 = 1.93, r2 = 1.9310. Further substitution produces no change in the fourth decimal place of the root. Solution 2. Forms other than those derived from 5.3:14 or 5.3:15 can be used for iteration. For example, the given equation can be solved for x 2 and then both sides divided by x to yield x = (3.6 log x + 2.7)/x, whence 9'(x) = (3.61ogx + 2.7)/x and 9"(2) = -0.6. Hence 9'(x) is suitable for iteration; again beginning with ro = 2, we find r 1 = 1.9, r 2 = 1.95, ra = 1.92, r, = 1.94, rs = 1.93, r6 = 1.932, r7 = 1.931, r8 = 1.9310. Reference to 5.3:8, 9 explains why the rate of convergence is much more rapid in solution 1 than in solution 2. In the first case, I 9"(x) I ~ 0.05 in the neighborhood of the root; in the second, I 9" (x) I ~ 0.6. REMARK 1. It should be borne in mind that the most suitable form for 9'(x) depends not only on the rate of convergence to the root but also on the ease with which the computations can be made. In turn, some computational forms may be most efficient when all calculations are made long-hand, other forms may be more suitable when slide rules or desk calculators are used. Still other forms may be advisable for high speed electronic calculators.
189
5.3. THE METHOD OF ITERATION
REMARK 2. The method of iteration has one very pleasing aspect. If in the calculation of Tk , say, an arithmetic mistake is made and Tk' is obtained instead, no great harm is done provided that Tk' is close enough to the root so that the condition 5.3:8 holds. Since a large mistake would be immediately obvious and corrected, mistakes in general merely change the rate of convergence to the root. REMARK 3. The method of iteration based on formula 5.3: 15 is known as the Newton-Raphson method. The formula itself can be otherwise derived and interpreted. Consider, for example, the graph of y = f(x) in the neighborhood of a root T of f(x) = 0, Fig. 5.3:£1. Suppose, as in y
FIG. 5.3:fI.
the diagram, that the slope is positive and the curve is concave upward in the neighborhood of the point R, the intersection of the curve with the x-axis, whose abscissa is T. Other cases can be treated similarly. If RoAI , RIA2 , ... , are perpendicular to the x-axis and AIRI , A2R2 , ... , are tangents to the curve at Al , A2 , ... , respectively, and if the abscissa of Ro is To, then the abscissas of RI , R2 , ... , are the values TI , T2 , ... , respectively, given by 3.5: 15. See example 33 of Exercise 5.3. The geometric interpretation of the iteration process determined by 5.3: 14 is similar to the preceding one. This time, the lines AIRI , A 2R2, ... , are not tangents but lines having a constant slope. See Fig. 5.3:f2. Another geometric interpretation is also of considerable interest. The problem of finding a value T to satisfy the equation x =
o
RO FIG. 5.3:f2.
x
190
S. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
the same as the problem of finding the abscissa of an intersection point of y = x and y = cp(x). See Fig. 5.3:f3. If R is an intersection point of the graphs of y = x and y = cp(x) and Ro , RI , R2 , "', SI' S2' "', are on the graphs of y = cp(x) and y = x, respectively, and if RoSI , R I S2 , "', SIRI , S2RS , "', are parallel and perpendicular, rey=x
--~~-----------------x
FIG. S.3:f3.
spectively, to the x-axis, then if 5.3:8 holds, the abscissas of R o, R I , R s, ... will approach T, the abscissa of R. If the equationf(x) = 0 has more than one real root, or, in particular, if it has several real roots that are close together, these geometric considerations will indicate a suitable choice for TO so that the iteration will yield the desired root. EXERCISE 5.3
In examples 1-26, find all the (real) roots if there are three or fewer roots in the equation, find the three roots of smallest absolute values if there are more than three roots; find all roots correct to the indicated number of decimal places (dp) or significant figures (sf). Assume all stated numbers are exact. 1. 2. 3.
4.
x~
+ 3x
- 100 = O.
y;-+ 4 + 4 sin x
ez(y; - 1) = ez + e- = 4.
(S dp)
=
O.
1.
Iz
+ IS = O. 6. (1 - x) e1+IZ = 3. 7. SQeZ/3 - 4Sx - 1 = O. 8. xe l / z = 2.72. 9. xez/I - 3xl + 3x - 1 = O. 10. Xl." - S.22x - 2.01 = O. 5. x - Se- z
11. logloX = 1 12.
Xl -
+ -x1 .
2x - logloX
(3 dp) (3 dp) (3 dp) (3 dp) (3 dp) (3 dp)
(3 dp) (4 sf) (3 dp) (2 dp)
=
O.
(3 dp)
5.3. THE METHOD OF ITERATION
13. 14. 15. 16. 17. 18.
191
= 1. 4 = O. 10.311oglo T + O.OOIT = 34.31. x" + 2x = 6. I + loglox = sin x. 11 sin x = lOx. Xl(lOglOX Xl
19. x
I)
(3 dp)
+ logloX -
+ -xI
=
(4 dp)
(3 dp) (3 dp) (3 dp) (3 dp)
.
(3 dp)
3 sm x.
20. lOuin! = 1. x 21. x + tan x - 2 = O.
(3 dp) (3 dp)
n.
x sinh 10 - 15 = O. (3 dp) x 23. tan x + tanh x = O. (3 dp) 980.56 24. x tanh - - - = a, for a = 401.75 and 970.23. (4 sf) x Xl + I (5 sf) 25. e llnz - - - - = O. x+2 26. eZ cos 2x + e-Z sin 2x = x. (4 dp) 27. Find the roots of the equations in problems 10 and 15 to as many significant figures as are warranted if the three decimal numbers in each equation are correct only as far as written. 21. Find the minimum value of V2x + 3 + e-Z correct to three decimal places. 29. Find the turning points with positive abscissas less than 2,. of sin x el/z and sin l x el/z correct to three decimal places. I, then 30. If,o is an approximation to a root, of x = F(x), andF'(,o) F(x) - xF'(,o) I - F'(,o) 'I'(x) = is suitable for iteration to the root,. 31. If,o is an approximation to a root' of x = F(x), and F'(x) I in a neighborhood of, (which includes '0), then F(x) - xF'(x) 'I'(x) = I - F'(x) is suitable for iteration to the root,. 32. Derive 5.3:15 from the finite Taylor expansionf(x + h) = f(x) + hf'(x) + hIR(x). 33. If,o is an approximation to a root, of f(x) = 0, prove that f(x) 'I'(x) = x - - f'(x) is suitable for iteration if [J'(x»)I > f(x) f"(x) > 0 for all x's between, and '0 . 34. If a > 0, prove that
*"
*"
'I'(x) =
!n (n -
I) x
+ _a_) X"-l
is suitable for iteration to yield a l/ft ; in particular a. tp(x) = x(2 - ax) is suitable for I/a; b. cp(x) = 1[x + (a/x)] is suitable for c. Find by iteration, correct to four decimal places, (i)
Va.
t (ii) v'1Q.3 (iii) {/4.2-:-
192
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
5.4. The Method of False Position (Regula Falsi); The Method of Chords. Another method of wide application for finding an isolated root r of an equation f(x) = 0 is the method of false position or regula falsi. The method which is essentially nothing but inverse linear interpolation and is related to the method of iteration, as we shall see, does not involve directly the concept of slope and hence can be used if f(x) fails to have a derivative at r or in some neighborhood of r. Let a < r < b, and suppose that r is the only root in the closed interval [a, b]; then f(c) has the same sign as f(a) if c is in the "left interval" or "left neighborhood" [a, r) and the same sign as f(b) if c is in the "right interval" or "right neighborhood" (r, b]. Suppose now that f(a) and f(b) have opposite signs so that the graph of y = f(x) actually crosses the x-axis at a point R whose abscissa is r. The root r is approximated by the abscissa ro of the intersection point Ro of the x-axis and the chord joining the points A: (a,f(a)) and B: (b,j(b)). See Fig. 5.4:fl. It is readily found that (5.4:1)
ro
=
af(b) -- bf(a) f(b) -- f(a) ,
or (5.4:2)
b--a ro = a -- f(b) __ f(a/(a).
Hf(ro) = 0, ro is the root and the process stops; if ro is in the left (right) interval, it is regarded as a new a (b) and combined with the old b (a) or with a new b (a) selected in the right (left) interval to yield a second approximation. The process is continued until we have an approximation to the root of desired precision. Since we can always contrive to enclose the root and an approximation in an interval of arbitrarily small length, we have a self-contained evaluation of the maximum error. y
----------~°r_~~~--------x A (0, f(a)) FIG. 5.4:fI.
5.4. THE METHOD OF FALSE POSITION; THE METHOD OF CHORDS
193
An example will illustrate the method and the manner in which it can be judiciously modified. EXAMPLE I. Find the positive root of {IX--=-l five significant figures.
-
cos x = 0 correct to
Solution 1. It is readily determined that there is only one positive root and that it is slightly greater than unity. We have f(l) = -0.54, f(1.2) = 0.22; hence the root is between a = I and b = 1.2. We use = 1.1. Since f(l.l) = 0.01, we regard 1.1 as 5.4: 1 or 5.4:2 and find a new b; using the new b and the old a = I, we find = 1.098. Since f(1.098) = 0.00566, 1.098 is also a new b. We continue in this fashionit will take quite a number of additional steps-to get the answer 1.0957 correct to five significant figures. Note that as the work proceeds, we will need more and more significant figures in the values of f(x).
'0
'1
Solution 2. The preceding method of solution is poor on two counts, the rate of convergence to the root is quite slow and the length of the interval within which the root is known to lie does not become arbitrarily small so that we do not have a good measure of the precision of the approximation at any step. To overcome these defects, we proceed as follows. Take, as before, a = I, b = 1.2 to find = 1.1. Since f( 1.1) = 0.0 I, the root is between 1.00 and 1.10 and probably closer to 1.1. As a conservative guess, take the new a = 1.06 and the new b = 1.10. Using these values, we obtain the approximation '1 = 1.096. Since f( 1.096) = 0.00073, 1.096 is a new b and we choose 1.095 as a new a. Since f(1.095) = -0.00176, 1.095 is indeed a new a. If it had turned out that f( 1.095) were positive, 1.095 would have been a new and better b than 1.096. Another step yields f(1.0957) = -0.00001, f(1.0958) = 0.00023. Hence, not only is the root between 1.0957 and 1.0958, but the former is certainly correct to five significant figures. If in the right-hand member of 5.4: I or 5.4:2 we replace a by x to obtain
'0
(5.4:3)
tp(x)
=
xf(b) - bf(x) b- x f(b) _ f(x) = x - f(b) _ f(x/(x),
then for b close to the root " tp(x) is suitable for iteration. Compare 5.4:3 with 5.3: 13 and 5.3: 15. In the example just worked out, start with b = 1.2 and '0 = I. We obtain on successive substitutions into 5.4:3, '1 = 1.14, '2 = 1.09, '3 = 1.097, '4 = 1.0955, '5 = 1.0957, with no further change in the fourth decimal place.
194
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
REMARK.
(5.4:4)
To pave the way for a later generalization, rewrite 5.4: I as f(b) '0
= a f(b) _ f(a)
f(a) - f(a) .
+ b f(b)
Put (5.4:5)
ml
=
f(b) f(b) - f(a) ,
m2
=
f(a) f(a) - f(b)'
so that (5.4:6)
and (5.4:7)
That is, if f(a) and f(b) are of unlike sign, then the weighted average 5.6:6, where the weights are determined by 5.4:5 (so that 5.4:7 holds), is likely to be a good approximation to a root r of f(x) = O. The method of chords is an adaptation of the method of false position. In some problems, it may be advantageous for computational arrangement to rewrite the equation to be solved, f(x) = 0, in the form G(x) = g(x) so that a root r of f(x) = 0 becomes the abscissa of a point of intersection R of the graphs of y = G(x) and y = g(x). We assume that G(x) and g(x) are single-valued and continuous in a neighborhood of r and that G(x) - g(x) has opposite signs in suitably small left and right neighborhoods of r. Let the chord joining A: (a, G(a» and B: y = g(x)
A'(O, g(o)
FIG. 5.4:f2.
(b, G(b» meet the chord joining A': (a, g(a» and B': (b, g(b» in the point R 1 • See Fig. 5.4:f2. It is readily determined that the abscissa r 1 of Rl is given by (5.4:8)
'1 = a + h,
5.4. THE METHOD OF FALSE POSITION; THE METHOD OF CHORDS
195
where h =
(5.4:9)
b_ a (
G(a) - g(a) ) G(a) - g(a) + g(b) - G(b)
EXAMPLE 2. Find the real root of (x + 1) 10gIO x = 1, correct to four decimal places. The given equation is put into the form log x = Ij(x 1), and we set G(x) = 1j(x 1), g(x) = log x. The root T is clearly greater than unity (since otherwise the left-hand member of the given equation will be negative or imaginary); since G(I) = 0.5, g(l) = 0, G(x) > g(x) for x < T. The computations below are self-explanatory.
+
+
h
=
x
G(x)
g(x)
2 3
0.33 0.25
0.30 0.48
(3 - 2)
0.33 -0.30 0.33 - 0.30 + 0.48 - 0.25
2.1 2.2
h
=
(2.2 - 2.1)
0.3226 0.3125
=
0.1
0.3222 0.3424
0.3226 - 0.3222 0.3226 - 0.3222 + 0.3424 -
0.3125
2.1013 2.1012 2.1011
0.32244 0.32245 0.32247
0.32249 0.32247 0.32245
2.10115
0.322461
0.322457
=
000 3 .
I
Hence, the root is 2.1012 correct to four decimal places. EXERCISE 5.4 1. Do the indicated examples by the method of false position or by the method of chords; the numbers refer to the examples of Exercise 5.3.
a. 1 b. 2 c. 5 d. 6 e. 7 f. 8 I. 9 h. 10 I. II j. 13 k. 17 I. 18 m. 19 n. 21 o. 25.
196
5. ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
2. Solve the following equations by the method of false position or by the method of chords. Follow the directions of Exercise 5.3 . •• lO(x - 2)· + 5x - II = O. (3 dp) b. (x - 1)1/3 = In 2x. (4 sf) C. 21+1/Z - 7 cos x = O. (3 dp) d. I sin x I - ez - 2 = O. (4 sf) e. 5(x + I) I log x I = J. (3 dp)
5.5. Imaginary Roots. Some of the methods described in Sections 5.3 and 5.4 for the determination of real roots are applicable with little or no modification to the determination of imaginary roots. For example, the method of iteration, of which the Newton-Raphson method is a special case, is particularly suited for the computational process. We illustrate the method by working: EXAMPLE
1.
Find the imaginary roots of f(x)
= x4 - 5x3 + 8x2 -
3x - 3
= O.
It is readily ascertained by Descartes' Rule of Signs and by substitution that the equation has two real and two imaginary roots. Since /(2) = -1, /(3) = 6; /( -I) = 14, /(0) = - 3; it appears that the real roots are approximately 2.2 and -0.2. The sum and product of the real roots are approximately 2 and -0.44, respectively; since the sum and product of all four roots are 5 and -3, respectively, the sum and product of the imaginary conjugate roots are approximately 3 and 6.8, respectively. It follows that the imaginary roots are approximately 1.5 ± 2i. Since f'(x) = 4x3 - 15x2 + 16x - 3, the Newton-Raphson formula for iteration becomes 44 - 5x3 + 8x2 - 3x - 3 x = x - _:--=---:-::---=--::--::-----::-4x3 - 15x2 + 16x - 3
We start with To = 1.5 + 2i and find by successive substitutions in the right-hand member of the preceding equation, Tl = 1.5 + 1.5i, T2 = 1.5 + I.li, T3 = 1.5 + 0.9i, T4 = 1.50 + 0.86i, etc. The root was previously found to be i(3 + V3i). Another method that can be used is an adaptation of the method of chords; it is the generalization referred to in the Remark of the preceding section. Let T be an isolated imaginary root of the equation (5.5:1)
f(x)
= o.
Suppose that by trial or otherwise we locate three numbers (5.5:2)
5.5. IMAGINARY ROOTS
197
each of which is close to the root r (and where ai and hi are real) such that the absolute values of (5.5:3)
(where ai and f3i are real) are small. Graph the three points representing the numbers r 1 , r 2 , ra in an x~plane and the three points representing the numbers f(r 1)'/(r2)'/(ra) in an f(x)-plane. See Fig. 5.5:fl. (We will find it convenient to refer to the point representing a number x merely as the point x, etc.) If r 1 , r 2 , and ra are indeed close to the root, and if f(x) is sufficiently regular (as it usually is in practice), then the points fer 1)' fer 2)' and fer a) will be fairly close to their origin (the zero point of the plane) and the triangle whose vertices are rl ' r2' ra will be approximately or roughly similar to the triangle whose vertices are /(r1)'/(r 2), f(ra)· b
21
/3 21
i
1
f~ )
f(r3) r2· •
-O~--~--~----~--~2--0
-2
-I
2
0
·f(rl)
a
-I
-21
x- plane
f(x)-plane
FIG. 5.5:fl.
Now, if the points f(r 1)'/(r2)'/(ra), are given numerical weights or masses, positive, negative, or zero, m 1 , m 2 , ma , respectively, then the center of gravity of the triangle is a + f3i, where
f3
+ m2f32 + m3f33 . m1 +m2 +m3
= m1f31
s.
198
ALGEBRAIC AND TRANSCENDENTAL EQUATIONS IN ONE UNKNOWN
If, on the other hand, we put ex =
fJ =
0, and ml
+ m + ma 2
= 1, then
This means that the origin will be the center of gravity of the triangle whose vertices are f(r l ), f(r2),j(ra) if the vertices are weighted with the masses ml , m 2 , ma , respectively, given by 5.5:4. Since the origin IS the point 0 + Oi = f(r), it is reasonable to expect that the point
(5.5:5) where
(5.5:6)
aI' = mlal
+ m~2 + maaa
bl ' = mlb l
+ m2b2 + maba ,
will be a good approximation to the root r. We can now combine r l ' with two of the previous numbers, or with new numbers, to secure a still better approximation. The process can be repeated over and over until an approximation to the root is obtained with the desired degree of precision. We illustrate this method by using it to find the root of example 1. We have, choosing the arguments more or less by guess, f(1.5 + %) = 0.7 - 0.2i, f(l.4 + 0.5%) = - 1.0 + O.4i, f(1.45 + 0.7%) = -0.6 + 0.4i. Next, 1- 1.0 04 -0.6 0.4 1 ml = -0.2 1 0.7 -1.0 0.4 -0.6 0.4 : 1
2
3'
m2
=
1- 06 04 0.7 -0.2 1 2 = 3' -0.2 1 0.7 0.4 -1.0 -0.6 0.4 :1
I-1.0 0.7
-0.21 0.4 ma= -0.2 1 0.7 -1.0 0.4 -0.6 0.4
:I
=
1
-3·
Hence we expect -i( 1.5 + %) + l(l.4 + 0.5%) - l( 1.45 + 0.7%) = 1.45 + 0.77i to be a good approximation to the required root. Indeed,
5.5. IMAGINARY ROOTS
199
have /(1.45 + 0.77i) = -0.33 + 0.27i. We evaluate next + 0.80i) = -0.25 + 0.16i,/( 1.50 + 0.90i) = 0.15 - 0.07i. Again we compute the m's: we
(1.48
m,
~
1-00.15.25
1-
0.33
-0.25 0.15
m,
~
1-0.33 0.15
1-
0.33
-0.25 0.15
0 .33 1--0.25
. , 1~
0.33
-0.25 0.15
0.16 -0.07 0.27 0.16 -0.07 -0.07 . 0.27 0.27 0.16 -0.07 0.27 0.16 0.27 0.16 -0.07
0.0065
= - 0.0256 = -0.254,
;I 0.0174 0.0256 = 0.680,
:I 0.0147 0.0256 = 0.574.
:I +
The new value of r is -0.254(1.45 + O.77t) + 0.680(1.48 + 0.80t) + 0.90i) = 1.499 + 0.865i. The last value is a good approximation to the root.
0.574(1.50
EXERCISE 5.5
1. Do examples 2, 3, 4 of Exercise 5.2 by the methods of Sections 5.3-5.
Chapter 6
The Numerical Solution of Simultaneous Algebraic and Transcendental Equations
6.1. Introduction. In the present chapter we consider various methods of finding the real solutions of a system of n equations in n unknowns. The discussion will be limited, except for the linear case, to the value n = 2 but generalizations for greater values of n will be outlined. The first and most obvious method of solving n simultaneous equations in n unknowns is the method in which the problem is reduced to the solution of one equation in one unknown, that is, to the type of problem investigated. in the preceding two chapters. As an illustration of the method, we do: EXAMPLE
1.
Find the real solutions of the pair of simultaneous equa-
tions f(x,y) g(x,y)
= x3 + 2y2 - 50 = 0, = x - y + IOglO(XY + 1) = O.
Whatever method we employ for the solution, we will find it convenient to graph the two functions on the same coordinate axes; the graphs are shown in Fig. 6.1 :fl. The real solutions are, of course, the coordinates of the points of intersection of the two curves. It appears that there are three real solutions, approximately x = 0.3, Y = -4.9; x = 2.7, Y = 3.6; x = 3.6, Y = -0.2. We obtain, on solving the first equation for y in terms of x,
whence, by substitution into the second equation, x
~ ~50 ~ x3 + log (± x~50 ~ x3 + 1) = 200
O.
6.1. INTRODUCTION
201 Y
25
I
20
,,
15
I I I I I I
\
\
\
\
-15
-10
,,
10 "-
"',
-5
10
15
20
, ,I
II
I
'" "' .... - -5
,, l " , ,,, ,I
-10
- - - - 11 3 + 2y2 -50=0 - - I09'O(IIY + I) + (11- y)
=0
-15
I I
I
-20
I
FIG. 6.1 :fl.
The solution with positive y is found from the equation obtained by taking the upper signs; the two solutions with negative y's are found by taking the lower signs. We obtain the solution with positive y first. We rewrite the corresponding equation in the form x
= '\jIso -2
x3
(/so -2 xi + 1) ,
- log x '\j
and then compute the entries in the following table: II x
Xl
2.7 2.8
19.683 21.952
IV
III
50 2
Xl
15.159 14.048
vm 3.89 3.75
V x(IV)
+
11.503 11.500
I
VI
VII
log (V)
(IV) - (VI)
1.06 1.06
2.83 2.69
202
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
The entries in the last column are the values of the right-hand member, call it F(x), of the preceding equation for x = 2.7 and 2.8, respectively. Since F(2.7) > 2.7 and F(2.8) < 2.8, the desired root is between 2.7 and 2.8. Furthermore, the slope of F(x) at any point within the interval from 2.7 to 2.8 is approximately equal to the slope of the chord joining the endpoints of the graph of F(x) in this interval which is (2.69 - 2.83)/(2.8 - 2.7) = -1.4. Substitute this value in the formula for q:>(x) given in example 30, exercise 5.3; we obtain
/SO-x3
'\/ x=
2
(/SO-x3)
- log x '\/
+ I + l.4x
2
---------------=~--------------
2.4
By the method of iteration, we find the root to four decimal places to be x = 2.7541, whence y = 3.8151. The work is shown partially in the tabulations below.
II
50 -
x
2.75 2.754 2.7541 2.75411
III
V
IV Xl
x(IV)
2 20.796875 20.887757 20.890033 20.890260
14.601563 14.556122 14.554983 14.554870
3.82120 3.81525 3.81510 3.81508
VII
VI
+
log (V)
I
11.5083 11.50719 11.50716 11.50716
(IV) -(VI)+ 1.4x
1.06101 1.06097 1.06097 1.06097
2.4 2.7542 2.7541 2.75411 2.75411
We determine next the two solutions with negative y. This time it is necessary to solve the equation
Iso -2
X= - ' \ /
x3
(
/
-log l-x,\/
SO -2 x3 ) .
We examine first the logarithmic argument
Iso -
z=l-x,\/
2
x3
'
the relevant portion of whose graph is shown in Fig. 6.1 :f2. The curve crosses the x-axis at about x = 0.20005 and x = 3.68034 and ends
6.2. THE METHOD OF ITERATION
203
abruptly at the point x = {ISO = 3.684, z = 1. The logarithm of a negative argument is imaginary, hence one of the desired roots is between 0 and 0.20005 and the other is between 3.6803 and 3.6840. By methods similar to the ones used above, we find that the solutions are x = 0.2000147,y = -4.9995999; x = 3.6804025,y= -0.2716742. This method can be extended in an obvious fashion for the solution of three or more simultaneous equations in the corresponding number of unknowns. y
15
FIG. 6.1:f2.
EXERCISE 6.1
1. Plot the following pairs of equations and find the real solutions correct to three decimal places .
+ 2y - 2 = 0, y8 = lxl - 3 + b. Xl - lx + yl - 8 = 0, yxl = 3. c. y = e"/', Y = 2/(1 + x 8 ). •• x
+ cosy = I, + e' = 5, y =
d. sin x
(x - y)1
e. e"'
4(x3
-
=
v'x + 2.
x.
x).
2. Find the real solutions ofthe following sets of equations correct to two decimal places• •• x = y8 - 2, y = x 8 - z, Z = y8 - lx. b. x + y = I, Xl + yl = z, x 8 + Zl = 4.
6.2. The Method of Iteration. This method lends itself to the solution of n simultaneous equations in n unknowns; we explain it for the case of two equations. Let (6.2:1)
f(x,y)
=
0,
g(x,y) = 0,
be a pair of equations for which a common solution
IS
sought.
204
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
We rewrite them in the forms
(6.2:2)
x
= F(x,y),
y
=
G(x,y),
respectively. Now if
(6.2:3)
x
=
xo ,
y =Yo,
is an approximation to a solution, we determine a second approximation
(6.2:4)
Y =Y1,
from the equations
(6.2:5) and then a third approximation Y =Y2'
by means of the equations
In general, an (n
(6.2:6)
+ l)st approximation x
=
x.. ,
Y=Y.. ,
is obtained from the nth approximation by means of the equations
(6.2:7)
x.. = F(X.._1 , Yn-1)'
Yn
=
G(Xn_1 , Yn-1)'
Our first problem is to determine the circumstances under which these approximations converge to the solution
(6.2:8)
x
=
T,
Y
= s,
that we are trying to find of Eqs. 6.2: 1. We have T = F(T, s),
(6.2:9)
s
=
G(T, s),
and therefore (6.2:10)
T - Xl = F(T, s) - F(xo ,Yo),
s - Y1
=
G(T, s) - G(xo , Yo).
205
6.2. THE METHOD OF ITERATION
Now, by the Law of the Mean for functions of two variables,
= (r G(xo ,Yo) = (r -
F(r, s) - F(xo ,Yo) G(r, s) -
+ (s - Yo)F (t, u), xo) G.,(v, w) + (s - Yo) Giv, w),
xo)F.,(t, u)
lI
u
= Yo + 8(s - Yo);
0< 8 < 1;
w
= Yo + 8'(s - Yo);
0<8'<1.
where t
v
= =
+ 8(r Xo + 8'(r Xo
xo), xo),
It follows that
I r-xil
+ I s-Yll
= I (r-xo)F., + (s-YO)F II I + I (r-xO) G., + (S-YO) Gil I
::;;; I (r-xo)F., I + I (S-Yo)FIII (6.2:11)
::;;;
Ir -
+ I (r-xO) G.,I + I(s-Yo) Gil I Xo I {IF., I + I G., I} + Is - Yo I {I FII I + I Gil I}.
Now suppose that for all points within a certain region R around the point (T, s), (6.2:12)
M
I, IFill, I G., I, I Gill < 2"'
IF.,
where 0 < M < 1.
The inequality 6.2: II then yields (6.2:13)
I r - Xl I + I s - Yl I ::;;; {I r - Xo I + I s - Yo I} M.
Similarly, (6.2:14)
Ir -
Xi+l
I + I s - Yi+l I ::;;; {I r -
Xi
I + I s - Yi I} M,
provided that we remain within the region R. Multiply the inequality 6.2: 13 by the inequalities 6.2: 14 for i = I, 2, ... , n - I; and then divide out the factor common to the two sides; we get (6.2:15)
I r - X" I + Is - y" I ::;;; {I r - Xo I + Is - Yo I} M".
The left-hand side is the sum of the errors of the (n + I)st approximation to the solution 6.2:8; the first factor on the right-hand side is a constant and the second factor approaches zero with increasing n; hence if condition 6.2: 12 is satisfied, the successive approximations will converge to the solution 6.2:8. (Compare this derivation with the one in Section 5.3 for one equation in one unknown.) If Eqs. 6.2: I are written haphazardly in the forms 6.2:2, the conditions 6.2: 12 will ordinarily not be satisfied. To learn how to rewrite
206
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
the original equations in forms suitable for iteration, we follow the lines indicated in Section 5.3 that stem from the equalities 5.3:12 and 5.3: 13. Consider the equations (6.2:16)
x y
= =
= F(x,y), d(x,y)g(x,y) = G(x,y),
x - a(x, y)/(x, y) - b(x,y)g(x,y) y - e(x,y)f(x,y) -
where a(x, y), h(x, y), e(x, y), d(x, y) are functions to be determined. It is quite clear that the solution 6.2:8, x = r, y = s, of the original equations 6.2: 1 will be a solution of the preceding equations 6.2: 16 provided that a(r, s), h(r, s), c(r, s), d(r, s) exist. We have Frz = 1 - alrz - bgrz - arzl - brzK,
(6.2:17)
F" = Grz =
- al" - bg" - alii - b"g, - elrz - dgrz - erzl - drzK,
G" = 1 - elll
-
dg" - e,,1 - d"g,
where the arguments x and y where dropped for the sake of simplicity. Delete the last two terms of the right-hand members of each of the preceding equations (note that these terms automatically drop out if a(x, y), h(x, y), c(x, y), and d(x, y) are constants), set the truncated equations equal to zero, and solve for a, h, c, and d. We find a(x y) ,
(6.2:18)
=
gix,y) .:1(x,y) ,
e(x y) = -gix , y) , .:1(x,y) '
b(x y) = -I,,(x,y) , .:1(x,y) , d(x y) = Irz(x, y) , .:1(x,y) '
where (6.2:19)
I
.:1(x y) = I/ix,y) grz(x,y) ' I,,(x, y) g,,(x, y) ,
whence we obtain by substitution into 6.2: 17, Frz
(6.2:20)
F"
= =
Grz = G" =
+ BtK(x,y), Ad(x, y) + Bzg(x, y), Cd(x,y) + D1g(x,y), C2/(x,y) + D2K(x,y), Ad(x,y)
where the capital letters represent functions of x and y involving the first and second partial derivatives of f and g. The precise forms of these functions can be easily obtained but are not given here. If, however,
207
6.2. THE METHOD OF ITERATION
these functions exist and are bounded in the neighborhood of the solution x = r, y = s of Eqs. 6.2: I, then it follows at once from the equalities 6.2:20 that the partial derivatives Px , P'II' Ox, and 0'11 will surely satisfy the inequalities 6.2: 12. To sum up: if Eqs. 6.2: I are written as x
=
y
= Y + .1(x,y) [g..(x,y)/(x,y)
x - .1(:,y) [gll(x,y)f(x,y) -/II(x,y)g(x,y)],
(6.2:21)
1
- I..(x,y)g(x,y)],
where LI(x, y) is given by 6.2: 19, they will be in forms suitable for iteration, provided that the functions represented by capital letters in the right-hand members of 6.2:20 exist and are bounded in the neighborhood of the solution. In particular, if x = xo , y = Yo is a good approximation to the solution, the preceding forms may be replaced by x
=
1 x - .1(xo ,Yo) [gl/(xo ,'vo)/(x,y) - II/(xo ,yo)g(x,y)],
(6.2:22)
y = Y
+ .1(xo1,Yo) [g",(xo ,Yo)f(x,y) -
I",(xo ,Yo) g(x, y)].
Theoretically, the forms 6.2:21 will lead to a more rapid convergence than the forms 6.2:22, but the far greater simplicity of the latter usually make them preferable for computational purposes. We illustrate the use of Eqs. 6.2:22 by doing: EXAMPLE I.
Find the real solutions of I(x, y) = 4x2 - 5xy + 3y2 g(x, y) = e"'l/ - x - y
+ 7x -
4y - 55
=
0,
= O.
The graphs of these equations are shown in Fig. 6.2:fl; from them we see that the solutions are approximately x = - 2.6, y = 2.6; x = 0.3, y = 5.2; x = 1.7, y = -1.6; x = 3.2, y = 0.4. We have
I", = 8x - 5y + 7, g",=ye"'I/-1, Put
II/ = -5x + 6y - 4, gl/ = xe"'U - 1.
208
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
then 6.2:21 can be put into the form
.12 Y=Y+Lf·
(6.2:23)
We find the fourth solution, correct to five decimal places. We substitute the values Xo = 3.2, Yo = 0.4 into the right-hand members of 6.2:23 and obtain Xl = 3.163, Yl = 0.401. After two more substitutions, we find X = 3.17328, Y = 0.40144. y
10
~
,.--....,
, 1
I
I
-10
I
5 10 ----L-----~/~----~~7=~===-~-----x I
I
I
I
I
I
:
" .... _-",.,.
",/ -5
-10
----- 4x 2 -5xy + 3y2 + 7x-4y -55: 0 - - - eXY: x +y
FIG. 6.2.£ I.
The other solutions can be found in the same way. Had we used 6.2:22 in place of 6.2:21 (6.2:23), it would have taken more steps to find a particular solution, but each step would have involved less computation. EXERCISE 6.2 1. Do example I of Exercise 6.1 by the method of iteration. 2. Complete the illustrative example of this section.
209
6.3. THE METHOD OF CHORDS
3. Find, correct to three decimal places, the real solutions of the following pairs of simultaneous equations. •• x + y2 = 7, y + x 2 = I I. b. 4x - y2 + 6y - 33 = 0, 3x 2 - lxy - y2 C. 4x2 + y - 9 = 0, cos x + cos xy = I. d. y2 = x 2(2 - x), If' + e",2 = 4.
lOx
+ 6y + 6 =
6.3. The Method of Chords. The next method of the method of chords of Section 5.4. Let (6.3: I)
f(X,y)
=
0,
g(X,y)
=
IS
O.
an adaptation
0,
be the equations to be solved; we suppose that in the neighborhood of a solution (r, s) the functions f(x, y) and g(x, y) are continuous and if solved for y, say, are single-valued functions of x. From a graph or otherwise we determine a pair of numbers Xl and x 2 close to r such that (6.3:2)
We substitute Xl and X 2 into the first of the equations to be solved and determine the corresponding y's, YI and Y2 . Similarly, by substituting Xl and x 2 into the second equation we determine the pair YI and Y 2 • The chord joining the points (Xl' YI) and (X 2 , Y2) will intersect the chord joining the points (Xl' Y I) and (X 2 , Y 2 ) in a point whose coordinates are fairly close to the desired solution. If greater accuracy is desired, the process can be repeated; the abscissa of the point just found is chosen as the new Xl or X 2 depending in whether it is smaller or larger than the abscissa of the solution. Which it is can be determined by a comparison of ordinates. It follows that the abscissa of the point of intersection is given by (6.3:3)
x'
=
Xl
+ h,
where (6.3:4)
Compare formulas 5.4:8 and 5.4:9. We illustrate the use of the method by finding one solution of the illustrative example of Section 6.1. We begin by taking Xl = 2.7. We then find YI = 3.89 by solving the equationf(2.7, y) = (2.7)3 + 2y2 - 50 = 0 for Y, and YI = 3.75 by solving the equation g(2.7, y) = 2.7 - Y + log(2.7y + 1) = 0 for y. Similarly, we take X 2 = 2.8 and findY2 = 3.75
210
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
and Y 2 = 3.87. Since Yl > Y 1 and Y2 < Y 2 , the abscissa r of the solution satisfies the inequality 2.7 < r < 2.8. For greater precision we calculate h and find h
= (2.8 - 2.7) 3.89 _
;:~~ ~ ;:~; _
3.75
= 0.054.
We then calculate the values Xl'
= 2.754,
YI'
= 3.81525,
Y I ' = 3.81493,
Y2' = 3.81376,
Y 2'
= 3.81620,
whence 3.81525 - 3.81493
h
= (2.755 - 2.754) 3.81525 _ 3.81493 + 3.81620 _ 3.81376 = 0.00012.
We then have X~'
Y~' Y~'
= 2.75412, = 3.8150696, = 3.8150902,
X~'
= 2.75411,
Y~'
= 3.815085,
Y~'
= 3.815078.
(In the last group, the entries on the left were calculated first. Since it turned out that Y~' was less than Y~', the abscissa of the solution is less than 2.75412. The values on the right were then calculated.) We thus obtain the solution X = 2.75411, Y = 3.81508. EXERCISE 6.]
1. Do the examples of Exercises 6.1 and 6.2 by the method of chords.
6.4. Simultaneous Linear Equations. Theoretical discussions of the system of n linear equations in n unknowns, allxl a 21 x I
+ a12x 2 + ... + alnXn = b + a 2r2 + ... + a 2nXn = b2 ,
l ,
(6.4:1)
can be found in texts on college algebra, linear algebra, and elsewhere.
211
6.4. SIMULTANEOUS LINEAR EQUATIONS
It is shown that if the determinant of the coefficients
.::1=
(6.4:2)
all
aI2
•••
aln
a 21
a22
•••
a2n
is different from zero, then the system has one and only one simultaneous solution
i = 1,2, ... , n,
(6.4:3)
where (6.4:4)
all
a I2 ··· al.i-l
hi
a 21
a22
h2
•••
a2 .i-1
at.i+!··· aln a 2 .HI··· a2n
(that is, L1i is the determinant obtained from LI by replacing the column of coefficients of Xi by the column of constants). If LI = 0, then either Eqs. 6.4: I are inconsistent and there are no solutions, or they are consistent and dependent and there are infinitely many solutions. We will assume in the following discussion that the equations are consistent and independent, that is, that LI i= O. The theoretical solution 6.4:3 is simple enough, but it may be of little value in actual practice if n is large because of the tremendous amount of labor necessary to evaluate a determinant of high order. Hence we investigate other means of obtaining the values of a solution. Two systems of equations are said to be equivalent if any solution of either system is also a solution of the other system. If any equation of the system 6.4: I is multiplied by a nonzero constant, or if an arbitrary multiple of one equation is added to another equation, the new system is equivalent to the old. It follows that a system of equations derived from 6.4: 1 by a finite number of transformations of the two types is equivalent to 6.4: 1. We use this concept of equivalence to simplify the determination of a solution. Let ali, be any nonzero coefficient of the first equation of 6.4: I (there must be at least one nonzero coefficient since, as we assumed, LI i= 0). Multiply the first equation by aijJa1i, and subtract from the ith equation for i = 2, 3, ... , n. All the coefficients of Xi, in the transformed system will be zero except the coefficient in the first equation. The second equation of the transformed system will have at least one nonzero coefficient, say the one in column j2 . As before, we can multiply
212
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
the second equation (of the transformed system) by suitable constants and subtract the multiples, in turn, from the third, fourth, ... , nth equations to obtain a new system in which every coefficient of x i2 ' after the second, is equal to zero. The zero coefficients of xii' of course, remain zero. If we continue to work downward in this fashion, we will end up with a system of equations S, equivalent to 6.4: 1, such that just one unknown, say xi n ' of the nth equation of S has a nonzero coefficient; just one unknown, say xin_t' where jn-l =1= jn, of the (n - l)st equation has a nonzero coefficient; just one unknown, say xin_I' where jn-2 =1= jn or jn-l , of the (n - 2)nd equation has a nonzero coefficient; and so on. The last equation of S can now be solved for xin ' the next to last equation for xi n_t ' the third from last for xin_2 ' and so on. The process can be modified slightly if, when we select a nonzero coefficient in the kth equation to be used to obtain zero coefficients in the (k l)st, (k 2)nd, ... , nth equations, we first divide the kth equation through by this nonzero coefficient. The process can be further modified if, when we operate with the kth equation, we obtain zero coefficients not only in the (k l)st, (k 2)nd, ... , nth equations, but also in the 1st, 2nd, ... , (k - l)st equations. Roughly twice as many steps will be necessary to derive the final system of equations, but then it will not be necessary to solve the system "backward"; the value for each variable will be immediately obtainable. We illustrate the various procedures by:
+
+
+
EXAMPLE
1.
Solve the system of equations
+ 2y x + 4y -
3x
(I)
+
z
+
3z -
= 8 2w = w
6x- y- z+4w=20 Sx - 3y
+ 2z + 2w =
(It is more convenient to use x, y, z, w than
7. Xl' X 2 , Xa , X" .)
Multiply the first equation by - 3, -1, 2, in turn, and add to the second, third, and fourth equations to obtain 3x
(II)
+ 2y -
-8x - 2y 3x - 3y
llx+ y
z
+
w=
- Sw
8
= -23
+ 3w = + 4w =
12
23.
6.4. SIMULTANEOUS LINEAR EQUATIONS
213
Next, multiply the second equation by -I and the third and fourth equations. We obtain
W=
3x+2y-z+
(III)
8
21
ISx
+T w =
7x
+ 2w =
3x
93
T 23
3
+ 2y -
and add to
Sw = -23
-8x - 2y
Multiply the third equation by we obtain
t, in turn,
-t z
and add to the fourth equation;
+
w
-8x - 2y (IV)
ISx
T·
Sw
21
=
= -23
+T w =
34
8
93
T 34
'fx
7·
The last equation yields x = 1; substituting into the third equation, we find w = 3; substituting into the second, we findy = 0; and finally, from the first equation, z = - 2. After the first stage, the second equation (of II) could have been divided by -2 before eliminatingy from the third and fourth equations; we would have obtained 3x + 2y - z
+
w
= 8
4x+ y (V)
ISx
+~w= 93 2 2
7x
+ 2 w = T·
3
23
214
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
Divide the third equation by 21/2, multiply the result by 3/2 and subtract from the last equation to obtain 3x
+ 2y -
z
to
7
W
= 8
+~w=23
4x+ y (VI)
+ 2
+
x
2 31
W=
7
We then solve backward as before. There is little to choose between the two methods in this example; but if the coefficients are given or written as decimals, the second procedure is somewhat preferable. After obtaining the system V, we could have eliminated the y term in the first equation by multiplying the second equation by 2 and subtracting the result from the first equation; we get -5x 4x+y
- z - 4w = -15 5 23
+ 2w =
(VII)
2
21
15x
+2 w =
7x
+ 2w =
93
"2
3
23
2
As before, we divide the third equation by 21/2 and then multiply the result by 3/2 and subtract from the fourth equation; but in addition, to eliminate the w terms from the first two equations, we multiply the resulting third equation by 4 and add to the first equation, and by 5/2 and subtract from the second equation. We get
5
"1x
19
-z
=-
7
3
(VIII)
3
-x+y 7
to
7
34
7
x x
"1 +
W
=
31 7
34
=7·
6."'.
215
SIMULTANEOUS LINEAR EQUATIONS
Divide the last equation by 34/7; we eliminate the x terms in the first three equations by multiplying the resulting fourth equation by 5/7 and subtracting from the first equation, multiplying by 3/7 and subtJ acting from the second equation, and by 10/7 and subtracting from the third equation. We end up with the solution previously found. The values obtained by any method in a solution of the system 6.4:1 will be approximate values if the coefficients and constants of the system are themselves approximate and not exact numbers. The problem of evaluating the magnitude of the errors in a solution due to errors in the given numbers of a system is a rather difficult one and is not considered here. Furthermore, even if the given coefficients and constants of a system are exact, the values of a solution may be in error because of rounding-off steps. These errors may be considerable because of the large number of steps necessary in any method of solution. Hence it is wise to use several decimal places more in the calculations than are required in the answers and, in any event, the answers should be checked by substitution into the original equations. I teration methods and other processes have been developed to lessen the number of steps leading to a solution and to improve an approximate solution. These methods are usually based on a study of matrices and are beyond the scope of this text.
EXERCISE 6.4 1. Solve the following systems of equations; assume all coefficients are exact and obtain the exact answers.
•. 3x - 6y + 4x + 2y 4x + 3y + 2x + 5y -
2z - w 5.8' 8.8' + 5w 6.8' - 3w
= = =
-7 -31 33 -21.
b. 15x + 30y - 15.8' = 166 12x - 6y - 6w = -I 60x + 60.8' - 30w = -29 15x + 15y + 15.8' + 30w = -41. c.
x - 2.ly 5.2x + 3.4y + 0.5x + 0.6y 3x + 2y -
3.5.8' + 8.9w = 0.571 1O.2z w = 29.970 7.7.8' - l.4w = -32.888 8.3.8' + 2.5w = -36.603.
+ 5.ly + 8.2z + 10.5" + 2.9v 2.3" + 14.lv 0.3x + 5.7.8' - 9.8" - 4.4v 2.4y + 3.3.8' 6.5v 8.5x + 3.7y - 1.9.8' + 6.4"
d. 2.3x
6.1x - 8.3y
=
= = = =
97.727 137.531 1.394 -32.308 151.334.
216
6. SIMULTANEOUS ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
2. Solve the following systems of equations; obtain answers to three decimal places. a. 0.333x + 2.904y - 1.507% - 2.286w = 8.268134 1.492.% - 1.732y - 0.304% - 1.665w = 10.593883 1.973x + 2.008y - 2.432% - 1.084w = 25.729042 2.088x - 1.414y + 2.567% + 2.093w = -15.439019. b. 3.054x - 9.240y - 0.807% - 2.61 lu + 4.402v = -37.777518 1.606.% - 3.876y - 2.955% + 3.171u - 3.578v = -51.092002 3.880x - 4.232y + 3.067% - 1.055u - 3.023v = -58.904530 2.294x + 7.057y - 4.229% - 2.526u - 6.604v = -3.452426 3.823x + 5.549y + 5.628% + 3.277u + 5.1000 = -3.903743.
Chapter 7
Numerical Differentiation and Integration
7.1. Introduction. The derivative f'(x) of a given function f(x) can almost always be found by the well-known rules of differentiation and hence the values of f'(x) for arbitrary values of the argument x can usually be obtained. Trouble may arise if f(x) is not an elementary function, for example, if f(x) = I x 2 sin(l/x) I or if f(x) is the function which equals 0 for x irrational, I for x = 0, and l/q for x equal to the nonzero rational number p/q in lowest terms. The ordinary rules cannot be used if the function possesses a derivative but is known only by means of a set of points or tabulated values, (Xi' Yi). The same remarks apply with even greater force to the evaluation of a definite integral since the indefinite integral of an elementary function is not necessarily an elementary function. For example, f x-leX dx is not an elementary function. Hence it becomes expedient to devise methods for the numerical approximation of derivatives and integrals. One method of approach consists in drawing the graph of Y = f(x) on cross-section paper. The value of the derivative f'(a) can be approximated by drawing a line, as best one can, tangent to the curve at the point (a,f(a» and then evaluating, in anyone of a variety of ways, the slope of the tangent. Since a definite integral can be interpreted as an area, the value of f!f(x) dx can be approximated by counting the number of squares within the region bounded by the curve, the x-axis, and the vertical lines x = a, x = h. In the count, consideration must be given, of course, to the position of a square, squares above the x-axis must be counted positively, those below, negatively; also, judgment must be used in estimating what fractional part of a square is represented by an irregular area contiguous to the curve. In spite of the obvious crudeness of this method, a little practice will yield rather good estimates from a carefully drawn graph for either the derivative or definite integral. Another simple method for those who desire an arithmetic rather than a geometric approach is available. Let h be a small positive number, then (f(a + h) - f(a - h»/2h, the slope of the line joining the points (a - h,f(a - h», (a + h,f(a + h» [or, what is the same thing, the average of the slopes of the chords joining (a - h,J(a - h», (a,f(a» 217
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
218
and (a,/(a», (a + h,/(a + h», respectively], is an approximation to /,(a). The area 2h/(a) of the rectangle of altitude /(a) and base 2h and the area h(f(a - h) + /(a + h» of the trapezoid of altitude 2h and bases /(a - h) and /(a + h) are approximations to the integral f:~:/(x) dx. Since one of the simple geometric areas usually overestimates and the other underestimates the integral, their average h(f(a - h) + 2/(a) + /(a + h»/2 is apt to be a better estimate than either. Note the similarity of the last formula to the still better Simpson's rule, h(f(a - h) + 4/(a) + /(a + h»/3, discussed later in this chapter. It is clear, however, that if great precision is desired for an approximation to the value of a derivative or definite integral, and if some estimate is wanted for the magnitude of the error, the two crude methods just discussed are inadequate and other numerical approximation methods must be sought. From one point of view, the problem may seem trivial. If a set of tabulated values, say (Xi' Yi)' is known for a function, then n + I of these pairs will determine, as we saw in Chapter 3, a polynomial of max-degree n which approximates the function. The polynomial can then be used to approximate the value of a derivative or definite integral of the function. We could thus dismiss the entire subject; however as a matter of practicability, it is better to construct special formulas for these purposes, particularly when the points are equally spaced. Furthermore, some of the desired formulas are not derivable from the approximating polynomial. Also, we shall want several of the formulas for use in the numerical solution of differential equations. We first introduce some notations and prove some identities that we shall need for the sequel. As before, let (7.1: I)
be n
+I
points with distinct abscissas, and let P(x) be the polynomial
(7.1:2)
Let Pi(x) be the polynomial derived from P(x) by deleting the factor X - Xi , that is, (7.1 :3) Pi(x)
=
(x - xo) ... (x - Xi_l)(X - Xi+l) ... (x - x,,),
i = 0, I, ... , n;
or (7.1:4)
P,(X)
= P(x) , x - Xi
i = 0, I, ... , n.
7.1. INTRODUCTION
219
The last equality is, of course, an identity; it should be noted, however, that whereas the right-hand member of 7.1:3 is defined for x = Xi , the right-hand member of 7.1:4 is not. Since it will be convenient to use the form 7.1 :4, we define its right-hand member to be the right-hand member of 7.1:3 for x = Xi. Corresponding definitions will be understood for the subsequent polynomials about to be given. Similarly, we define the polynomial (7 1 5) . :
P(x) P ..(x) = (x - Xi)(X - xi) , "
i=j::.j;
i,j
=
0, 1, ... , n;
it is the polynomial P(x) with the two distinct factors x deleted. In general, we put
Xi
and x -
Xj
(7.1 :6) P(X) P;;···m(x) = (x - Xi )( X - xi) ... (x - xm) ,
i, j, ... , m all distinct, i,j, ... , m = 0, 1, ... , n;
it is the polynomial P(x) with the distinct factors x - Xi' X - Xj , .:., Xm deleted. It follows at once from the definitions of the P's that
X -
for g =j::. i,j, ... , m,
(7.1 :7)
and that for k
(7.1:8)
=
anyone of the subscripts i, j, ... m.
The Lagrangian coefficient Lk(X) of Yk given by 3.3:2 (with k place of i) can now be written as (7.1 :9)
Differentiating both sides with respect to x, we find that Lk'(x) = P)Xk) [POk(x)
+ ... + Pk-U(x) + Pk+1.k(X) + ... + Pnk(x)],
or, (7.1:10)
Hence j =j::. k;
(7.1: 11) ,
Li (x;)
1
n
= ~ i-O
(i".;)
x;
_.
x,
In
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
220
It follows from 3.3:3 and 7.1: 10 that n
(7.1:12)
p'(x)
1
n
= ~ [~
Xk -
Xi
Ci"okl
This formula can be used for the derivative of p(x) but usually we pay little attention to it and resort to direct differentiation of the polynomial 3.3:3 or some equivalent form when the abscissas of the points 7.1: 1 in terms of which the function is known are not equally spaced. We consider some interesting and useful particular cases of some of the preceding results when the abscissas Xo , Xl , "', Xn are the integers 0, 1, "', n. We then introduce new notations for the polynomials P(x) and P1.(x) suggested by the notations for the binomial coefficients to which these polynomials are closely related. We put (notice that n has been replaced by n - 1) (7.1:13)
[~, = x(x - 1) ... (x - n + 1)
(7.1:14)
[~. = x(x - 1) .. ' (x - i + 1)(x - i-I) ." (x - n + 1)
= n! (:),
•
[X]
(X)
1 n! =x-in=x-in'
i = 0, 1, ''', n - 1.
The polynomial [j is frequently called the factorial polynomial; if x is a positive integer equal to or greater than n, [:] is the number of permutations of X distinct things taken n at a time. It follows from the preceding definitions that if m is a non-negative integer, then (7.1: 15)
[:]
=
0,
for
°
~m
< n;
(7.1:16)
[:J
ml (m - n)!
=
nl (:),
~ n;
for m
(7.1:17)
[:J; = 0,
for
°
~m
< n but m =1= i;
221
7.1. INTRODUCTION
(7.1:18)
[:L =
(_I)n-m-l ml(n - m - 1)1 (_I)n-m-l(n - 1)1
for 0::::;;; m < n;
(n: 1) n!
(m)
for m ~ n.
=m-i n'
We state and prove several theorems necessary for the sequel. THEOREM
I.
(7.1 :20)
Q(x; n)
=
±
(-I)i
i-O
(~)[ '
x ].
n
+1
= (-I)nn!
I
Let m be one of the integers 0, I, '.', n. Then Q(m' n) ,
=
(-I)m (n)[ m ] m n+1m
= (_I)m(n)(_I)n-m~ = m
(-I)nn!
(;)
Since.Q(x; n) is equal to the constant (-I)"n! (which is independent of m) for the n + I distinct values x = 0, I, ' .. , n, and since Q(x; n) is a polynomial in x of max-degree n, Q(x; n) is identically equal to (-l)" n! The proof of the theorem is thus completed. COROLLARY.
Let [,,:l]i be written in the form
X]1 i = [n +
c.'.V" _..,n
+ c.
1.1
x n - 1+
... + c.
I,n ,
i = 0, 1, ... , n,
then (7.1:21)
(n)
n . ~(-I)1 . Ci,i
i-O
(7.1:22)
=
±(-1)~ (~) Ci.n = i-O
0,
j
= 0, 1, ... , n -
1,
'
(-I)nn!
'
The proof of the corollary follows immediately from the theorem since the first sum, 7.1:21, is the coefficient of xi in Q(x; n) and the second sum, 7.1:22, is the constant term of Q(x; n).
222
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
We will also need: THEOREM
(7.1 :23)
2.
t! (_~)(-1 "
t
X.) = (X) "-1_1.'
(
n-t
n
~X-t
The left-hand member of this equality is a polynomial A(x) of maxdegree n - 1. If m is one of the integers 0, I, "', n - 1 then A(m)
= =
~ (-I )i-l ( ~. t
i=1
t
m ) . n- t
(_I.)i-l (
i
m.) n- t
t
i-,,-m
(-I)~ ('~)
=
(-1)"-1
=
(_1)"-1 ~ (-I); [
;-0 n -) }
[ n]f='o
n ]
("!)
m+I;)
m+1
=
(_1)"-1 (-I)"'m!
[m ~ I] _ (-I)"+m-lm!(n - m - I)! n!
The right-hand member of the equality in the statement of the theorem is
1 ,,-1
X
=,~[], n. i-O n i
7.2. NUMERICAL DIFFERENTIATION IN TERMS OF FINITE DIFFERENCES
223
and is therefore a polynomial B(x) of max-degree n - 1. It follows that B(m)
=
~!
%[~L
(_l)n-m-1m!(n - m - I)! n!
Since (-I )n+m-l = (_l)n-m-l, B( m) = A( m). The left- and righthand members of 7.1:23 are then polynomials of max-degree n - 1 equal to each other for n distinct values of x. They are therefore identically equal and the theorem is proved. EXERCISE 7.1 1. Draw, carefully, the graph of y = Xl - 2x - 3 on cross-section paper from -2 to x = 5. With the aid of a straightedge, draw the tangents to the parabola at x = -2, 0, 3, 4. Estimate from your drawing the values of dy/dx at the four points. Estimate, by square counting, the area bounded by the parabola and the chord joining (-2,5) and (5, 12). Check your answers by straightforward differentiation and integration.
x
=
2. Draw a smooth curve through the points
(-3, -2.5), (-2, -2.0), (-I, -0.9), (0,0.5), (I, 1.9), (2,3.0), (3,3.5), (4,3.2), (5,2.3). Determine, as in the preceding example, the values of the derivative at x = - 2, 0, 2, 4. Estimate the value of f~3f(x) dx. Check your answers by using y = ! + sin (x/2).
7.2. Numerical Differentiation in Terms of Finite Differences. In this section we develop a number of formulas for the derivative of the polynomial which passes through the n + 1 points 7.1: I when these points are equally spaced. The formulas will be expressed in terms of the differences of the y's and they will yield, if the polynomial is an approximating polynomial to a function f(x), approximations to f'(x). The magnitudes of the errors will be discussed later. The present set of formulas is derived from the forms 3.8: 13-16. We begin with the first of these, namely, (7.2:1)
n
Y
.
i=O
where t = (x - xo)/h, h =
t
= ~Ll'yo (.),
Xi -
Xi-l •
t
224
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
Differentiating with respect to x, we find
(t)
dy _ ~ • d -d - ~.1Yod- ., x i=1 X I
Since d (t) dx i
=
dt d (t) dx dt i'
and
(7.2:2)
~ (~) dt
I
=
(t.) ~_1_. = ;-0
I
t- J
± i-I
(_1,>;-1 (. t .), J I - J
by 7.1 :23, it follows that
(7.2:3)
dy dx
= y ' = !h ~ [~ ~ ~ ,=1
;=1
(-1 )H ( t )] Ai . . _. '" Yo . J I J
By rearranging the terms, this formula can be written as
(7.2:4) The last two expressions are the general formulas for the derivative of the polynomial 7.2: I at an arbitrary point. Of special interest, however, are the values of the derivatives at the points 7.1: 1. These can be obtained by putting t = 0, I, ... , n, in turn, in either of the last two formulas. We have, putting t = 0,
(7.2:5) which may be written, if we recall 2.3:16.4, in the symbolic notation
(7.2:5')
Yo'
= ~ In(1 + .1) Yo
(.1 nH = .1n+2 = '" = 0). To facilitate the computation of the coefficients of .1Yo, .1 2yo, ... , in the expressions for Y/, Y2', Ya', ... , rewrite 7.2:3 in the form
(7.2:6)
Y
,
At = Ii1 ~d ~ t.t'" Yo ,
t=1
7.2. NUMERICAL DIFFERENTIATION IN TERMS OF FINITE DIFFERENCES
225
TABLE 7.2:t1a
d,.,
VALUES OF
y/
=
FOR NUMERICAL DIFFERENTIATION
! ~ d,., A'yo h
2
3
1-1
5
4
1 2 1
1 3
2
2
6 1 3 11 6
7
13
2
3
25 12
5
9 2
47
77
6
6
11 2
37
12 57
3
4
10
13
107
2
6
15
73
2
3
17
191
319 12 533 12 275
459 20 743 15 1879 20 1627 10
o
2 3 4
7
8 9 10
3
2 5
1 4
7
6
8
1 9
10
56
72
90
105
168
252
360
140
280
504
840
105
280
630
1260
168
504
1260
56
252
840
8 761 280 4609 280 3601 56
72 1
360
9 7129 2520 4861 252
90
-
1
8
5 1
6 1
7 1
1
12
20
30
42
1
1
12
30
60
1 4
20
60
2
6
4
19
121
2
3
1207 12
10
9
1 1
1 1
-
1
30
5
137 60 87
1
1
-
6
42
49 20 223 20 341 35 2509 30 2131 12
7 363 140 481 35 3349 70 2761 21
1
1
1
1 1
10 7381 2520
where
(7.2:6.1)
.=~(-l)H( ~ . .
de ••
;-1
J
t). ,
1- J
The identity,
(7.2:6.2)
d e•i
=
de- 1• e- 1
+ de-I.; ,
can be readily derived from the definition of the d's. Note that this is actually an identity in the variable t; however, we shall use it only to
226
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
compute the coefficients of Llyo , Ll2yo , LlSyo , "', in the expressions for = 1,2,3, "', in turn. The d's, up to and including the coefficients of LllOyo, are given in Tables 7.2:tlabc. The coefficients in the first row are obtained directly from 7.2:5; the same formula also tells us that every coefficient in the first column is unity. The remaining coefficients are computed by means of 7.2:6.2, each is the sum of the one directly above and the one just above and to the left. In Table 7.2:tla, the coefficients are given in fractional form and are exact values; in Table 7.2:tl b, the coefficients
Yt"Y2',yS', "', by putting t
TABLE 7.2:tlb VALUES OF
d,., FOR NUMERICAL DIFFERENTIATION
y, ,
= -h1 ~ d'i• .d'Yo ,-1
, 1 ~ (-I)-d,., , 1 .d'Y-i Y-t=;; ,-1
Divide
:1
2
3
4
all
entries
5
by 2520.
6
7
8
9
10
-- - - - - - - - - - - 0 2520 -1260 840 -630 504 -420 360 -315 280 -252 1 2520 1260 -420 210 -126 84 -60 45 -35 28 2 2520 3780 840 -210 84 -42 24 -15 10 -7 3 5220 6300 4620 630 -126 42 -18 9 -5 3 4 2520 8820 10920 5250 504 -84 24 -9 4 -2 15 2 5 2520 11340 19740 16170 5754 420 -60 -5 6174 360 -45 10 -3 6 5220 13860 31080 35910 21924 7 2520 16380 44940 66990 57834 28098 6534 315 -35 7 8 2520 18900 61320 111930 124824 85932 34632 6849 280 -28 9 2520 21420 80220 173250 236754 210756 120564 41481 7129 252 10! 2520 23940 101640 253470 410004 447510 331320 162045 48610 7381
i
were written with the common denominator 2520 and the numerators only were entered in their proper places; in Table 7.2:tlc, the coefficients were written in decimal notation and they are, for the most part, correct only as far as written. The table is used in the most obvious fashion. Thus, if y = f(x) = S X 8x + 5, xo = 0, h = I, we find on forming the difference table that Llyo = -7, Ll2yo = 6, LlSyo = 6, and, of course, Ll4yo = Ll5yo =
... =
o.
7.2. NUMERICAL DIFFERENTIATION IN TERMS OF FINITE DIFFERENCES
227
TABLE 7.2:tlc d, •• FOR NUMERICAL DIFFERENTIATION
VALUES OF
\ I I I I I I I I I I I
0 I 2 3 4 5 6 7 8 9 10
2
3
4
5
-0.50000 00000 0.50000 00000 1.50000 00000 2.50000 00000 3.50000 00000 4.50000 00000 5.50000 00000 6.50000 00000 7.50000 00000 8.50000 00000 9.50000 00000
0.33333 33333 -0.1666666667 0.33333 33333 1.83333 33333 4.33333 33333 7.83333 33333 12.3333333333 17.83333 33333 24.33333 33333 31.83333 33333 40.33333 33333
-0.25000 00000 0.08333 33333 -0.08333 33333 0.25000 00000 2.08333 33333 6.4166666667 14.25000 00000 26.58333 33333 44.4166666667 68.75000 00000 100.58333 33333
0.20000 00000 -0.05000 00000 0.03333 33333 -0.05000 00000 0.20000 00000 2.28333 33333 8.70000 00000 22.95000 00000 49.53333 33333 93.95000 00000 162.70000 00000
~
6
7
8
o
-{).16666 66667 0.1428571429 -{).12500 00000 I 0.03333 33333 -{).0238095238 0.0178571429 2 -{).0166666667 0.00952 38095 -{).0059523810 3 0.01666 66667 -0.0071428571 0.00357 14286 4 -{).03333 33333 0.00952 38095 -{).00357 14286 5 0.16666 66667 -{).0238095238 0.0059523810 6 2.45000 00000 0.1428571429 -{).01785 71429 7 11.1 5000 00000 2.5928571429 0.1250000000 8 34.10000 00000 13.7428571429 2.7178571429 9 83.63333 33333 47.8428571429 16.46071 42857 10 177.5833333333 131.4761904762 64.30357 14286
9
10
0.11111 11111 -{).0138888889 0.0039682540 -{).0019841270 0.0015873016 -{).0019841270 0.00396 82540 -{).0138888889 O.lllll11lll 2.8289682540 19.2896825397
-{).IOOOO 00000 0.0111111111 -{).00277 77778 0.0011904762 -{).0007936508 0.0007936508 -{).001l904762 0.00277 77778 -().Ollli lllli 0.10000 00000 2.9289682540
Hence Yl'
= /,(1) =
1(-7) + ~ (6) -
Ys'
= /,(6) =
1(-7) +!! (6) 2
i
=
-5,
+ 373 (6) =
100.
(6)
These values can be checked by ordinary differentiation.
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
228
Note that the value of the derivative at a particular point, say /,(6), can be found in several ways. Indeed, we have if
Xo
= 2,
YII:
= /,(6) =
1(11)
+ ~ (18) + 1: (6) =
if
Xo
=
Y3'
= /,(6) =
1(29)
+ ~ (24) +
3,
Ii
(6)
=
100, 100,
if Xo = 6, Yo' = /,(6) = 1(119) - ~ (42) + ~ (6) = 100, etc. H f(x) is a polynomial of max-degree 10, Tables 7.2:tlab will yield exact values for the derivatives; if f(x) is not a polynomial of max-degree 10, the results will be approximate. The magnitudes of the errors will be discussed in Section 7.5. Incidentally, Table 7.2:tl can be extended backward to enable us to compute Y-l , Y-2 , .... (See Table 7.2:t2.) In all cases, however, we TABLE 7.2:t2 VAI.UD OF
Y':e
2
2 3 4
5
6 7
8 9
10
I
de•1
FOR NUMERICAL DIFFERENTIATION
= ~ d e•1 ..:Ilyo,
3
Ye'
1=1
4
=
~ ~ (-1)1-1 de•1 ..:IIY_I 1-1
5
6
7
8
9
10
761 7129 7381 3 11 25 137 49 363 2 6 280 2520 2520 12 60 20 140 4861 55991 5 13 77 481 4609 87 223 280 2520 2 3 12 10 35 252 20 7 47 3601 42131 44441 57 459 341 3349 2 6 4 70 56 504 420 20 10 9 37 32891 35201 485333 319 743 2509 2761 -2 3 21 168 126 1260 12 15 30 11 107 28271 395243 420983 533 1879 2131 25961 ---2 6 360 12 20 12 84 56 504 13 73 522109 275 1627 323171 348911 20417 22727 -- -60- -35- - -280- 180 2 3 168 10 4 15 191 134159 1207 15797 18107 263111 288851 312875 --- - - - - ------ --- -182 6 72 12 210 120 60 30 17 121 2074783 474742 261395 1135670 -2- - -1691 - -2021 - 30233 --30- - - - -56- - - - -126 126 3 12 210 5 5713839 19 299 477745 8842385 763 11899 96163 108175 --- ---- ------ - - - - - - - 2 6 504 168 20 28 56 4 60 33464927 21 181 831225 8161705 3013 25361 48975 44185 -2- --30- -56- - - - 504 3 12 252 20 7
--
7.2. NUMERICAL DIFFERENTIATION IN TERMS OF FINITE DIFFERENCES
229
are computing a derivative in terms of differences that form a descending diagonal in the difference table. We derive next the table based on formula 3.8:14 which we write again:
(7.2:7) where t
= (x - x_1)/h. We have dy d
X
Put z
= Y' = ~ (-I)' ~Y-I Ai ~ d~ (1
x,-.t).
.-0
= 1 - t, then d dx
(1 -i t) =dxd (Z)i =dxdz dz d (Z) i = _!
±
h ;-1
(-IY-l (. Z .) J ' - J
(by 7.2:2)
Hence
dy= Y '=!~(_I)'A' .~(-I);(I-t) h~ ~Y~~· . ., dX i-I ;-1 J ' - J or
(7.2:8)
i • Y ,=!~[~(-I)H(I-t)] h~ ~ . . . .1Y_i, 1-1 ;-1 J ' - J
(7.2:9)
Y
,
1 ..-1
= h- ~ (-1)1 ( i-O
If we put t
(7.2:10)
1- t .)
';=1+1 J
= 1, we obtain Yo
,
=
..
~ 1
1
.
[~ ~.1'y_;]
Ai ~-:~y-i' 1-1 '
'
.
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
230
The resulting table of coefficients is the same as Table 7.2:t1. To illustrate the use of the table, we take Y = J(x) = x3 - 8x 5, xo = 0, h = 1; whence LlY_1 = -7, Ll2Y_2 = -6, Ll3Y_3 = 6. We have
+
i
Y'-2 = /,(-2) = 1(-7) -
~ (-6) +
Y'-a = /'( -6) =
Ii (-6) + 337 (6) =
1(-7) -
(6)
4, 100.
As before, y' can be computed exactly from the entries in the table if Y = f(x) is a polynomial of max-degree 10. This table too can be extended backward and, in any case, it gives us a derivative in terms of differences that form an ascending diagonal in the difference table. If we start with formula 3.8:15, namely, (7.2:11)
-
Y-
[n/2]
~ Ll2t
~
Y-i
i-O
(t - I + i) + [(n+1)/2] (t - I + i) ~ Ll2i-1 2' ~ Y1-i 2' - I ' I
i=1
I
we obtain (7.2:12)
, _ ! l[n/2] (t -2' I_ +. i)] :t LI 2iY -[2ii :(_I)H t.
Y - h
+
J
;-1
i-I
J
(_Iy-l (t - I + i)] I :t Ll2t _lYl-i [2i-l :t --.-2i - I _. . J J
[(n+1)/2]
;-1
i-I
If t
I
= 0,
(7.2:13)
[2i (-I)H(i-I)] :t LI 2iY-i:t . 2i _ . J J
'_!I[n/2]
Yo - h
;=1
i-I
+ -_ IiI
[2f-l (_I)H (
[(n+1)/2] 2i-l
:t i-I
LI
Yl-i:t
[LI I Ll2 Yo - 2 )'-1
.
J
;=1
-
6"I Lla)'-1
I I - 60 Ll8Y_a - 140 Ll7Y_a
_ _1_LlI011 =!= ...] 1260 J-6·
•
i-I 2i - I - '
J
)]1
I
+ 12I Lifo)'-2 + 30I LI&)'-2 I
I
+ 280 Ll8y _ + 630 Ll9Y fo
-40
7.2. NUMERICAL DIFFERENTIATION IN TERMS OF FINITE DIFFERENCES
231
Finally, starting with formula 3.8:16 or (7.2:14)
[n/2]
Y
.
= i-O ~ .1 2·Y_i
(t - i + I)
+
2· I
[(n+l1/2]. .1 2.-1Y_i
~
(t - 2+ i) 2·-1
i-I
I
'
we obtain (7.2:15)
, _ 1 ![n/2]
Y -
h ~.1
[2i
2i
Y-i
i-I
+ If t
~
;-1
[('I+U/2]
~ .1
(-I)H • J
(t 2i- _1 +. i)] J
2i-l [2i-l Y-i
~
(-I)H •
J
;=1
i=1
(t2i -_ 21+_.i)]1 . J
= 1,
(7.2:16)
, _ ! l[n/2] 2i [2i (-I)H ( i ~.1 Y-i ~ . 2i _
Yo - h
i-I
+
J
i-I
[(n+l1/2]
~ .1
[2i-l
2i-l
~
Y-i
.
J
;-1
i-I
-_ h1 !.1Y-l
(-I );-1
+ 21 .12Y-l - 61 .13Y-2 -
1
+ 60 .1 8Y_3 -
1
140 .1 7Y_40
)]
. J (
i - I )] 1 2i _ 1 _ . J
1 .140 12 Y-2
1
-
280 .1 8Y_40
+ 301 .15Y-3 1
+ 630.1'y-s
+ li60 .1 10Y_6 =f .··1· Formulas 7.2:13 and 7.2:16 give formally different but actually equal expressions forj'{xo).lfwe add and divide by 2, we obtain the particularly simple formula (7.2:17)
, _ ! [.1Y - 1 + .1yo _ ! .1 3Y_2 + .1 3Y_l + .! .1 5Y_3 + .1 5Y_2
Yo -- h
2
6
2
30
2
This formula could have been obtained from 3.8: 17 as the preceding formulas were obtained from their predecessors. Formulas for the second and higher derivatives, Y
"
=
d2y
dx 2
'
Y
If'
= day dx3'
... ,
TABLE 7.2:t3a
'"w '"
VALUES OF Ck,i FOR NUMERICAL DIFFERENTIATION
h It ylk) 0
= ~Cti'. .diy0,
hky(k)
o
i=k
SJ 21 3 1 41 5 I 61 71 8 9 10
2 1 -2
3 1 3 - 1
4 4 11 12 3 2
5
5 5 6 7 4 -2
= ~ (-I)1'+ickit: .diy-i i-k
6
7
1 -6 137 180 15 8 17 6 5 2
7 7 70 29 15 7 -2 25 6 -3
8
9
1 -8 363 560 469 240 967 240 35 6 23 4 7 -2
1 9 761 1260 29531 15120 89 20 1069 144 -9 91 12 -4
10
11
10 7129 -12600 1303 672 4523 945 285 32 3013 -240 105 8 29 3 9 2
11 671 1260 16103 8400 7645 1512 31063 3024 781 48 4781 240 55 3 12 -5
12
13
14
:'"I Z
c
3: m
'"n »-
r-
2"T1 "T1
m
'"Zm
-I
;; -I
0 z »10831 360 99 4 175 12
Z 0
1747 40 65 2
Z m
-I C)
491 8
'"-I »0 Z
......
TABLE 7.2:t3b VALUES OF
hty(t) o
=
kC
._k
i"
k,i
L1'y
0 '
hty(:'
=
k
:I m r-
m
2
3
4
5
6
7
""Zm
-0.5 1
0.33333 33333 -1 1
-0.25 0.9166666667 -1.5 1
0.2 -0.83333 33333 1.75 -2 1
-0.1666666667 0.7611111111 -1.875 2.83333 33333 -2.5 1
0.1428571429 -0.7 1.93333 33333 -3.5 4.16666 66667 -3
;; -I 0 z
~I
-I
Z -I
m
""
:I
II>
0.."
_____
8
5 , 6 ' 7 8 9 10
""n>
(-I)HiCt ,. L1iy _.
.-t
.." .."
1 I 2 I 3 I 4 I 5 I
1l
C
Q
~ _1
Z
Ct .• FOR NUMERICAL DIFFERENTIATION
-0.125 0.64821 42857 -1.9541666667 4.0291666667 -5.8333333333 5.75 -3.5
9 0.11111 11111 -0.60396 82540 1.95310 84656 -4.45 7.42361 11111 -9 7.58333 33333 -4 1
10 -0.1 0.56579 36508 -1.93898 80952 4.7862433862 -8.90625 12.5541666667 -13.125 9.66666 66667 -4.5
11 0.09090 90909 -0.53253 96825 1.9170238095 -5.0562169312 10.2721560847 -16.2708333333 19.9208333333 -18.33333 33333 12 -5
12
13
14 -----
.."
Z
=i m
Q
.." .."
m
""zm
n m
II>
30.08611 11111 -24.75 14.58333 33333
43.675 -32.5
61.375
....
w w
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
234
can be found by repeated differentiation of Eqs. 7.2:3 or 7.2:4, 7.2:8 or 7.2:9, 7.2:12, 7.2:15. If we substitute 0 for t in these results, we ' 1 f or t, we 0 b ' ' ,'Yl ' ' , Yl(4) , ... ; · Yo" , Yo,,, , Yo(4) , ... ; 1'f we su bstltute ob tam tam' Yl and so on. Some of these results are given in Tables 7 .2:t3ab; the entries are self-explanatory and need no further comment. EXERCISE 7.2
1. By use of formula 7.2:3 or 7.2:4, find dyldx at x = 0.5,0.9, I, 1.3,5,5.3,6,6.1, if y = In x. Take n = 3, h = and appropriate values for Xo. Use a five-place table. Determine the error in each case by using dYldx = Ilx.
I,
2. By use of formula 7.2:3 or 7.2:4 and a five-place table for sin x (x in degrees), find d(sinx)/dx at x = 0°, 1°, 1°20',2°,50°,51°15',52°40',88°,89°,90°,91°,92°. Take n = 4, h = 2, and appropriate values for Xo • Determine the error in each case by means of ordinary differentiation. 3. Use formula 7.2:6 and Tables 7.2:tl, 2 to find the derivatives at the indicated points from the tabulated values of the functions . •. x = 28, 32, 34, 38, 46, 50. b, x = 3.70,4.75,5.10,6.50,7.20,7.90. C, x = I, 3, 6, 8, 12, 13. d, x = 25, 28, 32, 36, 40, 45.
•
b
d
C
x
f(x)
x
f(x)
x
f(x)
x
f(x)
34 36 38 40 42 44 46
0.31270 34549 37904 41318 44774 48255 51745
5.10 5.45 5.80 6.15 6.50 6.85 7.20
1.62924 69562 75786 81645 87180 92425 97408
5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0
38.02952 39.14868 40.20726 41.21285 42.17163 43.08869 43.96830 44.81405
30 31 32 33 34 35 36 37 38
0.23137745 22035947 20986617 19987254 19035480 18129029 17265741 1644 3563 15660536
4. Do example 3 using Table 7.2:tl. 5. Use Table 7.2:t3 to find, where possible, the first five derivatives of the functions of example 3. 6. Derive tables similar to 7.2:t3 for the derivatives at Xl
, X2 , Xa ,
x, .
7. Derive the identity 7.2:6.2.
I. Prove the following about the entries in Table 7.2:t3 . •. If hiy~iI = a i •i .:jiyo - a i •i +1 .:jHlyo ai+1,i+l
=
al,'+'_l
+ ai.H2.:ji+2yo =F
+ lai,'+'-2 + !ai,i+l-a + ... , j =
then 1,2,3, ....
7.3. NUMERICAL DIFFERENTIATION IN TERMS OF ORDINATES
235
b. If the numbers in the first row of the table are multiplied by I/ll. those in the second row by 1/2! • ...• those in the kth row by Ilk! • ...• then the sum of the numbers in any column after the first is zero; the sum of the positive numbers is t. c. The ith diagonal (of the original table) is an arithmetic progression of order i - I (read diagonals down and to the right).
7.3. Numerical Differentiation in Terms of Ordinates. In this section we shall present formulas for the numerical evaluation of derivatives of a function Y = f(x) in terms of the ordinates Yo , YI , Y2 , .... The most obvious way of obtaining such formulas merely involves the substitution for the finite differences in the formulas of the last section their values in terms of the ordinates. We recall the equalities 3.7:13 which we repeat here with a slight change of notation:
i = 1,2,3, ....
(7.3:1)
If we substitute these values in 7.2:3 and 7.2:4, we obtain (7.3:2)
and (7.3:3)
dy
dx
= y' = !
2 (t) [±
h i=u I
;-i+l
(-I )H-l . ~ . J I
±
(-I );-k
k-O
(i)k Yk] ,
where t = (x - xo)Jh. These formulas give dyJdx at an arbitrary point in terms of the ordinates Yo , YI , ... , Yn . The formulas for the values of the derivatives at the equally spaced points (xo, Yo), (Xl' YI)' (x n , Yn), are of particular importance. These can be obtained from the entries in Table 7.2:tl by use of 7.3:1. This time it is necessary to list the formulas for each value of n separately since the coefficient of a particular ordinate, Yi , will ordinarily change as n changes. The results will be found in Table 7.3:tl. The entries in this table can be found directly without recourse to the formulas of the preceding section by interesting and instructive methods. We recall that the notation was so chosen that (7.3:4)
Xk -
xi
=
(k -
i) h,
j,k = 0, I, ···,n;
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
236
TABLE 7.3:tl K
VALUES OF Ck./ AND
FOR NUMERICAL DIFFERENTIATION
K ..
Y/ =
.k
2 0 1
3 0
I 4 0
I
I
I
7
-I
I
48 -10 -8
-36 18 0
16 -6 8
I -I
lo
-137 -12 3
300 -65 -30
-300 120 -20
200 -60 60
-75 20 -15
12 -3 2
1
-147 -10 2
360 -77 -24 9
400 -100 80 0
-225 50 -30 45
72 -15 8 -9
-10 2
-I
-450 150 -35 -45
-1089 2940 -4410 4900 1260 -1050 -60 -609 700 10 -140 -329 -4 42 -252 -105
-3675 700 -350 420
1764 -315 140 -126
-490 84 -35 28
1
12
60
o 4~0
o slo I
2 3 4
~ 2120 2 3 4
6
5
-9 6
2 3
9
4
18 -3
1
"6
1
8
3
-I I
2 3 7
2 4 0
2 6 0
I
0
2 5 0
/-0
A l
h ~ Ck,/Yi
-3
-I -ll
-2 -25 -3
-2283 6720 -1l760 2940 -105 -1338 15 -240 -798 60 -420 -5 3 -32 168
8
9
10
2 -3
-I I 60 -10 4 3
15680 -14700 9408 -3920 960 -2940 2450 -1470 588 -140 1680 -1050 560 -210 48 -378 1050 -420 140 -30 -672 0 672 -168 32
-105 15 -5 3 -3
-79380 63504 -35280 12960 11760 -8820 4704 -1680 -4410 2940 -1470 504 3780 -1890 840 -270 -504 2520 -840 240
-2835 360 -105 54 -45
-7129 22680 -45360 70560 -280 -4329 10080 -1l760 5880 35 -630 -2754 135 -1080 -1554 -10 360 -1680 5 -60
280 -35 10 -5 4
10 0 2120 -7381 25200 -56700 100800 -132300 127008 -88200 43200 -14175 2800 -252 28 17640 -15876 10584 -5040 1620 -315 I -252 -4609 11340 -15120 -7 80 6720 -5880 4704 -2940 1344 -420 2 28 -560 -3069 3 1470 -630 189 -35 3 105 -945 -1914 4410 -2646 -7 -2 270' -1440 24 -924 3024 -1260 480 -135 3 -40 4 2 25 -150 600 -2100 0 2100 -600 150 -25 5 -2
--------------------------------------------------------------
237
7.3. NUMERICAL DIFFERENTIATION IN TERMS OF ORDINATES
we use these identities in 7.1:5 to obtain
(7.3:5) Hence, from 7.1: 11 we find (7.3:6)
L '(x) = (-I )k-J-I _1_. k
k- J
J
(~) !h' (j)
j =1= k,
and
the last identity can be rewritten as if n
< 2j,
if n = 2j,
(7.3:7)
if n
> 2j.
As an illustration of the use of these formulas in deriving the entries of Table 7.3:tl directly, we compute the value ofYl' in terms ofthe ordinates Yo, Yl , Y2 , Ya , Y4 . We have from 7.1:12, Yl' = p'(x1 ) = ~;_OL/(Xl) Yi , and from 7.3:6, L'( ) - (-1)-2 _I o Xl -I
L'() 2 Xl
=
(1)0 I -
I
(~)!h -__ 4h~ ' (1)
(~) IiI = (1)
3
2h '
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
238
and from 7.3:7,
,
Ll (Xl)
5. = - (I2 + 3I) Ii1= - 6h
Hence
It follows from 7.3:6 that (x
L' n-k
)
.
(_I)(n-k,-(n-,,-l
=
(_I)H-l _._1_ 1 J-k(n.)h n -J
n-;
(n ~ k) 1-
1
=
(n - k) - (n - j) ( n .) h ' n -J
(n ~ k)
Therefore (7.3:8)
Also, if n
<
2j, then n
L~_;(xn_;) = =
-
>
2(n - j) and
~ ( n - ; + 1 + ... + n -
-~(n-;+ 1 + ... + j) =
If n
= 2j, then n = 2(n - j) and
If n
>
2j, then n
<
1 ) (n - j)
-L;'(x;).
2(n - j), and
i( = i C!
L~-i(xn-i) =
n - (n
1
~ j) + 1 + ... + n ~ j ) + ... + n ~ J)
= -L/(xi)'
7.3. NUMERICAL DIFFERENTIATION IN TERMS OF ORDINATES
239
Hence in all cases, (7.3:9)
The equalities 7.3:8, 9 imply that if we have the formula for the derivative at a point in terms of the ordinates, say Y/
= ~h (coYo + C1Yl + ... + c..y1l),
then we can write at once the complementary formula
Thus, from the result of the illustrative example, we get Ys'
= l~h (-Yo + 6yl - 18Y2 + IOys + 3y,).
Because of the observations just made, it is sufficient to give explicitly in Table 7.3:tl the values of Y/ for i = 0, I, ... , [nI2], only. The remaining values can be obtained as explained above. Several properties of these formulas should be noted for present and future use. First, anyone of the formulas for a particular n is exact for all polynomials of max-degree n. If we use a formula with a particular nand Y = f(x) is not a polynomial of max-degree n, there will be an error whose magnitude will be discussed in Section 7.S. Second, the subscripts on a derivative y' and the corresponding ordinates Yi in any formula can all be raised or lowered by the same integer to yield a valid and, of course, a similar formula. Thus, from the illustrative example we derive the equally valid formulas Ys'
= 1~ (-3Y2 - IOys + 18Y4 - 6Y6 + Y8)'
Y~2 = 1~ (-3Y-3 -
IOy-2
+
18Y-l - 6yo
+ Yl)·
Third, the superscripts on Y/ denoting differentiation can be raised if appropriate superscripts are put on the y's. Thus, if yl°) is interpreted as the ordinate Yi and y1 m ) as the mth derivative of Y with respect to x evaluated at Xi , then each of the tabulated formulas yields a series
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
240
of formulas which are obtained by raising all superscripts by the same integer. For example, the foregoing illustration yields m
= 0, I, ....
Here, too, the subscripts can all be increased or decreased by the same integer. If in a formula for an (m + 1)st derivative in terms of the mth derivatives we replace the latter by their values in terms of (m - l)st derivatives, and these in turn by their values in terms of (m - 2)nd derivatives, and so on, we finally obtain a formula for the (m + I )st derivative in terms of the ordinates. Thus (we use y' and y" in place of ylll and yIZI):
Y~' = I~ (-3yo'
- IOy1'
+
18Y2' - 6Y3'
+ Y;)
I
= 144h2 [- 3(-25yo + 48Y1 - 36Y2 + 16Y3 - 3Y4) - IO( -3yo - IOyl
+ 18(yo - 6(-yo
+ (3yo -
8Y1
+
18Y2 - 6Y3
+ 8Y3 -
+ Y4)
Y4)
+ 6Y1 - 18Y2 + IOya + 3Y4) 16Y1 + 36Y2 - 48Ya + 25Y4)]
I
= 144h2 (132yo - 24Oy1 + 72Y2 + 48Y3 - 12Y4), or
The preceding result can be restated and summarized in a compact and instructive manner. Suppose that
i = 0, I, ... , n;
(7.3:10)
then (7.3:11)
Ylml i
_ -
I
(Kh)'"
~ f=i
clmly iJ J'
i = 0, I, ... , n;
where, if (7.3: 12)
e lml = II cJf' II ,
m
= 1,2,3, ... ,
241
7.3. NUMERICAL DIFFERENTIATION IN TERMS OF ORDINATES
we have m
(7.3:13)
=
1,2,3, ....
In words, the matrix of coefficients of the mth derivatives in terms of the ordinates is the mth power of the matrix of coefficients of the first derivatives in terms of the ordinates. Since the equations 7.3: II are exact if y = f(x) is a polynomial of max-degree n, the (n + l)st and higher derivatives are identically equal to zero. Hence (7.3:14)
C(fl+t)
==
This implies that the matrix
i = 1,2,3, ....
0,
em
is singular or that the determinant
I C(l) 1= O.
(7.3:15)
As an illustration of the use of Table 7.3:tl, consider the following set of values: XI
6.0 Y 1.7918
6.1
6.2
6.3
6.4
6.5
1.8083
1.8245
1.8405
1.8563
1.8718
We calculate/,(6.1) wheref(x) is a function determined by these points. If we put Xo = 6.1 and use the very first formula of the table, we obtain /,(6.1) = (-3(1.8083) + 4(1.8245) - 1.8405))/2(0.1) = 0.1630. If we put Xl = 6.1 and use the second formula, we obtain /,(6.1) = (-1.7918 + 1.8245)/2(0.1) = 0.1635. Again putting Xl = 6.1 and using the second formula for n = 5, we find /'(6.1)
= (-12(1.7918) - 65(1.8083)
+ 120(1.8245) -
+ 20(1.8563) -
60(1.8405)
3(1.8718))/60(0.1)
=
0.1634.
The answers in this case are in fairly close agreement. It should be remembered that we have said nothing as yet concerning the margin of error. Actually, we used the function y = In X in this example, so that /,(6.1) = 1/6.1 = 0.1639. The table for the derivatives in terms of the ordinates arising from the formulas stemming from 7.2:12 and 7.2:15 would be identical with Table 7.3:tl and therefore need not be given.
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
242
It is also well to remark that Table 7.3:t I can be extended by the same methods used in its derivation to include the expressions Ya'
= 2~ (3yo
Y4'
=
+ 5Y2),
- 8Yl
2~ (5yo -
12Yl
+ 7Y2),
which are exact for polynomials of max-degree 2; Y4' =
6~ (-llyo + 42Yl -
57Y2
Yr;
;h (- 26yo + 93Yl -
114Y2
=
+ 26ys) , + 47ys),
which are exact for polynomials of max-degree 3, etc. EXERCISE 7.3
1. Do examples 1,2,3 of Exercise 7.2 by use of Table 7.3:tl. 2. Use 7.3:9-13 and Table 7.3:tl to derive similar tables for the higher derivatives. 3. Prove that the matrix Cln" 7.3: 12, is of the form
la b e d
i a b c d ...
I~ ..b. . ~. ~.. '.': 4. Prove ~~-o
c:7'
= 0 for any i and
m, where c:~" is given by 7.3: II.
7.4. Method of Undetermined Coefficients. Another fruitful method of determining the formulas of the preceding sections is the method of undetermined coefficients. The method can be and is employed in many diverse investigations; we use it here to indicate an alternate method of procuring the formulas for the derivatives in terms of the ordinates. Some preliminaries are necessary. Since the derivative of a constant times a function equals the constant times the derivative of the function and the derivative of a (finite) sum equals the sum of the derivatives, it follows that if (7.4:1 )
243
7.4. METHOD OF UNDETERMINED COEFFICIENTS
is an exact formula for each of the functions
(7.4:2) no one of which is identically equally to zero, at the fixed (equally spaced) points
(7.4:3) then it will be an exact formula for any linear combination of these functions, that is, for
(7.4:4) at the same points, where C1 , C2 , ••• , Cm are arbitrary constants not all simultaneously zero. Let xi+l - Xi = h as usual and let
(7.4:5) be any set of n + I equally spaced points with the same spacing as the first set so that xi+l - Xi* = h, and suppose xo* - Xo = g. If we assume that each fi(X) of 7.4:2 has the property that for an arbitrary constant g the associated function fi(X + g) is expressible as a linear combination of the functions in 7.4:2, then for a given set of constants C 1 , C2 , '.', Cm , there will exist a corresponding set of constants C1 , C2 , .", Cm such that
(7.4:6)
Cdl(X
+ g) + C2f2(X + g) + ... + Cmfm(x + g) == Cdl(X) + c2Ux) + ... + c".f".(x).
It follows that the formula 7.4: I which is exact for the points 7.4:3 will be exact for any linear combination of the functions 7.4:2 at any set of points such as 7.4:5 spaced h units apart. Finally, if we assume that each fi(X) of7.4:2 has the property that for an arbitrary nonzero constant G,fi(GX) is expressible as a linear combination of the functions 7.4:2, it follows, since df(Gx)Jdx = G df(Gx)Jd(Gx), that if 7.4: I is exact for a function at n + I points spaced h units apart, then
(7.4:7) is an exact formula for the same function at any n h* units apart.
+I
points spaced
244
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
With these preliminaries understood, we take for the actual determination of the required formulas the polynomials (7.4:8)
y = 1, Y = x, Y = x 2 , "',y = x",
+
as the functions 7.4:2 (so that m = n 1). Any (not identically zero) polynomial of max-degree n is a linear combination of these polynomials and possesses the two properties stated above, hence if 7.4:1 is exact for the polynomials 7.4:8 at the points whose abscissas are the integers 0, I, "', n, then (7.4:9)
is an exact formula for any polynomial of max-degree n at any set of I points spaced h units apart. The problem of determining formula 7.4:9 is thus reduced to the problem of determining the coefficients ao , a1 , " ' , an; the reason for the name of this method is now apparent. The corresponding derivatives of the polynomials 7.4:8 are
n
+
(9.4:10)
y' = 0, y' = 1, y' = lx, "',y' = nx,,-I.
Using the values x = 0, 1, "', n in Eq. 7.4:8 and 7.4:10, we obtain from 7.4: 1 for an arbitrary integer k the system of linear equations ao + a1 +
a2 + ... + a,. = 0, + 202 + ... + no,. = 1, a1 + 22a2 + '" + n2a" = 2k,
a1 (7.4:11)
for the determination of the a's. Since the determinant of the coefficients, namely,
1
1··· 1
o o
2 ... n 22 ... n2
o
1 2" ... n"
,
is not equal to zero (this determinant is equivalent to a Cauchy-Vandermonde determinant; see page 72), the preceding system of equations has a unique solution for a given nand k.
245
7.4. METHOD OF UNDETERMINED COEFFICIENTS
Thus, for the particular values n ao + al
a1
+
a2
= 3, k = 1, Eq. 7.4:10 become
+
+ 2a2 +
aa
= 0,
3aa = 1,
+ 4a2 + 9aa = 2, a 1 + 8a2 + 27aa = 3; = - 1, a2 = 1, as = -1. a1
whence ao = the formula
- 1, a 1
These results yield
which is exact for polynomials of max-degree 3 for any four ordinates spaced one unit apart. Consequently, the formula
is exact for all polynomials of max-degree 3 for any four ordinates spaced h units apart. The other formulas of Table 7.3:tl can be likewise obtained by giving nand k appropriate values. We remark that, conceivably, a formula derived to be exact for polynomials of max degree n may turn out to be exact for polynomials of higher degree. This is not true in the example worked out above since a simple computation shows that the formula is not exact for y = X4. EXERCISE 7.4 1. Derive formulas of the indicated forms exact for all polynomials of the stated max-degrees.
a. Yl
,
I
=
h (CoYo + CaYa + caY.);
b • Yl ' = h I (coYo c. Yo
,
d. Yl' ,
+ CaYa + C.Y. + c,y,);
I
= h (c_aY_. + C-1Y-l + C1Yl + caY.); =
e. Ya =
~ (coYo + CaYa + c,y, + caY,); I
h (C-1Y-l + C1Yl + CaYa + c.Y. + c.Y.);
n
=
2.
n = 3. n
=
3.
n = 3. n = 4.
2<%
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
2. Derive formulas of the indicated forms exact for all polynomials of the stated max-degrees.
n = 2. n
= 2.
n = 3. ,,1 d. Yo = hs (c-aY-a
I.
+ caYa) + h(d_1Y_l + doYo');
n = 3. n = 2.
7.5. Magnitude of the Error in Numerical Differentiation. In the preceding three sections of this chapter, certain formulas were derived for the numerical evaluation of the derivative of a function y = f(x). It was stated on several occasions that these formulas were ordinarily not exact unless f(x) was a polynomial of a particular max-degree. In the present section we propose to discuss the magnitude of the. error involved. We consider here only the error inherent in the formula and not the errors due to rounding-off, truncation, or use of inexact values. It is important to repeat, for this information cannot be emphasized too strongly, that if all that is known about the function
(7.5:1)
y =/(x)
is that its graph passes through the points
(7.5:2) then nothing, absolutely nothing, can be said about the magnitude of the error. As a matter of fact, we are not even sure that the very derivative we are trying to evaluate actually exists. It is then necessary to make certain assumptions regarding the nature of the function f(x). In Chapter 3 we saw that, for a given n, f(x) could be expressed in the form
(7.5:3)
7.S. MAGNITUDE OF THE ERROR IN NUMERICAL DIFFERENTIATION
247
or in the form (7.5:4) for points equally spaced h units apart where h = Xi+1 - X, , t = (x - xo)/h, and where, in either case, X is a value between the largest and smallest of Xo , Xl , "', Xn , x. It is necessary to assume if either of the two expressions is to have meaning that pn+1'(X) exists in the neighborhood of the values involved. This is a definite assumption about the nature of the function f(x) and must be recognized as such. We also recall formulas 3.6:6 and 3.7:7 which we rewrite as
and
respectively; whence (7.5:5) The identity 7.5:4 may then be written as (7.5:6) from which we obtain upon differentiation with respect to x, (7.5:7)
,
_,
f (x) - Pn (x)
.!... ( t ) + Ll 71+1LJ(xo) [f'n+1'(X)! pn+1'(X1) h dt n + I t
+ (n + I
) d f'n+1'(X) ] dx pn+1'(X1) .
The error committed in approximating f'(x) by Pn'(x) is then given by (7.5:8)
E(x)
f'n+1'(X) I d ( t ) = f'(x) - Pn'(x) = Lln+lj(xo) [ pn+1'(X1) h dt n + I t
+ (n + I
) d f'n+1'(X) ] dx pn+1'(X1) .
Unfortunately, this expression for the error is not very helpful or useful. To obtain a happier and more fruitful evaluation we assume that f' 7I +l'(x) is constant within the interval under consideration. In view
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
248
of 7.5:5, this assumption is warranted if and only if the (n + l)st order finite differences of the function are constant in the interval. If we accept this condition, the expression for the error becomes E(x) = Ll1l+lj(xo) -I -d ( t ) h dt n + I
(7.5:9)
or
E(x)
(7.5:9')
=
h".f(1I+l'(X)!:.- ( t ). dt n + I
Values for d(,,!l)/dt for various values of t and n are given in Table 7.5:tl. These values can be computed directly or by use of 7.2:2. It turns o~t that this table is identical with a portion of Table 7 .2:tl a; TABLE
7.5:tl
VALUES OF THE DERIVATIVE OF THE BINOMIAL COEFFICIENT
:, C~ n
o
2
3
4
I
I
3
4
I
6 2
3 4 5
6 7
8 9 10
12
I
3
12
5
I)
6
7
-5
6
I
I
I
20
30
42
I
I
30
60
I
I
I
4
20
60
-5
I
-
7
8
10
9 I
8 56
9
10
I
I
72 I
90 1
I
360
495
105
168
252
140
280
504
I
-
II
110
I
840
1320
1260
2310
1260
2772
I
30
105
I
I
6
42
-
280
630 I
168
--
504
I
-
7
I
56
252
840
I
I
I
2310
8
72 I
360 I
I
9
90
495
10
110
1320
II
7.S. MAGNITUDE OF THE ERROR IN NUMERICAL DIFFERENTIATION
249
indeed, the entry in Table 7.5:tl for a given t and n is the coefficient of iJ1I+lYo/h in the expression for y/ in Table 7.2:tla. Table 7.5:tl used in conjunction with 7.5:9 or 7.5:9' provides us with estimates of the error inherent in the formulas for the numerical evaluation of derivatives whenever our assumption is justified. An alternate expression for the error 7.5:9 (or 7.5:9') can be found. Not only do we make a weaker assumption-we shall assume only that f'1I+lI(x) exists in the interval under consideration-but the derivation employs an ingenious approach which allows of great generalization. We have seen (Exercise 2.2, example 13) that if a functionf(x) possesses an (n + l)st derivative in the neighborhood of x = xo , then I(x)
= Pn(x) + n!1 f"'-"'o 0 w'f(n+1l(x -
w) dw,
where P1I(x) is a polynomial of max-degree n in X-Xo and hence, of course, a polynomial of max-degree n in x. For the present purposes, it is convenient to make the substitution s = x - wand rewrite the function f(x) as (7.5:10)
I(x)
=
Pn(X)
+ ,1 f'" n.
(x - s)n/,n+1I(s) ds.
"'0
It is proved in texts in advanced calculus that if q>(X)
f
"l(""
=
F(s, x) ds,
110(""
then dq>(x) = dX
f"l("" "0(""
of(s, x) d _ F( ) dvo F( ) dV I s Vo , x d + VI , x d . 0 X X X
We use this formula to find J'(x)
= Pn'(x) + (n
_1 I)!
f'"'" (x -
s)n-y(n+1l(s) ds,
o
I"(x)
=
p"(x) n
+ (n - 1 2)1 f'"
(x -
"'0
(7.5:11 n)
pnl(x)
=
p';:'(x)
+
r
/,n+1l(s) ds.
"'0
s)n-~(n+1l(s) ds
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
250
Now suppose we wish to find the expression for the error when the derivative of a function f(x) is approximated by a formula, say the first formula of Table 7.3:tl. The error at x = Xo (note that the Xo of 7.5:10 is purposely chosen as the Xo of the table) is given by (7.5:12)
Since the formula we are testing is exact for polynomials of max-degree 2, we put n = 2 in 7.5:10 and 7.5:11 1 and substitute into 7.5:12. We obtain E(xo)
=
pz'(xo) +
I
"'o
(xo - S)/,31(s) ds
"'0
=
IPz'(x o) -
-
~ [-3Pz(xo) + 4P2(X1) -
~ 14 I"'l (Xl
4h
- s)Z /,31(s) ds -
"'0
pz(xz)]
I"'a (xz "'0
I
s)Z /,31(S) ds l .
I
Since P2(X) is a polynomial of max-degree 2 and the formula we are testing is exact for such polynomials, the first brace is identically equal to zero and E(xo) reduces to (7.5:13)
In order to evaluate the preceding expression, we introduce a function U(s I a, b) of the variable s and the constants a and b, a ~ b, defined by the statement if s < a, U(, I _, b) (7.5:14) if a ~ s ~ h, if s > h.
~ I~
The function U(s I a, b) is thus equal to unity in the closed interval from a to b and is zero elsewhere; the function is sometimes called the char-
7.5. MAGNITUDE OF THE ERROR IN NUMERICAL DIFFERENTIATION
251
acteristic function of the closed interval [a, b] on the real axis. * Hence if g(s) is any function of s, the function g(s)U(s I a, b) coincides with g(s) in the closed interval from a to b and is equal to zero for all other values of s for which g(s) is defined. We use the new function to write E(xo) in the form
- f"" (XI -
S)11'31(s) U(s I Xo , XI) dS)
"0
or
Since the range of integration is from Xo to XI , the factor U(s I x o , XI) is really unnec~ssary; we put it in for the sake of symmetry. We consider that part of the integrand within the brackets, namely, R(s)
R(s) = 0 if s
<
=
4(XI - S)I U(s I Xo , xl) - (XI - S)I U(s I XO, XI).
XO , since then U(s I XO , Xl) = U(s I XO , XI) = 0;
R(xo) = 4(XI - XO)I - (XI - xo)1 = 4hl - (2h)1 = 0;
if Xo
< s < Xl'
R(s)
=
4(XI - S)I - (XI - S)I
=
+
+
(2XI - 2s XI - S)(2x1 - 2s - XI s) = (3(XI - s) h)(xi - S - h) < 0;
+
R(xl ) = -(XI - XI)1 = -hI;
if
Xl
<s<
and R(s)
XI'
= 0 if s >
R(s) = -(XI - S)I < 0; R(xl ) = 0; XI. The shape of the graph of R(s) is shown in
* One "explicit" definition for U(sl a, b) is
U(sl a, b)
=
~.~.~a I] [e.~:·: I] ,
where [x] is the greatest integer which does not exceed x. The constant e can be replaced by any other constant greater than unity and there are other "explicit" methods of defining the function.
252
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
Fig. 7.5:fl. It follows that R(s) is never positive and therefore by the Law of the Mean for integrals the identity 7.5: 15 may be rewritten as 1 f"" R(s) ds, E(xo) = - 4hf'3'(X)
(7.5:16)
"'0
where X is a value of x between Xo and X 2 • The important feature of the last expression for the error is that the integrand R(s) is independent of the function f(x). R(s)
----~--------~~--~~~~-------s
FIG. 7.5:f1.
The integral S;: R( s) ds can be evaluated directly or by use of 7.5: 12 and 7.5: 16 where a particular function is chosen for f(x). Indeed, we have by direct integration
f O'· R(s) ds = 4 f"'l (Xl ~o
S)I ds -
%0
= -
4 -3 (Xl -
f""
(XI - S)I ds
Zo
S)3
I",~o +"31 (XI - S)3 I",~0
On the other hand, take f(x) = (x - xo)(x - xl)(x - XI) so that f'(x) = (x - xI)(x - x 2) + (x - xo)g(x) and f'3'(X) = 6. We find on equating the values of E(xo) given by 7.5:12 and 7.5:16 that
7.5. MAGNITUDE OF THE ERROR IN NUMERICAL DIFFERENTIATION
253
Hence
as before. Consequently, (7.5:17)
Let us compare this result with the result given by 7.5:9'. Since t = 0, n = 2, we find by use of Table 7.5:tl that E(xo) = h2J<3)(X)/3, exactly the same expression we found by the more elaborate derivation. Then why bother with the lengthy procedure? Well, in the first place, the second procedure is based on a weaker assumption and therefore the results will hold if the stronger conditions of the first method are not justified. Secondly, the second method is applicable to a large variety of examples and approximation formulas over and above the formulas of Table 7.3:tl. Before we turn to such an illustration, let us examine the general case of an arbitrary formula chosen from Table 7.3:tl. The expression 7.5:9' gives us the error inherent in such a formula; will the lengthy procedure also end up with the same result? To answer this question, let (7.5:18)
Yk'
= ~h (coYo + C1Yl + ... + cV',,)
be a representative formula. Hence the error committed in approximating the derivative of a function f(x) at x = Xk is (7.5:19)
E(Xk) =j'(Xk) -
~ (coJ(xo) + cJ(x1) + ... + cnf(x,,».
We use 7.5:10 and 7.5:11 1 and express the error in the form
+ ....................... . + cn/J..(x,,) + (tl (x.. - s)"/,,,+1)(s) dS] .
:i
"0
25..
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
Hence
+-1 - f"~ (Xk (n - 1)1 "0
S)·l-1p"+1I(S) ds
- _1_ [eo f"'" (Xo - s)"p"+1I(s) ds nImh "0
+ ................. . + e"
r"
(x" - s)"p"+1I(S) dS] ;
"0
or, since 7.5:18 is exact for polynomials of max-degree nand p..(x) is such a polynomial,
+ ....................... . + e"
r"
(x" - s)"p"+1I(s) dS]
"0
+ ......................... . + e"
r" "0
(x" - s)" U(s I x o , X,,)p"+1I(S) dS]
7.5. MAGNITUDE OF THE ERROR IN NUMERICAL DIFFERENTIATION
= -
255
J"''
-I I h [-nmh(Xk - S),,-l U(S I Xo , Xk) n m "'0
+ CO(XO - S)" U(S I Xo , XO) + Cl(Xl - S)" U(S I Xo , Xl) + ....................... . + C"(X,, - S)" U(S I XO, X,,)]!I,,+1'(S) tis. Put R(s)
= - nmh(Xk -
S),,-l U(S I Xo , Xk)
+ CO(XO - S)" U(S I Xo , XO) + Cl(Xl - S)" U(S I Xo , Xl) + ................. . + C"(X,, - S)" U(S I Xo , X,,), then (7.5:20)
E(xk)
If"''' R(S)P,,+l,(S) ds. = Imh n
"'0
It can be verified that R(s) does not change sign in the interval from to Xn , hence by the Law of the Mean for integrals , E(Xk)
(7.5:21)
=
J"'' R(s) tis.
P,,+1,(X) nImh
"'0
To evaluate the integral, take !(x) = (x - xo)(x so that !(Xt) !'(Xk) pn+1'(x)
= 0, = (-I)n-kkl(n = (n
Xl) ••• (X -
i = 0, I, ... , n, k)lhn,
+ 1)1
Hence, from 7.5:19 and 7.5:21, (-l)n-kkl(n - k)lhn
+ 1)1 f"''' R(s) ds. nImh "'0
= (n
Solving for the integral and substituting in 7.5:21, we obtain (7.5:22)
E(x ) k
=
Xo
(_I)n-khn kl(n - k)1 P,,+1'(X) (n+ 1)1
Xn)
256
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
or (7.5:23)
This result is the same as the one given in 7.5:9' if in the latter Xk is substituted for x. This is what we wanted to prove. We illustrate the use of the lengthy procedure in another type of formula. It can be shown that (7.5:24)
is an exact formula if y = f(x) is a polynomial of max-degree 2. If y = f(x) is not such a polynomial [that is, if f(x) is a polynomial of higher degree or is some other kind of function], the error in computing f"(x o) by means of this formula is
To estimate the error, we substitute into this expression the values of andf" given by 7.5:10, 7.5:11 1 , and 7.5:11 2 where n = 2, and find
f,!'
E(xo) = - 4hI 2
f"'s R(S)f'31(s) ds, "'0
where
Since R(s) is obviously never negative, we have E(xo) = -
f'31(X)
~
f"'s R(s) ds. "'0
We find by a direct evaluation of the integral that
f"'s R(s) ds = "'0
whence
2h3
,
7.6. NUMERICAL INTEGRATION; INTRODUCTION
257
EXERCISE 7.5 1. Evaluate the errors in the formulas of Table 7.3:tl. 2. Evaluate the errors in the formulas derived in Exercise 7.3, example 2. 3. Evaluate the errors in the formulas derived in Exercise 7.4, examples 1 and 2. 4. Prove the statement made directly after 7.5:20 that R(s) does not change sign in the interval from Xo to Xn •
7.6. Numerical Integration; Introduction. The reader is quite aware that problems in applied mathematics-the determination of areas, volumes, and moments, to mention just a few-frequently lead to and f(x) dx. In can be solved by the evaluation of a definite integral contrast to the differentiation of f(x) which is a routine pro~ess that can be carried out by anyone acquainted with the rules, the integration of f(x) may be a far from routine process even when the indefinite integral J/(x) dx is known to exist. Moreover, the indefinite integral of many simple functions, as was pointed out in the first section, cannot be expressed in finite form in terms of the elementary functions. It is therefore important that methods be devised for approximating a definite integral. These methods will occupy our attention in the present and remaining sections of this chapter. We have already mentioned the crude evaluation of a definite integral by the method of counting squares. This graphical method has the advantage of speed-althoug even this is doubtful- and the disadvantage of inaccuracy. Where great precision is required, it is best to use one of the computational methods described hereafter. A method of wide application and great importance is based on one of the properties of power series (see page 32) j if f(x) is expressible as a power series, say,
r
(7.6:1)
and if J is the interval of convergence of the power series, then for any a and b within J, (7.6:2)
f f(x) dx = ao f dx + a f (x b
b
b
1
a
a
a
x o) dx
+ ... + a..
f (x b
a
xo)n dx
+ ...
Enough terms of the last series must be computed to ensure the required precision in the definite integral. (See Sections 2.3 and 2.4.)
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
258
Although, as we have just said, this method is of wide application, it should not be used if a power series expansion off(x) or an appropriate affiliated function cannot be readily obtained or if the rate of convergence of the right-hand member of 7.6:2 is too slow. A method allied to the preceding one but not as efficacious is based on the Euler summation formula 2.5:28. The final term, - R 2k , is f(x) dx. Since the dropped and the resulting equality is solved for remaining terms are known, the integral is deter~ined. The integral f(x) dx, where a and h are integers, can be found from the identity a
t
r
r
f(x) dx =
a
r
r
f(x) dx -
f(x) dx.
0
0
r
The integral f(x) dx for arbitrary a and h can be found by suitable transformation~ of the type x = mx' + q. The error inherent in this method is determined by the dropped term - R 2k • The method involves laborious calculations and is rarely used except as it gives rise to formulas to be developed later. We mention it here mainly for historic reasons. 7.7. Numerical Integration in Terms of Finite Differences. In this section we seek formulas for the numerical evaluation of the definite integral
t
(7.7:1)
a
f(x) dx
in terms of the finite differences determined by the ordinates Yo , Yl , ... , y" , where (xo , Yo), (Xl' Yl)' ... , (X" , y,,) are n I points on the graph of Y = f(x) spaced h units apart. We observe for immediate use that fF(t) dx = f(dx/dt)F(t) dt, and therefore if t = (x - xo)/h or t = (x - x_l)/h,
+
f F(t) dx = h f F(t) dt.
(7.7:2)
As in the case of numerical differentiation, we start with Newton's formula, 7.2: I, whence
(7.7:3)
. f (.)t dt. f'" Y dx = h ~.:1iyo t
"'0
i=O
0
,
This formula gives us the integral of Y in terms of the integrals of the binomial coefficients and the finite differences. It is more convenient
259
7.7. NUMERICAL INTEGRATION IN TERMS OF FINITE DIFFERENCES
to have the integral of y in terms of the binomial coefficients and the finite differences. Hence we must express the integrals of the binomial coefficients in terms of the binomial coefficients themselves. To do this, we observe that the equality 7.2:2, namely,
~ (~) = dt,
±
(-IY-l (. t .),
;-1
}
, -}
yields
~ (-1);-1 ~ -=----,'.'--
(7.7:4)
;=1}
I'o'-} ( t) dt = (t),.. •
•
t
For the sake of brevity, we write Hk for UJ dt; then putting I, 2, ... , n, in turn in the preceding equality w~ obtain the following system of simultaneous equations:
i
=
G) = G) =
Ho 1 --Ho+
HI
1 -Ho3
1 2Hl
2
+ Hz
= (;)
(7.7:5) (_I)n-l n Ho
+
(_I)n-z n _ 1 HI
1
+ ... - 2 Hn-z + Hn- 1 =
Hence Ho =
G),
HI
=
(~) + ~ G) ,
Hz
=
G) + ~ G) - 1~ G) ,
H 3 = (;)
+ ~ G) - 1~ G) + 2~ G) ,
(t)n .
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
260
In general, H.
~ ~ ~ [) + ~ W+ -
I-I! .1
-11
-4
"3
1
1-: 01I (
I
t
i k-2.)+
-t -I! 1
- "4
"3
1 --1
-
~
-
00 ( t) I k-3,
1 !-1
± ........................................... .
(7.7:6)
-l
+ (-l)k
-1
-! -:1
( _I)k-l k (_I)k
k+I
o I
-t
1
(_I)k-2 k-I ( _I)k-l k
(_I)k-a k-2 (_I)k-2 k-I
o o
o o o
I (_I)k-4 ... k-3 (_I)k-a
I
k-=-"2- ... - 2
This solution is readily obtained by using Cramer's rule for the solution of simultaneous linear equations; note that the determinant of the coefficients is equal to unity. Note too that the value of Hk does not depend on the number n (~k) of equations. (See the statements 2.3:22-24; also, Exercise 2.4, example 9.) In particular, the coefficients of the binomial coefficients in the expression for HID are, respectively, I 19 I, 2' - 12' 24' - 720'
(7.7:7)
3 863 275 160' - 60480' 24192'
33953 8183 3628800' 1036800'
3250433 479001600 .
Now, substituting the values of the integrals given by 7.7:6 into Eq. 7.7:3 and using the coefficients just obtained, we derive the formula ( / dx
=
h
!(D Yo +[G)+~G)]~Yo
(7.7:8)
+
[G) + ~ G) -
I; G)] ~2yo
7.7. NUMERICAL INTEGRATION IN TERMS OF FINITE DIFFERENCES
+ [(~) + ~ (;) -
/2 (~) + 2~ (D]
.13yo
:0 G)]
+ [G) + ~ (~) - I~ (;) + 2~ (~) -
71
+ [(~) + ~ (;) -
71;0
/2
261
(~) + 2~ (;) -
.14yo
(~) + I~O (D] .15yo
+ .........................................
~.
Rearranging terms, we get - h lI (t) [Yo + 2~ .1Yo J'"'0" y dX
(7.7:9)
~ .1 2Yo 12
4 ~ .1 3Yo - 12. + 24 720 .1 Yo + ... J
+ (2t) [.1Yo + 21 .12Yo -
1 .13 12 Yo
_ + (3t)[.12Yo + !.13 2 Yo
.l.14 12 Yo
.l.15 _ + 24 Yo
19 .16 720 Yo
+ ...J
_ + (4t)[.13Yo + !.14 2 Yo
.l.15 12 Yo
_ + .l.16 24 Yo
19_.17 720 Yo
+ ...J
+ (5t) [.14Yo + 21 .15Yo -
1 .16 12 Yo
+ 241 .17Yo -
19 .18 720 Yo
+ .. .]
+ 241 .14Yo -
19 .15 720 Yo
+ .. .J
+ ......................................... (, where, in either case, (7.7:10)
t =
1
Ii (x
- XO)·
The last two formulas give the value of the integral of a function y = f(x) from the fixed lower limit xo to the variable upper limit x in terms of the binomial coefficients and the finite differences. If we put t equal to an integer k, we obtain a formula for the evaluation of (7.7:11)
J ydx. "'k
"'0
Note that if k is a positive integer, all rows beyond the kth vanish in the right-hand member of 7.7:9 and the right-hand member of 7.7:8 will have corresponding gaps. Also, if y = f(x) is a polynomial of maxdegree n, all rows beyond the (k + l)st vanish in the right-hand member
TABLE 7.7:tla VALUES OF Ck,' FOR NUMERICAL INTEGRATION
r k
f(x) dx
h
=
%0
r·
k
~
1 2
2
3
4
5
24
19 720
3 160
3 8 8 3 75 8
2
2
3 1
3
9 2
41
4
8
5 1
5
25 2
12 1 3 9 4 20 3 175 12
61
6
18
27
24
71
7
49 2
1225 24
81
8
32
91
9
81 2
10 \\
10
50
539 12 208 3 405 4 425
21
--
-----
-
3
0
96 1323 8 800 -
3
90
3 80 14 45 425 144 123 10 26117 720 3928 45 14661 80 6275 18
f(x) dx
=
h
k(
-I)'
0 95 288 33 10 2499 160 2336 45 4455 32
645 2
Ck,'
LI·y_.
i-O
6
90 3 160
.,...........
Lily.
i-O
Z_t
0
Ct,.
863 --60480 37 3780 29 2240 8 945 275 --12096 41 140 30919 -8640 18128 -945 159219 2240 158975 756
7
8
275 24192 8 945 9 896 8 945 275 24192 0 5257 17280 736 189 103437 4480 17800 189
33953 ---3628800 119 --16200 369 44800 107 --14175 175 20736 9 1400 8183 --518400 3956 14175 26649 6400
123575 4536
9
10
8183 1036800 9 1400 25 3184 94 14175 25 3184 9 1400 8183 1036800
3250433 479001600 8501 --1496880 11899 - 1971200 --547 93555 114985 19160064 537 92400 84427 13685760 2368 --467775 4671 --394240 80335 --299376
0 25713 89600 20225 4536
~
z
c
:I m
'" n > ,... 0
::;:; .."
m m
'"z
-I
;; -I
5 z > z 0
Z
-I m Cl
> '"-I
5 z
-1 I -21 -3
-1
2
5 12
3 8
251 720
95 288
19087 --60480
5257 17280
1070017 - 3628800 ---
25713 -89600
26842253 95800320
.... :.....
z
c
3:
-2
2
7 3
8 3
269 90
33 10
13613 3780
-
736 189
67711 --16200
20225 4536
35417513 7484400
'" n
-3
9 2
27 4
75 8
987 80
2499 160
4302 2240
103437 4480
1221201 - -44800 --
2841201 --89600
14364223 394240
-I m
m
> r-
Z
Cl
-4 -5 I
-4
8
44 3
24
1634 45
2336 45
67192 --945
17800 189
1721263 ---14175
26798 -175
88671367 467775
-5
25 2
325 12
1225 24
12575 --144
4455 32
2543875 ---12096
7365875 --24192
- 8831375 -20736 --
168091625 290304
14725896425 19160064
18
- 45
96
1833 10
645 2
74591 --140
29304 35
1768401 ---1400
368431 200
16082039 6160
10401769 8640
7054229 3456
1712943127 518400
2634975 512
530812423351 68428800
-6 !
-6
-7 I
-7
49 2
833 12
1323 8
251027 --720
966427
-8 I
-8
32
304 -3
800 3
27688 --45
6432 5
2353328 ---945
--
611744 135
111071276 14175
184021888 14175
1940263936 93555
-9
81 2
567 -4
3267 8
81891 --80
369603 160
10752669 2240
8361225 --396
109871559
2701401201 89600
100312094331 1971200
50
575 -3
600
29225 --18
70805 18
6602825 ---756
3414400 189
159817025 4536
3661425 56
34808875345 299376
-9 I
-101 -10
1440
6400
'">-I 0 z
Z -I m
'"3:
II>
0"T1 "T1
Z
~ m
Q "T1 "T1
m
'"mz
n m
II>
...,
0-
w
TABLE 7.7:tlb
........ 0-
VALUES OF
Ck,i
FOR NUMERICAL INTEGRATION
{kf(X) dx
=
h
%'0
,diyo
i-O
{o f(x) dx = h
k
(_l)iCk,i ,diY_i
i-O
Z_k
0
k Ck.i
2
3
4
5
k I
1 2 3 4 5 6 7 8 9 10 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10
2 3 4 5 6 7 8 9 10 -1 ~2
I
-3 -4 -5 -6 -7 -8 -9 -\0
0.5 2 4.5 8 12.5 18 24.5 32 40.5 50
-0.08333 33333 0.33333 33333 2.25 6.66666 66667 14.5833333333 27 44.9166666667 69.33333 33333 101.25 141.6666666667
0.0416666667 0 0.375 2.66666 66667 9.375 24 51.0416666667 96 165.375 266.6666666667
-0.02638 88889 -0.01111 11111 -0.0375 0.31111 11111 2.9513888889 12.3 36.27361 11111 87.28888 88889 183.2625 348.61111 11111
0.01875 0.01111 11111 0.01875 0 0.32986 11111 3.3 15.61875 51.91111 11111 139.21875 322.5
0.5 2 4.5 8 12.5 18 24.5 32 40.5 50
-0.4166666667 -2.3333333333 -6.75 -14.6666666667 - 27.08333 33333 -45 -69.4166666667 -101.33333 33333 -141.75 -191.6666666667
0.375 2.6666666667 9.375 24 51.0416666667 96 165.375 266.66666 66667 408.375
-0.34861 11111 -2.9888888889 -12.3375 -36.3111111111 -87.3263888889 -183.3 -348.6486111111 -615.2888888889 -1023.6375 -1623.61111 11111
0.32986 11111 3.3 15.61875 51.9111111111 139.21875 322.5 671.12986 11111 1286.4 2310.01875 3933.61111 11111
600
:"'I Z
c
:I m
""n»r-
~
." ."
m m
""Z
-I
;; -I 0 z »z 0
z
-I m Cl
»""-I 0 z
......
~
TABLE 7.7:lb (continued)
Z
C
L I
k
I
I
2 I 3 4 5 6 7 8 9 10
:I m
7
8
9
10
6
'" n > ,...
Z -t
-0.0142691799 -0.00978 83598 -0.0129464289 -0.0084656085 -0.02273 47884 0.2928571429 3.57858 79630 19.18306 87831 71.0799107143 210.28439 15344
0.0113673942 0.00846 56085 0.01004 46429 0.00846 56085 0.0113673942 0 0.3042245370 3.8941798942 23.08861 60715 94.1798941799
-0.00935 65366 -0.00734 56790 -0.00823 66071 -0.0075485009 -0.00843 94290 -0.0064285714 -0.0157851080 0.27908 28924 4.16390625 27.2431657848
0.00789 25540 0.0064285714 0.00697 54464 0.00663 13933 0.00697 54464 0.0064285714 0.00789 25540 0 0.28697 54464 4.45877 42504
-0.00678 585 -0.0056791460 -0.0060364245 -0.0058468281 -0.00600 12848 -0.00581 16883 -0.0061689669 -0.0050622628 -0.0118481128 0.26834 14836
m
C)
'">-t
(5 Z
z -t
m
'":I VI
0
.." .."
Z ::::j
m
-1 -2 -3 -4 -5 -6 -7 -8 -9 ' -10 i
-0.3155919312 -3.6013227513 -19.2058035714 - 71.10264 55026 -210.3071263228 -532.7928571429 -1203.90844 90741 -2490.2941798942 -4800.2986607143 -8733.8955026455
0.3042245370 3.8941798942 23.08861 60715 94.1798941799 304.47565 31085 837.2571428572 2041.1542245370 4531.4370370370 9331.7243303571 18065.6084656085
-0.29486 80004 -4.1796913580 -27.2589508929 -121.42948 85362 -425.8957851080 -1263.14357 14286 -3304.2884394290 -7835.71611 99295 -17167.43109 375 -35233.0302028219
0.28697 54464 4.45877 42504 31.70983 25893 153.1314285714 579.01932 11254 1842.155 5146.435546875 12982.14377 42504 30149.5669754464 65382.5892857143
-0.2801895964 -4.7321779969 -36.4352247362 -189.5598674576 -768.5724027331 -2610.7206168831 -7757.1493779081 - 20739.28636 63086 -50888.8465559050 -116271.42905 57693
Q
.." .."
m
'"
m
Z
()
m
VI
..., a-
U!
266
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
of 7.7:8 and the right-hand member of 7.7:9 will have corresponding gaps. If we put t = I, 2, 3, "', in turn in 7.7:8 (or 7.7:9), we obtain the formulas of Table 7.7:tl for the evaluation of the integral 7.7:11. The first of these is known as Gregory's formula. The preceding formulas are in terms of forward differences; to obtain formulas in terms of backward differences we start with formula 7.2:7 and proceed along the same lines as above. The details are left to the reader to show that
f~ y dx =
h
!C ~ t) Yo
- [C ~ t) + ~ C~ t)] ~Y-l + [C ~ t) + ~ C~ t) - 1; C~ t)] ~2Y_2 - [C ~ t) + ~ C~ t) - I; C~ t) + 2~ C~ t)] ~aY_a ± .......................................
I·
This expression can be obtained from 7.7:8 by replacing each binomial by (li'), ~iyo by ~iY_i' and alternating the signs in coefficient front of the brackets. Note too the interchange of limits of the integral and that now, t = (x - x_1)/h. If we give t the values 0, -1, -2, "', in turn in 7.7:12, we obtain the formulas also given in Table 7.7:t1. Similar formulas can be found by starting with central difference expressions. However, an alternate method of derivation is noteworthy. Let
m
(7.7:13)
be a particular forward difference formula. Then (7.7:14)
to
Y dx = h[coYo -
C1
"-k
~Y-l + C2 ~2Y_2 -
Ca
~aY_a ± ...]
is a correct formula in terms of backward differences. Raise all subscripts on the y's and their differences by k in the last expression, then (7.7:15)
tk "0
Y dx
=
h[CoYk -
C1
~Yk-l + Cs ~2Yk_2 -
Ca
~aYk_a ± ...]
7.7. NUMERICAL INTEGRATION IN TERMS OF FINITE DIFFERENCES
267
is also a valid formula. Since 7.7:13 and 7.7:15 are formulas for the same definite integral, we obtain by addition and division by 2 (7.7:16)
+ Cs LISYo - 2LIsYk-S + ...] . This is a formula for the definite integral in terms of averages of differences that center about the midpoint between Xo and Xk • Another set of formulas is based on the Euler summation formula 2.5:28. Let Y = fl(Z) and put ~Ik)
= ftlk)(i).
Formula 2.5:28 may then be written as (7.7:17)
(fl(Z) dz
= (tYo + YI + ... + Yn-l + _
~
~
lYn)
Bli (yil/-U _ ylli-U)
(2j)1
n
0
+ R Ik •
Make the substitution Z = (x - xo)/h, where Xo a,nd h are arbitrary constants, h positive, and let Xl' X 2 , ••• , be the values of X corresponding to the values I, 2, ... , respectively, of z. We have fl(Z) = f(x), say, and for arbitrary positive integers k and T,
The summation formula can then be written as (7.7:18)
Ii1 f"''' f(x) dx = (tYo + YI + ... + Yn-l +
lYn)
"'0 k
B
_ ~ ~ (yI2i-U _ yll/-U) hl/-l ~ (2j)1 n 0
268
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
or (7.7:19)
r"f(x} dx
= h(!yo + Yl + ... + Y"-1 + ty,,}
"'0
_
~ B 2J ~
(y(2;-U _ y(2;-U) h2;
(2j}!"
+ R* 2k '
0
where yft) now means dr dxrf(x}
I"'="'k
This form of the Euler summation formula can, of course, be used for the evaluation of the integral but for greater facility in the computations it is better to replace the derivatives on the right by their values given in Table 7.2:t3. We first remark that if
is a formula of'Table 7.2:t3,
is a corresponding formula of Table 7.2:t3. If in the last equality we raise all subscripts on y(r) and the differences by the same integer n, we obtain the formula
Hence (7.7:20)
hr (y"(r) _ y(r)} 0
=
00
~ a ~
i=O
.(Llr+i1J
r.r+a
. _ (-I); Llr+iy )
J,,-(r+a)
Hence, by substitution into 7.7:19, (7.7:21)
r"f(x}dx = h [(iYo "'0
+ Yl + ... + Y"-1 + iy,,)
0 •
269
7.8. NUMERICAL INTEGRATION IN TERMS OF ORDINATES
The coefficients a2 i-1I2j-l+i are the numbers in the (2j - I )st row of Table 7.2:t3. Using these values of B2i from 2.3:21, we find (7.7:22) fnf(x) dx
= h [(lyo + Y1 + ... + Yn-1 + lYn)
"'0
- 112 (..1Yn-1 - ..1Yo) - ;4 (..12Yn_2 _.
7~ (..13Yn _3 -
-
+ ..1%)
..13yo) - 1~ (..1'yn-4
~:~o (..15yn_& -
..15yo) -
+ ..1'10)
2!~~2 (..16Yn _6 + ..16yo)
33953 (..17 ..17) 8183 (..18 - 3628800 Yn-7 Yo - 1036800 Yn-8
+ ..18Yo )
- ... - ...J. EXERCISE 7.7
1. Copy the values of cos x for x = 200• 22 0• 24 0•...• 300 from a five-place table. Compute. by use of 7.7:8 or 7.7:9. and Table 7.7:tl. cos x dx for u = 18 0• 190• 200• 210. ···.31 0.320.
g,
2. Use a five-place table and appropriate formulas to evaluate f: InS x dx for u = I. I.S. 2. 2.S. 4. S. 10. 3. Let functions be defined as in Exercise 7.2. example 3. Find
a. f:.!(x) dx b. f:.as!(x) dx c. f:. 5 !(x) dx d. J;,!(x) dx 4. If (2.3:2S)
for u = 33. 36. 40. 43. 48. for u = S.IO. S.SS. 6.00. 6.4S. 6.90. for u = 6.0. 6.4. 6.8. 7.8. 9.0. for u = 30. 32. 36. 37. 38.
In =
f! (!) dt
and
Hn =
f: (!> dt.
prove Hn
=
~i-o II(n-:+1).
S. Prove that the c's of Table 7.7:t1 satisfy the relationship Ct.1 = Ck-l.i-l + Ck-l.i + Cl.l. Starting with the formula for k = I. CO.I = 0 for every i. Ck.-l = 0 for every k. derive the other formulas of Table 7.7:tl.
7.8. Numerical Integration in Terms of Ordinates. In this section we seek formulas for the numerical evaluation of the definite integral (7.8:1)
r
f(x) dx
/J
in terms of the ordinates Yo , Y1' ... , Yn' where (xo, Yo), (Xl' Y1)' ... , (Xn ,Yn) are n + 1 points on the graph of Y = f(x) spaced h units apart.
270
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
The most primitive evaluation is found in any calculus text and depends on the very definition of the definite integral. If the x-axis from x = a to x = b is divided into n equal intervals by n 1 points whose abscissas are Xo = a. Xl' X 2 • •••• X n - l • Xn = b. then h r.~:oIYi and h r.~=IYi' where h = xHI - Xi. are crude approximations to the definite integral 7.8:1. The relation of these sums interpreted as sums of areas of rectangles to the definite integral interpreted as an area is well known and need not be elaborated here. The arithmetic average of the sums. namely. h[i(Yo + Yn) + r.~.:;.lYi]' usually gives a better approximation to the definite integral; the last expression is recognized as the sum of the areas of trapezoids and is also too well known for further mention here. More refined formulas can be obtained in several ways. The method of undetermined coefficients explained in Section 7.4 is also applicable here. As in the case of numerical differentiation. we use the basic set of polynomials
+
(7.8:2)
Y
=
I. Y
=
x. Y
=
xS, ... ,y
and the ordinates evaluated at the abscissas a formula of the type (7.8:3)
r o
y dx
=
boyo + blYI
X
=
x",
= O. 1. . ..• n. to obtain
+ ... + bnY" .
As before. the particular formula derived will be exact for all polynomials of max-degree n for ordinates at these abscissas. We obtain exact formulas for arbitrarily but equally spaced ordinates by multiplying the formulas found for abscissas O. 1•...• n by h. instead of by l/h as formerly. As an example. take k = 1 in formula 7.8:3. We must then determine the coefficients in (7.8:4)
(Y dx = boYo + blYI
+ ... + bnY"
so that this equation is exact for the polynomials of 7.8:2. Using the values O. I •...• n for x. we are led to the system of simultaneous linear equations bo + bl + bs + ... + b" = I, bl + 2b s + ... + nb" = 1, bl + 22b s + ... + n2b" = t, (7.8:5) bl
I + 2"b2 + ... + n"b,.. = -. n+1
7.8. NUMERICAL INTEGRATION IN TERMS OF ORDINATES
271
Note that these equations differ in form from Eqs. 7.4:1 only in the column of constants. Thus, for n = 3, we have bo + b1 b1
+ bz + + 2bz +
ba
=
3ba =
1,
l,
+ 4hz + 9ba = -1, b1 + 8b z + 27ba = i, b1
whence bo = 9/24, b1 = 19/24, b2 = -5/24, b3 we obtain the formula
= 1/24. Consequently,
which is exact for all polynomials of max-degree 3 for any four equally spaced points. Thus, from y = 2x3 - 8x, we find y = -6, -21/4, 0, 45/4, respectively, for x = 1, 2, i; and therefore
-t,
Ii (2x3 1
8x) dx
t [9(-6) + 19 (- -21) - 5(0) + -45] = - -95 = -24 4 4 32 .
The answer, of course, can be verified by direct computation. The formula is not exact for polynomials of degree 4. Another method of obtaining formulas of type 7.8:3 is by direct use of the formulas of Table 7.3:tl. For example, we have for n = 4,
= -25yo + 48Yl - 36yz + 16Ya - 3Y4 , 12hYl' = -3yo - 10YI + 18yz - 6Y3 + Y4' 12hyo'
12hyz' = 12hYa' =
Yo - 8Yl -Yo + 6Yl - 18yz
+ +
8Ya - Y4' 1OY3 + 3Y4 .
We eliminate y, from these equations to obtain 12h(yo' 12h(Yl' 12h(yo'
+ Ya') = + Y2') = + 3Yl') =
-26yo + 54Yl - 54Y2 + 26Ya, -2yo - 18Yl + 18yz + 2Ya, -34yo + 18Yl + 18yz - 2Ya'
We next eliminate Y3: 12h(yo' - 13Yl' - 13yz' + Ya') = 288Yl - 288yz , 12h(yo' + 4Yl' + yz') = -36yo . + 36Y2'
272
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
Finally, we eliminate Y2:
Hence
But J:~y' dx
= Yl - YO' and therefore,
which becomes the formula previously derived if we drop all the primes indicating differentiation. Note that since we used formulas from Table 7.3:tl that are exact when Y is a polynomial of max-degree 4 in deriving the last formula containing the primes, it is exact when the integrand is a polynomial of max-degree 3. However, the most expeditious method of obtaining numerical integral formulas of the required type is by substitution in the finite difference formulas. We use formula 3.7:13, namely,
±(-ly-i nYi+k'
.:1 rYk =
(7.8:6)
i=O
'
to replace the finite differences in 7.7:8. We obtain
(7.8:7)
J.., Y dx = h \/Ho (t)I Yo "0
+ [Ho G) + HI G)] (-Yo + Yl) + [Ho G) + HI G) + H2 G)] (Yo -
2Yl
+ Y2)
+ ........................... I, h±Hi ( _!+ 1)±(-ly-i(~)Yi' i=O
'
J
where the H's are given by 7.7:7.
i=O
'
273
7.8. NUMERICAL INTEGRATION IN TERMS OF ORDINATES
If we replace the finite differences in the formulas of Table 7.7:tl by their values in terms of the ordinates, we obtain the formulas of Table 7.8:tl. We have tabulated there the range of integration and the max-degrees of the polynomials for which the formulas are exact as well as the multipliers of h and the coefficients of the ordinates. Thus, if y = f(x), the tenth formula states
f
"'B
3h Y dx = 80 (9yo
+ 34Yl + 24Y2 + 14Ya -
Y4)·
"0
The right-hand member is, of course, only an approximation to the integral unless y is a polynomial of max-degree 4. Formulas 5, 14, 23, 30, 36, and 13,22,29, 35 of Table 7.8:tl are known as the Newton-Cotes formulas; the first group consists of the closed-type formulas, so-called because the range of integration coincides with the range of the ordinates involved; the second group consists of the open-type formulas, so-called because the range of integration is greater than the range of the ordinates involved. Several of these formulas have special names; formula 0 is known as the trapezoidal rule, formula 5 is Simpsons's one-third rule, formula 9 is Simpsons's three-eights rule. Some of these formulas can be simplified with little sacrifice in the margin of error or in the number of ordinates involved. Thus, if y = f(x) is a polynomial of max-degree 5, .1 6yo = Yo - 6Yl
+ 15Y2 -
20ya + 15Y4 - 6y5
+ Y6 = o.
Multiply this expression by 3/10 and add to the right-hand member of formula 22 of Table 7.8:tl ; we obtain a simpler formula exact for polynomials of max-degree 5, (7.8:8)
known as Weddle's formula. A formula of Table 7.8:tl can be combined with itself or with other formulas of the table to yield formulas for integration over longer intervals. For example, since
f "'2m Y dx = f"'2 Y dx + f"" :1'0
%0
Y dx
+ ... + f"'·m
%2
Y dx,
a"2m-1
and since, by formula 5 (Simpson's rule),
f
"'~/ %:U-2
h
Y dx = "3 (Y2/-1
+ 4Y2i-l + Y2i),
i
=
1,2, ... , m,
.... .... ...
TABLE 7.8:tl VALUES OF COEFFICIENTS FOR NUMERICAL INTEGRATION
ft
(f)x dx
=
Kh
=
Kh
Zo
I'"O
f(x) dx
z_k
Exact for Fonnula polynomials no. of max-degree
0
K
~ Ct.iYi '-0
~ Ct.iY-i 1-0
2
3
4
5
6
7
8
c
I
:I m
2
2 2
3
3
4
4
5
12 I 24
720
10 :""'I Z
-
0
9
'" n >
5
8
-I
9
19
-5
251
646
-264
106
-19
475
1427
-798
482
-173
r
Q
I
I
.." .."
m m
'"
Z
-I
;; -I
- - - - -_._----5
2,3
6
4
1440 I 3
0
27
Z
._--------
2
--------
>
Z 0
4
Z
7
5
90 I 90
2
29
2
28
124 129
24
4
14
-6
-I
-I
m
Cl
'"-I> 0 Z
'oj
8
2
9
3
10
4
11
5
12
6
13
3
14
4,5
15
6
16
3
17
4
18
5
19
6
20
7
3 4 3 8 3 80 3 160 2240 4 3 2 45 2 945 5 24 5 144 5 288 5 12096 5 24192
0
3
CD
3
z
c 3
3
3
~
m
3
9
34
24
14
-1
3
17
73
38
38
-7
3
685
3240
1161
2176
-729
4
0
2
'"n> ,...
Z
-I m
C'I
216
-29
'"~
(5
z
-1
Z
2
-I m
4
7
32
12
32
7
4
143
696
192
752
87
'"
~
en
0
24
-4
.."
0
'"cZ
5
-11
55
-65
45
5
19
-10
120
-70
85
51
19
75
50
50
75
19
51
743
3480
1275
3200
2325
1128
-55
5\
1431
7345
1395
8325
2725
3411
-495
~
m en
.... 'oj
VI
..... ~
TABLE 7.8:tl (continued) VALUES OF COEFFICIENTS FOR NUMERICAL INTEGRATION
IZkj(X) dx
=
Kh ~ Ck ••Y. i-o-
2'0
I'"" j(x) dx
=
Kh ~ Ck .•Y_i
X_.t
Exact for Formula polynomials no. of max-degree 21
4
22
5
23
6,7
24
5
25
6
26
7
27
8
i-O
......
0
K
2
3
4
5
6
7
8
9
10
z
c
~
m
3 IO 3 10 1 140 7 1440 7 8640 7 17280 7 518400
'" n > 2
6
11
-44
96
-84
41
6
0
11
-14
26
-14
II
6
41
216
27
272
27
216
7
-611
4277
-9618
12782
-8603
3213
7
751
-840
8547
-11648
14637
-7224
4417
7
751
3577
1323
2989
2989
1323
3577
751
21361 116662
6958
155134
7840
105154
74578
31882
7
r-
"T1 "T1
m m
41
'"Z
55
-I
~
(5
z z> 0
Z -I m
C)
-1169
'"> -I
(5
z
.....
28
6
29
7
30
8,9
31
7
32
8
33
9
34
10
35 36
9 10,11
8 945 9 945 4 14175 9 4480 9 44800 9 89600 9 1971200 5 4536
8
460 -2760
8706
-13904
13641
-7464
a. z c
2266
~
m
8
0
460
-954
2196
-2459
2196
-954
460
8
989
5888
-928
10496
-4540
10496
-928
5888
105039 -126801
98361
-45069
11493
""n
.-)-
Z
989
-I m
Cl
9 -1787
16083 - 52839
""-I )-
(5
9
2857 -4986
51966 -110322
182880 -177102
129666 - 50886
z
20727
Z 9
2857
15741
1080
19344
5778
19344
1080
15741
781056 -119382
335160
229527
5778
-I m
2857
"" ~
III
9
60259 372252 -93015
736968 -417834
88804 -2595
0
.."
0
10
29:376 10
0
4045 -11690
33340
-55070
67822
-55070
33340 -11690
""0
4045
Z
16067 106300 -48525
272400 - 260550
427368 -260550
272400 -48525 106300
16067
)-
-I m
III
.... :::I
278
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
we obtain, by adding up the m integrals for i
= I, 2, ... , m,
(7.8:9)
f
"1lm
Y dx
h
= "3 (Yo + 4Yl + 2Y2 + 4Y3 + ... + 2Y2m-2 + 4Y2m-l + Y2"')·
"0
Also, since
we have
which, if it is desirable to have small coefficients, can be rewritten as
The two formulas just derived are exact for polynomials of max-degree 3. EXERCISE 7.8 1. Do by the methods ofthis section examples 1-3 of Exercise 7.7.
2. Choose appropriate values for x o , h, and an appropriate formula to evaluate the following integrals, correct to the indicated number of decimal places.
a.I:~dx; b.
I: VI + I
HU
c. d.
e. f.
I.
I: I: I:
for u
Xl
sin -
1-u
2xa dx,
2 dp
dx,
4
cos Xl dx, riel dt,
for x =
e lill dt,
for x
tan Xl •/
dx,
f"ovl+x·
=
2 dp
1,2,3,4;
= 0, i, i, t, 1;
2 dp
i, I, !, 2;
3 dp
J-, 2, f' 3, 4;
3 dp
for u
for u =
=
t, I, 2, 3, 4;
for u
= 0.5,0.7, I,
3 dp 1.2, 1.24;
3 dp
7.9. MAGNITUDE OF THE ERROR IN NUMERICAL INTEGRATION
279
3. Derive by the method of undetermined coefficients or otherwise a formula of the indicated type, exact for polynomials of the stated max-degrees.
n
=
3.
n = 3.
n
= 2.
n = 6.
7.9. Magnitude of the Error in Numerical Integration. In this section we consider the magnitude of the error when a definite integral is approximated by a formula of the preceding sections. The discussion will parallel the discussion given in Section 5 of this chapter. As there, let
(7.9:1) where Pn(x) is the polynomial through the points (xo , Yo), ... , (xu, Yn), h = xHI - x" t = (x - xo)Jh, and X is a value of x between the largest and smallest of Xo , Xl' .•• , Xn , x. Hence
(7.9:2)
t ) dx, f ba f(x) dx = fba Pn(x) dx + hn+1 fba pn+1I(X) (n+1
t f(x) dx by t Pn(x) dx is
and the error committed in approximating
(7.9:3)
E(x)
= fb f(x) dx - fb Pn(x) dx = a
a
hn+1
a
a
fb pn+1I(X) ( a
t ) dx. n+1
If we again assume as in Section 5 that pn+lI(X) is constant within the interval of integration, and if we substitute h dt for its equal dx, then
(7.9:4)
E(x)
=
hn+~Cn+1I(X)
In particular, if we put a
(7.9:5)
=
Xo
f
and b
Cb-ZO' III
t
(
)
+1
dt.
Ca-zol/ll
n
=
the error becomes
Xk,
280
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
which in view of 7.5:5 can be rewritten as
(7.9:6) The integral on the right has been discussed on several previous occasions. Its value is the coefficient of LlnHyo in the row for Xo - Xk in Table 7.7:tl. The arbitrary condition that pn+l)(x) be constant within the interval of integration can be removed by the following artifice. Let
(7.9:7) be a typical formula for which we wish to estimate the error. If f f(x) dx = F(x) so that F'(x), then
But
hence
(7.9:8) The error inherent in the last expression can be determined by the long method of Section 7.5, and therefore, since 7.9:7 and 7.9:8 are equivalent statements, the error in the former can be determined. For example, Simpson's formula is
which is equivalent to F(X2) - F(xo)
=
i
(F'(x o) + 4F'(x1 )
+ F'(x2»·
Since Simpson's formula is exact if f(x) is a polynomial of max-degree 3, the last statement is exact if F(x) is a polynomial of max-degree 4. If
281
7.10. GAUSS' FORMULAS; ORTHOGONAL POLYNOMIALS
we then put n = 4 in 7.5:10 and proceed as in that section, we find the error in the last expression to be E(x)
=
f" R(s)F(5)(s) ds, "0
where R(s)
=
(X2 - S)4 24
U(s I Xo , x2) -
2
3
9 h(Xl - s) U(s I Xo , Xl)
- ;8 (X2 -
S)3 U(s I Xo , x 2)·
It is not difficult to prove that R(s) :::;;; 0 for all values of s, hence E(x)
= F(SI(X)
f" R(s) ds. "0
We find by direct integration
f"'. R(s) ds = -
hS . 90
"'0
Therefore E(x)
= -
hSF(SI(X) 90
= -
h5j'(41(X) 90
.
The result is the same as the one obtained by assuming .f'4I(x) constant in the interval from Xo to X 2 • EXERCISE 7.9
1. Determine the errors in the formulas of Table 7.8:tl. 2. Determine the errors in the formulas of Exercise 7.8. example 3.
7.10. Gauss' Formulas; Orthogonal Polynomials. In Section 8 of this chapter we developed a number of formulas of the type
for the approximation of the definite integral, where h = Xi+l - Xi . In general, these formulas yielded exact values whenever f(x) was a polynomial of max-degree n. It is reasonable to expect that if the restric-
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
282
tion that the x's be equally spaced be removed, it might be possible to obtain a formula of the type (7.10: I)
r
f(x) dx
a
=
aof(xo)
+ ad(xI) + ... + aJ(xn),
where the a/s are constants and the x/s are abscissas to be determined, which is exact for polynomials of higher max-degrees. Indeed, it is reasonable to expect that since 2n + 2 constants, a o , a l , ••• , an , Xo , Xl , ... , xn , are at our disposal, it may be possible to obtain a formula which is exact for polynomials of max-degree 2n + 1. We consider this problem in this section. It turns out that it is convenient to make the transformation x' = (x - a)/(b - a), so that 7.10:1 becomes (7.10:2)
(f(X) dx
=
Aof(xo) + Ad(xl )
+ ... + AJ(xn),
where we have dropped the primes on the x's for the sake of simplicity and where Ai = ai/(b - a). A formula of this type is known as a Gauss formula for numerical integration. We use the method of undetermined coefficients and endeavor to determine the 2n + 2 constants so that 7.10:2 is exact for each of the polynomials y
(7.10:3)
=
I, y
=
x, y
=
X2, "',y
=
x2n+1.
If we succeed in finding a formula which is exact for these polynomials, it will follow at once from the linearity properties of the integral that 1. it will be exact for any polynomial of max-degree 2n If we use Eqs. 7.10:3 in turn in 7.10:2, we obtain the following system of equations to be solved for the A's and the x's:
+
Ao AoXo
+ Al + A2 + .. , + An = I + A1x1 + A 2x 2 + ... + Anxn = i _.1.
(7.10:4)
-3
A x2n+1 o
0
+ A I x2nI +1 + A :"-2 _x2n+1 + '" + A x2n+1 = n 11.
2n
I
+2
Since these equations are linear in the A's but not in the x's, their solution presents a far from simple problem. To solve this problem we turn to some apparently foreign but nevertheless closely related investigations.
7.10. GAUSS' FORMULAS; ORTHOGONAL POLYNOMIALS
283
First of all, we solve the system of linear equations
!+ Ul
+
U2
!+
+
U2
1
2
2
Ul
3
3 4
Un 0 + ... +--= I+n
+"'+~=O 2+n
(7.10:5)
!+~+~+ .. ·+~-o n+1 n+2 n+n- ,
n
for U 1 , U 2 , ... , Un' If we add the fractions on the left-hand side of the kth equation, we get
rk + n]
[k
+ n]
[k
+ n]
In + 1 n + U 1 n + 1 n-l + ... + Un n + 1 0 [k + n] n+1
in the notation of Section 7.1. In virtue of Eqs. 7.10:5, the left-hand side of this identity must vanish for k = I, 2, ... , n; since the denominator on the right is positive for k = I, 2, ... , n, the numerator must vanish for each of these values. But the numerator is a polynomial in k if max-degree n, hence (7.10:6)
[k + n] n + 1n
+ U1 [k + n] + ... + Un n + 1 n-l
[k + n] n + 10
=
M(k _ I)(k _
2) ... (k -
n),
where M is a constant. Put k = 0; every term on the left-hand side drops out except the first which becomes n!; the right-hand side becomes (--I)nn!M. Hence M = (-I)n. Now put k = -i, i = I, 2, ... , n. The equality 7.10:6 reduces to Ui
[n - i]
n+l
n- i
=
(-I)n(-i _ I)(-i - 2)'" (-i - n)
284
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
or u;(-I)ii!(n - i)!
= (n
+ i)(n + i-I) ... (i + 1).
Hence
.=
u,
(-I)i (n
+ i)(n + i-I)'"
(i
i!(n _ i)!
+ 1)
or i=I,2,"·,n.
(7.10:7)
Secondly, we consider the polynomial of degree n defined by
or (7.10:8)
This polynomial is known as the Legendre polynomial of order n (but see the remark a little further on) and has some important properties which we state and prove below. We also list in Table 7.1O:tl the first ten Legendre polynomials for ready reference. TABLE 7.10:tl LEGENDRE Pn(X)
=
POLYNOMIALS
±
(-1)j
j-O
I: x
X2
XS
x·
Pn(X) dx
X·
Pn(X)
C) r ; i)
xj
n ;;;. 1
= 0, X6
X7
XS
x·
x lO
Po
PI P2
Ps
p. p. P6 P7 Ps
p. P IO
-2 -6 6 -12 -20 30 -20 -140 70 90 -30 210 -560 -252 630 -42 420 -1680 -2772 3150 924 -3432 -56 756 -4200 11550 -16632 12012 -72 1260 -9240 34650 -72072 -51480 12870 84084 -90 1980 -18480 90090 -252252 420420 -411840 218790 -48620 -110 2970 -34320 210210 -756756 1681680 -2333760 1969110 -923780 18475 6
7.10. GAUSS' FORMULAS; ORTHOGONAL POLYNOMIALS
Property a. If p(x) is any polynomial of max-degree n (7.10:9)
( p(x) Pn(x) dx
285
I, then
= O.
In particular, we have; Property b. (7.10:10)
r o
Pn(x) P",(x)
if n =F m.
=0
Property c. (7.10:11) Property d. The roots of (7.'10:12)
are all real, distinct, and between 0 and I. If two functions f(x) and g(x) have the property indicated in 7.10:9, or more generally, if the two functions are so related that
r
f(x) g(x) dx
a
=
0,
the functions f(x) and g(x) are said to be orthogonal on the interval from a to h. Any two distinct Legendre polynomials are then orthogonal on the interval from 0 to 1. It should be remarked, however, that Legendre polynomials are usually so defined that they are orthogonal on the interval from -I to I (it is convenient for our purposes to define them as we did). A suitable linear transformation can be used to send one set of polynomials into the other. Orthogonal polynomials are of great importance in mathematics and its applications and there is an extensive literature concerning them. We now prove that the Legendre polynomials have the four properties stated above. Consider first k
= 0, I, "', n - l.
286
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
We have
=
± +,+ i=O
k
(-.I)i
(~)
I,
(n ~, i) .
But the last sum is precisely the left-hand member of the (k equation of 7.10:5 and is therefore equal to zero. Hence k
(7.10:13)
= 0, I, ... , n -
+ l)st
l.
Property a follows at once since f[Cjl(X) + C2.Mx)] dx = C1fjl(X) dx + C2fj2(X) dx, where C 1 and C 2 are arbitrary constants. Property b is an immediate corollary of the first property. To prove property c, we note that fl P,.2(X) dx reduces to o
which equals ( -I)" (2n) ~ ( -I )i . (~) (n ~ n ~n+I+" ,
i) .
Put k = n + I in the identity immediately following the set of equations 7.10:5 and use 7.10:6, 7.10:7, and 7.1:19; we obtain ~
~n
(-I)i (n) (n + i) = + I +iii
(-I)"(n!)2 (2n I)! .
+
Hence
= _1_ I P"x2( ) dx = (-I)" (2n)n (-I)"(n!)2 (2n + I)! 2n + I ' l
o
as we wished to prove. We now prove the last property. It follows from the definition of the Legendre polynomial, 7.10:8, that Pn(O) = 1, hence P,,(x) is certainly
287
7.10. GAUSS' FORMULAS; ORTHOGONAL POLYNOMIALS
positive in some portion of the interval from 0 to 1. On the other hand, if we put p(X) = 1 in 7.10:9, we get
s:
P,,(x) dx = 0,
and if we recall that the definite integral can be interpreted as an area above the x-axis minus an area below the x-axis, we learn that P",(x) must be negative in some portion of the interval. It follows that the equation P",(x) = 0 must have at least one root between 0 and 1 of odd multiplicity. Let r1 , r2 , ... , rg be the distinct (real) roots of P",(x) = 0 that are between 0 and 1 and are of odd multiplicity. Then rex) = (x - r1 )(x - r2 ) ... (x - rg) is a polynomial of degree g ~ n. Hence, by property a,
f:
rex) P,,(x) dx
= 0,
unless g = n. But the polynomial r(x)p",(x) is not identically zero and does not change sign between 0 and 1 so that fl r(x)p",(x) dx cannot be equal to zero. It follows that g = n, which rri'eans that the roots of P",(x) = 0 are distinct and between 0 and 1 as we wished to prove. Incidentally, we have already seen that P ",(0) = 1 and it can be shown that P"'( 1) = (-1)"', hence neither 0 nor 1 are roots. We are now ready to solve Eqs. 7.10:4. Multiply the first equation by ("'~1)("'~1), the second by _("'11)("'12), the third by ("'~1)("'~3), and so on to the (n + 2)nd equation which is multiplied by (-1 )"'+l(:me::12 ); then add the n + 2 results. We obtain
= ~ (-I)i _.1_ (n ~ I) i=O
'
+I,
(n + ~ + i) ,
+
where P"+l(x) is the Legendre polynomial of order n 1. Now multiply the second equation by ("'~1)("'~1), the third by -("'11)("'12), the fourth 3)rd by (-I)"'+l(:m(~:{) and add the by ("'~1)("'~3), ... , the (n results. We obtain
+
AoXoP,,+1(xo) + A1x1Pn+l(X1) +
... + A"x"P"+1(x,,) =
s:
XP"+1(x) dx.
288
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
+
We repeat this process for each set of n 2 consecutive equations of the system 7.10:4. We thus obtain the system of n 1 homogeneous equations:
(7.10:14)
A"p"+1(xo) + A 1P"+1(Xl) AoX"p"+1(xo) + A 1x1P,,+1(Xl) AoXo2P"+1(xo) + A 1x 12P"+1(X1 )
+
+ ... + A"P"+1(x,,) = 0 + ... + A"x"P"+1(x,,) = 0 + ... + A"X,,2P"+1(X,,) = 0
The right-hand members of these equations all vanish in view of the orthogonal property of the Legendre polynomials. Equations 7.10:14 will clearly be satisfied no matter what the A's are if we choose the roots of Pn+l(x) = 0 for X O ' Xl , •.• , X" • If we so choose 1 equations of the x's and then substitute their values in the first n 7.10:4, we obtain a set of n + 1 equations linear in the A's. The determinant of the coefficients (of the A's) is the Cauchy-Vandermonde determinant previously discussed (page 72) which does not vanish since the x's are distinct. Consequently, the A's can be uniquely determined. It remains to prove that the A's and x's so determined will satisfy the remaining equations of 7.10:4. But this prooffollows readily enough. We have already seen that the first equation of 7.10:14 was obtained by multiplying each of the first n + 2 equations of 7.10:4 by certain constants and adding the results. We note, first, that the constant multiplying the last equation is (-1 )n+l(~+'i2) which is not zero and, second, that since the x/s were chosen as the roots of Pn+l(x) = 0, the coefficient of each Ai in 7.10:14 is identically equal to zero. These remarks imply that the (n + 2)nd equation of 7.10:4 is linearly dependent on the first n 1 equations and hence any solution of the first n I equations is necessarily a solution of the (n 2)nd. Precisely the same line of reasoning applies to the remaining equations of 7.10:4. That is, the A's and x's that were found to satisfy the first n 1 equations of 7.10:4 will satisfy all the equations of the system. Table 7 .1O:t2 gives the values of the roots of the Legendre polynomials and the corresponding A's (the Gaussian coefficients) up to n = 10, and two illustrative examples are worked out below. Note that since most of the x's are irrational, the greater precision afforded by the use of Gauss's formulas may be more than offset by the greater difficulty in computing the corresponding f(x),s, unless a computing machine is used.
+
+
+
+
+
7.10. GAUSS' FORMULAS; ORTHOGONAL POLYNOMIALS
289
TABLE 7.10:t2
n
2
3
Degree of polynomial for which Eq. 7.10:2 is exact
3
5
Roots of Legendre polynomials
x. = 0;5
A.
= I
x. = 0.2113248654 0.78867 51346
A.
=
Xl =
Al =
x. = 0.1127016654 0.5 X. = 0.8872983346
Al =
Xl =
4
5
7
9
X.
II
A.
=
Al
= 0.3260725774
XI
AI =
Xa
0.0694318442 0.33000 94782 = 0.6699905218 = 0.9305681558
X.
=
0.04691 00770 0.23076 53449 XI = 0.5 Xa = 0.7692346551 x, = 0.95308 99230
X.
=
X.
=
Xa =
x, = Xi =
13
X.
0.1184634425 0.23931 43352 AI = 0.28444 44444 Aa = 0.2393143352 A, = 0.1184634425 =
Al =
A.
=
Al = AI = Aa =
A,
=
Ai =
A.
0.08566 22462 0.1803807865 0.23395 69673 0.23395 69673 0.1803807865 0.08566 22462
= = =
=
A.
=
0.05061 42681
Xl =
Al
x, = X. = x, =
X.
0.02544 60438 0.1292344072 0.29707 74243 0.5 0.70292 25757 0.8707655928 0.97455 39562
A.
0.3260725774 0.1739274226
A, A. A,
XI = Xa =
15
0.0337652429 0.1693953068 0.3806904070 0.6193095930 0.8306046932 0.96623 47571
Aa =
0.17392 74226
0.0647424831 0.1398526957 0.19091 50253 0.2089795918 0.1909150253 0.13985 26957 0.0647424831
=
Xl =
8
AI
0.2777777778 (5/18) 0.44444 44444 (4/9) = 0.27777 77778 (5/18) =
=
Xl =
7
A.
0.5 (1/2) 0.5 (1/2)
Xl =
Xl =
6
Gaussian coefficients
0.0198550718 0.1016667613 XI = 0.23723 37950 Xa = 0.40828 26788 x, = 0.59171 73212 Xi = 0.76276 62050 x. = 0.8983332387 X7 = 0.9801449282
=
Al =
A.
=
Aa =
AI
= 0.1111905172 = 0.1568533229
Aa =
A, A. A. A7
= = = =
0.1813418917 0.1813418917 0.1568533229 0.1111905172 0.0506142681
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
290
TABLE 7.IO:t2 (continued)
Degree of polynomial for which Eq. 7.10:2 is exact
n 9
10
Roots of Legendre polynomials
= = = = = Xi = x, = X7 = X. = Xo Xl X8 X. X.
17
0.01591 98802 0.0819844463 0.19331 42836 0.33787 32883 0.5 0.6621267117 0.8066857164 0.91801 55537 0.9840801198
Xo = 0.01304 67357 Xl = 0.0674683167 X. = 0.1602952159 X. = 0.28330 23029 X. = 0.42556 28305 Xi = 0.57443 71695 x, = 0.7166976971 X7 = 0.8397047841 X. = 0.93253 16833 x. = 0.9869532643
19
Gaussian coefficients
A, A7 A.
= = = = = = = = =
Ao A1
= 0.03333 56722 = 0.07472 56746
Ao A1 As
A. A. Ai
0.0406371942 0.09032 40803 0.1303053482 0.15617 35385 0.16511 96775 0.1561735385 0.1303053482 0.0903240803 0.0406371942
As = 0.1095431813
A. A. AI
A, A7 A. A,
= = = = = = =
0.1346333597 0.1477621124 0.1477621124 0.1346333597 0.1095431813 0.07472 56746 0.03333 56722
The Legendre polynomials can be used to extend some of the results of Section 3.1. We were then looking for a polynomial Pn(x) = ao + a1x + a2x 2 + ... + anxn which would minimize the integral Is
=
t
[f(x) - Pn(x)]2 dx,
II
where f(x) was a given function of x. It is more convenient to express Pn(x) not as a polynomial in x but as a polynomial of the form (7.10:15)
where the b's are constants and the P's are the Legendre polynomials. (It is a well-known theorem of algebra that any polynomial written in powers of x can be written in the form 7.10: 15; as a matter of fact, the theorem referred to is true if in the form 7.10:15 Pi(x) is any polynomial of degree i. The converse of this theorem is obviously true.) We drop the subscript S on Is and again suppose that a suitable transformation has been made so that the limits of integration become 0 and 1.
7.10. GAUSS' FORMULAS; ORTHOGONAL POLYNOMIALS
Our problem is then to determine the coefficients bo , bl 7.10: 15 so that
r
291 ,
bn in
(7.10:16) 1= [f(x) - Pn(x)]2 dx o IS a minimum. Necessary conditions for a minimum to exist are that i
(7.10:17)
=
0, 1, ... , n,
assuming that the partial derivatives are continuous. We have -2
Ibi =
= =
-2
-2
r o
Pi(x) [f(x) - Pn(x)] dx
[t
o
[f:
Pi(x)f(x) dx -
t
Pi(x)Pn(x) dX]
0
Pi(x)f(x) dx -
2i
~
1] .
The last reduction follows from properties band c of the Legendre polynomials. Hence the condition 7.10: 17 will hold if (7.10:18)
bi = (2i
+
1)
r
Pi(x)f(x) dx,
o
Furthermore, 2
01 = ob.Ob. ,
,
Ib;bj
=
! 2i
i = 0, 1, ... , n.
if i =1= j,
20
+1
if i =j.
It follows from theorems of advanced calculus that the values of the b/s given by 7.10:18 will make I given by 7.10.16 a minimum and not a maximum. The desired polynomial 7.10: 15 is thus given by (7.10:19)
Pn(x)
=
i
i-O
(2i
+
1) Pi(x)
t
Pi(x)f(x) dx.
0
We illustrate an application of the preceding discussion by reworking example 2 of Section 3.1, page 69. We make the transformation X = X/TT. The function f(x) then becomes sin TT X and we have
292
7. NUMERICAL DIFFERENTIATION AND INTEGRATION
We evaluate these integrals and find ho The required polynomial is then
~+ TT
= 2/TT, hi = 0, h2 = IO/TT -120/TT3 •
(10 _ 120) (1 _
6X
1TS
1T
+ 6X2)
which becomes after simplification and a return to the original variable x,
the same result as the one previously found. We do two additional examples as illustrations of the direct use of formula 7.10:2 and Table 7.IO:t2. EXAMPLE 2. Find the value of formula 7.10:2 for three points. We find (Table 7.IO:t2) X
o = 0.11270,
A o = 5/18,
Xl
flo sin x dx (exactly),
= 0.5
Al = 4/9,
by use of the Gaussian
X2
A2
= 0.88730, = 5/18.
Hence the integral is approximately equal to 158 sin 0.11270 + ; sin 0.5
+ 158 sin 0.88730 = 0.45970.
The answer is correct to five significant figures and can be readily checked by direct integration. EXAMPLE 3. Find the value of f~l eX dx by use of the Gaussian formula for four points. In order to use Table 7.IO:t2, we first make the transformation Z = (x + 1)/3 so that the required integral becomes 3fl e3Z - 1 dz. From o the table, Zo = 0.06943, A o = 0.17393,
= 0.33001, Z2 = 0.66999, Zs = 0.93057,
Zl
= 0.32607, A2 = 0.32607, As = 0.17393. Al
Consequently, the required integral is approximately equal to 3(0.17393e"·06943 + 0.32607eo.33001
+ 0.32607e"·66999 + 0.17393e"·93067) = 7.0212.
7.10. GAUSS' FORMULAS; ORTHOGONAL POLYNOMIALS
293
The answer is correct as far as it is written and it too can be readily checked by direct integration. EXERCISE 7.10
1. Rework Exercise 7.8. example 3. by the methods of this section making suitable choices for the number of points. 2. Evaluate J~3 ~ I + lOx' dx by Gauss' method using 6 points in the interval [ - 3. 9]; by using 3 points in each of the intervals [ - 3. 3]. [3. 9]. 3. Use the Legendre polynomials to find polynomials of the indicated max-degrees that will minimize the integrals
.. I: [Vx -
p,(X)]8 dx.
b.
(1
c.
[e" - p,(x)]' dx.
I:
[cos x - P.(x)]' dx.
4. If u, is given by 7.10:7. prove
~_u_/_ -t:k+i
(n: I) . k (k+n)
= (-I)"
n+1 5. If F(x) = (x - x o) (x - Xl) ••. (x - x ..). where the x/s are the zeros of the Legendre polynomial Pn+1(x). prove that the A's satisfying 7.10:4 are given by I A, = - - F'(Xi)
Xi
II 0
F(x) ----dx
x - x,
•
i
=
O. I ..... n.
6. If xo. Xl ..... xn are the zeros of the Legendre polynomial P n+1(x). prove that + x .._/ = 1.
7. If Ao. AI ..... An are the coefficients in 7.10:2 determined as in the text. prove Ai = A .._,.
Chapter B
The Numerical Solution of Ordinary Differential Equations
8.1. Statement of the Problem. It is well known that the mathematical formulation of a natural phenomenon frequently leads to an ordinary differential equation, that is, to an equation whose general form is (8.1:1)
F(x,y;y',y", "',y(n)
= 0,
where x and y are the variables and y', y", ... , y(n) are, respectively, the first, second, ... , nth derivatives of y with respect to x. The formulation of a natural law involving three or more causally related entities frequently leads to a partial differential equation, that is, to an equation involving the dependent variable y, two or more independent variables Xl , X z , •.• , and one or more of the partial derivatives of y with respect to one or several of the independent variables. We discuss only ordinary differential equations in this text. It is often more convenient and sometimes highly desirable to write the law expressed by 8.1: 1 in the form (8.1:2)
f(x,y)
= 0;
a form in which only the variables x and y and none of the derivatives are involved. This equation is said to be a solution of the ordinary differential equation 8.1: 1 if 8.1: 1 reduces to an identity when y', y", ... , y(n) are replaced by their values derived from 8.1 :2. This implies that if (xo , Yo) is any point whose coordinates satisfy 8.1:2 and if Yo', y~', ... , y~n) are the values of the successive derivatives evaluated (from 8.1:2) at this point, then xo , Yo , Yo', ... , y~n) will satisfy Eq. 8.1:1. A differential equation usually has infinitely many solutions; indeed, if the differential equation contains a derivative of the nth order but none of higher order, a solution will normally contain n arbitrary constants or parameters, say Cl , Cz , ... , Cn . A solution of the differential equation is usually then written in the more suggestive manner (8.1:3)
f(x,y;
Cl , Cz, ••• ,
294
cn)
= O.
295
8.1. STATEMENT OF THE PROBLEM
It is customary to call a solution in this form a general solution; a general solution of a differential equation thus represents not a single curve but an n-fold infinity of curves. If particular values are assigned to the parameters c1 , C2 , ••• , Cn , the resulting solution is called a particular solution. Thus, if C1 and C 2 are arbitrary constants, (8.1:4)
is a general solution of (8.1:5)
(x
+ l)y" + xy' -
y = 0,
and (8.1:6)
y = x,
y
= 2x - 3e-"',
are particular solutions. If the general solution 8.1:3 of a differential equation involves n arbitrary constants and particular values are assigned to m of them, where 0 < m < n, or if m parameters are replaced by combinations of the others, the resulting equation represents a particular (n - m)-fold family of solutions of the general solution. Thus, (8.1:7)
y
= 2x + c2e-"',
are particular one-parameter families of the general solution 8.1 :4. Particular solutions or particular families of solutions are usually determined by the imposition of so-called initial or boundary conditions. For example, if the condition is imposed that the solution have slope 0 when x = 0, the one-parameter family y = c1(x + e-X ) is determined in the above illustration. If the additional condition is imposed that x = 0, y = 2 satisfy the solution, the particular solution y = 2(x + e-X ) is determined. The methods of obtaining solutions, either general or particular, of differential equations are treated in the texts on that subject. Unfortunately, it is quickly apparent that the standard methods can be used to solve only a relatively small number of types of differential equations. As a consequence, if a given differential equation does not belong to one of these solvable types, the scientific worker must be satisfied with an approximate solution. These approximate solutions can be obtained in two ways. In the first place, we can modify the differential equation in such a manner that the new form is amenable to solution. For example, the equation (8.1:8)
d 28
.
I dt 2 = -g sm 8,
296
8. NUMERICAL SOLUTION ':>F ORDINARY DIFFERENTIAL EQUATIONS
where I and g are constants, is not easy to solve as it stands; if, however, the angle 8 is small, 8 and sin 8 are almost numerically equal and hence it seems reasonable to suppose that if this equation is replaced by tJ28 I dt Z
(8.1:9)
=
-g8,
a solution of the latter would not differ materially from a solution of the first. This equation has a general solution (8.1: 10)
8
=
C1
sin
~f t + Cz cos ~f t
which is readily obtained by standard procedures. (Incidentally, it folCows at once from this solution that the time of the complete swing of the pendulum is given by the familiar formula T = 2TTvl/g. This formula, of course, is subject to the error due to the replacement of 8.1:8 by 8.1:9.) This method of obtaining a solution is frequently employed but it is open to a most obvious objection. Even though we replace a factor or term in the given differential equation by another almost numerically equal, how can we be assured that the error in the solution will be small? Undoubtedly, one ought to know the magnitude of the error in the solution due to the modification of the differential equation. But this is, as a rule, not an easy matter to determine. Ordinarily, if a solution is obtained in this manner and if the results agree with experimental data, the solution is kept, right or wrong. It is, indeed, a useful and powerful method, but we shall not discuss it further for the subject properly belongs in the study of differential equations. The second general method of obtaining an approximate solution employs the given differential equation without modification. This time, we do not attempt to approximate a general solution (although some procedures do yield it), but we are content with approximating a particular solution. Ordinarily, the general solution is particularized in advance by specifying certain initial or boundary conditions. The examples will illustrate various methods of doing this. The second general method is itself subdivided into two submethods. In the first of these we seek a function (8.1:11)
a(x,y)
=0
which is an approximation to the particular solution; in the second, we desire not a function at all but merely the numerical values of (8.1:12)
Yl' Y2' Y3'···'
297
8.1. STATEMENT OF THE PROBLEM
corresponding to given numerical values (8.1:13)
such that the pairs (8.1:14)
satisfy (approximately) a preassigned particular solution. A solution of this type will be called a pointwise solution and will be referred to as such henceforth. The remainder of this chapter is devoted to the development and discussion of these approximation methods as they apply to a limited number of simple cases. Before we plunge into these arithmetic approximation methods, it might be well to consider briefly a graphic method which, although rough, is sometimes quite helpful and informative for differential equations of the form dy dx
(8.1:15)
= F(x,y).
If very good approximations are not necessary, the graph is frequently adequate and has the advantage of speed; if great precision is necessary, the graph can be used advantageously in conjunction with the later methods to throw light on the nature or behavior of the solution. The graphic methods utilizes the so-called lineal-element diagram. Let h be a small positive quantity; the points (8.1:16)
(ih,jh),
i,j
=
0,
± 1, ± 2, ± 3, "',
form a square lattice that covers the plane. The differential equation 8.1: 15 determines a slope at each lattice point for which F( ih, jh) exists. At each lattice point a small line segment, called a lineal element, of length approximately h and centered on the lattice point, is drawn with the determined slope. The totality of lineal elements is the lineal-element diagram. A curve whose equation is a solution of 8.1: 15 is tangent to the lineal elements of the lattice points whose coordinates satisfy the equation. Hence, if we start at any point and follow the slope lines, we can sketch a curve whose equation is a particular solution of the differential equation 8.1: 15. Figure 8.1:fl shows that portion of a lineal-element diagram within a 4 by 4 square centered on the origin with h = 0.2 determined by the
298
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
differential equation y' = x + y2. The particular curves passing through (0, I), (0, 0), (0, -I) are shown. The method is rough; but with care and experience, the graph of a solution can be drawn which, although inadequate by itself, does throw much light on the behavior of the required solution. y
""//~//IIII
_/
/////11
'"
/////111 ///1/1111 ///1111111 ///1111111 I I I I I I I , I I
11111111" '/1/111111 " I I I I I " I
FIG. 8.1 :fl.
The number of lineal elements that need be drawn can be greatly reduced if we want one or just a few particular solutions. For example, suppose we wanted only that particular solution of y' = x + y2 which passes through the origin. We calculate y" from the differential equation and find y" = I + 2xy + 2y 3. At the origin, y' = 0, y" = I. Hence the curve representing the sought solution is tangent to the x-axis at the origin and is there concave upward. We draw the lineal elements for x = 0.2 andy = 0, 0.1, 0.2; then for x = 0.4 andy = 0.1, 0.2, 0.3; and then sketch the portion of the curve from x = 0 to x = 0.4. With an eye on the part of the curve already drawn, and with an occasional assist from the second derivative, we draw lineal elements for x = 0.6, 0.8 and appropriate values of y. We continue to sketch the curve and draw additional lineal elements until we have as much of the curve as we want.
8.2. PICARD'S METHOD OF SUCCESSIVE APPROXIMATIONS
299
EXERCISE 8.1 1. Draw lineal-element diagrams for each of the differential equations in the neighborhood of the given point and sketch several of the particular solutions . •. y'=3x,
c. y' = e. y'
Xl -
y,
e-Z
= --, yl - 1
(-1,-1).
b.y'=x+y,
(0, 0).
d. y'
=
_x_ , y -1
(0,0). (0, 1).
(0,0).
2. Draw only as many lineal elements as needed to sketch the particular solutions determined by the given points. Where helpful, make use of the second derivative . •. y' = x + e- z ; (0,0), (5,0), (-5,0). b. y' = xy; (-1,0), (0,0), (1,0). c. y' = (sin x)/y; (0, I), (0,0.5), (0,0.1). 3. Superimpose on each of the five lineal-element diagrams of example 1 new linealelement diagrams such that the old and new lineal elements of a lattice point are perpendicular. Sketch, for each of the five parts, several curves determined by the new linealelement diagrams.
8.2. Picard's Method of Successive Approximations. The first method of getting an approximation to a particular solution of a differential equation that we consider is due to Emile Picard. We give it mainly for historic reasons since it is usually cumbersome and difficult of application in practice and is therefore infrequently used for computational purposes. However, its basic feature is the underlying concept in several of the methods to be discussed later. As the name implies, the method is an iterative one and is similar in spirit and application to the procedure described in Section 5.3 for the numerical solution of ordinary equations. Let
(8.2: 1)
7x = F(x,y)
be the differential equation to be solved. If F(x, y) is independent of y, the solution is y = fF(x) dx and the problem is trivial, at least from the point of view of differential equations. If the integral is not easy to compute, we always have recourse to the methods of the preceding chapter on numerical integration. We assume henceforth that y is present in F(x, y). Let the desired solution of the differential equation 8.2: 1 be of the form
(8.2:2)
y =f(x).
The differential equation can then be rewritten as
(8.2:3)
d~~) =
F(x,J(x»,
300
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
whence (8.2:4)
I F(x,J(x» dx.
y = f(x) =
This equation, of course, does not solve the problem since the unknown f(x) appears in the integrand j it is merely another form of 8.2: I, a form
which is more vulnerable to our present line of attack. (As an aside, we remark that Eq. 8.2:4 is a particular example of what is known as an integral equation j the study of integral equations is a separate and distinct branch of mathematics.) Rather than solve Eq. 8.2:4 in its generality, we will attempt to find a particular solution. Since the general solution will contain one arbitrary parameter, we are free to impose one condition if we wish to particularize the solution. A usual method of imposing a condition is to require that the curve representing the particular solution pass through a given point (xo , Yo). The condition implies that Yo = f(x o). Now, one simple way of writing this condition into the general equation 8.2:4 is to rewrite the latter as (8.2:5)
y
= Yo +
r
F(x,f(x» dx,
"'0
or (8.2:6)
y
= Yo +
r
F(x,y)dx.
"'0
It should be made quite clear that so far we have done nothing but toss the problem around. We now consider an iterative process which generates a sequence of functions
(8.2:7) which, under conditions to be stated later, will converge to the desired solution 8.2:6. We start with the approximation
and substitute this value for y in the right-hand member of 8.2:6 to obtain Yl = ft(x) = Yo
+
r...
F(x, Yo) dx .
8.2. PICARD'S METHOD OF SUCCESSIVE APPROXIMATIONS
301
Since the integrand is now a function of x only, the integration can be carried out, at least theoretically. We substitute Yl for Y in the righthand member of 8.2:6 to obtain Y2 = !2(X) = Yo
+
r r
F(x, Yl) dx.
"'0
We substitute Y2 for Y in the right-hand member of 8.2:6 to obtain Ya
= !a(x) = Yo
+
F(x, Y2) dx,
"'0
and so on. In general, the (n + I )st approximating function is obtained from the nth by the recursive formula
(8.2:8)
Yn
= !n(x) = Yo +
r
F(x, Yn-l) dx.
"'0
The iterative process yields in this manner a sequence of functions
8.2:7. It can be proved that if, the function F(x, y) is bounded in some suitable region about the point (xo , Yo), that is, if there exists a positive number L such that
IF(.'t,y) I
(8.2:9)
for all x's and y's in the region, and if there exists a positive constant K such that for any pair of points with the same abscissas (x, y), (x, ji), in this region the Lipschitz condition IF(x,y) -F(x,y) 1< K(y - y)
(8.2:10)
holds, then the sequence of functions 8.2:7 approaches a limit function y = f(x) which is a particular solution of 8.2: I that passes through (xo ,Yo), It is well to note that the Lipschitz condition 8.2: 10 must necessarily hold if F lI (x, y) exists in a neighborhood of (xo ,Yo), We illustrate Picard's method by several examples. EXAMPLE 1. Find the particular solution of y' = x + y2 which passes through the point (0, 1). It is readily verified that the conditions for a solution to exist hold. The first approximation is the ordinate of the given point, Yo = I, whence, from 8.2:8,
Yl
= 1+
(x + I) dx,
or
302
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
We substitute this second approximation into 8.2:8 and obtain
or -1 Y2 -
1
14 & + X + 23 x2 + 32._q x- + 4 x + 20 x .
Similarly, we find _ 1 3 2 Y3 +x+ 2 x
4 x3
+3
+
13 x4 12
49
&
+ 60 x +
13 6 30 x
+
233 7 1260 x
29
+ 480 x
8
31 9 + 1 10 + 1 11 + 2160 x 400 x 44OO x .
It is becoming clear that the sequence Yo , Yl , Y2, ... , is approaching a function whose Maclaurin expansion starts Y
=
1+
x + fx 2 +
t x3 + ....
EXAMPLE 2. Find the particular solution of Y' = sin x + y2 which passes through the point (0, 1). It is again easy to verify that the conditions for a solution to exist do hold. If we then start with Yo = 1, we obtain
Yl = 1 + Y2
= 1+
I:
[sin x
I:
(sin x
+ (2 + x -
+
1) dx
=
cos X)2] dx
2
=
+x4
cos x;
+ ! x + 2x2 + i
-4 sin x - 3 cos x
+ i sin 2x -
x3
2x sin x.
We decide to stop at this point because further approximations can be obtained only with great labor. The method does not seem advisable for this equation. EXAMPLE 3. Find the solution of Y' = x + Y - y2 if, when y' = -1, y" = -2. We find from the differential equation that y" = I + (1 - 2y)y'; and hence from the given initial conditions, x + y - y2 = -1, 2y = -2. We obtain by solving the last two equations, x = 1, y = -I. The desired particular solution must pass through the point (1, -1) and it is readily
8.l. POWER SERIES APPROXIMATIONS
lOl
ascertained that F(x, y) satisfies the conditions for a umque solution at this point. Starting this time with Yo = -I, we find
by repeated use of 8.2:8. We stop at this third approximation to the particular solution. Estimates of the error are not easy to obtain and we do not propose to make such determinations here, but the following considerations will throw some light on the material to follow. In the last example just above, let us take x = 1.1. By substituting this value for x in the third approximation we find the corresponding value of y to be -1.1098. The differential equation then yields the value -1.24 for the derivative at the new point. Using the value x = 1.1 in the derivative of the third approximation, we obtain the value -1.19, just a fair approximation. EXERCISE 8.l Find, by Picard's method, the indicated approximations with the given boundary conditions.
1. y' = x
2. y' 3. y' 4. y'
= = =
x
+ y, + y,
xy, ye- Z ,
5. y' =yl,
6. y' 7. y'
= =
fifth approximation at (0, 0). fifth approximation at (I, 2).
fourth approximation at (I, I). fourth approximation at (0, I). thirdapproximationat(I, -I).
2eO - y, 2eO - y,
third approximation if y' = 3 when x = O. third approximation if y' = y" = I.
8.3. Power Series Approximations. In this section we find a solution of (8.3: 1)
~ = y' = F(x,y)
of the form (8.3:2)
y =f(x),
304
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
this time by use of the assumption that the solution can be expressed as a power series (8.3:3)
Our problem is to evaluate the coefficients so that 8.3:3 satisfies 8.3: 1. We illustrate the method by reworking the examples of the preceding section. EXAMPLE 1. Find the solution of y' = x + y2 which passes through the point (0, 1). We assume the solution can be expressed as a power series
(8.3:4)
which converges in some interval about
Xo
= O. We have
(8.3:5)
and (8.3:6)
y2
=
ao2 + (aual
+ alaO) x + (aua2 + alal + a2aO) x 2 + ... + (aua.. + altln-l + .. , + tlnao) x" + ....
Therefore, al
+ 2a2x + ... + (n + I) tln+1x" + ... =
ao2 + (aual
+ alaO+ I) x + (aOa2 + alal + a~o) x2 + ... + (aua.. + ... + a..ao) x" + ... .
We equate the coefficients of like powers of x and obtain the following system of simultaneous equations:
+1 3a3 = 2aua2 + a l2
2a2 = 2aual
305
8.3. POWER SERIES APPROXIMATIONS
Consequently,
If we substitute these values for a l , a 2 , a3 , ••• , into the power series for y, we obtain a general solution of the differential equation. This might have been anticipated because we have made no use as yet of the point (0, 1) through which the graph of the solution must pass. If we do use this point, we find, since x = and y = ao = 1, that al = 1,
°
a2
= 3/2,
a3
= 4/3, y = I
a4
= 17/12, ali = 31/20, .... Consequently, 3
4
17
31
+ x + 2 x 2 + 3 xl + 12 x4 + 20 xli + ....
Compare the sequence of functions 8.2:7 with the sequence of partial sums of this power series. We can obtain the same result somewhat differently, and perhaps more briefly, if we recall that (8.3:7)
nla •
ft
= y(ft) = y(ft)(x0) = d".ltheft' (xo) 0
where, to repeat, dnf(xo)/dxn is the nth derivative of f(x) evaluated at Xo. By successive differentiation (with respect to x) of the given differential equation, y' = x + y2, we find
+ 2yy', y(3) = 2(yy" + y'2), y(4) = 2(yy(3) + 3y'y"), y(l) = 2(yy(4) + 4y'y(3) + 3y"2), y"
= I
.............. , .. , ........ .,
306
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
whence, at (0, 1), y' = 1 and y" = 3, y(3) = 8, y(4) = 34, y(li) = 186, .... Hence, ao = I, a l = I, a2 = 3/2, a3 = 4/3, a4 = 17/12, ali = 31/20, ... , as before. EXAMPLE 2. Find the solution of y' = sin x + y2 which passes through the point (0, 1). As before, we assume the solution can be written as the power series 8.3:4 so that 8.3:5 and 8.3:6 again hold. Since
sin x
x3
= x- -
3!
+ -xli5! + ... + (_I)n+1 (2nX2n- - 1I)! + ... '
we now have al
+ 2a~ + ... + (n + 1) xn + ... = + (aoa2 + alaI + a2aO) x 2
ao2 + (aoal
+ alaO+ 1) x
id
+ ala2 + a2al + aaao x3 + ............................. .
+ (aoaa
+ (aoa2n-1 + ala2n- 2 + ... + a2n- laO+ (~~ ~n~;!) X2n-1 + (aoazn
+ ala271- 1 + ... + a 271all) x2n
+ .... Therefore
+ alaO+ 1 3aa = aoaz + alaI + azao 4a, = aoaa + ala2 + a2al + aaao 2az = aoal
+ 1) a2n+1 =
(_I)R+I I)!
+ ala2n-2 + ... + a2n-lao + (2n _ aoa2n + a l a 2n- 1 + ... + a2..aO
2na211 = aOa2n-1 (2n
1 3!
Again ao = 1 so that a l ... , and
=
1, a 2 = 3/2, a3 = 4/3, a4 = 11/8, ali
3 2 4 11 23 6 Y= 1 +x+-x 2 +-x3+-x'+-x 3 8 15 + ... .
=
23/15,
l07
8.l. POWER SERIES APPROXIMATIONS
Alternately, we have from y' = sin x y"
+ y2,
= cos x + 2yy'
+ 2(yy" + y'2) y(') = -cos X + 2(yy(a) + 3y'y") y(l) = sin x + 2(yy(') + 4y'y'a) + 3y"2) yea) = _ sin x
Hence, at the point (0, 1), y' = 1, y" = 3, y(3) = 8, y(4) = 33, y(l) = 184, ... j and ao = 1, a l = 1, a 2 = 3/2, a3 = 4/3, a, = 11/8, a& = 23/15, ... , as before. 3.
EXAMPLE
y'
Find the solution of y'
=
x
+y
- y2, if y"
=
-2 when
= -1.
As before, we find that the given boundary conditions are equivalent to imposing the condition that the solution pass through the point (1, -1). This time we start with the power series 8.3:3 where Xo = 1, whence y2 = ao2
and
+ (aoal + alaO)(x - 1) + (aoa2 + alaI + a2aO)(x - 1)2 + ... + (aoa" + ala..-l + ... + a..ao)(x -
y'
=
al
+ 2a2(X -
1)
+ ... + (n + 1) a..+1(x -
I)"
I)"
+ ...,
+ ....
Substituting these values into the differential equation, we obtain al
+ 2a2(x -
+ ... + (n + 1) a"+1(x - I)" + ... = (1 + ao - ao2) + (1 + al - aoal - alaO)(x - 1) + (a 2 - aOa2 - alaI - a2aO)(x - 1)2 + (aa - aoaa - ala2 - a~l - aaao)(x - l)a + .... 1)
Hence
= 1 + ao - ao2 2a2 = 1 + al - aoal - alaO 3aa = a2 - aoa2 - alaI - a2aO 4a, = aa - aoaa - al a2 - a~l Sal = a, - aoa, - alaa - a~2 al
aaao aaal - a,ao
308
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
= -1, we have al = -1, = -49/30, ... ; whence
Since a o a5
Y = - [ 1 + (x-I)
Or, since y'
+
= x
(x-I)2
+y
a2
= -1,
= -4/3,
a4
= -3/2,
] +"34 (x-I)3 +"23 (x-I)4 + 49 30 (x-I)5 + ....
- y2,
y(3)
= I + y' - 2yy' = y" _ 2(yy" + y'2)
y(4)
= y(3) _ 2(yy(3)
y(5)
= y(4)
y"
a3
_
+ 3y'y") 2(yy(4) + 4y'y(3) + 3y"2)
............................ , '
whence, at (1, -1) and from the given differential equation, y' = -1, y" = -2, y(3) = -8, y(4) = -36, y(5) = -196, .... Hence, as before, ao =
-1, a l = -1, a 2 = -1, aa = -4/3, a4 = -3/2, a5 = -49/30,
It is again of interest to compare the values of y' of the last example computed directly from the differential equation and from the fifth degree approximating polynomial for x = 1.1. We find from the polynomial that the corresponding value of y is -1.11150; from the differential equation we find y' = -1.2469; from the polynomial, y' = -1.2468. There is much better agreement this time. The method of power series lends itself to the solution of differential equations involving second or higher derivatives. We illustrate by doing EXAMPLE
4.
Find the solution of Bessel's equation of order zero, X
tPy dx 2
dy
+ dx + xy =
0,
whose graph has the slope 2 at the point (1, 1). We assume the solution can be written in the form y
=
a o + al(x - 1)
+
a2(x - 1)2
+ '" +
fln(x - I)"
+ ....
We find y'
=
y" = I
+ ... + (n + I) fln+l(x - I)" + '" , . 2a2 + 2 . 3a3(x - I) + ... + (n + 1)(n + 2) fln+2(x al
+
2a2(x - I)
I)"
+ .. , .
309
8.3. POWER SERIES APPROXIMATIONS
Write the differential equation in the form (x - l)y"
+ y" + y' + (x -
l)y
+ y = 0,
and substitute the power series expressions for y, y', and y". We obtain (a o + Pal
+ 1 . 2a2) + (ao + a l + 22a2 + 2 . 3a3)(x - 1) + (al + a2 + 32a3 + 3 . 4a4)(x - 1)2 + (a 2 + a3 + 42a4 + 4· Sa6)(x - 1)3 + ............................... . + (tln-l + tln + (n + 1)2tln+l + (n + 1)(n + 2) tln+2)(x - I)" + ......................................... . = o.
[We assume further that all the algebraic operations performed on the power series are permissible, at least in some region about the point (I, 1).] The preceding equality yields ao + 12a l
+ 1 . 2a2 =
0
ao + a l al
+ 22a2 + 2 . 3a3 = 0 + a2 + 32a3 + 3 . 4a4 = 0
We obtain from these equations, since Yo =/(1) = ao = l,yo' =/,(1) = = 2, the values a 2 = -3/2, a3 = 1/2, a4 = -5/12, a6 = 23/60, .... Hence 3 1 5 23 y = 1 +2(x-l)--(x-l)2+-(x-l)3--(x-l)4+-(x-l)6+ ... 2 2 12 60 ' al
is the desired solution. The alternate solution is also applicable. Write the differential equation in the form xy" + y' + xy = O. We obtain by successive differentiation xy(3) + 2y" + xy' + y =0
+ 3y(3) + xy" + 2y' = 0 xy(6) + 4y(4) + xy(3) + 3y" = 0 xy(4)
Since x = y = I, y' = 2, we find y" = -3, y(S) = 3, y(4) = -10, yeo) = 46, .... These values yield the same values for ao , al , a 2 , as , '" , as before.
310
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
EXERCISE 8.3
1-7. Do examples 1-7 of Exercise 8.2 by use of power series. Where possible, find the general term of the series.
8. Use power series to approximate a solution of xly' terms to calculate y(1.5) correct to four decimal places.
=
y if y(l)
=
rl. Find enough
9. Find the first six terms of the power series solutions of a. y" = y if y = I, y' = 0 at x = O. b. y" = xy if y(O) = y'(O) = I. c. y" + xy' - 2y = 0 if y(l) = 0, y'(l) = 1. 10. Find the first six terms of the power series which are general solutions. Where possible, find a formula for the nth term of the general solution. = I + xy. + y' - xy = O. + xy' + y = O. y" + x'y' + xy = lx. (x - x')Y" + 3y' + 2y
a. y" b. y" c. y" d. e.
= O. 11. Find the first six terms of the power series solution of 2y l31 if, at x = I, we have y = 0, y' = -2, y" = 2.
-
9y"
+ lOy' -
12. Find the first five terms of the power series solution of y = y' = _y" = _y131 = I at x = 2.
y"l
3y = 0
= xy' if
8.4. Pointwise Methods; Introduction. The methods of the preceding two sections furnish us with powerful tools for the approximate solution of differential equations but in practice it is frequently sufficient to find a pointwise solution. To repeat our previous definition, a pointwise solution is a series of points (8.4:1)
where the abscissas (8.4:2)
are ordinarily given so that they satisfy the inequalities
and where the corresponding ordinates (8.4:3)
Yl' Y2' ...
are to be found such that each pair of coordinates satisfies a certain prescribed but not found particular solution of the differential equation. Of course, the ordinates Y1 , Y2' ... , could be calculated by substituting
311
8.4. POINTWISE METHODS; INTRODUCTION
in turn in a particular solution found by one of the preceding methods, but as a rule, the approximating function approximates the solution closely only in the immediate neighborhood of Xo . For greater precision it is better to find Yl , then to use it and the given Yo to find Y2 , then to use Y2 and one or both of the previous y's to find Ys , and so on. Since, in general, the ordinate Yn will be found by use of some or all of the previously found ordinates Yn-l , Yn-2, ... , the methods to be discussed in the remainder of this chapter are in a sense step-by-step processes in which a step is taken only after all previous steps have been carried out. For this reason these methods of solution are frequently referred to as step-by-step methods; we will, however, usually call them pointwise methods. Xl , X 2 , ••• ,
8.5. Pointwise Methods; Power Series. The first of the pointwise or step-by-step methods that we consider is merely a slight modification of the power series approximations of Section 3 of this chapter. As there, let
(8.5:1) be a solution of the differential equation
(8.5:2)
~ = Y' = F(x,y)
which is satisfied by the coordinates of the point (xo , Yo) so that ao = Yo . If all the nth order partial derivatives of F(x, y) exist and are continuous, l)st derivative and can then be the solution Y = f(x) possesses an (n certainly written in finite form as
+
(8.5:3) where the a's are given by 8.3:7 and where X is between polynomial
X
and
Xo •
The
(8.5:4) was used as the approximating function to the solution of the differential equation; the error term is
(8.5:5)
f(n+l'(X) n+l (n + 1)1 (x - xo) .
312
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
As a rule, this error term grows rapidly in magnitude as x departs from the present modification is designed to overcome this objectionable behavior by constantly shifting the abscissa (here xo) which is the center of expansion. Let the ordinates
Xo;
(8.5:6)
Y2' Y3'···'
Yl'
be desired for the corresponding abscissas
(8.5:7, where Xl < XI < X3 < ... , and where the pairs (Xl' Yl)' (XI' YI)' (X3 ,Ya), ... satisfy, within prescribed limits of error, the solution of the differential equation through the point (xo , Yo). We first put
(8.5:8) and then rewrite 8.5:4 as ' "
(8.5:9)
Once Yl has been calculated, and we then have
Yl', y~',
' "
(8.5:10)
(n)
Y1 =Y0 +l!Lh 11 1 +l!Lh2+···+~h" 21 1 nIl· ... , can be calculated from 8.5:2 (n)
YI =YI+Llh I ! 2 +Llhl+···+~h" 21 I nl I ·
We continue in this fashion and find, in the general case,
(8.5:11) In practice, the intervals Xl - XO ' XI - Xl , Xa - X 2 , ••• , are frequently equal to each other; it is then usual to designate anyone of them by the letter h without a subscript and we rewrite the preceding equation as
(8.5:12) We illustrate this method by EXAMPLE 1. Find, correct to five decimal places, the ordinates Yl , YI' ... , Y6 corresponding to the abscissas 0.1, 0.2, ... , 0.5 such that each point is on the curve which passes through (0, 1) and whose equation is a solution of the differential equation Y' = X + y l •
313
8.5. POINTWISE METHODS; POWER SERIES
If we let y
= f(x) be the equation of the required curve, we have y'
= x + y2
y"
=
1+ 2yy'
= 2(yy" + y'2) y(4) = 2(yy(3) + 3y'y") yeo) = 2(yy(4) + 4y'y(3) + 3y"2) y(6) = 2(yy(0) + 5y'y(4) + IOy"y(3» ym = 2(yy(6) + 6y'y(o) + 15y"y(4) + lOy(3)") y(3)
(8.5:13)
+ 7y'y(6) + 2Iy"y(0) + 35y(3)y'4» y(9) = 2(yy(8) + 8y'ym + 28y"y(6) + 56y(3)y(0) + 35y(4)") y(10) = 2(yy(9) + 9y'y(8) + 36y"ym + 84y(3)y(6) + 126y(4) yeo»~ yell) = 2(yy(10) + IOy'y(9) + 45y"y(8) + l20y(3) y(7) + 21Oy(4) y(6) + 126y(0)") y(12) = 2(yy(11) + lIy'y(1O) + 55y"y(9) + 165y(3) y(8) + 33Oy(4) ym + 462y(0) y(6». y(8)
= 2(yym
Since Xo = 0, Yo = 1, it follows that at this point, y'" = 3, y(3) = 8, = 34, yeo) = 186, y(8) = 1192, y(7) = 8956, y'8) = 77076; therefore, from 8.5: 12 (h = 0.1 and k = 0),
y(4)
Yl = I
+ 1(0.1) + ~ (0.1)2 + ; (0.1)3 +
g
(0.1)4
+ ;~ (0.1)0
+ 19~ (0.1)6 + ~~!~ (0.1)1 + ~!~~ (0.1)8 =
1.11649236,
with an error (which can be approximated by use of 8.5:5) of at most one or two units in the last decimal place. We now use the value of Yl just obtained and Xl = 0.1 to derive by use of 8.5:13 the values of Y1', y;', .... These values are given in the second row of the table below. The value of Y2 corresponding to X = 0.2 is then calculated from 8.5:12 where now k = 1; and so on. The necessary entries are shown in the following table.
314
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
x
yO
y'
y
1 0 1 0.1 1.11649236 1.34655519 0.2 1.27356426 1.82196592 0.3 1.48802214 2.51420989 0.4 1.78936 167 3.60181519 0.5 2.23453307 x
yl'J
0 0.1 0.2 0.3 0.4
yf8J
yl3J
y"J
8 34 3 4.0068372 12.6736279 60.449283 5.6407814 21.0069147 115.17118 8.4824000 37.8865006 240.71111 13.8899001 75.6542550 570.91877
yl7J
ylBJ
yl8J
186 1192 8956 77076 214 x 103 366.751 2640.54 22250.7 680 x loa 84 x lOS 790.457 6481.68 62107.4 1910.111 18163.93 201647.7 2558 x 103 365 X 10' 5380.677 60836 802649 1212 x 10' 205 x 10·
y"OJ
386
X lOB
We consider the magnitude of the errors in Yl • Y2 • .... Since Xo = O. Yo = I were exact values. the only error in Yl (aside from rounding off errors) is caused by the use of a polynomial of finite degree rather than an infinite power series for its determination. The error is given by 8.5:5 where. in this example. n = 8. The maximum value of J<9)(X) (between x = 0 and x = 0.1) is 1'9)(0.1) which is about 3 X 106 • The error is then approximately (3 X 106 )(0.1)9/9! which is less than 9 X 10-9 and is therefore certainly less than one unit in the eight decimal place. The error in Y2 (again aside from rounding off errors) has a twofold cause: as in the preceding step. Y2 may be in error because a finite series was used instead of an infinite series but unlike the preceding step. Y2 may be in error because the initial value Yl = 1.11649236 is approximate (the initial value Xl = 0.1 is. of course. exact). Now. we have previously seen that the differentials dy. dy'. dy" • .... are equal to the errors in Y. y'. y" • .... respectively. if we neglect infinitesimals of higher order. But from 8.5:13. (8.5:14) dy' = 1 + 2ydy dy"
= 2(y dy + y' dy)
dy (3)
=
2(y dy"
dyCk)
=
2
[(k -0
+ 2y' dy' + y" dy) 1) Y dyCk-U
+ (k -1 1) y' dy Ck-2) + ... + (okk -_
1) 1 yCk-U dy]
8.6. POINTWISE METHODS; THE RUNGE-KUTTA FORMULAS
315
Knowing the error dYl in Yl we can compute the errors in Yl', y{', y1 3 ), "', and then, from 8.5: 10, the resulting error in Y2 . It develops that this error is not more than one unit in the eighth decimal place of Y2 . Corresponding computations verify that the calculated values of Y3 , Y4' and Y5 are certainly correct to five decimal places. We remark again that because of the accumulation of errors in the progressive tabulations and calculations, it is necessary to start with at least eight decimal places to be assured of five place precision in Y5 . EXERCISE 8.5
Find, correct to the indicated number of decimal places, the values of y corresponding to the given values of x so that the points are on the integral curve of the differential equation which passes through the given point. [The notation x = a (h) b signifies the values of x ranging from x = a to x = b at intervals of h units; thus, x = 2.30 (0.05) 3.50 stands for x = 2.30, 2.35, 2.40, 2.45, ... , 3.45, 3.50.] 1. y' = x + y; 2. y' = x + y; 3.y'=y2+1; dy 4. -
5. 6.
7. 8. 9. 10.
=
dx y' = y' = y' = y' =
y 2 - -;
x
xy; xy; yr"; 1 + 0.0Ix2y; y' = 2eo - y; xy' = 1 + eO;
(1,3);
x = 0 (0.05) 0.5; x = 1 (0.1) 2; x = 1 (0.1) 2;
4 dp. 3 dp. 4 dp.
(1,3);
x = 1 (0.2) 3;
3 dp.
(I, I);
x x x x x x
(0,0); (1,2);
(1,2); (2, I); (2,2); (3,0); (1,0);
= = = = = =
1 (0.2) 3; 1 (0.2) 3; 2 (0.3) 5; 2 (0.2) 4; 3 (0.1) 4; 0.5 (0.1) 1.5;
3 dp. 3 dp. 3 dp. 3 dp. 3 dp. 3 dp.
8.6. Pointwise Methods; The Runge-Kutta Formulas. It is soon evident to anyone who attempts to carry out, either long hand or with the aid of a desk calculator, the necessary computations to find a numerical solution of a differential equation by the method of the preceding section that the labor is long and tedious. Various methods have been devised to lighten the labor but, usually, the advantage of lesser labor is offset by the concomitant disadvantage of lesser precision. One such method due to Runge is discussed in this section. As before, we seek a set of y's (8.6:1 )
corresponding to the set of x's (8.6:2)
316
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
such that the points (Xi' Yi)' i = I, 2, 3, ... , lie on the particular integral curve of the differential equation
~ = Y' = F(x, y)
(8.6:3)
passing through a given point (xo' Yo). The method of Runge has its genesis in the integration formulas of Gauss and involves the following ideas. Suppose YIII is known; we calculate four constants kl , k2 , k3 , k4 by use of formulas of the form kl = hF(xm ,Ym) k2 = hF(xm + PI ,Ym + ql) ks = hF(xm + P2 ,Ym + q2) k4 = hF(xm + Pa ,Ym + qa), where, as usual, h = XH1 - Xi; PI , P2' and P3 are constants to be determined, and qi is a certain linear combination of hI' ... , hi' i = I, 2, 3. A linear combination h of hI' h2 , h3 , and h4 is then calculated. The point of the method is to choose the various constants in such fashion that Ym + h is a good approximation to Ym+l . We do not propose to develop here the underlying theory; we merely cite two of the infinitely many possible sets of formulas:
(8.6:4)
(8.6:5)
(Runge's formulas)
kl = hF(xm ,Ym) k2 = hF(xm + th,Ym + tkl) ka = hF(xm + th,Ym + tk2) k4 = hF(xm + h, Ym + ka), k = i(k l + 2k2 + 2ka + k4);
(Kutta's formulas)
kl = hF(xm ,Ym) k2 = hF(xm + 1- h, Ym + -l kl ) ka = hF(xm + -ih,Ym - ikl + k 2) k4 = hF(xm + h,Ym + kl - k2 + ka), k = i(kl + 3k2 + 3ka + k4).
We use a set of formulas by starting with the given point (xo ,Yo) so that = 0, calculate YI , then use the formulas for m = I to calculate Y2 , and so on. To illustrate the use of these formulas, we do again the m
EXAMPLE. Find the values of Y corresponding to the values 0.1, 0.2, ... , 0.5 of X which form a pointwise solution of Y' = X + y2 with the initial condition Y = I when x = The work, using Runge's formulas, is conveniently arranged as in the table below.
o.
8.6. POINTWISE METHODS; THE RUNGE-KUTTA FORMULAS
Xo Xo +!h Xo Xo
F(x,y)
y
x
+ !h +h
hF(x,y)
F(xo, Yo)
Yo
+ !hl Yo + !h2 Yo + ha Yo
317
+ !h, Yo + !hl) F(xo + !h, Yo + !h2) F(xo + h, Yo + ha)
F(xo
+ h,) + ha
hi h2
~(hl
ha h,
3h = sum h = Jsum
h2
The numbers in the first column are entered since all are known; also the next two entries in the first row. The value of hl is found from 8.6:4 and the next two numbers are entered in the second row. The value of h z is found and the next two numbers entered in the third row. Then ha and the next two numbers in the last row are entered. The h./s are entered in the fourth column and then h is found as indicated in the last column. The "sum" refers to the sum of the two entries above. The value of Yl is Yo h; the table is then continued by the same procedure until the value of the last Y is found. The entries for this example are:
+
x
y
x
+yl
h(x
+ y2)
0.1 0.11525
0.11736848 0.23210706
0 0.05
I
I
1.05
1.1525
0.05 0.1
1.057625 1.1685706 0.11685706 0.34947554 1.11685706 1.3473697 0.13473697 0.11649185
0.1 0.15
1.11649185 1.18381 956
1.3465541 0.13465541 0.15849050 1.5514288 0.15514288 0.31272 159
0.15 0.2
1.19406 329 1.27407056
1.5757871 0.15757871 0.47121209 1.8232558 0.18232558 0.15707070
0.2 0.25
1.27356255 1.8219616 0.18219616 0.21692072 1.36466063 2.1122986 0.21122986 0.42644 291
0.25 0.3
1.37917748 2.1521305 0.21521305 1.48877560 2.5164528 0.25164 528
0.3 0.35
1.48801 709 2.5141949 0.25141949 0.30601787 1.61372 684 2.9541143 0.29541 143 0.59797034
0.35 0.4
1.63572 281 3.0255891 0.30255891 0.90398821 1.79057600 3.6061624 0.36061624 0.30132940
0.4 0.45
1.78934649 3.6017609 0.36017609 0.45522086 1.96943453 4.3286724 0.43286724 0.88018262
0.45 0.5
2.00578011 2.23666187
0.5
2.23448098
4.4731538 0.44731538 5.5026563 0.55026563
0.64336363 0.21445454
1.33540348 0.44513449
318
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
The table for the solution by use of Kutta's formulas is similar:
x Xo Xo +
lh ih
y
F(x, y)
hF(x,y)
Yo Yo + !hl
F(xo, Yo) F(xo + lh, Yo + Ihl)
Yo -lhl + h. F(xo + ih, Yo - lhl + h.) yo+hl-hl+ha F(xo+h, yo+h l - h.+h a)
Xo + Xo + h
hi + h, 3(h. + ha)
hi h. ha h,
sum
h =
In detail:
+ y'
y
0 0.03333333
I 1.03333333
I 1.10111 II
0.06666667 0.1
1.07677778 1.11250060
1.22611 71 0.12261171 0.93193422 1.3376576 0.13376576 0.11649 178
0.1 0.13333333
1.11649 178 1.16137691
1.3465539 0.13465539 0.31553845 1.4821297 0.14821297 0.94102689
0.16666667 0.2
1.21981962 1.26839686
1.6546266 0.16546266 1.25656534 1.8088306 0.18088306 0.15707067
0.2 0.23333333
1.27356245 1.8219613 0.18219613 1.33429449 2.0136751 0.20136751
0.26666667 0.3
1.41419792 2.2666224 0.22666224 1.71563727 1.48105 331 2.4935189 0.24935189 0.31445466
0.3 0.33333333
1.48801 711 1.57182361
0.36666667 0.4
1.68460 689 3.2045670 0.32045670 2.41063939 1.77949702 3.56660 96 0.35666096 0.30132 992
0.4 0.43333333
1.78934703 3.6017628 0.36017628 0.90290596 1.90940579 4.0791638 0.40791638 2.65818288
0.46666667 2.07720465 0.5 2.21975151 0.5
2.23448314
x
h(x
+ yl)
x
0.1 0.11011 III
0.23376576 0.69816846
0.43154802 1.28408925
2.5141949 0.25141949 0.60808045 2.8039628 0.28039628 1.80255894
4.7814458 0.47814458 3.56108884 5.4272968 0.54272 968 0.44513 611
I (sum)
8.7. POINTWISE METHODS; FINITE DIFFERENCES
319
We note that the two values obtained for Y5 differ by about 2 units in the sixth decimal place. It is then natural to inquire into the errors inherent in the Runge-Kutta formulas or in similar formulas; however, since the formulas were not derived here, it is not possible to give a detailed discussion of the magnitude of the error. The end result is this: if YmH is obtained in two steps from Ym and Ym+l by means of Runge's, Kutta's, or similar formulas, and if y!aH is obtained from Ym in one step, that is, by use of an interval of width 2h, then the value of Ym+2 will usually be improved by adding to it the quantity (8.6:6)
One-half of this quantity can be added to Ym+l to improve its value. We illustrate the use of the correcting term by doing the previous example over again. The entries in the first eight rows of the main table below are copied from the table previously obtained (Runge's method). We then compute the first four rows of the auxiliary table using the double interval 2h = 0.2. The value of Y2 = 1.27356 255 which was previously found is then improved by adding to it the correcting term 1 1 15 (Y2 - Y2*) = 15 (1.27356 255 - 1.27353566) = 0.00000 179.
The corrected value of Y2 , namely 1.27356 434, is used in the next part of the main table and the work is continued as before. Compare the values obtained here with the values obtained in the previous section. EXERCISE 8.6 Redo the examples of Exercise 8.5 using the Runge and Kutta formulas.
8.7. Pointwise Methods; Finite Differences. Finite differences can be used in a variety of ways to calculate the ordinates Yl , Y2' "', of a pointwise solution with initial values x = Xo , Y = Yo of the differential equation (8.7:1 )
1x = Y' = F(x, y).
We discuss several such methods in this section.
320
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS MAIN TABLE
X
X
Y
+ y2
h(x
+ y2)
0 0.05
I
I
1.05
1.1525
0.1 0.11525
0.11736848 0.23210706
0.05 0.1
1.057625 1.11685706
1.1685706 1.3473697
0.11685706 0.13473697
0.34947554 0.11649185
0.1 0.15
1.11649 185 1.18381956
1.3465541 1.5514288
0.13465541 0.15514288
0.15849050 0.31272 159
0.15 0.2
1.19406 329 1.27407056
1.5757871 1.8232558
0.15757871 0.18232558
0.47121209 0.15707070
0.2
1.27356255 0.00000 179 (correcting term)
0.2 0.25
1.27356434 1.36466265
1.8219661 2.1123041
0.18219661 0.21123041
0.21692130 0.42644403
0.25 0.3
1.37917955 1.48877 796
2.1521362 2.5164598
0.21521362 0.25164 598
0.64336533 0.21445511
0.3 0.35
1.48801945 1.61372 954
2.5142019 2.9541230
0.25142019 0.29541230
0.30601880 0.59797212
0.35 0.4
1.63572 560 1.79057927
3.0255982 3.6061741
0.30255982 0.36061741
0.90399092 0.30133031
0.4
1.78934976 0.00001 155 (correcting term)
0.4 0.45
1.78936131 1.96945201
3.6018139 4.3287412
0.36018139 0.43287412
0.45522847 0.88019683
0.45 0.5
2.00579837 2.23668402
4.4732271 5.5027554
0.44732271 0.55027554
1.33542530 0.44514177
0.5
2.23450308 AUXILIARY TABLE
0 0.1
I
I
1.1
1.31
0.2 0.262
0.28277 478 0.53783220
0.1 0.2
1.131 1.2758322
1.37916 10 1.8277478
0.27583220 0.36554956
0.82060 698 0.27353566
0.2
1.27353566
0.2 0.3
1.27356434 1.45576095
1.8219661 2.4192399
0.36439322 0.48384798
0.54364 756 1.00318896
0.3 0.4
1.51548833 1.79290532
2.5967049 3.6145095
0.51934098 0.72290190
1.54683652 0.51561 217
0.4
1.78917651
8.7. POINTWISE METHODS; FINITE DIFFERENCES
321
If we substitute X1l for Xo and Y1I for Yo in formula 8.2:6, we obtain the equality valid formula (8.7:2)
Y
= Y1I +
r"'"
Yn+k
= Y.. +
f
whence
(8.7:3)
F(x,y) dx,
"'''+k
F(x,y) dx.
"'" The ordinate Yo was given; let the ordinates Y1 , Y2 , ..• , Y1I be computed by means of infinite series or any other of the previous methods. We then determine
(8.7:4)
i = 0, I, ... , n,
by substituting the given x's and the computed y's into Eq. 8.7:1. The basic feature of the methods of this section is the use of these F's and one or more suitably chosen formulas of Table 7.7:tl or 7.7:t2 to evaluate the integral on the right-hand side of 8.7:3 to determine Yn+k. Thus, one of the formulas of Table 7.7:tl is
whence, by 7.7:13, 7.7:14 and an interchange of limits,
If we add n to all subscripts and replace Y by F, we obtain
(8.7:5) Equation 8.7:3 can now be rewritten as (note that k
= 1)
or
(8.7:6) The last equation expresses the ordinate Y1I+1 in terms of the preceding ordinate Y1I' h, and previously found F's and their differences.
322
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
This method of obtaining a point-wise solution by means of formula 8.7:6 is due to J. C. Adams. We illustrate the method by finding a pointwise solution of the previously solved equation y' = x + y2, given the initial point (0, 1) and h = 0.01. We prepare a number of columns in which we will write the entries x, y, hF, .c1(hF), .c1 2(hF), .... See the table on below. We x
y
hF
0
1.00000 0000
0.01000 00000
0.01
1.01015 1348
0.0103040575
iJ(hF)
iJ2(hF)
iJ8(hF) iJ'(hF) iJ6(hF)
3040575 83511 3124086 0.02
1.02061 0898
0.01061 64661
3695 87206
32 11292 0.03
1.031387186
0.01093 75953
0.04
1.042489125
0.0112678358
212
91113 3302405
225 19
4132 95245
3397650
13
3907
244
_-----13
4376 99621 __ ----- 257 3497271 __ ----- 4633 0.06 1.065707647 0.0119573279 _ - - - 104254 ---.:...----------------1601525 0.07 1.077844163 0.01231 74804 296 3710690 5207 0.08 1.090346247 0.0126885494 114372 321 3825062 5528 0.09 1.103225074 0.01307 10556 338 119900 3944962 5866 0.10 1.116492354 0.0134655518 370 125766 4070728 6236 0.11 1.130160369 0.0138726246 132002 394 4202730 6630 0.12 1.144242003 0.0142928976 138632 424 4341362 7054 0.13 1.15875 0785 0.01472 70338 145686 459 44 87048 7513 0.14 1.17370 0926 492 0.0151757386 153199 4640247 8005 0.15 1.18910 7368 0.01563 97633 532 161204 4801451 8537 0.16 1.20498 5826 169741 578 0.01611 99084 4971192 9115 0.17 1.221352842 0.01661 70276 617 178856 5150048 9732 0.18 1.23822 5842 0.0171320324 188588 5338636 0.19 1.255623193 0.01766 58960 0.20 1.273564266 0.05
1.05392 6032
0.01160 76008
18 25 17 32 24 30 35 33 40 46 39
323
8.7. POINTWISE METHODS; FINITE DIFFERENCES
enter the values of x in the first column, that is, the numbers 0, 0.0 I, 0.02, 0.03, ... , and then the other two entries in the first row. We compute the value (1.01015 1348) of y corresponding to the value 0.01 of x by infinite series or some other one of the previous methods and then the corresponding value (0.01030 40575) of hF which is found from the differential equation. These values are written in their proper places in the second row and the first first-order finite difference LJ(hF) is computed and entered. We next compute, again by some previous method, the value of y corresponding to x = 0.02, the corresponding hF, and then the second first-order finite difference and the first second-order finite difference. We continue in this fashion and obtain after seven steps that portion of the table above the dotted line. When we compute the next y, that is, the one corresponding to x = 0.07, and then the corresponding values of hF, LJ(hF), ... , we note the oscillations in the columns for LJ5(hF) and LJ6(hF) (the latter column is not included in the table). We infer that the errors due to polynomial approximation and rounding-off have finally caught up to us and hence we decide to disregard the column of sixth differences. (We repeat that the number of the column in which oscillations due to polynomial approximation and rounding-off first appears is dependent on the nature of the functions involved and the number of decimal places used.) Further y's are now computed by means offormula 8.7:6 whose righthand member terminates in this example with the term (95/288)LJ5(hF). Thus, the y for x = 0.08 is computed by use of the formula from the y for x = 0.07 and from the entries in the lowermost diagonal of the difference table already formed, that is, from the entries between the dotted and solid lines of the table. After Ys (= 1.09034 6247) has been found, the corresponding hF is found from the differential equation and another diagonal is added to the difference table. Further y's are computed in a similar fashion to obtain the remainder of the table. Formulas similar to 8.7:6 can be derived from Tables 7.7:tl,2 for the evaluation of the integral in 8.7:3 for successive values of k. Indeed, if
r-
k
y dx = h( -CoYo
+c
1
.1Yo - C2 .170
± ... )
"'0
is a typical formula of one of the tables, then by 7.7:15,
is also a true formula.
324
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
Hence
Now, if we raise all subscripts by n
+ k,
replace Y by F, and write
tJi(hF) for htJiF, we obtain
(8.7:7) This formula gives us the value of the integral in 8.7:3 and enables us to calculate Yn+k in terms of the ordinate Yn and the F's and their differences evaluated at (xn , Yn), (x n- 1 , Yn-l), (x n- 2 ,Yn-2)' .... Note that formula 8.7:7 can be obtained directly from Table 7.7:tl if all minus signs in the table are changed to plus signs and tJiyo is replaced by tJi(hFn-.J
To illustrate the use of formula 8.7:7, suppose that in the example worked out above the values of Y for x = 0, 0.01, 0.02, ... , 0.10 have been found and that the F's and their differences have been computed. We can find Y20' the value of Y corresponding to x = 0.20, by taking n = k = 10 in 8.7:7. We have Y20 = YIO
+ 1O(hFlo) + 50 tJ(hFe) + 5~5 tJ2(hFs) + 600 tJ3(hF7)
tJ4(hF ) 70805 tJ5(hF ) + 2922~ 18 8 + 18 5
= 1.116492354 + [10(134655518) + 50(3944962) + 5~5 (119900)
+ 600(5528) + 29225 (321) + 70805 (25)] 18
18
10-10
= 1.27356 4397. This value is close to the value 1.27356 4266 previously obtained. The discrepancy is caused mainly by the piling up of rounding-off errors. Various formulas of Tables 7.7:tl,2 can be combined to yield additional formulas of type 8.7:7 for the evaluation of the integral in 8.7:3. For example, we have from the Table 7.7:tl
325
8.7. POINTWISE METHODS; FINITE DIFFERENCES
whence
f
"l
1 Ll2Y_l - 24 1 LlaY_2 = h( Yl -I:2 Llyo - 12
Y dx
)
••• ,
"0
or, adding n to all subscripts and replacing Y by F,
f.....
n+1
1
1
"2 LI(hFn) - nLl2(hFn_l) -
F dx = hFn+1 -
1 24 Ll3(hFn_2) - ....
Rewrite 8.7:5 and add unity to the subscripts:
r.
t2Fdx = hFn+1
+ ~LI(hF7I) + I;Ll2(hFn_1) + ~Lla(hFn_2) + ....
:1:,,+1
Now add the last two equalities to obtain
r.
t2
....
F dx
=
2hFn+1
+ iLl2(hFn_1) + j Lla(hFn_2) + ~~ Ll4(hFn_a)
+ !~ LlS(hFn_4) + ~~~~ Ll8(hFn_ + ... , li )
which can be rewritten as
(8.7:8)
rnt'.... F
dx
=
2hFn+1 -
+ j [Ll2(hFn_1) + Ll3(hFn_2) + Ll4(hFn_a) + LlS(hl',._4)] ~ [Ll4(hFn_a) + 2 LlS(hF7I -4)]
1139 8 - 3780 LI (hFn_li )
+ ....
If the sixth and higher order differences are negligible, the preceding formula is particularly convenient for the evaluation of F dx because of the simplicity of the coefficients. The formula was employed in this form by Nystrom. The methods of obtaining a pointwise solution of 8.7:1 discussed so far in this section do not permit a simple estimation of the error at each step. We then modify these methods to overcome this deficiency. As before, suppose that by some means or other the values of a pointwise solution (xo, Yo), (Xl' YI), ... , (x n , Yn) and the corresponding
f;:+2
326
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
values Fo = F(xo, Yo), ... , Fn = F(xn ,Yn) have already been found. We had previously obtained the formula (8.7:9) F dx = hFn+1 - i.:j(hFn) - 112 .:j2(hFn_1) - i4.:j3(hFn- 2) - ....
r"+l "'"
Equation 8.7:3 can then be written as (8.7:10) Yn+1 = Yn
+ hFn+1 -
1 1 1 2:.:j(hFn) - 12.:j2(hFn- 1) - 24.:j3(hFn- 2) - ....
If we now estimate a value for F n+1 (see the remark below), all the terms of the right-hand member of the last equality can be calculated and hence a value of Yn+1 based on the estimated value of Fn+l is determined. This tentative value of Yn+1 and the known xn+1 are substituted into the differential equation 8.7: 1 to obtain a second estimate for Fn +1. This second estimate and its differences are substituted into 8.7:10 to yield a second estimate for Yn+1 which in turn is substituted into the differential equation to yield a third estimate for F n +1. The process is kept up until there is no change in Fn+1 and the corresponding Yn+1 . The successive ordinates are found in the same manner. The method just described is analogous to the method of iteration used to find the roots of algebraic and transcendental equations considered in Chapter 5. We discuss this somewhat more fully later. We illustrate the method by an example and postpone for a moment the question of the convergence of the process. However, we first remark that a very convenient way of obtaining a good estimate for Fn+1 is to work backwards on the difference table of the F's. We assume the next entry in the last column of the difference table and by additions work backward to .d 2(hFn_1 ), .d(hFn), hFn+1 . This method has the advantage of yielding all the terms necessary for the evaluation of the right-hand member of 8.7:10. Thus, in the example worked out previously, suppose that we have progressed so far as the entry YIO = 1.116492354. The corresponding F and all the differences of the F's have been computed; we wish to compute Yu. The last entry in the last column is .d5(hF5) = 25 X 10-10 ; we guess the next entry .d 5(hFs) to be 20 X 10-10 (in place of the 17 X 10- 10 which is actually there). Five additions yield .:j4(hF7) 341 X 10-10 .:j3(hFs) 5869 X 10-10 .:j2(hFe) 125769 X 10-10 .:j(hF10) 4070731 X 10-10 hFll = 138726249 X 10-10 •
327
8.7. POINTWISE METHODS; FINITE DIFFERENCES
By substituting these values in 8.7:10, we obtain Y11 = 1.13016 0369. If we substitute this value and X11 = 0.11 into the differential equation, we obtain F11 = 1.38726 246. Further substitution does not change the value of Y11 , hence the above value is taken for Y11 . We do another example by this method by finding to four decimal places the values of Y corresponding to the values x = 0.1, 0.2, 0.3, "', which are determined by the integral curve of y' = Y - x + 1 which passes through (0, I). We find the values of Yl ,Y2 , ... by anyone of the previous methods. As each new Y is found, the corresponding F is found and the difference table of the F's is extended. When we reach Y5' the column of third differences begins to oscillate; we therefore stop at this point. See the table below. To determine Ye , we assume the tentative value tJ3(hF3} = 12 X 10-5 , a value suggested by the entries in the third difference column. We find tJ2(hF4 } = 162x 10-5, tJ(hF5} = 1731 X 10-5 , hFe = 28218 X 10-5 • From 8.7:10, Y8
=
2.1487
+ 0.28218 - 2"1 (0.01731) -121 (0.00162) - 241 (0.00012) =
2.4221.
Substituting this value and Xe = 0.6 into the differential equation, we find Fe = 2.8221, whence hFe = 0.28221, tJ(hF5} = 0.01734, tJ2(hF4 } = 0.00165, tJ3(hF3} = 0.00015. Using these new values in 8.7:10, we find again Ye = 2.4221. We accept this value for Ye, use the last Fe found and its differences and go on to calculate Y7 'Y8 , ... in the same manner. x
y
hF
iJ(hF)
iJ2(hF)
iJ3(hF)
0.20000
0
1052 0.1
1.2052
110
0.21052
13
1162 0.2
1.4214
0.22214
0.3
1.6499
0.23499
0.4
1.8918
0.24918
0.5
2.1487
0.26487
123 II
1285 134
16
1419 150 1569
Suppose we had made a start with the obviously bad choice of tJ3(hF3} = 0; then tJ2(hF4 } = 150 X 10-5 , tJ(hF5} = 1719 X 10-5 , hFe = 28206 X 10-5 • From 8.7:10, Ye = 2.4220. Substitution into the differential equation yields Fe = 2.8220. This new value of F produces the Y obtained before.
328
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
It remains to discuss the convergence of this process. We do this now, using the equation Y' = x + y2 as an illustration. Suppose that all the entries in the table for the first example have been found except Y20 j we wish to use formula 8.7: 10 to compute this last entry. Recall that we estimate F 20 and then from it and the lowermost diagonal of the table determine the values of hF20 , LJ(hF19 ), LJ2(hF1S )' LJ3(hFu), LJ4(hF16 ) and LJS(hF1S ). We substitute these values into 8.7:10 to determine an approximate value for Y20. This value and X 20 = 0.20 are substituted into the differential equation to obtain a new estimate for F 20 . This new estimate is used as the first F 20 was to obtain a new Y20 . The process is repeated until there is no change in Y20 and the last value is kept. We want to know if such a happy ending will actually happen. Since we are interested here only in the convergence of this process, we assume for the purposes of this discussion that the entries in the last row and diagonal are exact and that the differences of orders higher than five are all zero (or, what is essentially the same thing, that they are so small that they cannot affect the last decimal place retained in Y20). Furthermore, we pay no attention to computational or rounding-off errors. Let us now suppose that e is the error in the estimate for F 20 , that is, e is the difference between the true value and the assumed value. Then he is not only the error in hF20 but because of the method of formation of the difference table it is also the error in LJ(hF19) and in each of the subsequent differences. It follows from 8.7:10 that the error in Y20 is
3) = 288 95 he,
1 1 1 19 ( he 1 - "2 - 12 - 24 - 720 - 160
or approximately, (8.7:11)
e'
=
i-he.
Now if Y20 is in error by this amount, we find by substitution into the differential equation (remember that X 20 is exact) that Y' or the new F 20 is in error by the amount (Y20
+ e')2 -
Y:o =
i hey + i- h2e2 .
Assume e is positive (and note that Y20 is approximately 1.3) j then in order for the error in the new F 20 to be smaller than the error in the originally estimated F 20 we must have (8.7:12)
whence, using h = 0.01 and the overestimate Y = 1.3, e < 89220. If e is negative, it turns out that if e > -90780, then the absolute value of
329
8.7. POINTWISE METHODS; FINITE DIFFERENCES
the error in the new F 20 will be smaller than the absolute value of the error in the original F 20 • In other words, if the error e in the original F 20 satisfies the inequalities (8.7:13)
-90780
< e < 89220,
then the new F 20 will be a better approximation than the original F20! Since an inspection of the table assures us that the value of F 20 is most certainly within one-tenth of 1.8, we have here a most unusual latitude for the error. Just a minor word of caution. We have shown that if e satisfies the inequalities 8.7: 13, then the succeeding approximations for F 20 and hence (by 8.7: II) those for Y2U will be better and better. It does not follow that the error can be made to approach zero. But this desideratum can be attained if we replace the right-hand member of 8.7:12 by ke, where k is a proper fraction. For k = t, we have -45780 < e < 44220, still plenty of latitude. What we have seen to hold for the particular value Y20 for the particular differential equation above holds true in general. When we seek to determine the value of Yn+1 corresponding to a value x n+1 to satisfy a differential equation of the type 8.7:1 by use of formula 8.7:10, we find that it is sufficient to estimate the first Fn+1 to within an amount e which satisfies a pair of inequalities of the form (8.7:14)
-u
< e < fJ
(u,
fJ
> 0).
The values of u and fJ depend on the differential equation, the values of Y and h, and the number of differences in the right-hand member of 8.7:10. Although the values of u and fJ can be calculated for different examples by methods similar to those used above, it is rarely necessary to do so to ensure convergence because of the usual extreme latitudes. Of course, the better the estimate the more rapid the convergence and in any case it would soon be evident if the successive approximations for a Y did not converge. We repeat that the entire preceding discussion of convergence was based on the assumption that the only error influencing the value of Yn+1 was the error in the estimate of Fn+1 . It must be remembered that other errors due to rounding-off, neglect of higher order differences, and so on, will creep in. It is therefore advisable to use several decimal places more in the computations than are wanted in the final results. The reader should also note the discussion in the next section. The preceding methods can be combined to yield a rapidly convergent and self-checking pointwise solution. After Yo, ... , Yn' Fo , ... , Fn and their differences have been computed, the value of Yn+1 is computed
330
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
from 8.7:6 or a similar formula. Instead of accepting this value of Y immediately as we did before, we now substitute it and x n+1 into the differential equation to determine F n+1' The differences LJ(hFn)' LJ2(hFn_l ), ... , are then computed and substituted into 8.7: 10 to recompute Yn+1 . This process is continued until there is no further change in the value of Yn+l . EXERCISE 8.7
Do the following examples by the methods of this section. 1-10. Rework the examples of Exercise 8.5.
11. y' = 311" - 2y; (0, -4); x = 0 (0.2) 2; 12. y' = x + y2; (0,0); X = 0 (0.1) I; 13. y' = x + y2; (3,2); x = 3 (0.02) 3.3; 14. y'
=
y2 _
~
)+x
2
15. y' = -y - e"-2y2;
_
2x . (_I I)' x (I + X I )2' " (I, e); x = I (0.3) 4;
3 dp. 4 dp. 3 dp.
=
-I (0.2) ).,
3 dp.
4 dp.
8.8. Pointwise Methods; Iteration Using Ordinates. All of the formulas of the preceding section involving finite differences have their counterparts in formulas involving ordinates. It is only necessary to replace the finite differences by their values in terms of ordinates; these values are given by the identities 3.7: 13. Instead of doing this, however, we develop in this section a method based on the suggestion contained in the last paragraph of the preceding section. We describe a method of finding a pointwise solution of the differential equation (8.8:1)
~ = y' = F(x,y)
with initial conditions Y = Yo when x = Xo whose underlying feature is the use of a pair of formulas, one to "predict" a value for Yn+1 , the other to "correct" that value. We plunge immediately into the details. The values Yl , Y2' ... , Yn corresponding to the values Xl , X 2 , ... , Xn are found by anyone of the previous methods; the value of n itself will soon appear. We then obtain from Table 7.8:tl a formula which gives Yn+1 in terms of Yn , Yn-l , Yn-2 , ... , and y,,', Y~-l , Y~-2 , .... This formula will be known as a predicting or an advancing formula. We substitute this tentative value of Yn+1 into the differential equation 8.8: 1 to find the value of the corresponding Y~+1 . From Table 7.8:t 1 we obtain another formula known as the correcting formula which gives Yn+1 in terms of Y~+1 and the preceding ordinates and derivatives. We substitute the value of Y~+1 just found together with the necessary earlier found
8.8. POINTWISE METHODS; ITERATION USING ORDINATES
331
ordinates and derivatives to find a corrected value of Yn+l . This value is substituted into the differential equation to obtain a new value for Y~+l . The correcting formula is again used and the process is repeated over and over until there is no further change in Yn+l . We proceed in the same manner to find Yn+2 , Yn+3' ... We list three advancing formulas and their associated correctors:
(8.8:2) A: Yn+1 = Yn-3
+ ~ h(2Y~_2 - Y~-1 + 2Yn')
c: Yn+1
=
Yn-1
+ ~ h(Y~_1 + 4Yn' + Y~+1);
A: Yn+1
=
Yn-5
+
c: Yn+1
=
Yn-3
+ 4~ h(7Y~-3 + 32Y~_2 + 12Y~_1 + 32Yn' + 7Y~+1);
=
Yn-7
+ 9!5 h(460Y~_6 - 954Y~_5 + 2196Y~_4 - 2459Y~_3
(8.8:3) 130 h(llY~_4 -
14Y~_3 + 26Y~_2 - 14Y~_1 +
llYn')
(8.8:4) A: Yn+1
+ 2196Y~_2 + 954Y~_1 + 460Yn') c:
Yn+1
=
Yn-5
+
l!o h(41Y~_5 + 216Y~_4 + 27Y~_3 + 272Y~_2
These formulas are obtained in this manner. Formula 13 of Table 7.8:tl is
Write Y' (= dyJdx) for Y; then
r·
Y' dx =
t h(2Y1' -
"'0
But
J"'. y'dx "'0
Hence
=
Y4 - Yo;
Y2'
+ 2Y3')·
332
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
If we now add Yo to both sides and increase the subscripts by n - 3, we obtain formula 8.8:2A. The remaining formulas are similarly derived from formulas 5, 22, 14, 29, and 23, respectively, of Table 7.8:tl. For future needs we list three forms of the errors inherent in each of the formulas 8.8:2, 3, 4, respectively:
(8.8:5)
c:
-
A: (8.8:6)
c: A: (8.8:7)
c:
!~ J"J(xo),
!~h J4F(xo)
9~ J"J(xo),
- 90h J4F(xo);
I~ h7fC71(X),
I~J7j(Xo),
:1oh J6F(x o)
~ h7jC71(X)
'
- 945 J7j (x O),
- 945h J6F(xo);
'
3956 9 14175 J1(xo),
14175 h J F(xo)
!~ h"JCS1(X),
A:
-
9~ h"JCS1(X),
945
3956 h'f(9I(X)
14175
-
8
1
8
3956
8
__9_ h'f(9I(X) - I:OOJ'f(xo), - l:OOh J8F(xo)· 1400 '
These expressions for the errors were derived in Section 7.9; in particular, they come from formulas 7.9:5 and 7.9:6 with a slight change of notation. Here, y = f(x) is a solution of the differential equation and y' = j'(x) = F(x). As before, X is a value of x between the largest and the smallest of the x's under consideration and usually has one value for the advancing formula and another value for the associated correcting formula. The abscissa here called Xo is actually the abscissa X n - 3 of 8.8:2A, the abscissa Xn-l of 8.8:2C, and so on. We illustrate the present method of solving a differential equation by doing EXAMPLE I. Find the values of y corresponding to the values x 0.2, ... , 0.10 that satisfy the solution of
(8.8:8)
= 0.1,
dy -=2+y-2x dx
with initial conditions y = I when x = O. We decide to use formula 8.8:2A for advancing and its associated formula 8.8:2C for correcting. From the first formula it is clear that we need four "starting" values. These are obtained from the Maclaurin
8.8. POINTWISE METHODS; ITERATION USING ORDINATES
expansion of the desired solution. From y' = 2
+Y -
333
2x we obtain
y" = y' - 2 y(3)
= y"
in) = i,,-lI. At X = 0 we have Y = 1. y' = 3. y" = y(3) = ... = yIn) = 1. Hence
x2 x3 x" Y =I+3x+-+-+···+-+··· 2! 3! n! . We use the notation Xo = O. Xl = 0.1. X 2 = 0.2. etc .• then Yl = 1.3052. Y2 = 1.6214. Y3 = 1.9499. (We could. of course. use the Maclaurin series to find the values of Y4 • Y5 •...• but that is not the purpose here.) We enter these starting values and the corresponding values of y' In a table: y
y'
0
1.0000
3.0000
0.1
1.3052
3.1052
0.2
1.6214
3.2214
0.3
1.9499
3.3499
x
We see from the first form of the error term in 8.8:5A that the error inherent in the formula 8.8:2A will not affect the fourth decimal place of Yn+1 since in this example h = 0.1 and j'51(X) = 1. It turns out that we do not need formula 8.8:2C to correct. but we shall use it as a check on our calculations. From 8.8:2A. we get 4 Y4 = 1.0000 + 30 [2(3.1052) - 3.2214 + 2(3.3499)] = 2.2918.
We substitute this tentative value of Y4 into the differential equation and obtain Y4' = 3.4918. We now use 8.8:2C and find 1
y, = 1.6214 + 30 [3.2214 + 4(3.3499)
+ 3.4918] =
2.2918.
334
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
the same value as before as we anticipated. We enter this value in an extension of the table above (row 5 of the table below): x
y
y'
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1.0000 1.3052 1.6214 1.9499 2.2918 2.6488 3.0221 3.4138 3.8255 4.2596 4.7182
3.0000 3.1052 3.2214 3.3499 3.4918 3.6488 3.8221 4.0138 4.2255 4.4596 4.7182
Again, we have 4
Y6
= 1.3052 + 30 [2(3.2214) - 3.3499 + 2(3.4918)] = 2.6487.
Y6'
= 2 + 2.6487 - 1 = 3.6487.
Y5
= 1.9499 + 30 [3.3499 + 4(3.4918) + 3.6487] = 2.6488.
Hence 1
This time the corrected value is one unit more in the fourth decimal place than the tentative value. We enter these values in the table and continue in the same fashion to find the remaining values of y. We remark first that although the error due to the use of the formula is too small to affect the last decimal place, rounding-off errors may influence the results. As a matter of fact, the values of Y obtained above are correct as far as written except that Y5 should be 0.6487 and YIO should be 4.7183. The values can be checked from the solution Y = 2x + eZ of the differential equation. We remark next that although it is possible to obtain the values Y4 , Y5' ... from the Maclaurin series as we pointed out above, it probably takes no more time to obtain these results by the method used here. Before we do a second example, we pause for some important observations. Strange as it may seem at first, it is the correcting formula that plays the important, if sometimes hidden, role in this process. Although the advancing formula does predict the new Yn+l , actually the corrector and the differential equation can be used to iterate to the desired Yn+l .
8.8. POINTWISE METHODS; ITERATION USING ORDINATES
335
For example, suppose Yo' YI , ... , Y7 , Yo', YI" ... , Y7' of the preceding example are known. We wish Ys . It is readily ascertained that the differential equation and the correcting formula become, for this particular case
+ Ys ,
(8.8:9)
Ys' = 0.4
(8.8:10)
Ys = 3.68469
+ 3~Y8'.
Instead of taking the value Ys = 3.8255 as predicted by the advancing formula, let us choose the value Ys = 40, for no good reason. Substitution into the first of the above equations, 8.8:9, yields Ys' = 40.4; substituting this value into the second equation yields the better value Ys = 5.0. Substitution into the first equation gives Ys' = 5.4, and then this value into the second equation yields Ys = 3.86. Repetition of this circular iteration results in the successive values 3.827, 3.8256, 3.8255 for Ys . Further substitution causes no change in the last value and this is indeed the value previously obtained. The precision that can be obtained by this process depends, of course, on the precision of the preceding y's and the error inherent in the correcting formula. Let pursue this matter of iteration a bit further. We can reduce the double iteration process to an ordinary single iteration of the type discussed in Section 5.3 by substituting for Ys' in 8.8: 10 its value given by 8.8:9. We obtain (8.8:11)
Ys = 3.69802
+ 301 Ys .
This equation can be used for iteration to determine Ys. Since the derivative of the right-hand member (with respect to Ys) is 1/30, the process must converge to the desired value. Also, since the right-hand member is linear, there is but one root so that the initial value chosen for Ys may be any real (or imaginary!) number whatsoever. Again: what we are looking for here is a value of Ys which will satisfy 8.8: 11 ; but obviously this is a linear equation in Ys which can be solved directly, without the use of any iteration, for Ys to yield, as before, Ys = 3.8255. We can extend these concepts to yield another method of obtaining a pointwise solution of a differential equation. In example 1, we have, let us say, the values of Y..- I ' Y .. , Y~-l , y,/ . We want the value of Yn+l corresponding to the value x n +1 of x. In algebraic terms, what we
ll6
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
want is a value of Yn+1 which together with its derivative Y~+1 will satisfy 8.8:8 and 8.8:2C simultaneously. We get from 8.8:8
Substitute this value for Y~+l into 8.8:2C and solve for Yn+l; we obtain (8.8:12)
Yn+1
=
2~ (2 -
2xn+1
+ 3Oyn-l + Y~-l + 4Yn'),
a formula which can be used for the derivation of the successive values of y. The formula has two advantages; it requires only two starting values and it does away with prediction and correction since it yields the corrected value in one step. Its disadvantage is its somewhat greater cum bersomeness. However unimportant the advancing formula may now appear, it does have its use as a predictor to help us minimize the number of iterations and it has yet another use as we shall see in the discussion following the next example. EXAMPLE 2. Find the values of Y corresponding to the values x = 0.1, 0.2, 0.3, ... , 0.9, I, that satisfy the solution of Y' = x + y2 with the initial condition Y = 1 when x = O. We must first decide which of the formulas 8.8:2-4 we wish to use in this problem. If we turn back to page 313, we see that if Y = f(x) is the desired solution, yIn) = pn)(x) grows rapidly with n. As a matter of fact, P5)(0.4), P7)(0.4), P9)(0.4) are approximately 5 X lOs, 8 X 105 , 2 X 108 , respectively. Hence the magnitude of the errors in the correcting formulas for values in the neighborhood of x = 0.4 are roughly (remember that h = 0.1) 0.0006, 0.0007, and 0.00 I, respectively. It is then best to use the first formula, 8.8:2A, and its associated corrector, but to get reasonable precision, it is necessary to take a smaller value for h. We take h = 0.02 and find the values of Y corresponding to x = 0.02, 0.04, 0.06, .... We need for starting values, the values of Y corresponding to the values Xo = 0, Xl = 0.02, X 2 = 0.04, Xs = 0.06. These are found by Taylor's series or some other previous method and are listed, together with the corresponding values of Yo', Yl', Y2', and Y3' in the table below. The value Y4 = 1.09035 is then calculated from 8.8:2A; the corresponding derivative is determined from the differential equation and substituted into 8.8:2C to obtain the corrected value which turns out to be the same as the predicted value. We enter the value Y4 = 1.09035
8.8. POINTWISE METHODS; ITERATION USING ORDINATES
ll7
and the value of the corresponding derivative in the table and continue in the same manner to calculate the further entries. We have carried out the work as far as the Y corresponding to x = 0.2; the further entries are left to the reader. x
0 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20
y
1.00000 1.02061 1.04249 1.06571 1.09035 1.11649 1.14425 1.17370 1.20499 1.23823 1.27357
y'
1.00000 1.06164 1.12679 1.19574 1.26686 1.34655 1.42931 1.51757 1.61200 1.71321 1.82198
We have already remarked that the precision of the results obtained in the advancing and correcting process depends on the accumulation of rounding-off errors and on the errors inherent in the advancing and correcting formulas, more particularly the correcting formula. Nothing much can be done about the rounding-off errors except to hope that they more or less iron out or, what is more positive, to use a larger number of decimal places than is required in the final answers. On the other hand, we can estimate the magnitude of the error due to the formulas and it is here that the advancing formula plays an important role. Assume that Yn-3, Y~-2' Y~-l' and Yn' are correct, then the true value of Yn+1 is given by (8.8:13)
where y is the value obtained from 8.8:2A and e1 is the error given in 8.8:5A. But the exact value of Yn+1 is also given by (8.8:14)
where y is the value obtained from 8.8:2C, e2 is the error given in 8.8:5C, and e. is an error caused by using in 8.8:5C not the correct value (which we do not know) but an approximate value of Y~+l . (The value of y is the final value in the iteration process, that is, the value which remains unaltered when 8.8:5C is used.) We obtain from 8.8:13, 14, (8.8:15)
338
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
To get an estimate of the magnitude of the errors in 8.8:2A, C given by 8.8:5A, C, we assume first that e is negligible compared to el or e2 and that the X of 8.8:5A is the same as the X of 8.8:5C. This is equivalent to saying that e = 0, el = -28e 2 • We substitute these values in 8.8.15 and obtain (8.8:16)
That is, the error inherent in formula 8.8:5C is roughly (1/29)th of the difference between the value of Y predicted by 8.8:2A and the final value of Y obtained from 8.8:2C. As long as this error does not affect the significant figures used, we can rely on the values obtained by use of these formulas. However, if the error is large enough to affect the last decimal place retained, then either the final value of y obtained by iteration must be modified in light of the error, or, what is far safer, a smaller value of h should be chosen and used. In examples 1 and 2 worked out above, it is readily ascertained that e2 is too small to affect the results, at least as far as the work was carried out. But suppose that in example 2 we had used the interval h = 0.1, with Xo = 0, Xl = 0.1, x 2 = 0.2, etc. It turns out that the value of Y 4 predicted by the advancing formula is Y4 = 1.78661. The final value of Y4 obtained by iteration of the correcting formula is :94 = 1.78961. Hence e2 = -0.00010. The corrected value of Y4 is then Y4 = 1.78951. It can be shown by other means, however, that the value of Y4 correct to five decimal places is Y4 = 1.78936. The discrepancy shows that the interval h = 0.1 is too large for this example if we wish to keep five decimal places. Incidentally, the error e2 = 0.00010 differs so much from the actual error 0.00025 because the conditions that e of 8.8: 15 be negligible and the X's of 8.8:5A and 8.8:5C be equal are not satisfied here. It is wise when solving a differential equation by this method to keep an eye at each step on the difference Y - y, the difference between the predicted value and the final corrected value of y. Some workers go so far as to tabulate these differences in their work. Not only will the successive differences tell us if the interval h is small enough, but also, since these differences should vary but little from step to step, a difference which is out of line will indicate a mistake in the calculations. A sufficient condition for convergence of the iteration process is readily obtained by the same method as the one outlined above. Let h and Yn-l , Y~~l , Yn' be given. The differential equation 8.8: 1 becomes
if we substitute xn+l and Yn+l for
X
and y, respectively.
8.9. FIRST-ORDER SYSTEMS; HIGHER ORDER AND SPECIAL EQUATIONS
339
Hence (8.8:17)
This equation in which Yn+1 is the only unknown is the one used for iteration. If follows from the discussion in Section 5.3 that we are assured of convergence if (8.8:18)
, Yn+1) I IdF(xn+1 dYn+1
is less than some positive number which is itself less than (8.8:19)
3/h.
If formula 8.8:3C or 8.8:4C were used, convergence will be assured if the absolute value 8.8:18 is less than a positive number which is itself less than 45/14h or 140/41h, respectively. Note that as far as convergence is concerned, very little is gained by the use of the longer formulas in place of 8.8:2C. We repeat that even in the case of convergence, the final value of Yn+1 is still subject to the error inherent in the formula. If pm,(x) does not increase too rapidly with increasing m, then the longer formulas will entail smaller errors than formula 8.8:2C. In particular, the discussion in the preceding paragraph indicates that in example 2 we can keep on finding Yk , Yk+l , •.. until we reach a y 2 )/dy = 2y (x is a constant in value of Y which exceeds 75 since d(x this discussion) and h = 0.02.
+
EXERCISE 8.8 Do the examples of Exercise 8.7 by the methods of this section.
8.9. First-Order Systems; Equations of Higher Order; Special Equations. The methods of the preceding sections are applicable with little or no modification to the pointwise solutions of systems of first-order equations; that is, to systems that are or can be put into the form dYI dx -_ F 1(x , Y 1, Y 2, ... , Y '" )
~: = F2(x,Yl ,Y2, ... ,y",) (8.9: 1)
l.ofO
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
with given initial conditions. The example below will illustrate several of the possible methods of solution. For the sake of simplicity in notation, we designate the independent variable by t and the dependent variables by x and y; also, unless otherwise stated, primes and other symbols of differentiation indicate differentiation with respect to t. EXAMPLE
t
1.
Find the values of x and y corresponding to the values
= 1.1, 1.2, ... , 1.5 that are a point-wise solution of dx dt
=
1 2(Y - 1)
dy dt
=
2t 3x
(8.9:2)
with the initial condition x = 2/3, y = 3 when t Solution by infinite series. We assume that a solution exists of the form
= y =
x
(8.9:3)
ao + a1(t - 1)
+ a2(t 1) + b2(t -
bo + b1(t -
= 1.
+ .. . 1)2 + ... . 1)2
As before, (8.9:4)
bn
yln)(I)
= ---. n!
We get from the first of the given differential equations xln)
= ! yln-U
for values of n greater than unity; we get from the second equation y'
y" y(3)
= itx-1 = i - tx-2x' + X-I =
i-
tx- 2x"
+ 2tx- (x')2 3
2x- 2x'.
We find on making use of the initial conditions that at t
X"
= 1 = i-
X (3 )
= -
X (4 )
= j-.
X'
y' = 1
y"
i
y(3)
-! =! =
= 1,
8.9. FIRST-ORDER SYSTEMS; HIGHER ORDER AND SPECIAL EQUATIONS
341
Hence 2
x
= "3 + (t -
Y
=
3
+ (t -
I)
+ 41 (t -
I) -
41 (t -
1 1)2 - 24 (t - 1)3
+ 321 (t -
1)2
1)3
+ 641 (t -
1)4
+ ... ,
+ ....
We find the desired values of x and y by substituting the given values of t into the infinite series; they are listed in the following table.
1.0 1.1
1.2 1.3 1.4 1.5
x
y
0.667 0.769 0.874 0.988
3.000 3.098 3.190 3.277 3.362 3.441
1.104
1.225
Solution by Picard's method. the forms
We put the differential equations into
x=!+ (!(Y-I)dt (8.9:5)
y=3+
2t I -dt. 3x t
1
We use the initial value 3 for y, substitute into the integrand of the first equation of 8.9:5 and perform the integration; we obtain a first approximation for x, x=t-i·
Similarly, we substitute the initial value 2/3 for x into the integrand of the second equation of 8.9:5, integrate, and obtain t2 5 Y=-+-
2
2
as the first approximation for y. Substituting this approximation for y into the integrand of the first equation of 8.9:5 and carrying out the integration, we obtain a second approximation for x
342
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
Substituting the first approximation for x into the integrand of the second equation of 8.9:5 and integrating, we obtain a second approximation for y Y
= 3 + 3"2 ( t - I + 3"1 In
3t - 1 )
2
.
The second approximations yield the following values for x and y:
1.0 1.1
1.2 1.3 1.4 1.5
x
y
0.667 0.769 0.877 0.991 1.112 1.240
3.000 3.098 3.192 3.283 3.371 3.458
These values agree fairly well with the first set of values. It is apparent, however, that they are beginning to diverge.
Solution by Runge-Kutta formulas. The formulas of Section 8.6 can be modified for use in solving systems of first order differential equations. For example, the Runge formulas 8.6:4 are extended to read
= ki.2 =
ku
(8.9:6)
hFi(to , Xo ,Yo)
+ 1h, Xo + 1kl.l , Yo + ! k2.l) ki.a = hFi(t + ! h, Xo + ! kl.2 ,Yo + ! ku) ki., = hFi(t + h, Xo + k1.3 , Yo + ku), k i = i- (k i •1 + 2k i •2 + 2ki •a + k i .,)· hFi(to
O
O
Here, i takes on the values 1 and 2, F2
and
2t =-, 3x
After Xl and YI have been computed, all the appropriate subscripts are stepped up by unity and the calculations are continued as before. The generalization to m dependent variables is immediate. The work for this example is shown in the table below; the arrangement is essentially the same as it is in the table for one dependent variable and requires no further explanation.
8.9. FIRST-ORDER SYSTEMS; HIGHER ORDER AND SPECIAL EQUATIONS
k.,1
kl,l
I 20
-(y -
l.ofl
I)
t
kl
k.
0.10000 0.09768
0.10244 0.20494
0.09768 0.19518
0.10244 0.10488
0.09750 0.09535
0.30738 0.10246
0.29286 0.09762
3.0976 3.1453
0.10488 0.10727
0.09535 0.09333
0.10721 0.21449
0.09329 0.18652
0.8227 0.8763
3.1443 3.1908
0.10722 0.10954
0.09319 0.09123
0.32170 0.10723
0.27981 0.09327
1.2 1.25
0.8763 0.9311
3.1909 3.2365
0.10955 0.11183
0.09123 0.08950
0.11179 0.22361
0.08947 0.17889
1.25 1.3
0.9322 0.9881
3.2357 3.2803
0.11178 0.11402
0.08939 0.08771
0.33540 0.11180
0.26836 0.08945
1.3 1.35
0.9881 1.0451
3.2804 3.3243
0.11402 0.11622
0.08771 0.08612
0.11617 0.23239
0.08612 0.17215
1.35 1.4
1.0462 1.1040
3.3235 3.3664
0.11617 0.11832
0.08603 0.08452
0.34856 0.11619
0.25827 0.08609
1.4 1.45
1.1043 1.1635
3.3665 3.4088
0.11832 0.12044
0.08452 0.08308
0.12040 0.24084
0.08309 0.16609
1.45 I.S
1.1645 1.2247
3.4080 3.4495
0.12040 0.12248
0.08301 0.08165
0.36124 0.12041
0.24918 0.08306
I.S
1.2247
3.4496
X
Y
I 1.05
0.6667 0.7167
3.0000 3.0500
0.10000 0.10250
1.05 1.1
0.7179 0.7691
3.0488 3.0975
1.1 1.15
0.7691 0.8215
1.15 1.2
Solution by Adams' method. of formulas
15x
We replace formula 8.7:6 by the pair
X"+l
=
X..
+ hF1 , .. + 2"1 .d(hF1..._ 1) + 125 .d 2(hF1..._ 2 ) + ...
Y"+l
=
Y ..
1 5 + hF2... + "2.d(hF 2 ...- 1) + 12 .d 2(hF 2•
(8.9:7) 7I _
2)
+ ... ,
for the solution of the given equations. Again, the generalization to m dependent variables is immediate. As before, Fl and F2 refer to the righthand members of the two equations in 8.9:2. It turns out that we need four starting values for t, x, and y; we copy these from the results of the last solution and enter them in a table. These entries are shown in the
344
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
first four rows and first three columns of the following table. We find hFl and hF2 from the differential equations, calculate their differences (second differences are sufficient here) and enter them in the table.
y
x 0.6667
hFl
A (hF1)
AO(hF1)
0.10000
3
hFo
0.10000 488
0.7691
1.1
3.0976
-465 -21
0.10488
0.09535
0.8763
3.1909
-20
0.10955
0.09123
0.9881
3.2804
-16
0.11402
0.08771
431 1.4
1.1043
3.3666
1.5
1.2247
3.4497
60 -352
447 1.3
53 -412
467
1.2
A(hFo) AO(hFo)
0.11833
33 -319
0.08452
We next calculate = 0.9881
+ 0.11402 + "2I (0.00447) + 125 (-0.00020) =
1.1043
Y4 = 3.2804
+ 0.08771 + 2:I (-0.00352) + 125 (0.00060) =
3.3666.
X4
We find hF1.4 and hF2.4 and then extend the difference table. Finally, Xs
=
1.l043
+ 0.11833 + 2:I (0.00431) + 125 (-0.00016) =
1.2247
Y5
=
3.3666
+ 0.08452 + 2I (-0.00319) + 125 (0.00033) =
3.4497.
Solution using advancing and correcting formulas. We modify formulas 8.8:2A, C to read
(8.9:8)
8.9. FIRST-ORDER SYSTEMS; HIGHER ORDER AND SPECIAL EQUATIONS
345
TheF's are defined as above and the generalization to m equations is again immediate. Once more we need four starting values which we copy from the Runge solution and enter in a table. (See the first four rows of the table below.) We use 8.9:8A1 , A2 to predict X 4 and Y4 and find 0.6667
+ 304 [2(1.0488) -
1.0955
+ 2(1.1402)] =
X4
=
Y4
4 = 3.0000 + 30 [2(0.9535) - 0.9123 + 2(0.8771)]
1 1.1 1.2 1.3 1.4 1.5
x
y
Fl.!
F2.I
0.6667 0.7691 0.8763 0.9881 1.1043 1.2247
3.0000 3.0976 3.1909 3.2804 3.3664 3.4495
1.0000 1.0488 1.0955 1.1402 1.1832
1.0000 0.9535 0.9123 0.8771 0.8452
=
1.1043, 3.3665.
Substitution into the differential equations yields F 1 •4 = 1.1832, F2,4 = 0.8452. Next, we correct the preceding values of X 4 and Y4 by use of 8.9:8C1
,
C 2 and find
X4
= 0.8763 + 30I [1.0955 + 4(1.1402) + 1.1832] =
Y4
= 3.1909 + 30 [0.9123 + 4(0.8771) + 0.8452] = 3.3664.
1.1043,
I
We keep these values and go on to find Xs and Ys in the same way. The values are shown in the table. The various values obtained above can be checked from the particular solution of the differential equation x = 2t3/2 /3, Y = 2tl/2 + 1. The values of x and Y correct to four decimal places are:
1 1.1 1.2 1.3 1.4 1.5
x
y
0.6667 0.7691 0.8764 0.9882 1.1043 1.2247
3.0000 3.0976 3.1909 3.2804 3.3664 3.4495
346
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
The methods of solution used above are, of course, not the only methods available for the solution of systems of equations of the form 8.9: 1. As we noted before, practically every method that applies to a single first order differential equation can be used for simultaneous first order equations. Also, the reader is cautioned not to judge the efficiency of any particular method by what happened in this particular example. The amount of labor involved in a method of solution depends on the nature of the functions present, the number of decimal places required, and the number of successive values wanted, among other things. Only experience can teach one which method is apt to be the most suitable for a given problem. We consider next, although somewhat briefly, differential equations of higher order. We have already seen, example 4 of Section 8.3, that such equations can be solved by means of infinite series. Other methods also exist, but all that we shall do is to point out that the solution of the nth-order differential equation (8.9:9)
where Q and the P/s are functions of x and y, can be reduced to the solution of a system of first-order differential equations. Indeed, put dy dx d'y dxB
=
VI
dV I
= Tx =
V2
then the differential equation 8.9:9 is equivalent to the system of n first-order differential equations dy dx
dv] dx (8.9:10)
=
VI
=
VB
8.9. FIRST-ORDER SYSTEMS; HIGHER ORDER AND SPECIAL EQUATIONS
in the independent variable x and the n dependent variables Y,
347 VI'
••• , V n - l •
EXAMPLE 2. Find a pointwise solution of the differential equation in example 4, Section 8.3, for x = 1.1, 1.2, ... , 1.5, with the initial conditions y = 1, dy/dx = 2 when x = 1 by reducing the given equation to a system of first order differential equations. If we put V = dy/dx, the given second-order equation is immediately reduced to the first order system in the independent variable x and the dependent variables y and v:
dy
-=V
dx
We solve the first-order system by use of the advancing and correcting formulas 8.9:8 (the reader will make the necessary change of notation). The four starting values needed are found from the infinite series expansion of the solution given in Section 8.3. To get four decimal place precision, the series must be evaluated to the term in (x - 1F; v is obtained by termwise differentiation of the series for y. The four starting values and the two computed values are shown in the table below.
x
(= -y - ; )
y
v
F 1( =v)
1.0000
2.0000
2.0000
-3.0000 -2.7432
Fa
1.1
1.1855
1.7135
1.7135
1.2
1.3434
1.4493
1.4493
-2.5512
1.3
1.4758
1.2018
1.2018
-2.4003
1.4
1.5842
0.9684
0.9684
-2.2759
1.5
1.6699
0.7461
0.7461
-2.1673
The computer should avoid the common oversight of failing to use completely the correcting formulas. That is, suppose Ys and Vs have been estimated by the advancing formulas in the preceding example. The value of Y5 is then corrected by iteration in the correcting formula. The value of v is next corrected. If there is a change in the value of v, the value
348
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
of y must be recorrected since it depends on v. It is necessary to go back and forth in this manner until there is no further change in either variable. Some types of differential equations occur so frequently in the natural and applied sciences that they have received special study and special methods of attack have been devised for their solutions. In particular, we consider the differential equation
dBy dx 2 = G(x, y),
(8.9:11)
an equation of the second order with the first derivative missing. Although the substitution v = dy/dx reduces this equation immediately to the first-order system dy dx
dv
dx
=
V
=
G(x,y),
so that a solution can be obtained by solving the pair of first-order equations, it is more efficient to use some other means. By the method of undetermined coefficients or otherwise it can be shown that A: Yn+l
= Yn
+ Yn-2 -
Yn-3
+ ~2 (5Y~:'2 + 2Y~:'1 + 5y~/)
(8.9:12)
These equations are exact if y is a polynomial of max-degree 5. As before, the first equation is used for estimating the new value of y and the second equation is used for correcting; they need four starting values that must be found by other means. These equations are adapted for the direct solution of the Eq. 8.9: 11 if we replace y;' by G" = G(Xi 'Yi). An example will illustrate the method of solution. EXAMPLE 3. Find a pointwise solution of the differential equation d 2y/dx2 = xy for x = 0.2, 0.4, ... , 1.0, given the initial conditions y = I, dy/dx = 2 when x = Four starting values were found by use of infinite series (that is, three values in addition to the given value) and the two further values
o.
8.9. FIRST-ORDER SYSTEMS; HIGHER ORDER AND SPECIAL EQUATIONS
349
were computed by means of the formulas 8.9:12. All values are listed in the table below.
G
y
x
0
0
0.2
1.4016
0.2803
0.4
1.8149
0.7260
0.6
2.2580
1.3548
0.8
2.7560
2.2048
1.0
3.3432
3.3432
EXERCISE 8.9
Do the following examples by the methods of this section. dx 1 1. dt = -2(Y - 5),
dy t -dt -- 6x''
x = 9, dx
2. -
dt
y = 8
dx
=
when
t = 0;
dy - = 3t - x· dt ' x = -I, y = 1 when
y - tl
t = 9(0.5)15;
2 dp.
-
x = y = 0
3. dt
t = 9;
dy = -x/to dt '
+ 1'
= x - y
when
t = 0(0.2)2;
3 dp.
+ I,
t = 0;
t ='0(0.1)2;
dx dy dz 4. - = x - z - t - = x - 3t - 1 - = x - y - t l dt 'dt 'dt x=2, 5. dx dt
+ 2tT dy
8. xay", -
t=O;
t - I' '
t=O(O.I)I;
dy + ~ y dx = 0, dz _ dx = x; 2 dt dt dt dt y = I, z = -I when t = I; t = 1(0.4)3;
+ x(x
y = 7, 7. xy" - 2y'
when
-
3dp.
= 0,
dt x = 0,
6. (x - 1)1 y"
z=-I
y=O,
4dp.
+ xy
= y=I,
XI(X -
y = e,
= x - 6; at x = 2; x = 2(0.2)4;
3 dp.
- I) y' - xy y' = -2 2e~-1(x
- I) - 2 sin (x - I);
y'=2
I) y"
at x=l;
+ xy' + 5y =
y' = 0,
3 dp.
y" = e
at
x=I(0.1)2;
4dp.
3~;
x = I; x = 1(0.1)2;
4 dp.
350
8. NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
9. 4xi y"
+ 2yy' + x-ly = = 6,
y
10. y"
= 2(y +
y'
3x·
+ I;
= 11/4 at x = 4; x = 4(0.2)6; 3 dp.
I) sec· x;
y=y'=O at 11. y"
=
12. y'"
=
y
x=O;
x =0(0.1)1;
3dp.
(I + ~ - 4:.); y=e,
y'=ie at x=l; x=I(0.1)2;
2(y' - 2x)a; y = 3, y' = 3, y" = 1 at x = I;
3dp.
x = 1(0.1)2;
3 dp.
Chapter 9
Curve Fitting
9,1, Introduction, The preceding eight chapters were mainly devoted to a consideration of two questions: how does one obtain numerical answers to a variety of numerical problems? how reliable are these answers? This chapter is concerned with a different, but related, problem: given a mass of data, usually the results of observation, measurement, or experiment and usually presented as a set of numbers or a set of number pairs, how can we obtain the significant mathematical law underlying the data? In particular, if (9.1:1)
is a set of numbers, what single number will "best" represent this set? If (9.1:2)
is a set of number pairs interpreted as points in the Cartesian plane, what is the equation of the curve whose graph "best" fits these points? The reader undoubtedly knows that the number chosen to answer the first of the preceding questions is almost always one of the means or averages: the simple or weighted arithmetic mean, the simple or weighted geometric mean, the simple or weighted harmonic mean, the median, the mode. Also, he has undoubtedly gathered from the use of the quotation marks and the multiplicity of the available averages that more must be known about the numbers before a particular average is chosen or before one average can be called better than another. For example, there is no such thing as the best representative of the numbers 70, 80, 78 if nothing more is known about these numbers; but if these are a student's grades in three equally weighted tests, various considerations may lead one to choose the simple arithmetic average. We do not attempt to justify this choice, but if the median and mode are ruled out as unfit in this situation, the arithmetic average has the advantage of being the easiest to calculate and it is the most altruistic since (for positive numbers) the harmonic mean never exceeds the geometric mean and the geometric mean never exceeds the arithmetic mean. But suppose that a piece of 351
9. CURVE FITTING
352
meat weighs 5 lb when placed in one pan of an off-center beam balance and 8 lb when placed in the other pan. It is easily proved from the momentum laws of physics that the true weight of the meat is the geometric mean of 5 and 8. We do not pursue the topic of averages any further but devote the remainder of this chapter to a discussion of the problem raised by the second question above.
9.2. The Straight Line. In the natural sciences, a physical law is frequently determined by first measuring a quantity y for given values
(9.2:1) of a quantity Xi say the measured values corresponding to the X's are
(9.2:2) Alternately, the X's may be measured for the given values 9.2:2 of y, or the values Xl and Y J , X 2 and Y 2' ••• , Xn and Y n may be measured simultaneously. The mathematical expression of the physical law is an equation
(9.2:3)
f(x,y) = 0
that is satisfied or almost satisfied by the number pairs or points
(9.2:4) From one point of view the problem of determining f(x, y) may seem trivial since we have seen, Section 3.2, that if the X's are distinct there is a polynomial y = P(x) of max-degree n - 1 whose graph will pass through these n points; however, this polynomial is usually undesirable as the function f(x, y) for several reasons. First, a polynomial of degree n - 1 may have as many as n - 2 turning points and hence may not be smooth enough to express the physical law; second, physical or other considerations may indicate that some other type of function, sayan exponential or periodic function, is more appropriate; third, and most important, the X's or the Y's, or both, were obtained by measurement or other means involving some degree of error and are undoubtedly inexact so that the points 9.2:4 should, by and large, lie not on the graph of f(x, y) = 0, which is the "true" expression of the physical law, but near the graph. These considerations lead us to believe that some function other than the polynomial determined by the points is more appropriate and desired.
lSl
9.2. THE STRAIGHT LINE
If not the polynomial, then what kind of function should f(x, y) be? As previously suggested, a prior knowledge of the physical laws involved may indicate the type of function which seems appropriate; if the phenomenon is entirely new or prior knowledge sheds no light, we assume as simple a type of function as possible which seems to fit the points 9.2:4. This function is kept until accumulated evidence indicates the necessity for a change. To illustrate: the points (0.5, 0.24), (0.8, 0.40), (1.0, 0.52), (1.3,0.64) seem to lie on or close to a straight line through the origin (the reader should draw a graph for himself); the graph of y = x/2 is a good fit. But so are the graphs of y = 5 sin x/IO and y = 0.05 x + In( I + 0.6x). Hence, lacking other information, we would choose y = x/2 since it is the most simple equation for most purposes. We suppose, for the remainder of this section, that a straight line is sought as a fit for the points 9.2:4. The first, and simplest, method of obtaining the line, the method of inspection, consists merely in plotting the points on graph paper, taking a straightedge or ruler and adjusting it by eye until it seems to fit the points well, and then drawing the line. The method is indeed simple, it is quick, and in the absence of further information it may be as good, for all we know, as any other line determined by the much longer methods described below. One drawback, however, is that the equation of the line must yet be found. This is done easily enough by selecting two points on the line (the coordinates have to be approximated, of course) and then using the twopoint formula (y - YI)(X I - XI) = (YI - YI)(X - Xl) of analytic geometry to determine the equation. Another drawback may be more serious even though it is psychological in nature. Many peopleincluding many scientific workers who ought to know better- are upset by the simplicity of the method of inspection and the lack of prolonged calculations. For their sake, and because the methods to come are indeed sometimes justified, we investigate more evaluatory procedures. Suppose first that the points 9.2:4 seem to lie on a vertical line; its equation is of the form
(9.2:5)
X=
X.
If x is chosen as the arithmetic average of Xl' XI' "', X n , that is, if x = ~:-l Xi/n, the vertical line 9.2:5 is as good, by almost any natural criterion, as any other vertical line. Suppose next that the required line is not vertical; its equation for which we are looking can be written in the form
(9.2:6)
Y = mx+b.
35-4
9. CURVE FITTING
Since two parameters, m and b, have to be determined, the equivalent of two conditions is at our disposal. We consider the errors to help us determine the parameters. As far as the X's and Y's are concerned, there are four possibilities: (i) (ii) (iii) (iv)
the the the the
X's Y's X's X's
are exact, the Y's are in error, are exact, the X's are in error, and the Y's are in error, and the Y's are exact.
For example: in a moving body experiment, one could measure distances Y i at stated times Xi' We then assume that the X's are exact and the Y's are in error. If a particular distance Y i is not measured exactly at time Xi , the error is thrown into the distance Y i . This is case (,). One could measure the times Xi for stated distances Y i ; case (ii). Or three people could work in conjunction in this manner, one gives a signal and at his command the second measures time Xi and the third measures the distance Y i ; case (iii). The fourth case does not occur in actual practice. Refer to Fig. 9.2:fl. Suppose point Pi with coordinates (Xi' Y i ) is one of the points to be fitted by a line ST (some of the other points are indicated in the diagram). If ST were the "true" line whose equation is being sought, then, had there been no error, Pi would have been at A: (Xi' Yi) in case (i); in case (ii), Pi would have been at C: (Xl' Y i ). There is no clear indication where on the line Pi would have been in case y
P,' (X,', 'r/ ) . • "C(xi,Y;)
s
T
~~~--------~o~------------------X
•
FIG. 9.2:£1.
9.2. THE STRAIGHT LINE
355
(iii). A not unnatural supposition (but definitely a supposition) is to assume that Pi. would have been at B, the foot of the perpendicular from Pi. to ST. We consider the first case. Since Pi. should have been at A, the error or deviation is APi or (9.2:7)
Since A is on line ST whose equation is given by 9.2:6, Yi or
= mXi.
+b
(9.2:8)
Hence the sum of all the errors for all points is (9.2:9)
To determine m and b, we impose the condition that
~ei = OJ
(9.2:10)
then (9.2:11)
(the limits of summation, when not expressed, will be understood to be 1 and n). This one linear equation in m and b is not sufficient to determine m and b. We can get two conditions by the following device. Separate the points 9.2:4 into two groups. This can be done by putting the points whose coordinates have even subscripts into one group and the others in the second; or by putting the first half of the points (using the numerical values of the abscissas to order the points) into one group and the others into the second, and so on. After the points have been separated, rename the points in one group (9.2:12)
and the points in the other group (9.2:13)
(X~', Y~'),
(X;', Y;'), ... , (X~~.,
Y~:.).
356
9. CURVE FITTING
If we now impose the conditions that the sum of the errors of each group of points be zero, we obtain ft.'
m~
(9.2:14)
X/
+ n'b =
i=1
i-I
n"
m ~ X;'
(9.2:15)
fl.'
~ Y/ ,
+ n"b =
i-I
n"
~ Y;' . i-I
It is quite clear that anyone of the three equations 9.2:11, 14, 15 is a
linear combination of and is therefore dependent on the other two equations. If Eqs. 9.2: 14 and 9.2: 15 are consistent and independent, they can be solved for m and b. If they are inconsistent or dependent, it is necessary to regroup the points to obtain a uniquely solvable pair of equations. It is to be expected that different groupings will result in different sets of values for m and b and therefore in different "best" straight lines. EXAMPLE I. Fit a straight line to the set of points (2, -2.5), (4, -1.1), (6, 1.3), (8,3.1), (10, 4.7), (12,6.9). The plot of the points on graph paper (which the reader should draw) indicates that the points do lie approximately on a straight line. If we group the first three points and the last three, Eqs. 9.2: 14 and 9.2:15 become 12m + 3b = -2.3 30m
whence m = 17/18, b straight line is
+ 3b =
14.7;
= -409/90 and the equation of the required 17
Y
409
= IS x -9(f'
If we group the first, third, and fifth points together, and the second, fourth, and sixth points together, we are led to the equations
+ 3b = 24m + 3b = ISm
whence m
3.5 S.9;
= 9/10, b = -127/30 and 9
Y= lO x-
127
30 .
357
9.2. THE STRAIGHT LINE
If we put the two extreme points into one group and the remaining four points into a second group, we obtain the inconsistent equations
+ 2b = 28m + 4b = 14m
4.4 8
which cannot be solved for m and b. The graphs of the two lines fit the points rather well. This, however, is not always the case. Consider EXAMPLE 2. Fit a straight line to the points (0, 3), (I, 2), (2, 2), (3, I), (4, I), (5,0). If we group the first, third, and fifth and the second, fourth, and sixth points, we obtain 6m+3b=6 9m
+ 3b =
3.
Hence, m = -I, b = 4, and y = -x + 4. Its graph, which the reader should draw, is not a good fit for the points. If we group the first three and the last three points, we obtain y = -5x/9 + 26/9 or 5x + 9y - 26 = O. Its graph is a much better fit than the first. It has been pointed out that a solution of Eqs. 9.2: 14 and 9.2: 15 will satisfy Eq. 9.2: II. If Eq. 9.2: II is divided through by n to yield m LX, n
+b=
L Yo , n
it is seen that the point whose abscissa and ordinate are the arithmetic averages of the X's and Y's, respectively, that is, whose coordinates are (9.2: 16)
will satisfy Eq. 9.2:6. The point 9.2: 16 is called the centroid or center of gravity of the points 9.2:4. The imposition of the condition 9.2: 10 forces the line 9.2:6 to go through the centroid of the points 9.2:4; dividing the points into two groups forces the line to go through the centroid of each group (and through the centroid of all the points) and hence determines the line unless all three centroids coincide. A line determined in this manner
9. CURVE FITTING
358
is said to be determined by the method of averages; in general, the equation of any line or curve determined by condition 9.2:10 is said to be determined by the method of averages. We have just seen that if the errors are determined as in case (i) and the condition 9.2: 10 is placed on the errors, the required straight line will be determined by two centroids of the points. Since the X's and Y's play symmetric roles in this result, the same result is obtained if the errors are determined as in case (ii). If both the X's and the Y's are inexact, case (iii), and the error is assumed to be the perpendicular distance from the point to the line, or mX, - Y i ei
=
+b
vm2 + 1
and if we again impose condition 9.2:10, we are once more led to the same result. We have seen that if we separate the points 9.2:4 into two groups and choose the line determined by the centroids as a fit for the points, that not only will we usually get different lines for different methods of grouping but, in some cases, the lines found are not good fits at all. As another example, consider the four points A: (0.0, 2.2), B: (2.2, 2.4), c: (3.0,2.7), D: (5.0, 3.3). The three ways of grouping these points two by two yield the answers y = 0.24x + 2.03, y = 0.19x + 2.16, y = -2.0x + 7.75. The first two answers are reasonably close together and a graph will show that the lines are fair fits; the third, however, represents a line that is almost perpendicular to the first two and is not a good fit at all. The reason for this behavior is easy to find. In the first two cases, the centroids are some distance apart so that a slight shift in one or the other or both would not have a great effect on the line through them, but in the third case the centroids are rather close together so that a slight shift in either could cause a large shift in the line. It is therefore advisable to group the points in such manner that the two centroids are far apart to obtain a line that fits well. The next method we consider for fitting a line to a set of points involves considerably more computation than the preceding methods, but it requires no exercise of judgment of just where to draw the line or just how to group the points, and it always results in a good fitting straight line. Conditions other than 9.2: 10 may be imposed on the errors ei , however they may be defined, to determine the parameters m and b of the equation 9.2:6. For example, we may impose the condition that :E I ei I be a minimum. This condition is imposed rather rarely since the absolute
359
9.2. THE STRAIGHT LINE
value is not a simple function to manipulate. Another condition, one which is widely used, is that be a minimum.
(9.2:17)
A result obtained by imposing this condition is said to be obtained by the method of least squares. We interrupt the train of discussion for a moment to recall a necessary theorem from the calculus. Let z = f(x, y) be a function with continuous second partial derivatives. The value of z will be a minimum at a point (a, b) if at this point (9.2:18)
Zz
=
of ox =
0,
Zll
of = 0, = -oy
if (9.2:19)
and if (9.2:20)
We now return to the discussion at hand. We seek the parameters m and b in Eq. 9.2:6 if the condition 9.2: 17 is imposed on the errors ei given by 9.2:8; this is case (i). We then have et 2 = (mXi b - Yi)2, hence
+
(9.2:21)
It follows that Sb
=
2 ~ (mXi
+b-
Y i ),
(9.2:22)
Set 8 b
= 8 m = 0, then m ~ Xi
+ bn = ~ Y i
(9.2:23)
m ~ Xi 2
+ b ~ Xi =
~ XiYi .
These equations are consistent and independent if
(9.2:24)
D=
*0,
9. CURVE FITTING
360
+
that is, if (~Xi)2 - n ~ Xi 2 =1= O. But (Xi - X;)2 ~ 0, or Xi 2 Xi 2 ~ 2Xi X i , with the equality holding only if Xi = Xi' Therefore, ~i<; (Xi2 Xl) = (n - I) ~ Xi. 2 ~ 2 ~i<; XiX; and n ~ Xi 2 ~ ~ Xi 2 2 ~i<j XiX j = (~Xi)2. The equality can hold only if Xi = X; for every i and j. If we rule out this case, then
+
+
D=
<0
and Eqs. 9.2:23 are consistent. Now
= -4D>0 and 2n > OJ hence the unique solution of 9.2:23 yields a mlmmum value for S. We note, first that the imposition of the condition that S given by 9.2:21 be a minimum is equivalent to two conditions, enough to determine the parameters m and h of Eq.9.2:6. Second, since the first equation of 9.2:23 is the same as Eq.9.2:11, the line determined by the method of least squares also goes through the centroid of the points 9.2:4, at least for case (i). Equations 9.2:23 are often referred to as the normal equations for the determination of the straight line. We do example 2 over again, this time by the method of least squares. We form the following table:
x
y
XI
XY
0
3 2 2
0
0
I
2 3
I
2
4 9
4 4 0
13
4
I I
5
0
16 25
15
9
55
The normal equations are 15m + 6b = 9 55m + 15b = 13;
3
361
9.2. THE STRAIGHT LINE
whence m = -19/35, b = 20/7, and the required line is y = -19x/35 + 20/7 or 19x + 35y - I()() = O. This line differs but little from the second solution obtained by the method of averages. If we make the transformation x'=x-Jl (9.2:25)
y' =y- Y,
where g = ~ Xi/n, Y = ~ Y{./n, that is, we translate the axes so that the new origin is at the centroid of the points 9.2:4, then (9.2:26)
Referred to the new axes, the normal equations become nb'
(9.2:27)
= 0
m~X? = ~X/Y/, whence b'
(9.2:28)
=0 ~X/Y/
~X'2
m=
j
'
and the equation of the required line becomes
Y'~X;2
(9.2:29)
= x'~X/Y/.
The work for the example just done would then look as follows:
x
y
0
3 2 2 1 1
1 2 3 4 5 15
X'=X-Q y' = y 2
t
X'I
X'y'
0
-5/2 -312 -1/2 1/2 312 5/2
312 1/2 112 -1/2 -1/2 -3/2
2514 9/4 1/4 1/4 914 2514
-1514 -3/4 -1/4 -1/4 -3/4 -1514
9
0
0
7014
-38/4
9. CURVE FITTING
362
Hence m = - 38/4 -;- 70/4 = -19/35 and 19x' + 35)" = O. This equation reduces to the original one if we transform back to the original variables. One reason for translating the axes is to shorten the amount of computational work when performed longhand. If the X's are in error and the Y's are exact, case (ii), and the required line is not horizontal, the desired equation can be written in the form (9.2:29')
x
= py + a.
The same reasoning as before leads to the new normal equations
p ~ Yi
+ an =
~ Xi
(9.2:30)
P~
y;2
+ a ~ Yi =
~ Xi Y i
which can be solved for a and p. Also, as before, the transformation 9.2:25 leads to the solution (9.2:31)
The solution for the points of example 2 is 22x' + 38)" = 0 or, in the original variables, llx + 19)' - 56 = O. Note carefully that this equation is not the same as the one found for case (i); the two lines are, however, close together and each goes through the centroid (t, !) of the six points. Let us suppose, finally, that both the X's and the Y's are in error, case (iii), and that the error in Pi is the length of the perpendicular from Pi to the required line whose equation is given by 9.2:6; the error is then (9.2:32)
In order to simplify some of the ensuing calculations, we assume that the centroid of the points 9.2:4 is at the origin. In the contrary case, we would first translate the axes so that the origin is at the centroid, obtain the results below, and then go back to the original variables. We may suppose, then, that (9.2:33)
The sum T of the squares of the errors is given by (9.2:34)
363
9.2. THE STRAIGHT LINE
We have Tb
=
Tm
=
2 m2 + 1
k (mX; m2 ~ 1 k (mX; -
Y;
+ b)
Yi
+ b) Xi -
(m 22: 1)2
k (mXi -
Yi
+ b)2.
In virtue of 9.2:33, these two equations reduce to
(9.2:35)
Tm
=
(m 2
!
1)2 !m 2 kXiYi
+ m [k Xi 2 -
k Yi2] - k XiYi -
!.
mnb 2
If we set Tb = 0, then (9.2:36)
b = O.
That is, the line again goes through the centroid of the points. From T m = 0 and b = 0, we get the equation ex.m 2 + 213m - ex.
(9.2:3'7)
=
0
for the determination of m, where (9.2:38)
We find (9.2:39)
m=
-13
±
vex. 2 ex.
+ 132
(We assume for the time being that ex =F- 0.) To test for a minimum, we find
Tmb
=
2n
Tbb
=
m2
+
T bm
=
-
4mnb (m2 + 1)2
Tmm
=
(m 2
!
1
1)2 {2ex.m
+ 213 -
nb2 }
(m 28: 1)3 {ex.m 2 + 213m - ex. - mnb 2}.
364
9. CURVE FITTING
At the required values, 9.2:36 and 9.2:37 hold, hence
o
8n
4
(m 2
+ 1)2 (ma: + fJ)
(m 2
+ 1)3
(ma:
+ fJ)·
The first factor on the right is evidently positive, hence the sign of the determinant depends on the second factor ma + f3. But from 9.2:39, ma + f3 = ± V~ + f32, hence the determinant will be positive if we choose the positive sign in front of the radical; that is, if (9.2:40)
where y = f3/a and the plus or minus sign is taken according as a is I) > 0, the values of band positive or negative. Since Tbb = 2n/(m 2 m given by 9.2:36 and 9.2:40 minimize T of 9.2:34 and hence yield the required line. If ex = 0 but f3 =F 0, Eq. 9.2:37 yields
+
m =0.
(9.2:41)
Also, I
If
f3 >
Tbb Tmb
T bm I Tmm
=
1
2n 0 0 4fJ
I
=
8nfJ·
0, the line
(9.2:42)
is the required line. If (9.2:42a)
f3 <
0, it turns out that the required line IS x
= o.
If a = f3 = 0, then ~ Xi 2 = ~ Y i 2 and T reduces to T = ~ Xi2, an expression independent of m. Hence any line through the centroid will do. As an example of caSl~ (iii), we fit a line to the points of example 2. We first translate the axes so that the new origin is at the point whose old coordinates are (t, t) and construct the following table (where we have dropped the primes from the X's and Y's):
365
9.2. THE STRAIGHT LINE
x
y
-5/2 -312 -1/2 1/2 3/2 5/2
312 112 112 -1/2 -1/2 -3/2
0
0
XI -----2514 9/4 1/4 114 914 2514
XY
Y·
-1514 -3/4 -1/4 -1/4 -3/4 -1514
9/4 114 114 114 114 9/4
._-------
:E
70/4
-38/4
2214
- - - - - - - - - - ._---_._-------
CO _ 22) =6 4 '
19 0<= -2' P = ~ 2 4 m
12 = 19
~ I + e2f 19 =
12
Y=-19'
-0.55
Hence, referred to the new axes, the required equation is y = -O.55x; referred to the original axes, the equation is y = -O.55x + 2.88. This equation is different from but close to the ones previously obtained. If an initial or boundary condition is placed on the required straight line, for example, the nature of the physical phenomenon may dictate that the line go through the origin, then only one further condition is at our disposal. Since the line determined by the method of averages or by the method of least squares passes through the centroid of the points in all cases, it is natural to make this the second determining condition if it does not conflict with the boundary condition. EXERCISE 9.2 1. Find equations of straight lines to fit each of the following sets of points by (i) drawing a line with a ruler, judging the "best" position; (ii) the method of averages; (iii) the method of least squares for each of the three cases.
a x
y
x
-I
-I I
-I
0 2 5
----
c
b
4 12
0 2 5
d
y
x
y
x
y
5 2 0 -7
4.1 6.1 9.8 15.0
4.4 6.3 11.4 16.6
-4.2 -0.3 5.7 11.2
1.0 -1.2 -3.5 -7.3
9. CURVE FITTING
366
e x -1.1 0.2 1.8 3.7 8.1 15.4
h
I y
-1.8 -1.7 4.9 11.1 23.8
46.5
x
y
x
0.8 2.1
0.82 1.70
-2.0 -0.9 0.1 1.3 3.4 7.8 10.1 14.5
5.2
4.25
9.7 19.6 50.1
8.47 16.90 42.38
y
9.2 7.3 4.6 3.1 -1.0 -11.3 -15.1 -24.0
x
Y
-20 -12
-4.0 -3.7 -3.0 -2.8 -2.7
-5 0
5 10 20 30 SO 80
-2.5 -1.9 -1.6
-0.5 1.0
2. Find equations of straight lines to fit each of the following sets of points and to satisfy the accompanying condition . •• (-1,3.1), (1,2.8), (3,8.7), (6, 18.2), and passing through the origin. b. (-5.1, 1.0), (-2.8,0.5), (4.2, -0.7), (10.0, -1.8), and passing through the origin. c. (-1.1, -5.2), (0, -2.8), (3.3, 3.9), (7.6, 12.1), and passing through the point (I, -I). d. The points of part c and parallel to the line y = lx. e. (-3, -6.8), (I, -4.1), (5, -0.7), (13, 5.2), and tangent to the circle Xl + yl - 4x - 6y - 12 = O.
1. In example I, define the error at a point P, in parts (i) and (ii), as the value of y found by substituting the abscissa of P into the equation minus the corresponding observed or given value of y; in part (iii), define the error as in the text. Determine the errors at the given points. What light do these answers throw on the number of significant figures to be used for the parameters ?
9.3. Polynomial Graphs. In this section we discuss methods of determining the coefficients (parameters) of a polynomial of max-degree m, (9.3:1)
so that the graph of the polynomial is a good fit for the points (9.3:2)
whose coordinates are obtained by measurements or other means. The problem makes sense only if n exceeds m; in actual practice, n will usually be considerably larger than m. We suppose further throughout this entire section that the X's are exact and the Y's inexact. The other two cases are more difficult to handle and the slight differences in the results do not warrant the extra labor.
9.3. POLYNOMIAL GRAPHS
367
The first method, the method of centroids, is an adaptation of a method discussed in the previous section. Suppose the n points 9.3:2 arranged so that the abscissas are in increasing order; separate the points into m+ 1 groups with more or less equal numbers of points. Find the centroid of each group and then the polynomial of max-degree m through the m + 1 centroids. The graph of this polynomial will usually be a good fit for all the points of 9.3:2. EXAMPLE 1. Fit a parabola y = a o + a1x + a 2x 2 to the points ( - 2, 9), (-1,6), (0,3), (1, -1), (2, -2), (3, -3), (5, -1), (7,3).
We group the first three, the second three, and the last two points; the centroids of the three groups are, respectively, (-1, 6), (2, - 2), (6, 1). The equation of the parabola through these three points, by the methods of Chapter 3, is y = (198 - 265x + 41x2 )/84. The "true" values of y, corresponding to the given values of x, are computed from the equation to be 446/42, 252/42, 99/42, -13/42, -84/42, -114/42, -51/42, 176/42. Hence, the respective errors are 68/42,0, -27/42, 29/42,0, 12/42, -9/42, 50/42. The sum of the errors is 123/42. A method of averages can be developed as follows. By substituting Xi for x in 9.3: 1, we obtain the corresponding "true" value of y, namely, Yi = ao + alXi + a2 Xi + ... amXr· The error at this point is
+
(9.3:3)
the sum of the errors for all the points is (9.3:4)
where, as before, 1 and n are to be understood as the limits of summation. If we set Ui = 0, we obtain only one condition for the determination of the m + 1 parameters ao , aI' ... , am; we therefore do what we did before, we divide the points 9.3:2 into m + 1 groups
(9.3:5)
(Xu, Y n ).
(X I2 • Y 12 ).
...• (XI •a • Y I •a );
(X21 • Y 21 ).
(X22 • Y 22 ).
. ..• (Xu. Yu);
and set the sum of the errors in each group equal to zero. The resulting m + 1 equations can be solved for the m + 1 parameters. If these equations are inconsistent, a regrouping is necessary.
9. CURVE FITTING
368
We redo example 1 by the method of averages. If we group the points as above. we obtain the three equations 3ao - 3a1 + 5al = 18 3ao + 6a1 + 14a2 = -6 2ao + 12a1 + 74a2 = 2, whence ao = 522/255. a 1 = -803/255. a2 = 123/255. The required equation is y = (522 - 803x + 123x2 )/255. which is in close agreement with the previously found solution. A method of least squares can be developed by procedures similar to those followed for the straight line. If the errors are given by 9.3:3. then put (9.3:6)
We obtain by partial differentiation.
+ ... + amXr Sal = ~ 2(ao + a1Xi + ... + amXr Sal = ~ 2(ao + a1Xi + ... + amXr Sao
Sam
=
=
~ 2(ao + a1Xi
~ 2(ao + a1X j
+ ... + amXr -
Yi) Y i ) Xi Y i ) XiI
Y j ) Xr·
Setting these partial derivatives equal to zero. we obtain aon
ao~ Xi (9.3:7)
+ a 1 ~ Xi + ... + am ~ Xr = ~ Y i + al~ XiI + ... + am~X~+l = ~ XiYi + ... + am~ ~ X~+2 = I
~ x.ly' ~
I
I
These are the normal equations for the determination of the polynomial of max-degree m. It can be shown that these equations are consistent and independent and the solution minimizes the sum of the squares of the errors. Note again that the condition that the sum of the squares of the errors be a minimum is sufficient to determine the m + I parameters ao • a 1 ••••• am·
9.3. POLYNOMIAL GRAPHS
369
The data of example I yield the table: X
y
x·
XI
x'
Xy
-2 0 1 2 3 5 7
9 6 3 -1 -2 -3 -1 3
4 1 0 1 4 9 25 49
-8 -1 0 1 8 27 125 343
16 1 0 16 81 625 2401
-18 -6 0 -1 -4 -9 -5 21
36 6 0 -1 -8 -27 -25 147
15
14
93
495
3141
-22
128
-I
~
I
x·y
The normal equations for this example are therefore 8ao + ISa 1 + 93a2 = 14 ISao + 93a1 + 49Sa2 = -22 93ao + 49Sa1 + 3141a2 = 128.
These equations yield the solution y = 2.133 - 2.864x + 0.429x2 which, as we could have anticipated, is close to each of the two previous solutions. As in the case of the straight line, the preceding procedures must be slightly modified to accomodate given initial or boundary conditions. EXERCISE 9.3
1. Find equations of parabolas of the form y = a + bx + ex· that fit the following sets of points by the method of centroids, the method of averages, and the method of least squares. a
c ----
b
x
y
x
-3 --2 -1 0
11 4 -1 -2
I
-I
2
0
y
2 0 3 3 4 9 5 20 6 28 7 40
f
e
d
x
y
x
y
x
y
x
Y
-6 -4 -1 3 4 8
-13 -6 -1 3 2 -6
-4.0 -1.5 -1.0 -0.5 0.0 5.0
2.0 3.8 2.8 1.4 2.0 -9.2
-9 -7 -5 -2 -1 0
70 48 30 10 6 3 0 -2
0 0.5 1.0 1.5 2.0 3.0 3.5 4.0 4.5 5.0 6.0 8.0
0 -2.2 -5.0 -8.3 -12.0 -20.8 -26.1 -32.1 -38.2 -44.8 -60.0 -96.3
I
3 4 6 9 12
-I
2 16 39
9. CURVE FITTING
370
2. Find equations of cubics that fit the following sets of points by the method of centroids, the method of averages, and the method of least squares:
:1
-3
-2
-I
0
-5.4
-1.5
-0.2
0.0
XI
-5
y
-178
0.1
2
3
4
5
6
1.4
5.5
13.0
25.0
43.0
-4
-3
-2
-I
0
2
3
4
-40
-12
0
2
0
10
30
70
3. Find an equation of a parabola which is a good fit for the points ( -4, 29), (I, -2), (3, I) and which passes through the origin.
(-2, 10),
4. Find an equation of a parabola which is a good fit for the points (-I, - 3.8), (2,2.1), (4, -4.0) and which passes through the point (I, 2). 5. Find an equation of a parabola which is a good fit for the points ( -I, 8.1), (3, 7.8) and which is tangent to the line 6x - y - 13 = 0 at (2, -I).
(0, 0),
(0, - 1.0),
9.4. Other Graphs. It is often desirable to fit a curve to a set of points
(9.4:1) where the equation of the curve is not of the form y = p(x), p(x) a polynomial in x. For example, the graph of the points plus some knowledge of the underlying physical law may indicate the suitability of an equation of the type y = aebz . The parameters involved may usually be determined in at least one of three ways: the problem can be reduced to a previous case by an appropriate change of variables; one or more special devices can be used, some of which are illustrated below; either freehand or with the aid of a French curve a good fitting curve is drawn and estimates are made, directly or indirectly, of the parameters from the graph. We do a number of examples to illustrate the methods.
1.
Determine the parameters in y = aebz (e is not a parameter) so that the graph of the curve is a good fit for the points (0.5, 0.58),
EXAMPLE
(1.0,0.68), (2.0,0.90), (4.0, 1.65), (9.0, 7.45). Solution by reduction to previous type. Take the natural logarithm of both sides of the given equation; then In y = In a + bx. Put y* = lny, a* = In a; then y* = a* + bx. From the given data, we find the corresponding values of In Y, namely, -0.545, -0.386, -0.105, 0.501, 2.011. The problem reduces to fitting a line to the points (0.5, -0.545), (l.O, -0.386), (2.0, -0.105), (4.0,0.501), (9.0,2.011). (It can be verified that these points lie approximately on a line by plotting them on ordinary graph paper or by plotting the original points on semilog paper.) The line y* = -0.697 + 0.299x was found by the method
9.4. OTHER GRAPHS
371
of centroids, whence a = 0.498. The final answer, using two significant figures, is y = 0.50eO. 30z • It is to be carefully noted that if the equation of the straight line y* = a* + bx is found by the method of least squares, it is generally not true the values of the parameters so determined will minimize the sum of the squares of the errors in the equation whose graph fits the original data. Solution by special device. We differentiate y = aeb z to obtain y' = abeb z so that y' /y = b. The values of yare approximately the respective Y's, we need the corresponding values of y'. We note that if Pu: (xo, Yo), Pl : (Xl' Yl)' P2: (X2' Y2) are three points on or near a curve with X o < Xl < X2 , the slope of the curve at or near Pl should be some sort of weighted average of the slopes of the chords POPl and Pl P2 . If we take as the weights the distances X2 - Xl and Xl - Xo, respectively, the slope at or near P l is approximately (9.4:2)
If we use this formula to estimate the derivative at each of the three interior points of the given data, and then evaluate b, we obtain the three values 0.30, 0.30, 0.36. Their arithmetic average, 0.32, gives us reasonable estimate for b. Using this value for b, and substituting the given values of X and Y for X and y in a = y/ebZ , we obtain five values for a, 0.49, 0.49, 0.47, 0.46, 0.42. These average out to 0.47. Hence, the final equation is y = 0.47eO. 32z , a result fairly close to the previous one. Note that if Xl - X o = X2 - Xl , then 9.4:2 becomes (Y2 - yo)/(x2- xo), the slope of the line POP2.
Solution by graphing. Plot the given points carefully on graph paper and draw a smooth curve that seems to be a good fit. Extend the curve until it meets the y-axis. The y-intercept gives the value of a in the equation, but this value should be averaged in with the value obtained as now described to even out drawing inaccuracy. Select five points, more or less equally spaced, on the graph and draw tangents to the curve at these points, by inspection, but with the aid of a straightedge. The slopes of the tangents yield the values of y'; as above, calculate the values of a and b. Average this a with the y-intercept. Essentially the same result as before should be obtained.
EXAMPLE 2. Determine the parameters in y = a(2 + X)h so that the graph of the curve is a good fit for the points (-I, 3.50), (0, 1.94), (I, 1.39), (3, 0.89), (5, 0.67).
9. CURVE FITTING
372
Solution hy reduction to previous type. Take the common logarithm of both sides of the given equation; we obtain log y = log a + h log(2 + x). Make the substitutions x* = log(2 + x), y* = log y, a* = log a, so thaty* = a* + hx*. Form the following table: x -I
0 1 3 5
y
x*
y*
3.50 1.90 1.39 0.89 0.67
0.000 0.301 0.477 0.699 0.845
0.544 0.288 0.143 -0.051 -0.174
It can be verified that a straight line is a good fit for the x*, y* points by plotting them on ordinary graph paper or by plotting the original points on log log paper. Grouping the first two and the last three x*, y* points, and using the method of averages, we obtain the equation y* = -0.847x* + 0.543. The required equation is therefore y = 3.49/(2 + X)O.847.
Solution hy graph and special device. The given points are carefully plotted and a smooth curve is drawn through them. It may help to note that the x-axis is a horizontal asymptote and x + 2 = 0 is a vertical asymptote. The given equation yields y' = ah(2 + X)b-l, whence h = y'(2 + x)/y. Select about five more or less equally spaced points on the graph (between -1 and 5) and at each determine x, y, and y'. These values are substituted into the last equation to yield five values for h. These, when averaged, should yield a fairly good approximation for h, and then, as in example I, a value for a can be found. A good result can be obtained with care. EXAMPLE 3. Determine the parameters in y = a(h + x)c so that its graph is a good fit for the points (-2.5,17.90), (-1.5,4.70), (-0.5,2.35), (0.5, 1.45), (1.5, 1.05), (2.5,0.80). Solution. The given points are plotted on ordinary graph paper and from the hyperbolic shape of the curve we conclude that a and hare positive and c is negative. The given equation yields log y = log a + c log(h + x). Make the substitutions y* = log y, x* = log(h + x), a* = log a, .so that y* = a* + cx*. The value of a* is to be found, the values of y* (for the given points) can be found, but the values of x* cannot be found because h is unknown. Hence the first job is to find a good estimate for h. This can be done in several ways. Since x + h = 0
373
9."'. OTHER GRAPHS
is a vertical asymptote of the required curve. the diagram tells us that b is approximately 3. We decide to try b = 2.8. 3. 3.2 and form the following table: x
-2.5 -1.5 -0.5 0.5 1.5 2.5
x
+ 2.8 0.3 1.3 2.3 3.3 4.3 5.3
x+3
x
0.5 1.5 2.5 3.5 4.5 5.5
+ 3.2
Y
0.7 1.7 2.7 3.7 4.7 5.5
17.90 4.70 2.35 1.45 1.05 0.80
If the points (x + 2.8. Y). (x + 3. Y). (x + 3.2. y) are plotted on log log paper. or if the points (log(x + 2.8). log Y). (log(x + 3). log Y). (log(x + 3.2). log y) are plotted on ordinary graph paper. it will be seen that the points (x + 3.2. y) or (log(x + 3.2). log y) almost lie on a straight line. whereas the others do not. Hence we take b = 3.2 and proceed as in example 2. An approximate value for b may also be found as follows. Plot the given points on ordinary cross-section paper as before and draw a smooth. good fitting curve. Let (Xi' Yi)' i = 1.2•...• be arbitrary points on the curve so thatYi = a(b + Xi)c, Choose four points so thatYl: Y2 = Ya: Y4'" then (b + x1)/(b + x2 ) = (b + xa)/(b + X 4)i whence. b = (x ra - X1X4)/(X1 - x2 - Xa + x4). If several such tetrads are chosen. the value of b calculated for each tetrad. and then the b's are averaged. a fairly good result can be obtained if care is exercised. The end result is Y = 10.5(3.2 + X)-1.5. EXAMPLE 4. Determine the parameters in Y so that its graph is a good fit for the points:
= a + b sin x
+ c cos x
~I
0.6
0.7
0.8
0.9
1.0
1.1
1.2
1.3
1.4
1.5
y
0.87
0.98
1.10
1.20
1.30
1.38
1.45
1.53
1.60
1.65
There does not seem to be any good approach to this particular problem. If we differentiate the given equation twice. we readily obtain Y + y" = a. Values of y" can be obtained from the given data. since the points are evenly spaced. by the methods of Chapter 7. but (in this example) the values of Y + y" will vary so much that no satisfactory value of a can be obtained. Although various devious devices can be used to get values for a. b. and c. the methods of the next section will yield excellent results and so we postpone the completion of this example for a short time.
9. CURVE FITTING
374
EXERCISE 9.4 1. Determine the parameters in each equation so that the graph of the curve is a good fit for the given points. Make a suitable transformation in each case to reduce the problem to a polynomial form.
a. y = ax&;
:..\I0.351
2
b. y = ax&;
xl
;\ c. y
=
d. y =
e. y
ax&;
f. y =
15
20
25
30
6.25
6.90
7.45
7.90
8.30
2.0
3.0
2.33
1.02 0.42 0.17
1.7 x 11.3 y 8.55 9.73
= ab~;
1.8
11.1
x
3.4
12.6
16.8
4.0
I I y 3.560
7.0
4.5
5.0
0.126 0.157 0.197 2.5
3.0
1.43 6.50 29.9
y I. y = e"+N;
4.5
2.5
3.5 x 13.0 y 0.080 0.101
a2&~;
8.75
10
x 11.5 y 4.31
ab~;
15
1.80 4.05
0.80
y
8
4
3.4
88.4 204
2
3
4
5
X
h. y = a
I. y = a
+ b cos x;
2.095
1.235 0.725 0.430
0.5 1.0 xIO.O y 1.430 1.210 0.610
+ blog,ox;
;16.60 7.70
J.
y = a
0.4 y -2.00
xl
;1
2.0
-0.225
-0.755
-1.090
15
19
8.30
8.75
9.05
0.8
1.2
1.6
2.0
-3.35
-4.85
-5.90
-4.90
+ b sin x + e sins x
x 1200 y 0.950 I. y = a
2.0
+ be" + eel:!:;
:..1 k. y = a
1.8
11
7
3
xl
1.5
+b
30
1.025
2.4
-2.60 2.25
(x in degrees);
40
0
2.2
0
50 0
600
700
800
900
1.015 0.940 0.840 0.750 0.665 0.640
vx + ex + dx Vx;
2.5
-0.59 0.13
3.0
3.5
4.0
1.08 2.30 3.68
4.5
5.0
5.5
6.0
6.5
7.0
7.5
5.29
7.05
8.95
11.05
13.26
15.68
18.08
9.5. INCONSISTENT EQUATIONS
375
2. Determine the parameters in each equation so that the graph of the curve is a good fit for the given points. Use whatever combination of methods seems applicable.
+ bez ;
•. y = ax
b. y = aez - be-z ;
x \ 0.6
0.8
1.0
1.2
1.4
Y 0.940
1.375
1.745
2.075
2.305
0.8
xl
1.5
1.0
2.0
3.0
-I
y
c. y
=
+ aebz ;
2x
I -1.420 -0.765 0.810 2.590 9.220
xl
1.5
1.0
e. y = a
+ bxc ; + becz ;
x y x
I
y f. y = a(b
+ x)C;
I. Y = a(b
+ x)C;
x
:It'
h. y = - - . b + ex'
I. y = x"(1
J.
y
x y
+ bx)<;
8.285
9.550
3.0
5.0
-0.100
0.695
8.0
10.0
2.170 4.230 5.560
1.0
1.3
1.6
1.9
2.2
2.5
2.8
1.080
1.225
1.335
1.440
1.545
1.630
1.715
1.795
8
9
10
3
2
4
3.58 6.01
I 3.5
5
4.0
4.5
16.30 8.33
5.38
I
3
2
5.0
5.5
4
5
0.876
6.0
6.5
7.0
2.44
2.03
1.74
7
8
9
---_.
3.90 3.03 6 ---"---
0.505
xl4 y 7.15
7
6
7.58 8.85 9.90 10.83 11.74 12.45 13.20
----_.y
3.5
0.7
xl y
-0.695
-1.145
3.0
2.0
1.3
0.8
I
2.5
4.640 5.830 7.045
y 3.470
d. y = a
2.0
-_.
-----
1.72 2.20 2.69
1.27
3.19
3.72 4.34
6
8
10
12
14
16
18
9.16
11.1
12.9
14.7
16.4
18.0
19.5
-_._---
10
= a sin(b + ex), angle in degrees; x
I
200
y 0.508
300
400
0.734 0.950
500
60 0
70 0
80 0
900
1000
1.154
1.348
1.522
1.680
1.819
1.930
9.5. Inconsistent Equations. Many investigations in the natural sciences and elsewhere lead to a set of m, say, simultaneous equations in n unknows, where m > n. If the coefficients in these equations were exact, the equations would normally be consistent; since, however, the coefficients are, directly or indirectly, obtained as the results of measurements, they are inexact and the equations are therefore, as a rule, inconsistent. In this section we will discuss methods for finding approximate solutions for systems of inconsistent equations; that is, we will seek values for the unknowns which when substituted into the equations
9. CURVE FITTING
376
will make the left- and right-hand sides equal or almost equal. In a sense, the problem is complementary but similar to the problem of the preceding sections. We consider the set of m simultaneous linear equations in n unknows, m >n, allx1
(9.5:1)
a2l x I
+ a l 2x 2 + ... + a1nXn = hi + a22x 2 + ... + a2nXn = h2
One method of finding an approximate solution is to separate the m equations into n more or less equal groups, add the equations within a group, and then solve the resulting n equations for the n unknows. As an illustration, we do EXAMPLE I. Find an approximate solution for the equations (where x and yare used in place of Xl , X2)
2x+4y= II 3x -
y
= -5
2x+ y = x
+ 5y =
15.
If we group the first two and the last two equations, we obtain
5x+3y= 6 3x
+ 6y =
16,
whence X = -4/7, Y = 62/21. If we group the first and third, and the second and fourth equations, we obtain 4x + 5y = 12 4x
+ 4y =
to
so that X = t, y = 2. If we group the first and fourth, the second and third equations, we obtain 3x 5x
and x
= -4/5, y = 142/45.
+ 9y =
26
= -4,
377
9.5. INCONSISTENT EQUATIONS
The example illustrates the method; it also illustrates the profound effect on the answers due to the particular method of grouping. If we substitute the values of the first solution for x and y into the original four equations, the respective left-hand sides are 32/3, -14/3, 38/21, 298/21. The respective "errors" are e1 = II - 32/3 = 1/3, e2 = -5 + 14/3 = -1/3, ea = I - 38/21 = -17/21,e4 = 15 -298/21 = 17/21. We note that
~e,=O,
(9.5:2)
and the solution satisfies the "centroid" equation 8x + 9y = 22 obtained by adding all four equations together (division by 4 to get an "average" causes no essential change). The same remarks hold for the other two solutions. We take a hint from the preceding work on curve fitting. Let (9.5:3)
X;
= X;,
j = 1,2, ... , n,
be an approximate solution of the simultaneous equations 9.5: I. Define the errors to be n
(9.5:4)
e.
=
b, - ~ ajjX; ,
i = 1,2, ... , m;
;=1
then, in place of 9.5:2, we impose the condition that (9.5:5)
be a minimum. As before, we can show that S is a minimum at the solution of the equations Sx; = 0, j = I, 2, "', n, or m
(9.5:6)
Xl
~ ai1 a t; .-1
+X
m
2
~ ai2aij i-I
m
+ ... + Xn ~ aina .; = .-1
m
~ a,;bi , ,=1
j
= 1,2, ... , n.
These are the "normal" equations for the least square solution of Eqs. 9.5:1. To do the preceding example by the method of least squares, we form the following self-explanatory table (and use X and Y in place of Xl and X 2 ):
9. CURVE FITTING
378
all
2 3 2
a'a
b,
a:1
a~2
16
4
II
4
-I
-5
9
I
I
4
5
15 18
Qilail
allb,
a,.)J,
22 -15 2 15
44 5
25
8 -3 2 5
43
12
24
125
I
75
Hence, 18X+ 12Y= 24 12X
+ 43Y =
125.
Solving these two equations, we find X = -26/35, Y = 109/35. Note that this solution is close to but not on the graph of the centroid equation. The errors this time are 1/35, 12/35, -22/35, 6/35, respectively. EXAMPLE
2.
An experiment in sugar chemistry gave rise to the following
equations: 133.37x - 2.872xy
= 50.13
133.37x - 4.898xy
=
133.37x - 6.923xy
= 49.91
133.37x - 8.949xy
= 49.84;
49.97
find x and y. Since x has the same coefficient in all four equations, it seems natural to subtract one equation from another and then solve the resulting equation for xy. Unfortunately, different choices for the two equations will result in widely different values for xy. We abandon this attack and use the method of least squares. Regard x as one variable and xy as the other; the method of least squares leads to the normal equations 71150.23x - 3153.134 xy -3153.13x
Solving, we find x
+
160.2513xy
=
26653.99
= -1180.272.
= 0.37665, xy = 0.0459129; whence y = 0.12190.
9.5. INCONSISTENT EQUATIONS
379
EXAMPLE 3. Determine the parameters in y so that its graph is a good fit for the points:
xi
~6
;ro.s7
=
a
+ h sin x + c cos x
~7
~8
03
1.0
1.1
1.2
1.3
1.4
1.5
0.98
1.10
1.20
1.30
1.38
1.45
1.53
1.60
1.65
(this is the postponed problem, illustrative example 4 of Section 9.4). We use the method of this section as follows. Substitute the values of x and y into y = a + h sin x + c cos x; we obtain the ten linear equations in the unknowns a, h, and c: a + 0.565b
+ 0.825c = a + 0.644b + 0.765c =
0.87
a + 0.717b
+ 0.697c =
1.10
+ 0.622c = a + 0.841b + 0.54Oc =
1.20
a + 0.783b
0.98
1.30
a + 0.891b
+ 0.454c = 1.38 a + 0.932b + 0.362c = 1.45 a + 0.964b + 0.267c = 1.53 a + 0.985b
+ 0.170c = a + 0.997b + 0.071c =
1.60 1.65.
The method of least squares yields the equations
+ 8.319b + 4.773c = 8.319a + 7.l24b + 3.637c = 4.773a + 3.637b + 2.873c = lOa
13.060 11.221 5.632.
Solving, we find a = 0.56, h = 1.12, c = -0.38 so that y 1.12 sin x - 0.38 cos x is the required equation.
= 0.56
+
EXAMPLE 4. Find the equation of a circle which is a good fit for the points (0.0, 4.58), (0.5, 4.96), (1.0, 5.20), (1.5, 5.34), (2.0, 5.38).
Solution I. Call the points A, B, C, D, E, in the given order. If the five points were on one circle, the perpendicular bisectors of AB, BC, CD, DE would meet in a common point, the center of the circle.
9. CURVE FITTING
380
Since the five points do not lie on one circle, the equations of the perpendicular bisectors form the inconsistent set
+ 0.76y = 3.8752 x + 0.48y = 3.1884 x + 0.28y = 2.7256 x + 0.08y = 2.1788. x
The method of least squares leads to the normal equations
4x + l.60x
1.6Oy
= 11.9680
+ 0.8928y =
5.413056.
Solving, we find x = 2.002, y = 2.476; we take the point 0: (2.002, 2.476) as the center of the required circle. The distances OA, OB, ~C, OD, OE are, respectively, 2.9043, 2.9028, 2.9024, 2.9077, 2.9040. We take the arithmetic average, 2.9042, for the radius so that the equation of the required circle is (x - 2.002)2 + (y - 2.476)2 = 2.90422 or x 2 + y2 - 4.004x - 4.952y + 1.704 = O. Solution 2. The required equation is of the form ax + by + c = x 2 + y2. Substituting the coordinates of the five points for x and y, we obtain the set of equations
+ c = 20.9764 0.5a + 4.96b + c = 24.8516 a + 5.20b + c = 28.0400 1.5a + 5.34b + c = 30.7656 2a + 5.38b + c = 32.9444. 4.58b
The normal equations are
+
26.45b
+ 5a +
130.078b
7.5a 26.45a
+
5c = 152.503
+ 25.46c = 25.46b + 5c =
706.673 137.578,
whence a = 4.0 I 0, b = 4.950, c = -1.697. The equation of the required circle is, therefore, x 2 + y2 - 4.01Ox - 4.950y + 1.697 = 0, a result close to but different from the previous result.
381
9.S. INCONSISTENT EQUATIONS
We do not investigate here methods for finding approximate solutions for a set of nonlinear equations which cannot be transformed into a set of linear equations. EXERCISE 9.5 1. Find solutions which are good fits for the following sets of equations.
a.
2x - 3y 5x + y 3x + y 3x + 2y
d.
2.Ix - 5.Oy - 3.2z = 23.55 3.2x - 2.4y - 0.318 = 13.32 4.5x + 0.4y + 1.918 = 5.32 4.9x + 1.8y + 2.718 = 1.S9 5.7x - 2.2y + 3.418 = 8.35
= = = =
14.0 9.5 4.5 I.S
b.
c.
x - 8y = 1.2 2x + 5y = - 12.4 4x - 13y = -8.0 5x - 16y = -10.2
e.
x + 2y 2x - y + 2x - 3y 3x + y 5x + 2y + 7x + 4y -
1.32x + 4.07y 4.96x + 5.21y 8.22x - 0.58y 10.57x - 3.94y
18 + W 318 - 4w 318 + 5w 18 + 2w 618 - 3w 518 - 5w
= = = =
0.54 25.05 62.64 87.78
10.2
=
= -17.0 = 15.3 = II.8 = -15.1 19.8
=
2. Find values for x, y, and 18 which will yield good fits for the following sets of equations.
a. 3x + 2yl 5x - yl 7x - 2y l 9x + yl
= = = =
8.2 9.3 12.5 19.1
b. 5.Ix - xy = 6. Ix + xy = 7.Ix + 2xy = 8.1x - 3xy =
13.10 c. 2xy - 3yz - xz = 233.4 190.2 24.20 3xy + yz - 4xz = 31.48 3xy + 3yz + xz = -51.5 15.38 5xy + 5yz + 3xz = -127.5
3. In examples I and 2, define the error for a particular equation to be the difference between the right-hand side and the value of the left-hand side when the solution is substituted for the variables. Determine the various errors. 4. Do all parts of example I, Exercise 9.2, by the methods of this section. 5. Do all parts of examples I and 2, Exercise 9.3, by the methods of this section. 6. Do all parts of example I, Exercise 9.4, by the methods of this section. 7. Do parts a and b of example 2, Exercise 9.4, by the methods of this section. 8. Fit a vertical ellipse to the following points by the methods of this section. x
y
I
1.0 -2.296
1.2
1.4
1.6
1.8
2.0
-2.072
-1.878
-1.842
-1.792
-1.775
9. Let (Xi, Yi) be the given coordinates of a point in one of the examples 4-8; let Yi be the corresponding value of y calculated from the equation after the parameters have been found; determine the various errors Yi - Yi .
Bibliography
A brief list of books for supplementary reading and historical notes. Several of the works cited contain extensive reference lists. Curtiss, J. H. (ed.), "Numerical Analysis: Proceedings of Symposia in Applied Mathematics," Vol. VI. McGraw-Hill, New York, 1956. Davis, D. S., "Nomography and Empirical Equations." Holt, New York, 1955. Hartree, D. R., "Numerical Analysis." Oxford Univ. Press (Clarendon), London and New York, 1952. Hildebrand, F. B., "Introduction to Numerical Analysis." McGraw-Hill, New York, 1956. Householder, A. S., "Principles of Numerical Analysis." McGraw-Hill, New York, 195~. Johnson, L. H., "Nomography and Empirical Equations." Wiley, New York, 1952. Kopal, Z., "Numerical Analysis." Wiley, New York, 1955. Levens, A. S., "Nomography," 2nd ed. Wiley, New York, 1959. Lipka, J., "Graphical and Mechanical Computation." Wiley, New York, 1918. Milne, W. E., "Numerical Solution of Differential Equations." Wiley, New York, 1953. Nielsen, K. L., "Methods in Numerical Analysis." Macmillan, New York, 1956. Paige, L. J., and O. Taussky (eds.), "Simultaneous Linear Equations and the Determination of Eigenvalues." Natl. Bureau of Standards, Appl. Math. Ser. 29, 1953. Scarborough, J. B., "Numerical Mathematical Analysis," 5th ed. Johns Hopkins Press, Baltimore, 1962. Steffensen, J. F., "Interpolation." Williams & Wilkins, Baltimore, 1927. (2nd ed., Chelsea, New York, 1950.) Stiefel, E. L., "An Introduction to Numerical Mathematics," translated from the German by W. C. Rheinboldt. Academic Press, New York, 1963. Todd, John (ed.), "Survey of Numerical Analysis." McGraw-Hill, New York, 1962. Whittaker, E. T., and G. Robinson, "The Calculus of Observations," 4th ed. Blackie, London, 1946. 382
Answers
EXERCISE 1.1
1a. Unit. loo b. Tenth. 10-1 c. Thousandth. 10-3 d. Hundredth. 10-1 e. Millionth. 10-8 f. Tenth. 10-1 I. Hundred-thousandth. 10-6 h. Millionth. 10- 8 I. Millionth. 10-' j. Hundred-thousandth. 10-6 • 2a. Thousand. 108 ; or. hundred. 101 ; or. ten. 10; or. unit. 10°. b. Same as a c. Million. 10'; or. hundred-thousand. 10'; ... ; or. unit. loo d. Unit. loo e. Unit. 10° f. 10; or. unit. loo. 3a. 4 b. 4 c. 5 d. I
e. 2 or 3 f. 7 I. 7 h. 5 I. 7 j. 4.
4. 1a. 4.36 X 101 b. 7.502 X 101 c. 2.006 X 10° d. 5 X 10-1 e. 5.0 X 10-6 f. 4.000 X 101 1.0 X 10-6 h. 1.976530 X loo I. 1.000001 X loo j. 8.8309000 X 101• 2a. 9.56000 X 10' or 9.5600 X 106 or 9.560 X 10' or 9.56 X 10' b. 9.06000 X 10' or 9.0600 X 10~. etc. c. 1.000000 X 10' or 1.00000 X 10'•...• I X 10' d. 1.000001 X 10' e.9.99999 X 10' f. 3.020010 X 10' or 3.02001 X 10'. 3a.4.029 X 108 b.4.029 X 10 c. 5.3670 X 10 d. 2 X 10-' e. 1.90 X 101 or 1.9 X 101 f. 2.000000 X 10° I. 2.000006 X loo h. 3.0002 X 10° I. 8.310400 X 10 j. 8.040 X 10-1•
Sa. 4.330 b. 682.5 c. 29.00 d. 102800 e. 0.07654 f. 8976 I. 1.000 h. 1.350 I. 407.4 j. 32.11. 6a. 3.143 h. 3.629.000
b. 3.142 i. 31.01
7a. 3.1 b. 3.1 j. 63360.0.
Ia. 3 b. I
c. 33330 j. 63360.
d. 1.000
e. 1.000
c. 33333.3 d. 1.0 e. 1.0 f. 0.1
f. 0.08994
I. 0.01899
I. 0.0 h. 3628800.0 I. 31.0
c. 2 d. 5 e. 2 f. 2 I. 4 h. 4 i. 2 j. 3. EXERCISE 1.2
b. 0.019.0.0068.0.68 % 1a. 0.015.0.011. 1.1 % d. 100. 0.0028. 0.28% e. 0.0078. 0.00029. 0.029% I. 393. 0.001. 0.1 % h. 0.00004. 0.00021. 0.021 % j. 0.40 (mm). 0.016. 1.6%.
c. -0.0026.0.00021.0.021 % f. 0.00012. 0.00011. 0.011 % I. -0.63 (in.). 0.016. 1.6%
la. 0.005.0.0003 b. 0.00005.0.00016 c. 0.5.0.011 d. 0.5.0.00007 e. 50.0.0053 or 5. 0.00053 or 0.5. 0.000053 f. 5 X 10-'.0.17 I. 0.05.5.8 X 10-' h. 0.0005.
0.0017 I. 0.05.0.027 ,. 0.5.0.25. 3. 0.000293
4. (y2)"/1 - (e/2)v'i- = 0.0221. 383
3&4
ANSWERS
EXERCISE 1.3
1. P 3. P
= -0.01 in.; = 0.0005 in.;
a a
= 0.0009. = 0.13.
2. P = 0.8 gm; a = 0.00081.
4. The measurement of the cylinder is the more precise and the more accurate.
5. P = -0.0025 in., a a = 0.00084.
= 0.00084; P = -0.005 in.,
a
= 0.00084; P = -0.02 ft,
EXERCISE 1.4
dx 1a. nx"-l dx, n -
C.
x
dx
dx I dx e. - ; - - x Inx x dx h. a Z In a dx; x In a - . x
7rX
7r
d. - -sinxdx' 180 '
dx I. eZdx; x x
dx loglo e dx f • logloe-; --x loglo X X
- -tanx180 x
3. 93.6 ± 0.2 mm or 94 mm; 33.09 (2 significant figures).
d.'t
cos x dx; x ctn x x
± 0.08 mm or 33 mm;
4. 61.6 ± 0.4 in. or 62 ± I in.; 302 13.72 ± 0.16 in. or 14 in.
±
5. P = 0.0063, a = 0.0092.
548
±
3 mm S or 550 mm l
4 sq in. or 300 sq in. (2 significant figures); 6. 312
± 2 sq ft.
I = 0.0018,1 dA 1 = 0.34 sq .m.; IVdV I = 0.003, 1dV 1 = 0.5 cu .m. 8. Id; I = 0.0083,1 dW 1 = 0.12 lb. 9.1 ~ I = 0.021,1 dF 1 = 0.000009 k. 11.1 ~ I 0.066, 1cis 1 0.97. 10·1~ 1= O.I,ldFI =0.09. dA 7. I A
=
12.
I I d:
=
14. r 1 = -2.452
0.42,1 dsl = 0.023.
=
± 0.011, rs = 0.956 ± 0.004.
EXERCISE 1.5
1. If side of square is a, then: a. 1da 1 < 0.005 mm b. 1da 1 < 0.1 mm c. To within 0.007 mm d. To within 0.007 mm e. To within 0.0035 mm. 2a.
Id; I < 0.001
b.
Id; I < 0.0005
3. I da 1 = 1de 1 < 0.000039 cm.
c.
Id; I < 0.00049.
4. 1da 1 = 1db 1 = 1de 1 < 0.002 ft.
5. Take 1dw 1 = 3 1dr I; 1dr 1 < 0.000029 in., w correct to 4 significant figures. (Note: the value for 7r should be correct to 5 decimal places.) 6. Assume 1dm 1 = 1dM 1 = 2 1dr I;
Id; I<
0.0000027.
then
I~ I < 0.0034, Id:: I < 0.00002,
ANSWERS
385 EXERCISE 2.2
+ lx +
1. pb) = I
l •
2. pb) = 0.841
1.284(x - I) - 1.04I(x - 1)1. sin(0.9)1 - PI(0.9) = 0.021.
I
3. pix) = 384 (384 4. PI(X) = I
+ 6( I
+ 192x + 48xl + 5
+ 2x + - Xl; error at 8
2
8x3 + x'); e - p,(2)
I x = - x3[e X (I - X)-l
= 0.010.
+ 3(1 - X)-I + 6(1 -
X)-3
6 where X is between 0 and x.
- X)-'] "" - X3 eX, 3
-I - 4(x - I) - 5(x - 1)1. I x - I I < 0.2.
5. P3(X)
=
6. PI(X)
= I +"3 x + 18 Xl + 162 x 3. P3( I) = 1.4. Estimated error and actual error "" I.
7. P3(X)
= I
I
I
+ (x
I
3 - I) - - (x - 1)1
8
f( 1.S) - p(1.5) = 0.095.
II (x - 1)1. 48
+-
P3(1.5) = 1.935;
EXERCISE 2.4
1. 0.27226, 0.82628, 1.4062, 3.0591, 8.0387. 2. 0.09967, 0.19737, 0.46128, 0.74682, 0.88208, 3. 0.1469, 0.4777, 0.8650, 2.130, 6.230, 22.48. 5. 0.9983, -0.03330, -0.3323, 0.01998; 0.9933, 0.9589, -0.1625, -0.3087, 0.09733; 0.8414, 0.4546, -0.4354, -0.01925, 0.2369; -0.1892,
0.88623. -0.06640, -0.3293, 0.03986; -0.7874, -0.2391, 0.1771; -0.II6I, 0.2473, -0.02203.
EXERCISE 2.5
1. 0.00036 (n
2a.
Il I Il I
=
5).
2. 0.18(n = I); 0.0982 (n
4).
5. 2.929, 7.485, 0.701.
EXERCISE 2.6
II x I - mx I dx
= hI
and is therefore independent of m.
-1
l [I x I - mx]1 dx
= Ih3(1 + ml) and is a minimum at m = O.
-1
c.
~
f(x) - mx I dx = I
positive x, mx >
I
l
Xl.
3
if m ;;. 0 and h is so small that, for
In this case, a minimum exists at m
(f(x) _ mx)1 dx =
_1
+ mhl -..!!...
~+~+ 3
5
m (2h
3
3
=
O.
_.!!....) +m 2
l
2h3 3
;
minimum at
3h - 4 m=--8-'
3b.
Il
(I x I - ax l - bX)1 dx
= a
(2h" _ he) +
5 and b are not uniquely determined for a minimum. _1
h 3b
3
+ 2h3 3
. The coefficients a
386
ANSWERS EXERCISE 3.1
1. fl (I X 1 - ax - b)I dx
f'
= 1 + lal
- 2h
+ 2h1; minimum for Pl(X) = i.
-1
(I x 1 - a - bx - exl)1 dx is a minimum for PI(X)
=
-1
I (28 - x + 40x' ). 81
-
EXERCISE 3.2 I
2. y = - 10 (6x 8 3. y = -I 5• y
+ 6x ..I
6. y = -
I
2e 7a. y = Xl
I
X
[(e -
I
- Xl.
60-9
=
23x l - IIx + 28).
-
4. y = 72 (-72 + 430x - 71x1 + x'). 9-40 2.. x
+
= -0.05215xl + 0.53208x.
1)1 Xl + (el - I) x + 2e] = 0.54308xl + 1.17520x + I.
b. y = x. EXERCISE 3.3
1a. y = -3x - I
b. y = 1(2x
+ 25)
= -II + 6x - Xl h.
y
+ ix
- 1
I
f. y = 10 (-6x 8 + 23x l + IIx - 28)
e. y = 2.0667 + 1.0500x - 0.816;X ' ,. y
c. y = 4 d. y = iX'
= 72(-72 + 430x - 71x1 + x 8)
I. y = 13860 (339x 4 - 21 34x8 -7841x l + 32596x + 74060)
J.
y = 1 + 6x - iX'.
3a. y = 0.00248 44733x+4.99769 38220 b. y = -0.00000 30786x'+0.00496 27463x + 4.4989421504 c. y = 0.00000 00051x 8 - 0.00000 92445x l + 0.0074475989x + 4.1651449880 d. Same as c e. Same as c f. 5.9979427726 ,. 5.9979427726, 5.9979435114, 5.9979435132 h. 5.9979435132. EXERCISE 3,4
1a.
-I
e.
2
-I
0.2
-3 0
1.050
-I
2.3
-0.817 -3.033
4 I.
-4
-6.8
3 0.8000 7
0.7667 2.3333
-2
0
-0.1540 -0.6190
-0.1429 5 -I
0.0714 0.5000
7
0
0.0245 0.1151
ANSWERS
l87 EXERCISE l.6 I
1a. y = 60 (-18 - 97x+ 32x1 + 23x 3 ) b. y = 0.4599x3 +O.9401x'- 1.4305x - 0.8180. l. y = IOx3 - 9x; y(2) = 62; estimated error = 90, actual error = 2. Sa. y = 1.00212 - 0.OOO34x - 0.OOOI4x'; y(30) = 0.86592; actual error = 0.00011; predicted margin of error = 0.0017 b. y = 1.000000 + 0.0000315x - 0.OOOI579x· + 0.00000027x3; y(30) = 0.86621; actual error = -0.00018; predicted error = 0.00000 (actual error is due to rounding-off)
c. y
= 0.93969 - 0.006676(x - 20) - 0.OOOI36(x - 20) (x
- 25); y(30) = 0.88613; -0.00010; predicted error = 0.00005 (again, rounding-off influences
actual error answer).
EXERCISE l.7
1a.
-3
c.
1.76
3.0
-3.025
3.2
-3.000
-1.76 0
25 4.65
0 2.89
10 -2
35
3 2.89
3.4
-2.965
8
3.6
-2.922
-I
-3
43 5 48 3.8 la.
20
-0.46595
40
-0.19193
-2.874
27402 -14456 12946 60
-0.06247
7092 -7364
5582 80
-0.00665
-5310 1782
-5582 0
100
-0.00665
(Note: log sin 20° = 9.53405 - 10 = -0.46595, etc.)
EXERCISE l.8
1.
V40I =
20.0250; estimated error = 0.0000, actual error = 0.0000
V405.2 = 20.1296; estimated error = 0.0000, actual error = 0.0000 V 409.25 = 20.2299; estimated error = 0.0000, actual error = 0.0000. lao /( -6.02) = 0.2430, /( -6.125) = 0.2187 c. /(0.011) = 0.803483, /(0.0193) = 0.682275, /(0.02015) = 0.670995 e. 10(2.015) = 0.2153, 10(2.407) = -0.0011; U2.507) = 0.4953, 11(2.834) = 0.3984. EXERCISE l.9
1.
V39s =
19.8752; estimated error" 0.0006, actual error
=
0.0006
V 415 = 20.3723; estimated error" 0.0007, actual error = -0.0007.
ANSWERS
388
3a. (Actual values) 100e-i = 0.6738, 100e-i •• = 0.3028, 100e-a•a = 0.1360, 100e-8 •m = 0.1216 c. (1.009)-10 = 0.8359, (1.04)-10 = 0.4564, (1.05)-10 =0.3769 e. 10(1) = 0.7652, 10(1.9) = 0.2818,10(3.5) = -0.3801; 1,(1.95) = 0.5794,1,(3.02) = 0.3316, 1,(3.15) = 0.2812 EXERCISE 3.11
1a. y = 0.318 sin 'lTX, y = 0.381 sin 'lTX
+ 0.006 sin 3'ITx.
-
0.031 sin 2'ITx, y = 0.386 sin 'lTX
-
0.040 sin 2'ITx
3a. y = e'-z b. Errors are 0.029, 0.006, 0.004, 0.014, respectively. Sa. (n = m = 2) C(x) =
~ (1
-
3 ~ sin 2'IT(x - 1)
+ cos 'IT(x
- 1») .
7. y = 0.048lxe'·8CIZ; errors are approximately 1,4,222, respectively. EXERCISE 4.2
1. 4.384 3. 1.133 7. 1.224, -1.550, -4.713, -7.854
5. 2,4, -0.767 9. 2.78
EXERCISE 5.1
1a. 0.860,2.230,3.910 c. 0.893,2.270,2.838 d. 0.732,1.414, -1.414, -2.732. la. 0.1716,5.8284. EXERCISE 5.2
la. -2.449, -2.303, 1.303,2.449 b. -0.434,0.768 (each is a double root) c. -1.949, -1.852, 1.783, 2.052, 3.166. 4a. 2 ± 1.414i, -1 ± 0.707i(2 ± V2i, -1 ±
~i)
b. -2.096, 1.500 ± 1.658i, 2.548 ± 0.424i c. -2 ± 3.162i, 3 ± 2.236i( -2 ±
VIoi, 3 ± Vsi).
EXERCISE 5.3
1. 9. 21. 25.
2.47345 3. 1.497 0.3085, 1.467,5.006 0.854,2.601, -1.826 2.5943, -0.36939
5. 13. 24. 26.
-1.028 7. 2.870, 3.088 10.223 17. 0.137 (a = 401.75) 408.4, (a = 970.23) 5481 Least positive root, 0.7259. EXERCISE 5.4
la.1.148,2.197 c. 0.710,0.916, -1.396 e.0.771,1.229. EXERCISE 6.1
1a. 0.895,1.723 c. 0.588 e. 1.070, -0.399, -0.807, -1.265. la. (x, y,.8') = (0.35, -1.53, 1.65), (1.53, 1.88,0.47), (-1.88, -0.35,3.88), (-2,0,4).
ANSWERS
389
EXERCISE 6.2
la. (x, y) = (3,2),
(3.584, -1.848),
(-2.805, 3.131),
(-3.779, -3.283)
c. (x,y) = (±0.175, 8.877), (±1.475, 0.299), (±1.518, -0.215). EXERCISE 6.4
1a. x = -2, Y = 2, !II = 5, w = -I b. x = 2/3, Y = 4, c. x = 0.83, Y = -4.02, !II = 3.91, w = 0.56 d. x = 15.2, Y = 12.9, !II = 0.84, u = -3.75, () = 10.16. lao x b. x
!II
= -12/5, w = -5/2
= 3.086, Y = -2.409, !II = -10.322, w = 0.577 = -8.233, Y = 4.114, !II = -0.598, u = -3.294, () = 3.702. EXERCISE 7.2
1. Usingxo = 0.5,/,(0.5)
= 1.79,error
=
0.21;/,(0.9)
= 1.16,error = -0.05.
la. 0.01440, 0.01569, 0.01618, 0.00694, 0.01744, 0.01718 C. /'(1) = 5.2./'(3) = 3.3,/,(6) = 2.17./'(8) = 1.72.
EXERCISE 7.4
EXERCISE 7.7
la. -1.6941, -0.7240, 0.7921, 2.1094, 4.6530. C. -19.84136, -4.01038, 12.15403, 53.94016, 106.48444. EXERCISE 7.8
lao 0.87
C.
h
lb. 24 (-Yo
0.54, 0.81, 1.08, 1.34, 1.56 e. 1.406, 3.059, 5.179, 8.039, 17.736.
+ 13Yl + 13YI
- Ya)
h
C.
3(Y-l
- 2yo
+ 7YI)·
EXERCISE 7.10
+ 38.98 = 62.83 (Simpson's extended rule, h = t, yields 59.10). - [(e· + 41e- 1) - 4(e ' - 4Oe- 1) x + 100e' - 13e- 1) xl) 27 0.8323 + 1.0853x + 0.9654x·.
2. 59.55; 23.85
lb. P.(x) = =
I
ANSWERS
390
EXERCISE 8.2
x8
X3
Xl
X.
I 3. Y3 = 48 (29
2! + 3! + 4! + TI· 1(-10 + 12x - 6Xl + x 3 ).
1. Y. =
5. Y8 =
+
ISxl
+ 3x· + Xl).
+ X + Ix8 •
7. Y3 = I
EXERCISE 8.3 x3
x3
1. Y
=
I
X -
3. Y = I
+ (x
+ (x
X
Xl
x"
11
21
nl
I
(x - 1)3
X -
+ -I!- -
-2-!-
ISI(x-I)' 1091(x-1)7 6! 7!
10.. Y = ao
=
a,,(x - I)"
n!
+ ....
2. 3. 4 •....
- 1)1 =f ...
+ (-I),,-l(x -
I)"
+ ....
+ .... (x - 1)1
(x - I)·
+ -3-1- + -4-!-
-
19(x - 1)1 51
7841(x-I)B S6SI9(X-I)'). ( _ 0 4 81 9! • Y 1.5) - .513.
+
2x.
Xl
9b. Y = 1
+ ... +
31
- I) a"_3 • n
- I) - (x - 1)3
+ - + - + ... + -
8. Y = e- 1 ( 1
+
4(x - 1)1
+
21
= a"_l + (n
where a"
= I
2(x - 1)8
+ -11- +
5. Y = -I
7. Y
x"+1
-+-+ ... +---+ .... 21 31 (n + 1)1
OXI
+ x + -3! + - 4! + - 51 . Xl
2a 1x·
a"x3
3xl
(n - 2) ax"
4a"x8
+ alx + -21 + - 31 + -4!- + -S! + -6!- + ... ..J..' n l
where a is a o • al • or I according as n = 3k. 3k
11. Y = -2(x - I)
+
2(x - 1)8
2!
+
19(x - 1)3 31
+
+ I.
3k
+ ... •
+ 2.
72.S(x - 1).
279.2S(x - 1)1
41
51
EXERCISE 8.5
1. (0.05. 0.0013). (0.50.0.1487).
(0.10. 0.0052).
(0.20. 0.0214).
(0.30. 0.0499).
(0.40. 0.0918).
4. (1.2. 2.867). (1.4. 2.829). (1.8. 2.911). (2. 3.000). (2.6. 3.369). (3. 3.667). 7. (2.3. 1.036).
(2.9. 1.084).
(3.8. 1.120).
10. (0.5. -1.099). (0.6. -0.847). (0.8.
(4.4. 1.131).
(5.0. 1.137).
-0.405). (1.0). (1.2.0.405). (1.5.1.099).
EXERCISE 8.7
11. (0.2. -2.130). 14. (-0.8. 1.098). 15. (1.3. 1.5490).
(0.4. -0.755).
(0.8.1.216).
(-0.6. 1.176). (1.6. 0.9324).
(0. 1).
(1.4.3.751).
(0.4. 0.517).
(2.5. 0.2426).
(2.7.297).
(I. 0).
(3.4. 0.0725).
(4. 0.0338).
391
ANSWERS
EXERCISE 8.9
1. (t, x, y) = (9.5,9.76,8.08), (10, 10.54,8.16), (10.5, 11.34,8.24), (11, 12.16, 8.32), (12, 13.86, 8.46), (13, 15.62, 8.61), (14, 17.46, 8.74), (15, 19.36, 8.87). 3. (t, x,y) = (0.1, -0.7952, 1.1048), (0.3, -0.3598,1.3409), (0.8,0.8206,2.0541), (1,1.3012,2.3818), (1.4,2.2155,3.1154), (2, 3.3254, 4.4932).
(0.5,0.1018,1.6070), (1.8,3.0010,3.9866),
5. (t, x, y, 03') = (1.4,0.336,0.845, -0.592), (1.8,0.588, 0.745, -0.154), 0.674,0.323), (2.6,0.956,0.620,0.840), (3, 1.099,0.577, 1.394). 7. (1.2, 1.4598),
(1.4,2.0370),
9. (4.4, 7.132),
(4.8, 8.325),
(1.6,2.7255), (5.2, 9.577),
(1.8,3.5168),
(5.6, 10.886),
(2.2, 0.788,
(2,4.4012).
(6, 12.247).
11. (1.2,3.637), (1.4,4.798), (1.6,6.265), (1.8,8.116), (2,10.450). EXERCISE 9.2
1a(iii). c(iii). e(iii). • (iii).
30x - 14y + II = 0, 98x - 45y + 33 = 0, y = 2.340x + 0.490. y = 1.142x - 0.315, x = 0.872y + 0.318, y = 1.113x - 0.064. y = 3.024x - 0.364, x = 0.329y + 0.140, y = 3.000x - 0.250. y = -2.032x + 5.310, x = -0.492y + 2.616, y = -1.736x + 4.043. EXERCISE 9.3
I a. y = -(40xl - 31x -78) 35 c. y = 1.430 + 1.003x - 0.237xl e. y = 2.4806 - 2.991Ox 5. y = 2.89xl - 5.56x - 1.44. 3. y = 1.08lxl - 2.914x.
1. Least square solutions.
+ 0.5014xl.
EXERCISE 9.4
= 0.34x1.1 C. Y = 1O.3x-1ol e. y = 0.021(1.565)~ •. y = el.B-O.I'~ = 5.12 + 3.07 log x k. y = 0.45 + 2.12sinx - 1.93sinl x. la. y = 3.36x - 0.59~ c. y = 2x + 1.18e00l1~ e. y = 2.57 - 1.85ro.31~ •• y = 1O.45(x - 2.8)-l.Il i. y = x-o.'I(1 + 2.05x)1.U. 1a. y i. y
EXERCISE 9.5
1a. (2.5, -3.1)
c. (7.45, -2.28)
e. (1,2, -3,2).
2b. (3.34, 1.16). 8. Xl
+ 0.0875yl
- 3.6483x
+
1.6552y
+ 5.9880
=
O.
Index
Accuracy, 10 Adams, J. C., 322 Advancing formula(s}, 330, 331, 344, 348 Aitkin, A. C., 86 Aitkin-Neville processes, 86 Algorithmic methods, 137 Approximating polynomial, 67 Arithmetic methods, 137 Asymptotic series (expansion, representation), 49 Averages, method of, 358, 367 Bernouilli, James, 35 Bernouilli numbers, 36 Bernouilli polynomials, 51 Bessel's equation of order zero, 308 Boundary conditions, 295 Bromwich, T. J., 50
diagonals of table, 80 order of, 78 table of, 79 Equally spaced points, 97 Error(s}, 7 actual, 7 computational, 12, 106 inherent, 106 margin of, 4, 8 maximum, 8 maximum relative, 8 per cent maximum relative, 8 per cent relative actual, 7 relative actual, 7 replacement, 23 Error analysis, curve fitting, 354, 355, 362,
377 Error analysis, differential equations, 296,
Carrier curve, 142 Cauchy, A. L., see Vandermonde-Cauchy determinant Center of gravity, see Centroid Centroid, 357 Centroids, method of, 367 Characteristic function, 250 Chords, method of, 194, 209 Correcting formulas, 330, 331, 344, 348 Cotes, R., see Newton-Cotes formula Closed type formulas, 273 Dandelin, G., 171 Differential equation solution(s}, 294 general, 294 particular, 294 particular family, 294 pointwise solution, 297 Divided difference(s}, 78
303, 319, 323, 332, 337, 338 Error function, 26, 29, -41, 47, 88, 91,
104, 247, 248, 253, 255, 256, 279, 280 Euler numbers, 46 Euler's constant, 54 Euler's summation formulas, 54, 59 Everett, J. D., see Laplace-Everett formula Extrapolation, 117 Factorial polynomial, 220 False position, method of, 192 Finite difference(s}, 97 order of, 97 table of, 98 Fourier series, 128 Gauss' central difference formulas, 103 Gaussian coefficients, 288
393
394
Gauss' numerical integration formulas, 282 Graeffe, C. H., 171 Graph, 137 Graphical methods, 137 Gregory's formula, 266 Horner's method, 47, 169 Imaginary roots, 181, 196 Initial conditions, 295 Inspection, method of, 353 Integral equation, 300 Interpolating polynomial, see Approximating polynomial Interpolation 23 additional methods, 133 inverse, 135 linear, 23 Iteration methods, 137, 185, 203 Knopp, K., 50 Kutta's formulas, 316 Lagrange coefficient(s), 75 derivative of, 237 tables of, 102 Lagrange interpolation formula, 75 Laplace-Everett formula, 112 Least squares, method of, 359, 368, 377 Legendre polynomials, 284 Lineal element, 297 diagram, 297 Lipschitz condition, 301 Literal methods, 137 Lobachevsky, N. I., 171
INDEX
approximate, correct significant figures, 4 decimal representations, I round(ing)-off, 4 Numerical unit, I form, 2 Nystrom's formula, 325 Open type formulas, 273 Orthogonal functions, 285 Period, 52 Periodic functions, 52 Picard, E., 299 Polynomial interpolation sequence, 112 convergence of, 113 Power series, 30 algebra of, 33 alternating, 41 computation with, 40 convergent, 31 differential equations 304 divergent, 31 everywhere convergent, 31 nowhere convergent, 31 numerical integration, 257 radius of convergence, 31 Precision, IO Predicting formulas, see Advancing formulas Principle of equal effects, 20
Maclaurin series (expansion), 33 MacRobert, T. M., 50 Max-degree, 24 Mean, theorem of the, 88
Raphson, J., see Newton-Raphson method Reduction method, 200 Reguli falsi, see False position, method of Root-squaring method, 171 Round(ing)-off, see under Number Rule(s), see Scale(s) Runge, c., 315 Runge's formulas, 316
Neville, E. H., 86 Newton-Bessel formula, 112 Newton-Cotes formulas, 273 Newton-Raphson method, 189 Newton's interpolation formulas, 103 Newton-Stirling formula, 112 Nomogram, 137, 154 Normal equations, 360, 368, 377 Number(s), I
Scale(s), 142 coordinate system of, 142 linear, 142 mark of, 142 nonuniform, 143 origin of, 142 sliding, 151 stationary, 148 uniform, 142
INDEX unit distance, 142 zero point of, 142 Scientific form (notation), 3 Semi-convergent series, see Asymptotic series Sequence chain(s), 81 backward, 81 central, 82 forward, 81 Significant digit (figure), 2 Simpson's rules (formulas), 273 Standard form (notation), see Scientific form (notation) Stirling's formula, 56, 58, 60 Subtabulation, 118 Symbols, --, 49 10:1,42
395
Tables binomial coefficients, 119 binomial coefficient derivatives, 248 Gaussian coefficients, 289, 290 Legendre polynomials, 284 Legendre polynomials, roots of, 289, 290 numerical differentiation, 225, 226, 227, 228, 232, 233, 236 numerical integration, 262, 263, 264, 265, 274, 275, 276, 277 Taylor series (expansion, theorem), 26 Trapezoidal rule, 273 Vandermonde-Cauchy determinant, 72 Wallis' infinite product, 55 Weddle's formula, 273 Weierstrass, K., 67