Table Look-Up Method for the Evaluation of Functions

3
Journal of Approximation Theory 107, 160162 (2000) LETTER TO THE EDITOR Table Look-Up Method for the Evaluation of Functions Stuart Ball Ademco Microtech Ltd., East Kilbride G74 5PA, Scotland E-mail: stulightsoft.co.uk and Ranko Bojanic Department of Mathematics, Ohio State University, 328 Mathematics Building, 231 W. 18 th Avenue, Columbus, Ohio 43210-1174 E-mail: bojanicmath.ohio-state.edu Communicated by Paul Nevai and Amos Ron Received December 31, 1999; accepted in revised form March 31, 2000; published online October 11, 2000 The table look-up method for finding values of functions is probably as old as mathematics itself. Tables of logarithmic and trigonometric functions that were used everywhere 50 or 60 years ago have been replaced by elec- tronic calculators. The table look-up method, however, has survived and it is still used in computer programs when the speed of computations is extremely important. Suppose that we have to evaluate a continuous function f very fast for a large number of values of the variable x in [0, 1]. With a fixed integer N, we first create a table of values f (0), f \ 1 N+ , ..., f \ N&1 N + , f (1). Then, for an arbitrary x in [0, 1], to get an approximate value for f ( x) we have only to compute [ Nx ], the integral part of Nx, or, using program- ming language, we have to convert the floating point number Nx into the integer [ Nx]. If that integer is Q, the approximate value of f ( x) is found at position Q+1 in the table. doi:10.1006jath.2000.3489, available online at http:www.idealibrary.com on 160 0021-904500 35.00 Copyright 2000 by Academic Press All rights of reproduction in any form reserved.

Transcript of Table Look-Up Method for the Evaluation of Functions

Page 1: Table Look-Up Method for the Evaluation of Functions

Journal of Approximation Theory 107, 160�162 (2000)

LETTER TO THE EDITOR

Table Look-Up Method for the Evaluation of Functions

Stuart Ball

Ademco Microtech Ltd., East Kilbride G74 5PA, ScotlandE-mail: stu�lightsoft.co.uk

and

Ranko Bojanic

Department of Mathematics, Ohio State University, 328 Mathematics Building,231 W. 18 th Avenue, Columbus, Ohio 43210-1174

E-mail: bojanic�math.ohio-state.edu

Communicated by Paul Nevai and Amos Ron

Received December 31, 1999; accepted in revised form March 31, 2000;published online October 11, 2000

The table look-up method for finding values of functions is probably asold as mathematics itself. Tables of logarithmic and trigonometric functionsthat were used everywhere 50 or 60 years ago have been replaced by elec-tronic calculators. The table look-up method, however, has survived and itis still used in computer programs when the speed of computations isextremely important.

Suppose that we have to evaluate a continuous function f very fast fora large number of values of the variable x in [0, 1]. With a fixed integerN, we first create a table of values

f (0), f \ 1N+ , ..., f \N&1

N + , f (1).

Then, for an arbitrary x in [0, 1], to get an approximate value for f (x) wehave only to compute [Nx], the integral part of Nx, or, using program-ming language, we have to convert the floating point number Nx into theinteger [Nx]. If that integer is Q, the approximate value of f (x) is foundat position Q+1 in the table.

doi:10.1006�jath.2000.3489, available online at http:��www.idealibrary.com on

1600021-9045�00 �35.00Copyright � 2000 by Academic PressAll rights of reproduction in any form reserved.

Page 2: Table Look-Up Method for the Evaluation of Functions

From the approximation-theoretic point of view, the look-up methodcan be described as approximation of f (x) by f ([Nx]�N). If we assumethat the function f satisfies the Lipschitz condition

| f (x)& f ( y)|�|x& y|, (1)

we already have the error estimate

} f \[Nx]N +& f (x)}�Nx&[Nx]

N�

1N

.

If the function f is, in addition, a monotone increasing (or decreasing)function, we can obtain a smaller error estimate just by adding the number1�(2N)(or&1�(2N)) to each element of the table. More precisely, we wantto show that for a monotone increasing Lipschitz function f on [0, 1] wehave

} f \[Nx]N ++

12N

& f (x)}� 12N

. (2)

For a monotone decreasing Lipschitz function f on [0, 1] we have

} f \[Nx]N +&

12N

& f (x)}� 12N

. (3)

Examples of functions satisfying condition (1) on [0, 1] are arc tan(x),sin(x), cos(x), exp(&x), and many others. To obtain values of increasingfunctions with an error estimate of 0.005, we have to construct a table of101 numbers

f (0)+0.005, f (0.01)+0.005, ..., f (0.99)+0.005, f (1)+0.005.

The proof of inequality (2) is geometrically obvious. The analytic proofis just as simple. Assuming that f is a monotone increasing function satisfy-ing condition (1) on [0, 1], and using inequalities x&1�[x]�x, we have

f \x&1N++

12N

� f \[Nx]N ++

12N

� f (x)+1

2N. (4)

By the Lipschitz condition we have

f (x)& f \x&1N+�

1N

161LETTER TO THE EDITOR

Page 3: Table Look-Up Method for the Evaluation of Functions

or

f (x)&1

2N� f \x&

1N++

12N

. (5)

From (4) and (5) we conclude that

f (x)&1

2N� f \[Nx]

N ++1

2N� f (x)+

12N

and inequality (2) is proved. The proof of inequality (3) is similar.

Printed in Belgium

162 LETTER TO THE EDITOR