Está en la página 1de 8

Rational Chebyshev Approximations for the Error Function

Author(s): W. J. Cody
Source: Mathematics of Computation, Vol. 23, No. 107 (Jul., 1969), pp. 631-637
Published by: American Mathematical Society
Stable URL: http://www.jstor.org/stable/2004390 .
Accessed: 13/01/2011 17:43

Your use of the JSTOR archive indicates your acceptance of JSTOR's Terms and Conditions of Use, available at .
http://www.jstor.org/page/info/about/policies/terms.jsp. JSTOR's Terms and Conditions of Use provides, in part, that unless
you have obtained prior permission, you may not download an entire issue of a journal or multiple copies of articles, and you
may use content in the JSTOR archive only for your personal, non-commercial use.

Please contact the publisher regarding any further use of this work. Publisher contact information may be obtained at .
http://www.jstor.org/action/showPublisher?publisherCode=ams. .

Each copy of any part of a JSTOR transmission must contain the same copyright notice that appears on the screen or printed
page of such transmission.

JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of
content in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new forms
of scholarship. For more information about JSTOR, please contact support@jstor.org.

American Mathematical Society is collaborating with JSTOR to digitize, preserve and extend access to
Mathematics of Computation.

http://www.jstor.org
Rational Chebyshev Approximations for the
Error Function*
By W. J. Cody
Abstract. This note presents nearly-best rational approximations for the functions
erf (x) and erfc (x), with maximal relative errors ranging down to between 6 X 10-19 and
3 X 10-20.

In [1] Hart, et al., present rational approximations for the function

erfc (x) 1 - erf (x) = a j e-tdt

valid for 0 ? x < a, where a = 4, 8, 10, or 20. They carefully point out [1, p. 138]
that these approximations are not useful for computing the error function

erf (x) 1-erfc (x) = e-tf dt

for small x because of subtraction error, but they do not provide any alternative.
Hastings' [2] approximations for erf (x) are no better, since they explicitly use the
constant 1 as an additive term and are chosen to nearly minimize the maximum
absolute error rather than the relative error. Clenshaw's [3] Chebyshev series ex-
pansions for erf (x)/x come close to minimizing relative error, but his approximations
are somewhat inefficient because of his choice of interval and his restriction to
polynomials.
For a computer subroutine with entries for both erf (x) and erfc (x), cancellation
error can be avoided by evaluating erf (x) directly and erfc (x) indirectly (as
1 - erf (x)) when erf (x) is smaller in magnitude than erfc (x), and erf (x) indirectly
and erfe (x) directly, otherwise. The changeover point occurs for IxI .47.
In this note we present nearly-best rational approximations for the functions
erf (x) and erfc (x) with maximal relative errors ranging down to between 6 X 10-19
and 3 X 10-20. The approximation forms and intervals used are

erf (x) x 1.m


(X2 ) , lxI < .5 ,
erfc (x) ~ e-x2RJm(,) .46875 < x < 4.0,

erfc (x) x _ + 2 Rtm(1/XI)}m x


X> 4

where the Rim(z) are rational functions of degree 1 in the numerator and m in the
denominator. The relations erf (-x) = -erf (x) and erfc (-x) = 2 - erfc (x) canl
be used to evaluate the functions for negative arguments.

Received January 24, 1969.


* Work performed under the auspices of the U. S. Atomic Energy Commission.

631
632 w. J. CODY

Table I. = -100 log1o max f


AM f(x)

f(x) = erf(x), jxf < .5


w****************** ****************************************

m\ 0 1 2 3 4 5 6 7 8
*** * *** ***************4*******************************.****
O 139 313 496 688 887 1092
1 417 556* 753 960 1172 1390
2 558 702 986* 1212 1438 i666
3 80 956 1317 1465* 1698 1 935
4 962 1108 1466 1626 1950*
5 1158 1338 1751 1932
**** ********* *********************************************

f(x) = erfc(x)g .46875 < x < 4.0


O 61 1C9 161 21.4 270
1 e164 222* 280 340 401 462
2 376 441 506 572 638
3 440 597 666 736 806
4 502 666 824 897*
5 1056 1132*
6 1292 1371
7 1532 1613*
8 1775 1859*
**** F***************************** **********.***************

f(x) erfc(x), x > 4.0


0 628 756 876
1 688* 828 958 1081 1198
2 855 998* 1131 1256
3 992 1151 1287* 1415
4 1116 1283 1431 156:*
5 1232 1405 1558 1824*

Coefficients for these approximationsonly are given in Tables It-IV.


RATIONAL CHEBYSHEV APPROXIMATIONS 633

* *
** * oo
*00 "400_o r ^
4.4,4 oa. n
tflN,40

** *
*O 000 Q- QQ - 0 0 - 0 00
* *
* * Q
* *
* * I - 0
.n * * U m o
)c* * (Q - UN
* * N N
Vi * * o F F>
- * *
X t(* * N' 0 0('J-4 NtN0
- M * Ho h 4 40H
'l* * No M-N0 %(1to
* o-* c?O"40 O'+t4
* * tLm 0 O'tx1OD0 %N49o
* *
* * Hew4fo ~4'OQ ?o
* * 4' O a
UN E0
0 t co -t '0
47%J0* * 4 # 0 0 0 * 0
* *1~ tott ~o tChQ O C- (o
r) * *~'b?> m0 U'o ?Q' ' 4 4 0
C\i * *
X * * tro N*0 0O~~o o#4N0
'n * * +*'0 CNI?4Q N (\jn0NC'O4
* ?*O %ft? 4pO #owNQ0 4CNOOO
o * *Lt~i~t)
O oO'~t~) O
m .%N r M
SE-~3Il * *f'40N~ W O CN c%ON%4 %l
* * *** 00 000* 0* 009 *

~NI * *
*rc * *
* * _ __ _ _ __,___
o * * t)C J o~40r4IH40C4 m m NO mH
* * o Q
*:,-, cIo m k -It
* * _ _ Y _ _ _ __ _
X* *
*
11i* * (An F
* *
X * * ^ ?
s * * %H
* * NsO9Q~O
* *m L w 0% S0 -
t * c. *
_ * * rtn~ncm X o O, .-q
* * c I O- C)((nt %NO -4O
* * Cl t 0 0 O 0 L
9 Q
+m* * % (V L ( 7) m M #1
s * * XQCO Q ( 1' m "It
ai * *
* * rue> fCr%x OH.4C X tQ X0
* * * ( Qo C\"IHQOO Q Z %e
,- * * N?' Q 4s 4 c F ( rt ?
* cF~rm%~w~ Lr>Q
*r~c P? em r
* * V 1nIn
* *
-o * *~*(3?? e ~ Nts O h ? J h.
* *f~ Lrc'Or(-N oo
O-'O Zc
> o~ Q
F- * *'O~ F X)\ON b 4XHf%
* *f~O b ne a Na~~ >4olt o n@
* *0 ,-4h@
rr~W H e .IHcrU . 4c i
* '** *0 **** *
90* * *090t **
* * (t N.'( NN
r171 Q m) x . f ltw
* * I
* ,, _ * .. -^ .
* *n* 0Q H qu4N 0,W4N~f (4 ^N~ n
* ~*r _ (tf
634 W. J. CODY

* *
* * **e~~~~0
^o o
0'-4 V4 00 Pwr4 .4 -4 0 0
* *00 00000 000000
* * 1
% o r % - % W f ' %
* l * -

o * *
* * *
t ~* *
vi * *
*

* *
vL * *

* *
co * *
co
f. ** ** w e O
* * * 00 n sH
* * s QO'I*eQO^0
*
^ * ?QO'O - %O
x * ~* ^ OD CF% t Il.% co n
ON
O * * coOONt- 0*\0 ( C tC U
*n ~~* ~ ~~~~~~~~~~
* QQ(\J?O0
H
O,_?QQ'
O Ot
CA
c 14-, ON OOQ Q
It co %Otn 0% 0
* *~~~~~~~CI
* ne

e-4V r~F0
Ln f 0 Wf7{N04
r- so D I- N
X L* *- 0 4tNQ fl(flnOO0
*n *- __% __ __- co 0
** ** J fII.- CI- N
N HNQ % 0
*l7~ *. *QWV4 YLl~t

O~~~~~~~~~4
* * ;N in
O (\I r-4
NQ Ln
o1 *
*
*%O
*
4I
* _
~ * .
~ *00 l
*
40'Ol
.-- -9*
I
*rX * **O~4~aN 0r.Uq'4
0'm-4 I t t-4 0'4 %O
-4UC\'w
O ~ ~* ~ ~~~~~~~~
*

I o ~* * *
*00 00'O)00 OQQOQQ

* *g ii
*r) * *
X~ * *
_S * *X
v ~~* *
* *
t1* *

* * m -0
_s * * 4 D 0 0 0 4

__ * * ** co m c cOUN 0
W * ** % " "4
> ( so C " a;:
; * a* O q) a) -V .
H~ * * ** 1_ ( __ c C 0 >% O C N " rq
* * 0Fn OO?
o * * ^ O0Q'0 J - L 0 Z' O Q
n * * OC'** 0OH4oO asr tfl
* * m0r % NO ( 0
ci * * I ~ (w4' (\|V~4w
* . .~O% ) . O .f
0 * *n*

S.- * * 04 Oe %n - (NJ
NO C-

'-.4
I-* 'K
* ** O ^
I tq 0 N N ?j1 r4
* *rr~t~~. L
RA TIONAL CHEBYSHEV APPROXIMATIONS 635

of OM OOP -Of sof ^of 4" sof #W ONV ow O -OM *M dom Ofbs

NUNNfN.4_O Cy^ Nntu4o


00000000 000000000
* O OWOP O o Ow o
%O "o "O"M

m No0 -t 0*
b m
NL fl O Nr f o inmO
N v4IAO
O Mto 0 0cw % mr N0
N l P o
Q-NN m0
O Nr( 0a N a3 O %

N NNO r1-N0 C P N q
LA0 O-t 0
Cra
0 so
%* S4
N0 r j0 0 w
Q St( m
(0
CA 0(rA
0 0rl 0WO
mC-4 Olt
It Gt --N tn % Q 4ON
a, a, " oo
so 0- I
& -O 0 0o
az ON

U1n i tO LA OQ c-4 rV tL %OQ 0 O

aol M I
co O
-4 Nt(T4 q C UN Itl co
N JLC 0u 4
O0
10N -?D UI 0 o aso 0N > %O

WotX(NQ4cr 4
CFQ .0o
L tA 0n * r O0 ' N N
on cr
90*0** *e * . . * *O...*
S ci rnA Ot UN 0 O 0ON. 0 ,- v 4 -~-
" co r-
0 O t- 0 mN N I,-,

N000t00060%go
" N N Vk{)0 0. t%
"*O%40 O*d-tO' m
00-000f00%
(" N W-4 - 004
V
0

%0 "Oft o*w *O vow I o*40


I *W %WI Wo*V
I11

cN tn, r4 Cf- - -

o ej %o L OC C0 -4% 1Ur
to 7%O
Qt 4 co 0 r - 0 cv % L n c ol c

SO " -4 -- fn M CI r- P-^ r" ?0 V4( WN( X


V N m a f%. crl m %D 0 f% r^ al ?0 r- 0 m
w -4
so I'l m 0O %D0m P. 4-
-- r1 Q- -
r- 0 QC-tfl--I
0% 0 0 C-1 r0 0I
m r-

, 4 % OD 0 N 0ON N M F H co 00
e4 m -- C N co - co - co No - ON -
m OD F-
- r-F 0 " Q 1 f-4 M N'
mn %r r- CN CY
a ?
4 m % t N Nr n %Or UNr- 9 co
4 O ,% n
1l
0JL0Q 4 *"O eO m m NO ml On Cr- 0\
NVC OD(V co %OD 0%
5t PI- fv 9- CF UN -T m
Oll co 0 il N n in t m P- 41 N WN W It co V
HN a) 0
-0r m OS %r V4 o AD V4 " -D r- m
n- V4 m CV V4 V4 %O m
fo N4
Vf co V- co L
UN _4 %ttO
LO N
r4fl--
so^
--
4m M0C
cm tP. L M O'4w4ODr
co L" co NO
m %re (n W Nr P- Ln 9 P4 C4 1 co No XZ %

0Q
.
, N
u' ru. 4. - ^
., _ >,c_
N in 4ro0 I
o
OD
636 W. J. CODY

* *
* * - _ _
* *.40 P4 o40 N O0 0 N r" 00 M%N 4 0 0 0
* *0~~~0 0 0 000 0 00000 000000
* *1 Q WOo O "o Oi i oo O ao Q Q
"W lO
* * | I t - t 0 P C
O 0 ** ** _ _ _ _ _ _ _ _ _ _ _ _ _ ___
* *
* *
Al * * L O so NO
X * * 4r" t0,~0
* * No
* * i I co % O %P $ N 0o
* * 4k0tC1 06'4 1t0
* *
* * 'C 0N0 to- MN40(0
a * * Fe~St N 0 ONar1%C 41N4CO
* * rFr4 ? f o s Q 0 * f Q Q
ct ~* * o-* * r4M 0~~~~~~.00 r40 0 w 0 OD*"N0
CM 0* * 4 'Q O (P-0 N PoA NNN-
0 NO0
* * *
*r)* U0OO U~~~~~~~~0
4^4
N V4 Q0
7'O'0 ~OD
%1 4f '*oFM00 GM in t4
MOP4Q-Qr(NO N
,~~~~~~~~~~~v4
*nt *n0 .g, "t %
M~h 0 0h %O C4 c al N
>-2 O * * ,40 Q0 M co 0t O
cr k4 M 0 NN0 O C.
> KI, * *
* *f-Q ~4N0 ~ONw0 CO~ 0 ^0 0 C.N) 0
Cq ** *%O0
*~'40 f~~~~~~'r040W
4U 0 %tCI
NU'ih0 4 (I4r
00%Oe1~0-,400- P4 ((JOeqQN
% U40CO. 4
X * *00o~ QO0 oOM Xoco
coO0 0^
on * * 4?0 ?(\* f^OO0.- 00Q'0 %E0NC -tO
** ~ ** 9 0 *** 9 0 90 0 90** * *
o * *4o ? ,qQ^ 4Hv49 4oB4,.4wH4 N'~OmtNr
o@Cll * *
*
kq *
r
*n
4 j**
* * * -
^ Q
* .-N ? - o
N,.4N N %C
OD
N4w
,- F
N
-D ,
o o
tn
O ? ^ Q
OD c
~~~~~~~n
M "N 4
c>
?I-- tr11 U0 S M
N cr
M^ N
+ * *0o0 0(0 000 OO o0000D00

*
*
q ~~*MS *
*n~~~~~~~~~~~~~~~~~~~~~~~~4
0-w --

* *
1 1g ** *tin
* | MI I~~~~~~~~~(1
NO c co
C,, co II. N
M I ON C, Q J r- ., q?| W-
I ?
_ X ~** Q ** *11 II 111M
q1 1V 1111O
n0
%O 111n%
3?bV4(111
%
S:* *
- * * o Q N o
X II-. * * M X~co
M. (M %D M 01$C NQ
- M0C%4
cO
tN cc X
44D tNM
4v Il
a: %t vs
t1
* *
H
4Fj~ N:o4- H
fl NN0.-$e
* * Uo.%t X?NO2CJ0
I
__ * * CnQOg C QVcO4I4. o4Q inlO Yi M w.cmn
x* *
* * tfl C C ) - M (
'c- 0 Ill-0 NO - co
*l * LA- . (( C j 4N >0 O Us4>
O n ?4 Y
rsO'(f
s * *~*"4~ % CN M t0f CCIO
c o) Ln
c4 HAM
a * *~ soO
Q (J -, r4 - 0Q' C - NE1cm
* *LrI') %OI(. @ > NU - Cfl4' + XW
* *
* * * O0 tO N Q e-4# N O ( p
Q N NO - MO M
_ ~~* Z 00<4' f?'O~ Q
*%O~ zHHHnI 00
* * f(NI tFrJ O nc7 'Q'n @f0'~
F h OrwXf e flt"
ax * *%t' tfX~ -Z Z nk O? 0 O0U ' 0 A e
* * N' (r
C'J0'w4O JO4'4N M 0 N MO Qc\I U
42 * * 00 900 ( 0000 000009*
* 09090
* . *
F ~* *~c'
< C-.~ S ~ tn (NI tCN('4 X (1f ^
* * I i I I3 i I I 1 1 11
I
.
r- *c~~ ~eJ 04 w r4\Jl 0. .__~4
* .*~ *
RATIONAL CHEBYSHEV APPROXIMATIONS 637

Table I presents the initial segments of the Lx,3


Walsh arrays while Tables II, III,
and IV present selected approximations. All approximations were generated using a
standard version of the Remes algorithm [4] on a CDC 3600. The master function
routines used continued-fraction expansions described in [1] and were verified to be
accurate to at least 22S. Finally, the accuracy of the approximations as presented
here was verified by comparison against the master routines using 5000 pseudo-
random arguments.

ArgonneNational Laboratory
Argonne, Illinois 60439

1. J. F. HART, et al., Computer Approximations, Siam Series in Appl. Math., Wiley, New
York, 1968.
2. C. HASTINGS,JR., Approximations for Digital Computers, Princeton Univ. Press, Princeton,
N. J., 1955. MR 16, 963.
3. C. W. CLENSHAW,Chebyshev Series for Mathematical Functions, National Physical Lab.
Math. Tables, vol. 5, H.M.S.O., London, 1962. MR 26 #362.
4. W. J. CODY,W. FRASER & J. F. HART, "Rational Chebyshev approximations using linear
equations," Numer. Math., v. 12, 1968, pp. 242-251.

También podría gustarte