Sei sulla pagina 1di 4

4

ALGORITHM
PROCEDURES
ALLAN GIBB*

61
FOR

RANGE

ARITHMETIC

U n i v e r s i t y of A l b e r t a , C a l g a r y , A l b e r t a , C a n a d a

begin
p r o c e d u r e R A N G E S U M (a, b, c, d, e, f);
real a , b , c , d , e , f ;
c o m m e n t The term "range n u m b e r " was used by P. S. Dwyer,
Linear Computations (Wiley, 1951). Machine procedures for
range arithmetic were developed about 1958 by Ramon Moore,
"Automatic Error Analysis in Digital C o m p u t a t i o n , " LMSD
Report 48421, 28 Jan. 1959, Lockheed Missiles and Space Division, Palo Alto, California, 59 pp. If a _< x -< b and c ~ y ~ d,
then R A N G E S U M yields an interval [e, f] such t h a t e =< (x + y)
f. Because of machine operation (truncation or rounding) the
machine sums a -4- c and b -4- d may not provide safe end-points
of the output interval. Thus R A N G E S U M requires a non-local
real procedure A D J U S T S U M which will compensate for the
machine arithmetic. The body of A D J U S T S U M will be dependent upon the type of machine for which it is written and so
is not given here. (An example, however, appears below.) I t
is assumed t h a t A D J U S T S U M has as parameters real v and w,
and integer i, and is accompanied by a non-local real procedure
C O R R E C T I O N which gives an upper bound to the magnitude
of the error involved in the machine representation of a number.
The output A D J U S T S U M provides the left end-point of the
output interval of R A N G E S U M when A D J U S T S U M is called
with i = --1, and the right end-point when called with i = 1
The procedures RANGESUB, R A N G E M P Y , and R A N G E D V D
provide for the remaining fundamental operations in range
arithmetic. R A N G E S Q R gives an interval within which the
square of a range nmnber must lie. R N G S U M C , RNGSUBC,
R N G M P Y C and R N G D V D C provide for range arithmetic with
complex range arguments, i.e. the real and imaginary parts
are range numbers~
begin
e : = A D J U S T S U M (a, c, - 1 ) ;
f : = A D J U S T S U M (b, d, 1)
end RANGESUM;
p r o c e d u r e R A N G E S U B (a, b, c, d, e, f) ;
real a, b , c , d , e , f;
c o m m e n t R A N G E S U M is a non-local procedure;
begin
R A N G E S U M (a, b, - d , --c, e, f)
end RANGESUB ;
p r o c e d u r e R A N G E M P Y (a, b, c, d, e, f);
real a, b, c, d, e, f;
c o m m e n t A D J U S T P R O D , which appears at the end of this
procedure, is analogous to A D J U S T S U M above and is a nonlocal real procedure. M A X and M I N find the maximum and
minimum of a set of real numbers and are non-local;
begin
real v, w;
i f a < 0 A c => 0 t h e n
1: b e g i n
v:=c;
c:=a;
a:=v;
w:=d;
d:=b;
b:=w
e n d 1;
i f a => O t h e n

2: b e g i n
i f c >= 0 t h e n
3:begin
e:= aXe;f := bXd;goto8
end 3 ;
e:=bXc;
ifd ~ 0then
4:
begin
f:=bXd;
goto8
e n d 4;
f:=aXd;
goto8
5: e n d 2;
ifb > 0 then
6: b e g i n
if d > 0 then
begin
e : = M I N ( a X d, b X c);
f : = M A X ( a X c , b X d); go t o 8
e n d 6;
e : = b X c; f : = a X c; go t o 8
e n d 5;
f:=aXc;
i f d _-<O t h e n
7: b e g i n
e:=bXd;
goto8
end 7 ;
e:=aXd;
8: e : = A D J U S T P R O D (e, - 1 ) ;
f := A D J U S T P R O D (f, 1)
end RANGEMPY;
p r o c e d u r e R A N G E D V D (a, b, c, d, e, f) ;
real a, b, c, d, e, f;
c o m m e n t If the range divisor includes zero the program
exists to a non-local label " z e r o d v s r " . R A N G E D V D assumes a
non-local real procedure A D J U S T Q U O T which is analogous
(possibly identical) to A D J U S T P R O D ;
begin
i f c =< 0 A d ~ 0 t h e n go to zer0dvsr;
if c < 0 then
1: b e g i n
ifb > 0 then
2:
begin
e : = b / d ; go t o 3
e n d 2;
e := b/c;
3:
i f a -->_0 t h e n
4:
begin
f : = a / c ; go t o 8
e n d 4;
f : = a / d ; go t o 8
end 1;
if a < 0 then
5: b e g i n
e : = a/c; go t o 6
end 5 ;
e := a/d;
6: i f b > 0 t h e n
7: b e g i n
f : = b / c ; go t o 8
end 7 ;
f := b/d;
8: e : = ADJUSTQUOT (e, - 1 ) ; f : = ADJUSTQUOT (f,1)
end RANGEDVD ;
p r o c e d u r e R A N G E S Q R (a, b, e, f);
r e a l a, b, e, f;
c o m m e n t A D J U S T P R O D is a non-10cal procedure;
begin
if a < 0 then
C o m m u n i c a t i o n s o f t h e &CM

319

1:

begin

if b < 0 t h e n
2:

begin

e : = b X b; f : = a X a; go t o 3
end 2;
e:=0;
m:=MAX(-a,b);
f:=mXm;
goto3
end 1 ;
e : = a X a; f : = b X b;
3:
A D J U S T P R O D (e, - 1 ) ;
A I ) J U S T P R O D (f, 1)
end R A N G E S Q R ;
p r o c e d u r e R N G S U M C (aL, aR, bL, bU, cL, cR, dL, dU, eL,
eR, fL, fU);
real aL, aR, bL, bU, eL, cR, dL, dU, eL, eR, fL, fU;
c o m m e n t Rangesum is a non-local procedure;
begin

R A N G E S U M (aL, aR, cL, cR, eL, eR) ;


R A N G E S U M (bL, bU, dL, dU, fL, fU)
end R N G S U M C ;
p r o c e d u r e R N G S U B C (aL, aR, bL, bU, eL, cR, dL, dU, eL,
eR, fL, fU);
real aL, aR, bL, bU, cL, cR, dL, dU, eL, eR, fL, fU;
c o m m e n t R N G S U M C is a non-local procedure;
begin

R N G S U M C (aL, aR, bL, bR, --cR, - - c L , - - d U , --dL, eL, eR,


fL, fU)
end R N G S U B C ;
p r o e e d t t r e R N G M P Y C (aL, aR, bL, bU, cL, cR, dL, dU, eL,
eR, fL, fU);
r e a l aL, aR, bL, bU, eL, cR, dL, dU, eL, eR, fL, fU;
c o n n n c n t R A N G E M P Y , R A N G E S U B , and R A N G E S U M are
non-local procedures ;
begin
r e a l L1, R1, L2, R2, L3, R3, L4, R4;

R A N G E M P Y (aL, aR, eL, cR, L1, R1);


R A N G E M P Y (bL, bU, dL, dU, L2, R2);
R A N G E S U B (L1, R1, L2, R2, eL, eR);
R A N G E M P Y (aL, aR, dL, dU, L3, R3);
R A N G E M P Y (bL, bU, eL, cR, L4, R4);
R A N G E S U M (L3, R3, L4, R4, fL, fU);
end RNGMPYC ;
procedure
R N G D V D C (aL, aR, bL, bU, cL, cR, dL, dU, eL,
eR, fL, fU);
r e a l aL, aR, bL, bU, cL, cR, dL, dU, eL, eR, fL, fU;
c o m m e n t R N G M P Y C , R A N G E S Q R , R A N G E S U M , and
R A N G E D V D are non-local procedures;
begin
r e a l L1, R1, L2, R2, L3, R3, L4, R4, L5, R5;

R N G M P Y C (aL, aR, bL, bU, cL, cR, - d U , --dL, L1, R1, L2,
R2) ;
R A N G E S Q R (cL, cR, L3, R3);
R A N G E S Q R (dL, dU, L4, R4);
R A N G E S U M (L3, R3, L4, R4, L5, R5);
R A N G E D V D (L1, R1, L5, R5, eL, eR);
R A N G E D V D (L2, R2, L5, R5, fL, fU)
end R N G D V D C
end

EXAMPLE
real procedure

C O R R E C T I O N (p); r e a l p;
c o m m e n t C O R R E C T I O N and the procedures below are intended for use with single-precision "normalized floating-point
arithmetic for machines in which the mantissa of a floating-point
number is expressible to s significant figures, base b. Limitations
of the machine or requirements of the user will limit the range of
p to b m =< I P I < b n+l for some integers m and n. Appropriate
integers must replace s, b, m and n below. Signal is a non-local
label. The procedures of the example would be included in the
same block as the range procedures above;

320

C o m m u n i c a t i o n s o f t h e ACM

begin
i n t e g e r w;
for w := m step 1 until n do
1 : begin

i f (b T w ~ abs (p))/~ (abs (p) < b ]" (w -4- 1)) t h e n


2:

begin

C O R R E C T I O N := b ~ ( w - t - l - s ) ;

g o t o exit

end 2
end 1;
g o t o signal;

exit: e n d

CORRECTION;
A D J U S T S U M (w, v, i);

real procedure
r e a l w, v;

i n t e g e r i;

c o m m e n t A D J U S T S U M exemplifies a possible procedure for use


with m~chines which, when operating in floating point addition,
simply shift out any lower order digits that may not be used. No
attempt is made here to examine the possibility that, every digit
that is dropped is zero. C O R R E C T I O N is a non-local real procedure which gives an upper bound to the nmgnitude of the error
involved in the machine representation of a nmnber;
begin

r e a l r, ew, cv, cr;


r:=w+v;
i f w = 0 V v = 0 t h e n g o t o 1;
cw : = C O R R E C T I O N (w);
cv : = C O R R E C T I O N (v);
cr : = C O R R E C T I O N (r);
i f cw = cv /~ cr ~ cw t h e n g o t o 1;
i f sign (i X sign (w) sign (v) X sign (r)) = --1 t h e n g o t o 1;
A D J U S T S U M : = r -4- i X M A X (cw, cv, cr)~ g o t o exit;
1: A D J U S T S U M : = r;
exit: e n d A D J U S T S U M ;
real procedure
A D J U S T P R O D (p, i); r e a l p; i n t e g e r i;
c o m m e n t A D J U S T P R O D is for machines which truncate when
lower order digits are dropped. C O R R E C T I O N is a non-local real
procedure ;
begin

ifp X i ~ 0 then
begin
A D J U S T P R O D : = p; g o t o out
end 1;
A D J U S T P R O D : = p -4- i X C O R R E C T I O N (p);
out: e n d A D J U S T P R O D ;
c o m m e n t Although ordinarily rounded arithmetic is preferable
to truncated (chopped) arithmetic, for these range procedures
truncated arithmetic leads to closer bounds than rounding does.

1:

* These procedures were written and tested in the Burroughs


220 version of the ALGOL language in the smnmer of 1960 at
Stanford University. The typing and editorial work were done
under Office of Naval Research Contract Nonr-225(37). The author
wishes to thank Professor George E. Forsythe for encouraging
this work and for assistance with the syntax of ALGOL 69.

ALGORITHM
62
A SET OF ASSOCIATE LEGENDRE
OF THE SECOND KIND*

POLYNOMIALS

JOHN" R. HERNDON
Stanford Research Institute, l~ienlo Park, California
e c ) m m e n t This procedure places a set of values of QnIn(x) in the
array Q[ ] for values of n from 0 to nmax for a particular value
of m and a value of x which is real if ri is 0 and is purely imaginary,
ix, ortherwise. R[ ] will contain the set of ratios of successive
values of Q. These ratios may be especially valuable when the
Q,~"~(x) of the smallest size is so small as to underflow the machine
representation (e.g. 10-6~ if 10-~1 were the smallest representable

n u m b e r ) . 9.9 X 10 45 is u s e d to r e p r e s e n t i n f i n i t y . I m a g i n a r y
v a l u e s of x m a y n o t be n e g a t i v e a n d reM v a l u e s of x m a y n o t be
s m a l l e r t h a n 1.
V a l u e s of Qd~'(x) m a y be c a l c u l a t e d e a s i l y by h y p e r g e o m e t r i c
series if x is n o t t o o s m a l l n o r (n - m ) t o o large. Q~m(x) c a n be
c o m p u t e d f r o m a n a p p r o p r i a t e set of v a l u e s of Pnm(X) if X is n e a r
1.0 or ix is n e a r 0. L o s s of s i g n i f i c a n t d i g i t s o c c u r s for x as s m a l l as
1.1 if n is l a r g e r t h a n 10. L o s s of s i g n i f i c a n t d i g i t s is a m a j o r diffic u l t y in u s i n g finite p o l y n o m i M r e p r e s e n t a t i o n s also if n is l a r g e r
t h a n m . H o w e v e r , Q L E G h a s b e e n t e s t e d in r e g i o n s of x a n d n
b o t h large a n d small;
procedure
Q L E G ( m , n m a x , x, ri, R, Q); v a l u e In, n m a x , x, ri;
r e a l In, m n a x , x, ri; r e a l a r r a y R , Q;
begin
r e a l t, i, n, q0, s;
n : = 20;
i f n m a x > 13 t h e n
n := nmax +7;
i f ri = 0 t h e n
begin
ifm = 0then
Q[0] : = 0.5 X 10g((x + 1 ) / ( x - 1))
else
t : = - - 1 . 0 / s q r t ( x X x - - 1);
begin
q0 : = 0;
Q[O] : = t ;
for i : = 1 step 1 until m do
begin
s :=
(x+x)X(i-1)Xt
Q[0]+ (3i-ii-2)q0;
q0 : = Q[0];
Q[0] : = s e n d e n d ;
if
x = 1 then
Q[0] : = 9.9 I" 45;
R [ n + 1] : = x - s q r t ( x X x - 1);
for
i : = n s t e p --1 u n t i l 1 d o
R[i] : = (i + m ) / ( ( i + i + 1) X x
+(m-i1) X R [ i + l ] ) ;
g o to t h e e n d ;
if m = 0 then
b e g i n i f x < 0.5 t b e n
Q[0] : = a r c t a n ( x ) - 1.5707963 e l s e
Q[0] : = - a r e t a n ( 1 / x ) e n d e l s e
t : = 1 / s q r t ( x X x + 1);
begin
q0 : = 0;

q[0] := t;
for

R[n +
for

for
the:

for i : =

end

QLEG;

i : = 2 step 1 until m do
b e g i n s : = (x + x) X (i -- 1) X t X Q[0I
+(3i+iX
i -- 2) q0;
qO : = Q[0];
Q[0] := s e n d e n d ;
1] : = x - s q r t ( x x + 1);
i := n step - 1 until 1 do
R[i] : = (i + m ) / ( ( i -- m + 1) R[i + 1]
--(i+i+
1) X x);
i : = 1 step 2 until nmax do
Rill : = -- Rill;
1 step 1 until nnmx do
Q[i] : = Q[i - 1] X R[i]

* T h i s p r o c e d u r e w a s d e v e l o p e d in p a r t u n d e r t h e s p o n s o r s h i p
of t h e A i r F o r c e C a m b r i d g e R e s e a r c h C e n t e r .

ALGORITHM 63
PARTITION
C. A. R. HOARE
Elliott Brothers Ltd., Borehamwood, Hertfordshire, Eng.
procedure

partition (A,M,N,I,J); value M,N;


a r r a y A; i n t e g e r M , N , 1 , J ;

conunent
I a n d J are o u t p u t v a r i a b l e s , a n d A is t h e a r r a y ( w i t h
s u b s c r i p t b o u n d s M : N ) w h i c h is o p e r a t e d u p o n b y t h i s p r o c e d u r e .
P a r t i t i o n t a k e s t h e v a l u e X of a r a n d o m e l e m e n t of t h e a r r a y A,
a n d r e a r r a n g e s t h e v a l u e s of t h e e l e m e n t s of t h e a r r a y in s u c h a
w a y t h a t t h e r e e x i s t i n t e g e r s I a n d J w i t h t h e following p r o p e r t i e s :
M _-< J < I =< N p r o v i d e d M
< N
A[R] =< X f o r M
=< R _-< J
A[R] = X f o r J
< R < I
A[R] ~ X f o r I =< R ~ N
The procedure uses an integer procedure random (M,N) which
chooses equiprobably a random integer F between M and N, and
also a p r o c e d u r e e x c h a n g e , w h i c h e x c h a n g e s t h e v a l u e s of its t w o
parameters ;
begin
real X; integer F;
F : = r a n d o m ( M , N ) ; X : = A[F];
I:=M;
J:=N;
for I : = I s t e p 1 u n t i l N d o
up:
i f X < A [I] t h e n g o to d o w n ;
I:=N;
down:
f o r J : = J s t e p --1 u n t i l M d o
if A[J]<X then go to change;
J:=M;
c h a n g e : i f I < J t h e n b e g i n e x c h a n g e (A[IL A[J]);
I := I+ 1;J:=
J - 1;
g o to u p
end
else
i f [ < F t h e n b e g i n e x c h a n g e (A[IL A[F]) i
I:=I+l
end
else
i f F < J t l l e n b e g i n e x c h a n g e (A[F], A[J]) ;
J:=J-1
end ;
end
partition

ALGORITHM 64
QUICKSORT
C. A. R. HOARE
Elliott Brothers Ltd., Borehamwood, Hertfordshire, Eng.
procedure

quicksort (A,M,N); value M,N;


a r r a y A; i n t e g e r M , N ;
Q u i c k s o r t is a v e r y f a s t a n d c o n v e n i e n t m e t h o d of
comment
s o r t i n g a n a r r a y in t h e r a n d o m - a c c e s s s t o r e of a c o m p u t e r . T h e
e n t i r e c o n t e n t s of t h e s t o r e m a y be s o r t e d , since no e x t r a s p a c e is
r e q u i r e d . T h e a v e r a g e n u m b e r of c o m p a r i s o n s m a d e is 2 ( M - - N ) In
( N - - M ) , a n d t h e a v e r a g e n m n b e r of e x c h a n g e s is one s i x t h t h i s
a m o u n t . S u i t a b l e r e f i n e m e n t s of t h i s m e t h o d will be d e s i r a b l e for
its i m p l e m e n t a t i o n on a n y a c t u a l c o m p u t e r ;
begin
i n t e g e r 1,J ;
if M < N then begin partition (A,M,N,I,J);
quicksort (A,M,J) ;
q u i c k s o r t (A, I, N )
end
end
quieksort

ALGORITHM 65
FIND
C. A. R. HOARE
Elliott Brothers Ltd., Borehamwood, Hertfordshire, Eng.
procedure

find ( A , M , N , K ) ; v a l u e M , N , K ;
a r r a y A; i n t e g e r M , N , K ;
comment
F i n d will a s s i g n to A [K] t h e v a l u e w h i c h it w o u l d
h a v e if t h e a r r a y A [ M : N ] h a d b e e n s o r t e d . T h e a r r a y A will be
p a r t l y s o r t e d , a n d s u b s e q u e n t e n t r i e s will be f a s t e r t h a n t h e first;
Communications

of the ACM

321

begin

end

integer [,J;
i f M < N t h e n b e g i n p a r t i t i o n (A, M, N, I, J ) ;
i f K=< I t h e n find ( A , M , I , K )
e l s e if J N K t h e n find ( A , J , N , K )
end
find

b e g i n i n t e g e r i, j, k, m ; r e a l a r r a y v [ l : n ] ; r e a l s;
integer array c[l:n];
t a b l e : j : = -- n; k : = n-4- 1; f o r i : = 1 s t e p l u n t i l n d o
begin
j : = j + k - - i; c[il : = j e n d ;
load: f o r i : = l s t e p l u n t i l n d o
b e g i n f o r j : = i s t e p 1 u n t i l n d o R E A D (vii]); m : =

c[i];
ALGORITHM 66
INVRS
JOHN CAFFREY

Director of Research, Palo Alto Unified School District,


Palo Alto, California
procedure
I n v r s (t) size : (n) ; v a l u e n; r e a l a r r a y t~ i n t e g e r n;
comment
I n v e r t s a p o s i t i v e definite s y m m e t r i c m a t r i x t, of
o r d e r n, b y a simplified v a r i a n t of t h e s q u a r e root m e t h o d . Replaces t h e n(n-4-1)/2 diagonal a n d s u p e r d i a g o n a l e l e m e n t s of t
w i t h e l e m e n t s of t -~, leaving s u b d i a g o n a l e l e m e n t s u n c h a n g e d .
A d v a n t a g e s : only n t e m p o r a r y s t o r a g e registers are r e q u i r e d , no
i d e n t i t y m a t r i x is used, no s q u a r e r o o t s are c o m p u t e d , only n
divisions are p e r f o r m e d , a n d , as n b e c o m e s large, t h e n u m b e r of
m u l t i p l i c a t i o n s a p p r o a c h e s n3/2;
b e g i n i n t e g e r i, j, s; r e a l a r r a y v[l:n--1]; r e a l y, p i v o t ;
for s := 0 step 1 until n-1 do
b e g i n p i v o t : = 1.0/t[1,1];
b e g i n p i v o t : = 1.0/t[1,1];
c o m m e n t If t[1,1] ~ 0, t is n o t p o s i t i v e definite ;
f o r i : = 2 s t e p 1 u n t i l n d o v i i - l ] := t[1, i];
for i : = 1 step 1 until n--1 do
b e g i n t[i,n] : = y : = - - v [ i ] X p i v o t ;
for j : = i step 1 until

n--1 do

t[i, jl : = t[i -4- 1, j -4-11 -4- vii] X y


end ;
t[n,n] : = - p i v o t
end;
comment
A t t h i s p o i n t , e l e m e n t s of t -~ o c c u p y
t h e original a r r a y space b u t w i t h signs r e v e r s e d ,
a n d t h e following s t a t e m e n t s effect a simple reflection;
for i : = 1 step 1 until n do
f o r j : = i s t e p 1 u n t i l n d o t[i,j] : = --t[i,j]
end Invrs

ALGORITHM 67
CRAM
JOHN CAFFREY
Director of Research,

Palo Alto Unified School District,

Palo Alto, California


procedure
C R A M (n, r, a) R e s u l t : (f); v a l u e n, r; i n t e g e r
n, r; r e a l a r r a y a, f;
comment
C R A M stores, v i a a n unspecified i n p u t p r o c e d u r e
R E A D , t h e d i a g o n a l a n d s u p e r d i a g o n a l e l e m e n t s of a s q u a r e s y m m e t r i c m a t r i x e, of o r d e r n, as a p s e u d o - a r r a y of d i m e n s i o n
l : n ( n -4- 1)/2. R E A D (u) p u t s one n u m b e r i n t o u. E l e m e n t s eli, j]
are a d d r e s s a b l e as a[e -t- j ], w h e r e c = (2n -- i) (i -- 1)/2 a n d c [i -/- 1]
m a y be f o u n d as e[i] -4- n -- i. Since el1] = 0, it is s i m p l e r to d e v e l o p
a t a b l e of t h e c[i] b y r e c u r s i o n , as s h o w n in t h e s e q u e n c e l a b e l l e d
" t a b l e " . F u r t h e r m a n i p u l a t i o n of t h e e l e m e n t s so s t o r e d is illust r a t e d b y p r e m u l t i p l y i n g a r e c t a n g u l a r m a t r i x f, of o r d e r n, r, b y
t h e m a t r i x e, replacing t h e e l e m e n t s of f w i t h t h e n e w values, req u i r i n g a t e m p o r a r y s t o r a g e a r r a y v of d i m e n s i o n l : n ;

322

Communications

of the ACM

f o r k : = i s t e p 1 u n t i l n d o aim -4- k] : = v[k] e n d ;


premult: forj := lstepluntilrdo
begin for i := 1 step 1 until n do
b e g i n s : = 0.0;
for k := 1 step 1 until i do
b e g i n m : = c[k]; s : = s + aim + i]
Xf[k, Jl e n d ;
f o r k : = i -4- 1 s t e p 1 u n t i l n d o
s := sWa[mWk]X
f [ k , j ] ; v[i] = s
end ;
f o r k : = 1 s t e p 1 u n t i l n d o f[k, j] = v[k]
end

end

CRAM

R E M A R K ON ALGORITHM 53
Nth ROOTS OF A COMPLEX N U M B E R (John R.
Herndon, Comm. A C M 4, Apr. 1.961)
C. W.

NESTOR, J R .

Oak Ridge National Laboratory, Oak Ridge, Tennessee


A c o n s i d e r a b l e s a v i n g of m a c h i n e t i m e for N >= 3 would result
f r o m t h e use of t h e recursion f o r m u l a s for t h e sine a n d cosine in
place of an e n t r y i n t o a sine-cosine s u b r o u t i n e in t h e do loop
a s s o c i a t e d w i t h t h e N t h r o o t s of a c o m p l e x n u m b e r . T h a t is, one
could use
sin (n -4- 1)0 = sin nO cos0 -4- cos nO sin0
cos (n -t- 1)0 = cos n0 cos0 -- sin nO sin0,
at t h e cost of some a d d i t i o n a l storage.
We h a v e f o u n d t h i s p r o c e d u r e to be v e r y efficient in p r o b l e m s
d e a l i n g w i t h F o u r i e r analysis, as s u g g e s t e d b y G. Goerzel in
c h a p t e r 24 of Mathematical Methods for Digital Computers.

C o n t r i b u t i o n s to t h i s d e p a r t m e n t m u s t be in t h e f o r m
s t a t e d in t h e A l g o r i t h m s D e p a r t m e n t p o l i c y s t a t e m e n t
(Communications, F e b r u a r y , 1960) e x c e p t t h a t A L G O L 60
n o t a t i o n s h o u l d be used (see Communications, M a y , 1960).
C o n t r i b u t i o n s s h o u l d be s e n t in d u p l i c a t e to J. H .
W e g s t e i n , C o m p u t a t i o n L a b o r a t o r y , N a t i o n a l B u r e a u of
S t a n d a r d s , W a s h i n g t o n 25, D . C. A l g o r i t h m s s h o u l d be in
t h e P u b l i c a t i o n f o r m of A L G O L 60 a n d w r i t t e n in a s t y l e
p a t t e r n e d a f t e r t h e m o s t r e c e n t a l g o r i t h m s a p p e a r i n g in this
department.
A l t h o u g h each a l g o r i t h m has been t e s t e d b y its cont r i b u t o r , no w a r r a n t y , e x p r e s s or i m p l i e d , is m a d e b y t h e
c o n t r i b u t o r , t h e e d i t o r , or t h e A s s o c i a t i o n for C o m p u t i n g
M a c h i n e r y as to t h e a c c u r a c y a n d f u n c t i o n i n g of t h e alg o r i t h m a n d r e l a t e d a l g o r i t h m m a t e r i a l a n d no r e s p o n s i b i l i t y is a s s u m e d b y t h e c o n t r i b u t o r , t h e e d i t o r , or t h e
A s s o c i a t i o n for C o m p u t i n g M a c h i n e r y in c o n n e c t i o n t h e r e with.
T h e r e p r o d u c t i o n of a l g o r i t h m s a p p e a r i n g in t h i s dep a r t m e n t is e x p l i c i t l y p e r m i t t e d w i t h o u t a n y charge. W h e n
r e p r o d u c t i o n is for p u b l i c a t i o n p u r p o s e s , r e f e r e n c e m u s t be
m a d e to t h e a l g o r i t h m a u t h o r a n d t o t h e Communications
issue b e a r i n g t h e a l g o r i t h m .

Potrebbero piacerti anche