HOME

TheInfoList



OR:

In
mathematics Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, tables of
trigonometric function In mathematics, the trigonometric functions (also called circular functions, angle functions or goniometric functions) are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. They are widely used in all ...
s are useful in a number of areas. Before the existence of
pocket calculator An electronic calculator is typically a portable electronic device used to perform calculations, ranging from basic arithmetic to complex mathematics. The first solid-state electronic calculator was created in the early 1960s. Pocket-sized d ...
s, trigonometric tables were essential for
navigation Navigation is a field of study that focuses on the process of monitoring and controlling the movement of a craft or vehicle from one place to another.Bowditch, 2003:799. The field of navigation includes four general categories: land navigation, ...
,
science Science is a systematic endeavor that builds and organizes knowledge in the form of testable explanations and predictions about the universe. Science may be as old as the human species, and some of the earliest archeological evidence for ...
and
engineering Engineering is the use of scientific method, scientific principles to design and build machines, structures, and other items, including bridges, tunnels, roads, vehicles, and buildings. The discipline of engineering encompasses a broad rang ...
. The calculation of mathematical tables was an important area of study, which led to the development of the first mechanical computing devices. Modern computers and pocket calculators now generate trigonometric function values on demand, using special libraries of mathematical code. Often, these libraries use pre-calculated tables internally, and compute the required value by using an appropriate
interpolation In the mathematical field of numerical analysis, interpolation is a type of estimation, a method of constructing (finding) new data points based on the range of a discrete set of known data points. In engineering and science, one often has a n ...
method. Interpolation of simple look-up tables of trigonometric functions is still used in
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
, where only modest accuracy may be required and speed is often paramount. Another important application of trigonometric tables and generation schemes is for
fast Fourier transform A fast Fourier transform (FFT) is an algorithm that computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IDFT). Fourier analysis converts a signal from its original domain (often time or space) to a representation in th ...
(FFT) algorithms, where the same trigonometric function values (called ''twiddle factors'') must be evaluated many times in a given transform, especially in the common case where many transforms of the same size are computed. In this case, calling generic library routines every time is unacceptably slow. One option is to call the library routines once, to build up a table of those trigonometric values that will be needed, but this requires significant memory to store the table. The other possibility, since a regular sequence of values is required, is to use a recurrence formula to compute the trigonometric values on the fly. Significant research has been devoted to finding accurate, stable recurrence schemes in order to preserve the accuracy of the FFT (which is very sensitive to trigonometric errors).


On-demand computation

Modern computers and calculators use a variety of techniques to provide trigonometric function values on demand for arbitrary angles (Kantabutra, 1996). One common method, especially on higher-end processors with
floating-point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
units, is to combine a
polynomial In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An exa ...
or
rational Rationality is the quality of being guided by or based on reasons. In this regard, a person acts rationally if they have a good reason for what they do or a belief is rational if it is based on strong evidence. This quality can apply to an abili ...
approximation An approximation is anything that is intentionally similar but not exactly equality (mathematics), equal to something else. Etymology and usage The word ''approximation'' is derived from Latin ''approximatus'', from ''proximus'' meaning ''very ...
(such as
Chebyshev approximation In mathematics, approximation theory is concerned with how functions can best be approximated with simpler functions, and with quantitatively characterizing the errors introduced thereby. Note that what is meant by ''best'' and ''simpler'' wi ...
, best uniform approximation, Padé approximation, and typically for higher or variable precisions,
Taylor Taylor, Taylors or Taylor's may refer to: People * Taylor (surname) **List of people with surname Taylor * Taylor (given name), including Tayla and Taylah * Taylor sept, a branch of Scottish clan Cameron * Justice Taylor (disambiguation) Plac ...
and
Laurent series In mathematics, the Laurent series of a complex function f(z) is a representation of that function as a power series which includes terms of negative degree. It may be used to express complex functions in cases where a Taylor series expansion c ...
) with range reduction and a table lookup — they first look up the closest angle in a small table, and then use the polynomial to compute the correction. Maintaining precision while performing such interpolation is nontrivial, but methods like
Gal's accurate tables Gal's accurate tables is a method devised by Shmuel Gal to provide accurate values of special functions using a lookup table and interpolation. It is a fast and efficient method for generating values of functions like the exponential function, expon ...
, Cody and Waite range reduction, and Payne and Hanek radian reduction algorithms can be used for this purpose. On simpler devices that lack a
hardware multiplier A binary multiplier is an electronic circuit used in digital electronics, such as a computer, to multiply two binary numbers. A variety of computer arithmetic techniques can be used to implement a digital multiplier. Most techniques involve co ...
, there is an algorithm called
CORDIC CORDIC (for "coordinate rotation digital computer"), also known as Volder's algorithm, or: Digit-by-digit method Circular CORDIC (Jack E. Volder), Linear CORDIC, Hyperbolic CORDIC (John Stephen Walther), and Generalized Hyperbolic CORDIC (GH C ...
(as well as related techniques) that is more efficient, since it uses only shifts and additions. All of these methods are commonly implemented in hardware for performance reasons. The particular polynomial used to approximate a trigonometric function is generated ahead of time using some approximation of a
minimax approximation algorithm A minimax approximation algorithm (or L∞ approximation or uniform approximation) is a method to find an approximation of a mathematical function that minimizes maximum error. For example, given a function f defined on the interval ,band a de ...
. For very high precision calculations, when series-expansion convergence becomes too slow, trigonometric functions can be approximated by the arithmetic-geometric mean, which itself approximates the trigonometric function by the (
complex Complex commonly refers to: * Complexity, the behaviour of a system whose components interact in multiple ways so possible interactions are difficult to describe ** Complex system, a system composed of many components which may interact with each ...
)
elliptic integral In integral calculus, an elliptic integral is one of a number of related functions defined as the value of certain integrals, which were first studied by Giulio Fagnano and Leonhard Euler (). Their name originates from their originally arising in ...
(Brent, 1976). Trigonometric functions of angles that are
rational Rationality is the quality of being guided by or based on reasons. In this regard, a person acts rationally if they have a good reason for what they do or a belief is rational if it is based on strong evidence. This quality can apply to an abili ...
multiples of 2π are
algebraic number An algebraic number is a number that is a root of a non-zero polynomial in one variable with integer (or, equivalently, rational) coefficients. For example, the golden ratio, (1 + \sqrt)/2, is an algebraic number, because it is a root of the po ...
s. The values for ''a/b·2π'' can be found by applying de Moivre's identity for ''n = a'' to a ''bth''
root of unity In mathematics, a root of unity, occasionally called a Abraham de Moivre, de Moivre number, is any complex number that yields 1 when exponentiation, raised to some positive integer power . Roots of unity are used in many branches of mathematic ...
, which is also a root of the polynomial ''xb - 1'' in the
complex plane In mathematics, the complex plane is the plane formed by the complex numbers, with a Cartesian coordinate system such that the -axis, called the real axis, is formed by the real numbers, and the -axis, called the imaginary axis, is formed by the ...
. For example, the cosine and sine of 2π ⋅ 5/37 are the
real Real may refer to: Currencies * Brazilian real (R$) * Central American Republic real * Mexican real * Portuguese real * Spanish real * Spanish colonial real Music Albums * ''Real'' (L'Arc-en-Ciel album) (2000) * ''Real'' (Bright album) (2010) ...
and
imaginary part In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the form ...
s, respectively, of the 5th power of the 37th root of unity cos(2π/37) + sin(2π/37)i, which is a root of the
degree Degree may refer to: As a unit of measurement * Degree (angle), a unit of angle measurement ** Degree of geographical latitude ** Degree of geographical longitude * Degree symbol (°), a notation used in science, engineering, and mathematics ...
-37 polynomial ''x''37 − 1. For this case, a root-finding algorithm such as
Newton's method In numerical analysis, Newton's method, also known as the Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valu ...
is much simpler than the arithmetic-geometric mean algorithms above while converging at a similar asymptotic rate. The latter algorithms are required for transcendental trigonometric constants, however.


Half-angle and angle-addition formulas

Historically, the earliest method by which trigonometric tables were computed, and probably the most common until the advent of computers, was to repeatedly apply the half-angle and angle-addition
trigonometric identities In trigonometry, trigonometric identities are equalities that involve trigonometric functions and are true for every value of the occurring variables for which both sides of the equality are defined. Geometrically, these are identities involvin ...
starting from a known value (such as sin(π/2) = 1, cos(π/2) = 0). This method was used by the ancient astronomer
Ptolemy Claudius Ptolemy (; grc-gre, Πτολεμαῖος, ; la, Claudius Ptolemaeus; AD) was a mathematician, astronomer, astrologer, geographer, and music theorist, who wrote about a dozen scientific treatises, three of which were of importanc ...
, who derived them in the ''
Almagest The ''Almagest'' is a 2nd-century Greek-language mathematical and astronomical treatise on the apparent motions of the stars and planetary paths, written by Claudius Ptolemy ( ). One of the most influential scientific texts in history, it canoni ...
'', a treatise on astronomy. In modern form, the identities he derived are stated as follows (with signs determined by the quadrant in which ''x'' lies): :\cos\left(\frac\right) = \pm \sqrt :\sin\left(\frac\right) = \pm \sqrt :\sin(x \pm y) = \sin(x) \cos(y) \pm \cos(x) \sin(y)\, :\cos(x \pm y) = \cos(x) \cos(y) \mp \sin(x) \sin(y)\, These were used to construct
Ptolemy's table of chords The table of chords, created by the Greek astronomer, geometer, and geographer Ptolemy in Egypt during the 2nd century AD, is a trigonometric table in Book I, chapter 11 of Ptolemy's ''Almagest'', a treatise on mathematical astronomy. It ...
, which was applied to astronomical problems. Various other permutations on these identities are possible: for example, some early trigonometric tables used not sine and cosine, but sine and
versine The versine or versed sine is a trigonometric function found in some of the earliest (Sanskrit Āryabhaṭa's sine table , ''Aryabhatia'',
.


A quick, but inaccurate, approximation

A quick, but inaccurate, algorithm for calculating a table of ''N'' approximations ''s''''n'' for
sin In a religious context, sin is a transgression against divine law. Each culture has its own interpretation of what it means to commit a sin. While sins are generally considered actions, any thought, word, or act considered immoral, selfish, s ...
(2 π''n''/''N'') and ''c''''n'' for cos(2π''n''/''N'') is: :''s''0 = 0 :''c''0 = 1 :''s''''n''+1 = ''s''''n'' + ''d'' × ''c''''n'' :''c''''n''+1 = ''c''''n'' − ''d'' × ''s''''n'' for ''n'' = 0,...,''N'' − 1, where ''d'' = 2π/''N''. This is simply the
Euler method In mathematics and computational science, the Euler method (also called forward Euler method) is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic explicit met ...
for integrating the
differential equation In mathematics, a differential equation is an equation that relates one or more unknown functions and their derivatives. In applications, the functions generally represent physical quantities, the derivatives represent their rates of change, an ...
: :ds/dt = c :dc/dt = -s with initial conditions ''s''(0) = 0 and ''c''(0) = 1, whose analytical solution is ''s'' = sin(''t'') and ''c'' = cos(''t''). Unfortunately, this is not a useful algorithm for generating sine tables because it has a significant error, proportional to 1/''N''. For example, for ''N'' = 256 the maximum error in the sine values is ~0.061 (''s''202 = −1.0368 instead of −0.9757). For ''N'' = 1024, the maximum error in the sine values is ~0.015 (''s''803 = −0.99321 instead of −0.97832), about 4 times smaller. If the sine and cosine values obtained were to be plotted, this algorithm would draw a logarithmic spiral rather than a circle.


A better, but still imperfect, recurrence formula

A simple recurrence formula to generate trigonometric tables is based on
Euler's formula Euler's formula, named after Leonhard Euler, is a mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex exponential function. Euler's formula states that for an ...
and the relation: :e^ = e^ \times e^ This leads to the following recurrence to compute trigonometric values ''s''''n'' and ''c''''n'' as above: :''c''0 = 1 :''s''0 = 0 :''c''''n''+1 = ''w''''r'' ''c''''n'' − ''w''''i'' ''s''''n'' :''s''''n''+1 = ''w''''i'' ''c''''n'' + ''w''''r'' ''s''''n'' for ''n'' = 0, ..., ''N'' − 1, where ''w''''r'' = cos(2π/''N'') and ''w''''i'' = sin(2π/''N''). These two starting trigonometric values are usually computed using existing library functions (but could also be found e.g. by employing
Newton's method In numerical analysis, Newton's method, also known as the Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valu ...
in the complex plane to solve for the primitive
root In vascular plants, the roots are the organs of a plant that are modified to provide anchorage for the plant and take in water and nutrients into the plant body, which allows plants to grow taller and faster. They are most often below the sur ...
of ''z''''N'' − 1). This method would produce an ''exact'' table in exact arithmetic, but has errors in finite-precision
floating-point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
arithmetic. In fact, the errors grow as O(ε ''N'') (in both the worst and average cases), where ε is the floating-point precision. A significant improvement is to use the following modification to the above, a trick (due to Singleton) often used to generate trigonometric values for FFT implementations: :''c''0 = 1 :''s''0 = 0 :''c''''n''+1 = ''c''''n'' − (α ''c''''n'' + β ''s''''n'') :''s''''n''+1 = ''s''''n'' + (β ''c''''n'' − α ''s''''n'') where α = 2 sin2(π/''N'') and β = sin(2π/''N''). The errors of this method are much smaller, O(ε √''N'') on average and O(ε ''N'') in the worst case, but this is still large enough to substantially degrade the accuracy of FFTs of large sizes.


See also

* Aryabhata's sine table *
CORDIC CORDIC (for "coordinate rotation digital computer"), also known as Volder's algorithm, or: Digit-by-digit method Circular CORDIC (Jack E. Volder), Linear CORDIC, Hyperbolic CORDIC (John Stephen Walther), and Generalized Hyperbolic CORDIC (GH C ...
*
Exact trigonometric values In mathematics, the values of the trigonometric functions can be expressed approximately, as in \cos (\pi/4) \approx 0.707, or exactly, as in \cos (\pi/ 4)= \sqrt 2 /2. While trigonometric tables contain many approximate values, the exact values f ...
*
Madhava's sine table Madhava's sine table is the table of trigonometric sines of various angles constructed by the 14th century Kerala mathematician-astronomer Madhava of Sangamagrama. The table lists the trigonometric sines of the twenty-four angles 3.75°, 7.50 ...
*
Numerical analysis Numerical analysis is the study of algorithms that use numerical approximation (as opposed to symbolic computation, symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). It is the study of ...
*
Plimpton 322 Plimpton 322 is a Babylonian clay tablet, notable as containing an example of Babylonian mathematics. It has number 322 in the G.A. Plimpton Collection at Columbia University. This tablet, believed to have been written about 1800 BC, has a table ...
*
Prosthaphaeresis Prosthaphaeresis (from the Greek ''προσθαφαίρεσις'') was an algorithm used in the late 16th century and early 17th century for approximate multiplication and division using formulas from trigonometry. For the 25 years preceding the ...


References

*
Carl B. Boyer Carl Benjamin Boyer (November 3, 1906 – April 26, 1976) was an American historian of sciences, and especially mathematics. Novelist David Foster Wallace called him the " Gibbon of math history". It has been written that he was one of few histo ...
(1991) ''A History of Mathematics'', 2nd edition,
John Wiley & Sons John Wiley & Sons, Inc., commonly known as Wiley (), is an American multinational publishing company founded in 1807 that focuses on academic publishing and instructional materials. The company produces books, journals, and encyclopedias, in p ...
. * Manfred Tasche and Hansmartin Zeuner (2002) "Improved roundoff error analysis for precomputed twiddle factors", ''Journal for Computational Analysis and Applications'' 4(1): 1–18. * James C. Schatzman (1996) "Accuracy of the discrete Fourier transform and the fast Fourier transform",
SIAM Journal on Scientific Computing The ''SIAM Journal on Scientific Computing'' (''SISC''), formerly ''SIAM Journal on Scientific & Statistical Computing'', is a scientific journal focusing on the research articles on numerical methods and techniques for scientific computation. It ...
17(5): 1150–1166. * Vitit Kantabutra (1996) "On hardware for computing exponential and trigonometric functions,"
IEEE Transactions on Computers ''IEEE Transactions on Computers'' is a monthly peer-reviewed scientific journal covering all aspects of computer design. It was established in 1952 and is published by the IEEE Computer Society. The editor-in-chief is Ahmed Louri, David and Mari ...
45(3): 328–339 . * R. P. Brent (1976)
Fast Multiple-Precision Evaluation of Elementary Functions
,
Journal of the Association for Computing Machinery The ''Journal of the ACM'' is a peer-reviewed scientific journal covering computer science in general, especially theoretical aspects. It is an official journal of the Association for Computing Machinery. Its current editor-in-chief is Venkatesan ...
23: 242–251. * * William J. Cody Jr., William Waite, ''Software Manual for the Elementary Functions'', Prentice-Hall, 1980, {{ISBN, 0-13-822064-6. * Mary H. Payne, Robert N. Hanek, ''Radian reduction for trigonometric functions'', ACM SIGNUM Newsletter 18: 19-24, 1983. * Gal, Shmuel and Bachelis, Boris (1991) "An accurate elementary mathematical library for the IEEE floating point standard",
ACM Transactions on Mathematical Software ''ACM Transactions on Mathematical Software'' (''TOMS'') is a quarterly scientific journal that aims to disseminate the latest findings of note in the field of numeric, symbolic, algebraic, and geometric computing applications. It is one of the old ...
. Trigonometry Numerical analysis