Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Y 3. A17
21 1)
TechnicalMemorandum
SCTM 145-53(51)
>te on the numerical evaluation of integral
-e form C' f (x)>(x) dx, with particular ref,
)04-BK (3-58)
n hI
1:1
THIS IS A SANDIA CORPORATION WORKING PAPER ANDIS INTENDED PRIMARILY FOR INTERNAL DISTRIBUTION;THE IDEAS EXPRESSED HEREIN DO NOT NECESSARILYREFLECT THE OPINION OF THE CORPORATION.
II
TID-4500 (15th Ed.)PHYSICS AND MATHEMATICS
SCTM 145-53(51)
Note on the numerical evaluation of integrals of
the form f f(x)4(x) dx, with particular referenceto the determination of the expectation of a func-
tion of a normally distributed random variable.
Systems Evaluation Department
Sandia Corporation, Albuquerque, New Mexico
ABSTRACT
A method is given for the rapid and accurate numerical integration ofintegrals of the form f! f(x)4(x) dx, where f(x) is "smooth." Tablesare given for the special case (x) = 1 e -x 2 /2c2.
1'2 n a
Case No. 417.0 September 3, 1953
Printed in USA. Price $0.75. Availablefrom the Office of Technical Services,Department of Commerce, Washington 25, D. C.
Second Reprinting
May 24, 1960
1-2
INITIAL DISTRIBUTION:AFSWP - R & D (10)W. A. MacNair, 5000R. E. Poole, 1000S. C. Hight, 5100R. W. Henderson, 1200L. A. Hopkins, Jr., 1300L. J. Paddison, 1500J. R. Townsend, 1600A. B. Machen, 1700G. A. Fowler, 5200F. J. Given, 5300L. G. Abraham, 5400E. F. Cox, 5110R. W. Shephard, 5120 (25)K. W. Erickson, 5130G. E. Hansche, 5140G. T. Pelsor, 5121P. Maxwell, Jr., 5122E. Silverman, 5120M. C. Ayer, 5120G. M. Byrne, 1921-3 (2)
B DISTRIBUTION:T. F. Lonz, 4761-1 (3)
C DISTRIBUTION:TISE (325)OTS (75)U. S. Military Academy, West Point,New York - Attn: MathematicsDirector (3)
U. S. Naval Academy, Annapolis,Maryland - Attn: MathematicsDirector (3)
U. S. Air Force Academy, ColoradoSprings, Colorado - Attn:Mathematics Director (3)
ASTIA (10)W. K. Cox, 3466-1 (10)
LEGAL NOTICE
This report was prepared as an account of Governmentwork. Neither the United States, nor the Commission, noracting on behalf of the Comnission:
sponsoredany person
A. Makes any warranty or representation, expressed or implied,with respect to the accuracy, completeness, or usefulness of the in-formation contained in this report, or that the use of any informa-tion, apparatus, method, or process disclosed in this report may notinfringe privately owned rights; or
B. Assumes any liabilities with respect to the use of, or fordamages resulting from the use of any information, apparatus, method,or process disclosed in this report.
As used in the above, "person acting on behalf of the Commission"includes any employee or contractor of the Commission, or employee ofsuch contractor, to the extent that such employee or contractor of theCommission, or employee of such contractor prepares, disseminates, orprovides access to, any information pursuant to his employment or con-tract with the Commission, or his employment with such contractor.
3-4
- 5-
1. Introduction. This note is concerned with the numerical integration
of integrals of the form 4'f (x) cp (x) dx, where the function f (x)
is "smooth". It is often convenient to carry out such a numerical inte-
gration using values of the function f(x) at equally spaced points. A
particularly appropriate method would appear to be one which involves the
exact integration of an integral obtained by replacing f(x) by a smooth
function interpolating the values of f(x) at the equally spaced points.
Such a function is given by the cardinal series associated with these values
(for references to the literature on cardinal series, cf. J. M. Whittaker,
Interpolation Theory).
The integral
I = f f(x) 0(x) dx
is to be approximated in terms of the values, jf(k)}, (k = 0, + 1, + 2, ... )
of f(x) at points with integral abscissas. The cardinal series, f*(x),
associated with the values, ff(k), of f(x) is given by:
f*(x) =k f(k) sin II x-k),
The integral I is approximated by
I* = _ f*(x) Q1 (x) dx,
I*= - f (k-) isin2-n(x-k) (P(x) dx,k=-c -fkx-k))
or I* = akf(k) (1)
where ak = sin x P(x) dx. (2)
Formula (1) has two important advantages, which are, of course, shared by
other methods of numerical integration:
(A) The integral I* is expressed as a linear combination of
-6-
the given values of f, and is thus particularly well-suited to calculation
with a desk calculator.
(B) The coefficients, ak, do not depend on the particular
function, f.
2. The expectation of function of a normally distributed random variable.
Suppose it is desired to compute the expected value of a function, f(x), of
a normally distributed random variable g, and that coordinates have been
chosen so that the mean of x is 0. The expectation of f(x) is given by
I = f f(x) P(x) dx,
where (x)= e x2/24
and where o is the standard deviation of x.
Let the function f(x) be evaluated at equally spaced points, and let
the distance between an adjacent pair of these points be chosen as unit. The
integral I is then approximated by
I* = r=. ak f(k), (1)
where the coefficients ak are tabulated for various d in Table 1.
For a ' 1 an approximate formula for the coefficients ak is
1 e - k2/2d2 (2)
The error for c"= 1 is 0.0006 when k = 0 and decreases as k increases.
For c = 2 the error in (2) is of the order of 10-10 and is smaller for
larger o. Thus we have the rather surprising result that for c 1 an
integration scheme which is nearly exact for the cardinal series is obtained
simply by multiplying each value of the function f(x) by the ordinate of
the probability density function at the same point and adding the results.
Whether or not this scheme is accurate for the integration of the function
f(x) itself depends, of course, on how close to the function f(x) is its
cardinal series. A rough check on the accuracy of interpolation by the
cardinal series may be obtained by plotting the points (k, f(k)), joining
them by a smooth curve, and comparing the resulting graph with the graph
of f(x).
In terms of arbitrary linear units, one concludes from the above obser-
vations that if the graph of f(x) is sufficiently smooth, then accurate
results are obtained by evaluating f(x) at points at distance d units
apart and multiplying each such value by o and by the corresponding
ordinate of the probability density function:
cx~ 1 - (kd)2/2d2f(x) 4(x) dx" o f(ko) e-,
k2 /or .00f(x) 0(x) dx M f(ko) 1 e - k2/2
If the graph of the function f(x) is not smooth enough that the cardinal
series using values at points o units apart represents the function accu-
rately, then more closely spaced points may be used. If the function is
evaluated at rioints at distance o/n units apart, the ap roximate formula
I f(x) 4(x) dx 1 f(-) e - k2/2n2-2w n
may be used.
For a situation in which the integral I is to be computed for a fixed
function f and for a number of different values of d, it is desirable to
have tables of the coefficients ak for various d. Such coefficients are
given in Table I for o = 1/2, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20. The
distance between adjacent points at which f is evaluated is chosen as the
linear unit in terms of which the standard deviation, d, is measured.
T A 3L I
A
0
+_1
+3
+4
5
+ 6
+ 7
+9
*1
+11
Y 1i
13
"14
+15
+16
+1j7
+20
rl
:23
24
+25
126
+27
- 2
.29
+30
+3,
+32
+33
X34
+35
+36
+37
+36
+39
+40
+41
+44"
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+ .706
+.1c0
-.018
+.008
-.005
+.00
-.00:.
+.00.
-. 001
+.001
-. 1
+.QT1
-.001
. 0
0=1
.398
243
.054
.004
.000
.200
.176
.121
.065
.027
.009
.002
Q=3
.1;2.126
.106
-081
.055
.033
.018
.009
.004
.001
.001
.100
.097
.088
.075
.060
.046
.032
.022
.014
.008
. 004
.0u2
.001
.080
.078
.074
. 067
.058
.048
.039
.030
.022
.016
.011
.004
.003
.002
.G61
=6
.066
.066
.063
.059
.053
.047
.040
.034
.027
.022
.017
.012
.009
.006
.004
.003
.002
.001
.001
.001
d=8
.050
.049
.048
.046
.044
.041
.038
.034
.030
.026
.023
.019
.016
.013
.011
.009
.007
.005
.003
.002
.002
.001
.001
0=10
.040
.040
.039
.038
.037
.035
.033
.031
.029
.027
.024
.022
.017
.015
.013
.011
010G
.008
.005
.004
.004
.003
.002
.002
.00:1
.001
.uu1
.00
c=12
.034
.033
.033
.032
.031
.030
.029
.028
.027
.025
024
.022
.020
.019
.017
.015
.014
.012
.011
. v J
.008
.007
.006
.005
.005
.004
.001
.00
.001
.001
.001
.001
.001
.026
.026
.026
.026
.026
.025
.025
.024
. 023
.02Z
.2.1
.019
.018
.017
.016
.015
.015
.012
.012
.012
.010
.009
.008
.007
.006
.006
.05
.005
.004
.00/
.003
.002
.003
.002
.002
.002
.001
.001
.001
.001
.001
.001
.001
G=20
.020
.020
.020
.020
.020
.029
.019
.018
.018
.C17
.017
.016
.016
.01 5
.014
.L1
.C1'.
.012
.011
.011
.010
.'.10
.009
.009
.008
.007
.007
.006
.CC6
.006
.005
.005
.004
.C04
.004
.0C0
.003
.Cs
.002
.002
.002
.001
.001
.001
.001
.001
.001
.001
.0 -
.001
.001+54
+55
+56
.001
.000
- k
- Al-
APPENDIX
Calculation of coefficients
Al. General. The coefficients ak are given by the formula
= j si x-k) 4 (x) dx. (Al)
It may also be convenient to use the expression derived below. We have
a. =) P$(x) dx * fcos (x-k) t dt,x J (xdx " A o
n0
ak = j cos kt dt . (O(x) cos xt dx
(A2)
+ L / sin kt dt . c(x) sin xt dx.iT o -o
If Q (x) is even, the second term on the right of equation (A2) vanishes,
and the coefficient ak is seen to be, except for a multiplicative constant,
the k-th Fourier cosine coefficient of the cosine transform of 40(x):
Lk jo cos kt dt I (P(x) cos xt dx. (A3)
iarl;, if ((x) is an odd function of x, we have
ak = sinkt dt L ((x) sinxtdx.
If q (x) is even, then under conditions sufficient for the convergence of t-.:
:iurier werits of the function / 4(x) cos xt dx to the proper value, we
have
I P(x) cos xt dx = ak cos kt
for It1 < 1. In this connection it is of interest to observe that on setting
-A2 -
t = 0 we have
k= o ak = 7CO. (x) dx.
Hence if f(x) is identically constant, then the integrals I and I*
coincide, where
I = 47 f(x) cP(x) dx,
1* = J f*(x) cp(x) dx,
and f*(x) f(k) sin k)
for * = ak ff(k) = C JcQ(x) dx
and I= C 4. (x) dx
if f(x) is the constant C. Thus the formula
I _ ak f(k) (A4)
is exact when f(x) is identically constant. Indeed, it can be shown that
the cardinal series associated with values of a constant function is itself
that constant; and since the formula is exact for every cardinal series, the
above observation follows.
A2. The expectation of a function of a normally distributed random variable.
Let x be a normally distributed random variable with mean 0 and standard
deviation d. Its probability density function is
((x) =-1 e - x/262
Let f(x) be a function of the random variable g. Its expectation is the
integral
- A3 -
1222I = fCOf(x)PQ(x) dx = 1Cf(x) e x/202
Since gD(x) is even, formula (A3) for the coefficient, ak,
appropriate. We have
122/01 74(x) cos xt dx = 0e4 ex/20 cos xt
- 2 2/2
dx.
is
dx
Formula (A3) then gives
ak 2 e 2/2 cos kt dt. (A5)
The remainder of this section is devoted to the evaluation of this integral.
It is clear first of all that, for large a,
ako e 02 2/2cosktdt,
ak 1de 2 2/2cos kt dt) ,
and a 1 e - k2/202. (A6)
The error involved in this approximation is not greater than
1 f -e0 2 t 2 /2 dt = ( e _ 2t2/2 dt)
[1 - d(o)], (A7)
where m(x) is the normal cumulative distribution function,
g(x) = 1 /X et 2 /2dt.
For o = 1 this upper bound on the error is 0.00064. For o = 2 the
error in formula (A6) is not greater than 6.78 (1011). For larger o,
of course, the error is smaller.
For k = 0 and for arbitrary o we have, from (A5),
a = fe - c2t 2/2 dt = 1 f2( 0s.-I e _ 02t2/2 dt),o 19 o o 2R
= [5( wc) - 1/2], (AS)
where again G(x) is the normal cumulative distribution function.
It remains to develop methods for computing ak from (A5) for o < 1
and k > 1. On expanding the exponential in a power series, equation (A5)
becomes
ak = 1 (0)j2 2j cos kt dt,
ak? _oJ 22 u cos wku du,
or a = (-l) k (1)j20 Ck J, (A9)
1 2where Ck,j = (-1t2j cos vkt dt. (A10)
The constants (- 1 )k Ckj are tabulated in Lowan and Laderman, Journal of
Mathematics and Physics, 1943. For a situation in which these tables are
not sufficiently extensive, the recursion formula derived below may be used.
We have, from (Ala), on integrating by parts,
1 1C = (-1)k [t2j sin kt] _ f 2j-1 sin irkt dt ,k~j sk o ik o
k+1 k1CkJ = (-1) k(2 )Jf t2~ 1 sin 'kt dt, for j Zl, k> 1.
A further integration by parts yields
- A5 -
C =(l1k+1(2 j) [-cos ,ikt (t2j-1 1 2j-2 cos Jkt dtkj = rk Ak o + k o
Ckj = 2 [1-(2j-1) C ] (All)kj (urk)2 k, j-1
for j ?_l, kilo .Clearly
Ck,0 = 0 if k t_1,
Ck,0 "IC00= 1.
The following alternative series expansion of ak converges rapidly for
small 0 and large k. We have from (A5)
2
g=k 4 0, -e u /2 cos audu,K =O dku
ak n e(u) cos du,
where (u)e= -u/2
Hence 1"ak4(u) cos du
[r sin $(u)] - QT'O*(u) sin-du
=-j[- -kcos 4'(u)] + ko "(u)cos du
= (-1)k 2 2 In "(u) cos - du
kA k o (3
= (-1)k ( ) (-1)k 4 (Is) ek k
= (- 1 )k f (-1)r (2) *(2r+1) (d),k2 ro k
where $(2r+1) (n'r d) is the (2r + 1)-st derivative of $(u) = e -u /22cw
-A6-
evaluated at u = 1 d. Hence
ak ()k d j0 o(l)r (k)2r *2r+l)( 0 ). (Al2)
The Hermite polynomials, H,(x) are defined by
(9 ) 44(i)(x) = (-1) H (x) $(x),
so that equation (A12) may be rewritten
(-)klf= g(id) (- )2rH (d ). Alkk2k+o H2r+1
We have H0(x) = 1, H(x) = x, H2(x) = x2 - 1, H3(x) = x3 - 3x,
H4 (x) =x 4-6x2 + 3, H5(x) = x5 - 10x3 + 15x, H6 6x) 6-15x4 +45x2 - 150
Further Hn(x) may be determined from the recurrence relation,
H(x) = x H (x) - H (x).
For small k neither of the above series developments converges rapidly. On
expanding the cosine in (A5) in a power series, we have
= j ()jk2j 1 4 2j e - d2t2/2 at.ak jNo o(2je)dt.
Now l" t2je - d2 t2 /2dt = 1 J u2 j je-u2/2 du.W 0 0d2j+l o
Let A(x) =x u2je-u/2 du. (A14)
Then 1k -1 k (- L(k)2J A (d). (A15)
We have A (x2) = 1 -uj-1 - u2/2] + 2- I uj-2 e - u2/2 du,
A.(x) = - x2j-1 4(x) + (2j-l) A- 1 (x) (j > 1), (A16)
where
We have
where
Further Ai(x) can
- A7 -
e x/2*(x) = e
AO(x) = Q(x) - 1/2,
x 2
g~x =t---2edt,
A1 (x) = Aox - x (x),
A2(x) = 3 Ao(x) - (x) [x3 + 3x],
A3(x) = 15 AO(x) - *(x) [x5 + 5x3 + 15x],
A4 (x) = 105 A(x) - *(x) [x' + 7x5 + 35x3 + 105x].
be determined from the recurrence relation (A16).
SYSTEMS EVALUATION DEPARTMENT - 5120
mn