computational complexity of mathematical operations
{{Short description|Algorithmic runtime requirements for common math procedures}}
{{more citations needed|date=April 2015}}
File:comparison computational complexity.svg
The following tables list the computational complexity of various algorithms for common mathematical operations.
Here, complexity refers to the time complexity of performing computations on a multitape Turing machine.{{cite book |first1=A. |last1=Schönhage |first2=A.F.W. |last2=Grotefeld |first3=E. |last3=Vetter |title=Fast Algorithms—A Multitape Turing Machine Implementation |publisher=BI Wissenschafts-Verlag |date=1994 |isbn=978-3-411-16891-0 |pages= |oclc=897602049}} See big O notation for an explanation of the notation used.
Note: Due to the variety of multiplication algorithms, below stands in for the complexity of the chosen multiplication algorithm.
Arithmetic functions
This table lists the complexity of mathematical operations on integers.
{{clear}}
On stronger computational models, specifically a pointer machine and consequently also a unit-cost random-access machine it is possible to multiply two {{mvar|n}}-bit numbers in time O(n).{{cite journal |last1=Schönhage |first1=Arnold |title=Storage Modification Machines |journal=SIAM Journal on Computing |date=1980 |volume=9 |issue=3 |pages=490–508 |doi=10.1137/0209036}}
Algebraic functions
Here we consider operations over polynomials and {{mvar|n}} denotes their degree; for the coefficients we use a unit-cost model, ignoring the number of bits in a number. In practice this means that we assume them to be machine integers.
class="wikitable"
!Operation !Input !Output !Algorithm !Complexity |
rowspan=2|Polynomial evaluation
|rowspan=2| One polynomial of degree with integer coefficients |rowspan=2| One number |Direct evaluation | |
Horner's method
| |
rowspan=2|Polynomial gcd (over or )
|rowspan=2| Two polynomials of degree with integer coefficients |rowspan=2| One polynomial of degree at most | |
Fast Euclidean algorithm (Lehmer){{Citation needed|date=September 2023}}
| |
Special functions
Many of the methods in this section are given in Borwein & Borwein.{{cite book |first1=J. |last1=Borwein |first2=P. |last2=Borwein |title=Pi and the AGM: A Study in Analytic Number Theory and Computational Complexity |publisher=Wiley |date=1987 |isbn=978-0-471-83138-9 |oclc=755165897}}
= Elementary functions =
The elementary functions are constructed by composing arithmetic operations, the exponential function (), the natural logarithm (), trigonometric functions (), and their inverses. The complexity of an elementary function is equivalent to that of its inverse, since all elementary functions are analytic and hence invertible by means of Newton's method. In particular, if either or in the complex domain can be computed with some complexity, then that complexity is attainable for all other elementary functions.
Below, the size refers to the number of digits of precision at which the function is to be evaluated.
It is not known whether is the optimal complexity for elementary functions. The best known lower bound is the trivial bound
= Non-elementary functions =
class="wikitable"
!Function !Input !Algorithm !Complexity |
rowspan=3|Gamma function
|-digit number |Series approximation of the incomplete gamma function | |
Fixed rational number
|Hypergeometric series | |
, for integer.
|Arithmetic-geometric mean iteration | |
rowspan=2|Hypergeometric function
|-digit number |(As described in Borwein & Borwein) | |
Fixed rational number
|Hypergeometric series | |
= Mathematical constants =
This table gives the complexity of computing approximations to the given constants to correct digits.
class="wikitable"
!Constant !Algorithm !Complexity |
Golden ratio,
| |
Square root of 2,
|Newton's method | |
rowspan=2|Euler's number,
|Binary splitting of the Taylor series for the exponential function | |
Newton inversion of the natural logarithm
| |
rowspan=2|Pi,
|Binary splitting of the arctan series in Machin's formula |
Gauss–Legendre algorithm |
Euler's constant,
|Sweeney's method (approximation in terms of the exponential integral) | |
Number theory
Algorithms for number theoretical calculations are studied in computational number theory.
Matrix algebra
{{main|Computational complexity of matrix multiplication}}
The following complexity figures assume that arithmetic with individual elements has complexity O(1), as is the case with fixed-precision floating-point arithmetic or operations on a finite field.
In 2005, Henry Cohn, Robert Kleinberg, Balázs Szegedy, and Chris Umans showed that either of two different conjectures would imply that the exponent of matrix multiplication is 2.{{cite book |first1=Henry |last1=Cohn |first2=Robert |last2=Kleinberg |first3=Balazs |last3=Szegedy |first4=Chris |last4=Umans |arxiv=math.GR/0511460 |chapter=Group-theoretic Algorithms for Matrix Multiplication |chapter-url= |title=Proceedings of the 46th Annual Symposium on Foundations of Computer Science |year=2005 |publisher=IEEE |isbn=0-7695-2468-0 |pages=379–388 |doi=10.1109/SFCS.2005.39|s2cid=6429088 }}
Transforms
Algorithms for computing transforms of functions (particularly integral transforms) are widely used in all areas of mathematics, particularly analysis and signal processing.
class="wikitable"
!Operation !Input !Output !Algorithm !Complexity |
rowspan=2|Discrete Fourier transform
|rowspan=2|Finite data sequence of size |rowspan=2|Set of complex numbers |Schoolbook | |
Fast Fourier transform
| |
Notes
{{reflist|group=nb}}
References
{{reflist|40em}}
Further reading
{{refbegin}}
- {{cite book |last1=Brent |first1=Richard P. |author-link1=Richard P. Brent |last2=Zimmermann |first2=Paul |author-link2=Paul Zimmermann (mathematician) |title=Modern Computer Arithmetic |year=2010 |publisher=Cambridge University Press |isbn=978-0-521-19469-3}}
- {{cite book |last1=Knuth |first1=Donald Ervin |author-link=Donald Knuth |series=The Art of Computer Programming |volume=2 |title=Seminumerical Algorithms|year=1997| edition=3rd |publisher=Addison-Wesley |isbn=978-0-201-89684-8}}
{{refend}}
Category:Computer arithmetic algorithms
Category:Computational complexity theory
Category:Mathematics-related lists