词条 | Factorial | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
释义 |
In mathematics, the factorial of a positive integer {{mvar|n}}, denoted by {{math|n!}}, is the product of all positive integers less than or equal to {{mvar|n}}. For example, The value of 0! is 1, according to the convention for an empty product.{{sfn|Graham|Knuth|Patashnik|1988|page=111}} The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic use counts the possible distinct sequences -- the permutations -- of {{mvar|n}} distinct objects: there are {{math|n!}}. The factorial function can also be extended to non-integer arguments while retaining its most important properties; this involves more advanced mathematics, notably techniques from mathematical analysis. HistoryFactorials were used to count permutations at least as early as the 12th century, by Indian scholars.[1] In 1677, Fabian Stedman described factorials as applied to change ringing, a musical art involving the ringing of many tuned bells.{{sfn|Stedman|1677|pages=6–9}} After describing a recursive approach, Stedman gives a statement of a factorial (using the language of the original): {{Cquote| quote = Now the nature of these methods is such, that the changes on one number comprehends [includes] the changes on all lesser numbers ... insomuch that a compleat Peal of changes on one number seemeth to be formed by uniting of the compleat Peals on all lesser numbers into one entire body.{{sfn|Stedman|1677|p=8}} }} The notation {{math|{{math|n!}}}} was introduced by the French mathematician Christian Kramp in 1808.[2] DefinitionThe factorial function is defined by the product for integer {{math|n ≥ 1}}. This may be written in the Pi product notation as From these formulas, one may derive the recurrence relation For example, one has and so on. Factorial of zeroThe factorial of 0, , is 1. There are several motivations for this definition:
. More generally, the number of ways to choose all {{mvar|n}} elements among a set of {{mvar|n}} is .
Factorial of a non-integerThe factorial function can also be defined for non-integer values using more advanced mathematics (the gamma function {{math|1=n! = Γ(n + 1)}}), detailed in the section below. This more generalized definition is used by advanced calculators and mathematical software such as Maple, Mathematica, or APL. ApplicationsAlthough the factorial function has its roots in combinatorics, formulas involving factorials occur in many areas of mathematics.
possibilities. This however produces the {{mvar|k}}-combinations in a particular order that one wishes to ignore; since each {{mvar|k}}-combination is obtained in {{math|k!}} different ways, the correct number of {{mvar|k}}-combinations is This number is known[5] as the binomial coefficient, because it is also the coefficient of {{math|xk}} in {{math|(1 + x)n}}. The term is often called a falling factorial (pronounced "n to the falling k").
while this is inefficient as a means to compute that number, it may serve to prove a symmetry property[4][5] of binomial coefficients:
where {{math|Dn xn}} is Euler's notation for the {{mvar|n}}th derivative of {{math|xn}}.[8] Rate of growth and approximations for large {{mvar|n}}As {{mvar|n}} grows, the factorial {{math|n!}} increases faster than all polynomials and exponential functions (but slower than double exponential functions) in {{mvar|n}}. Most approximations for n! are based on approximating its natural logarithm The graph of the function {{math|f(n) {{=}} ln n!}} is shown in the figure on the right. It looks approximately linear for all reasonable values of {{mvar|n}}, but this intuition is false. We get one of the simplest approximations for {{math|ln n!}} by bounding the sum with an integral from above and below as follows: which gives us the estimate Hence {{math|ln n! ∼ n ln n}} (see Big {{mvar|O}} notation). This result plays a key role in the analysis of the computational complexity of sorting algorithms (see comparison sort). From the bounds on {{math|ln n!}} deduced above we get that It is sometimes practical to use weaker but simpler estimates. Using the above formula it is easily shown that for all {{mvar|n}} we have {{math|({{sfrac|n|3}})n < n!}}, and for all {{math|n ≥ 6}} we have {{math|n! < ({{sfrac|n|2}})n}}. For large {{mvar|n}} we get a better estimate for the number {{math|n!}} using Stirling's approximation: This in fact comes from an asymptotic series for the logarithm, and {{mvar|n}} factorial lies between this and the next approximation: Another approximation for {{math|ln n!}} is given by Srinivasa Ramanujan {{harv|Ramanujan|1988}} Both this and Stirling's approximation give a relative error on the order of {{math|{{sfrac|1|n3}}}}, but Ramanujan's is about four times more accurate. However, if we use two correction terms in a Sitrling-type approximation, as with Ramanujan's approximation, the relative error will be of order {{math|{{sfrac|1|n5}}}}:{{Citation needed|date=March 2019}} ComputationIf efficiency is not a concern, computing factorials is trivial from an algorithmic point of view: successively multiplying a variable initialized to 1 by the integers up to {{mvar|n}} (if any) will compute {{math|n!}}, provided the result fits in the variable. In functional languages, the recursive definition is often implemented directly to illustrate recursive functions. The main practical difficulty in computing factorials is the size of the result. To assure that the exact result will fit for all legal values of even the smallest commonly used integral type (8-bit signed integers) would require more than 700 bits, so no reasonable specification of a factorial function using fixed-size types can avoid questions of overflow. The values 12! and 20! are the largest factorials that can be stored in, respectively, the 32-bit and 64-bit integers commonly used in personal computers, however many languages support variable length integer types capable of calculating very large values.[9] Floating-point representation of an approximated result allows going a bit further, but this also remains quite limited by possible overflow. Most calculators use scientific notation with 2-digit decimal exponents, and the largest factorial that fits is then 69!, because {{nowrap|69! < 10100 < 70!}}. Other implementations (such as computer software such as spreadsheet programs) can often handle larger values. Most software applications will compute small factorials by direct multiplication or table lookup. Larger factorial values can be approximated using Stirling's formula. Wolfram Alpha can calculate exact results for the ceiling function and floor function applied to the binary, natural and common logarithm of {{math|n!}} for values of {{mvar|n}} up to {{val|249999}}, and up to {{val|20000000|end=!}} for the integers. If the exact values of large factorials are needed, they can be computed using arbitrary-precision arithmetic. Instead of doing the sequential multiplications {{nowrap|((1 × 2) × 3) × 4...}}, a program can partition the sequence into two parts, whose products are roughly the same size, and multiply them using a divide-and-conquer method. This is often more efficient.[10] The asymptotically best efficiency is obtained by computing {{math|n!}} from its prime factorization. As documented by Peter Borwein, prime factorization allows {{math|n!}} to be computed in time {{math|O(n(log n log log n)2)}}, provided that a fast multiplication algorithm is used (for example, the Schönhage–Strassen algorithm).[11] Peter Luschny presents source code and benchmarks for several efficient factorial algorithms, with or without the use of a prime sieve.[12] Number theoryFactorials have many applications in number theory. In particular, {{math|n!}} is necessarily divisible by all prime numbers up to and including {{mvar|n}}. As a consequence, {{math|n > 5}} is a composite number if and only if A stronger result is Wilson's theorem, which states that if and only if {{mvar|p}} is prime.[13][14] Legendre's formula gives the multiplicity of the prime {{mvar|p}} occurring in the prime factorization of {{math|n!}} as or, equivalently, where {{math|sp(n)}} denotes the sum of the standard base//Euclid's theorem">Euclid's theorem that the number of primes is infinite.{{sfn|Bostock |Chandler |Rourke |2014|pages=168}} Primes of the form {{math|n! ± 1}} are called factorial primes. Series of reciprocalsThe reciprocals of factorials produce a convergent series whose sum is the exponential base {{mvar|e}}: Although the sum of this series is an irrational number, it is possible to multiply the factorials by positive integers to produce a convergent series with a rational sum: The convergence of this series to 1 can be seen from the fact that its partial sums are less than one by an inverse factorial. Therefore, the factorials do not form an irrationality sequence.{{sfn|Guy |2004|page=[{{google books|plainurl=yes|id=1AP2CEGxTkgC|pg=PA346}} 346]}} Factorial of non-integer valuesThe gamma and pi functions{{Main|Gamma function}}Besides nonnegative integers, the factorial can also be defined for non-integer values, but this requires more advanced tools from mathematical analysis. One function that fills in the values of the factorial (but with a shift of 1 in the argument), that is often used, is called the gamma function, denoted {{math|Γ(z)}}. It is defined for all complex numbers {{mvar|z}} except for the non-positive integers, and given when the real part of {{mvar|z}} is positive by Its relation to the factorial is that for any natural number {{mvar|n}} Euler's original formula for the gamma function was Another function that also fills the values of the factorial (but with no shift in the argument), originally introduced by Carl Friedrich Gauss, that is sometimes used, is called the pi function, denoted {{math|Π(z)}} for real numbers {{math|z ≥ 0}}. It is defined by In terms of the gamma function, the pi function is The pi function properly extends the factorial in that In addition to this, the pi function satisfies the same recurrence as factorials do, but at every complex value {{mvar|z}} where it is defined In fact, this is no longer a recurrence relation but a functional equation. Expressed in terms of the gamma function this functional equation takes the form Since the factorial is extended by the pi function, for every complex value {{mvar|z}} where it is defined, we can write: The values of these functions at half-integer values is therefore determined by a single one of themdimensional hypersphere of radius {{mvar|R}} is Factorial in the complex planeRepresentation through the gamma function allows evaluation of factorial of complex argument. Equilines of amplitude and phase of factorial are shown in figure. Let Several levels of constant modulus (amplitude) {{mvar|ρ}} and constant phase {{mvar|φ}} are shown. The grid covers the range {{math|−3 ≤ x ≤ 3}}, {{math|−2 ≤ y ≤ 2}}, with unit steps. The scratched line shows the level {{math|φ {{=}} ±π}}. Thin lines show intermediate levels of constant modulus and constant phase. At the poles at every negative integer, phase and amplitude are not defined. Equilines are dense in vicinity of singularities along negative integer values of the argument. For {{math|{{abs|z}} < 1}}, the Taylor expansions can be used: The first coefficients of this expansion are
where {{mvar|γ}} is the Euler–Mascheroni constant and {{math|ζ(z)}} is the Riemann zeta function. Computer algebra systems such as SageMath can generate many terms of this expansion. Approximations of the factorialFor the large values of the argument, the factorial can be approximated through the integral of the digamma function, using the continued fraction representation. This approach is due to T. J. Stieltjes (1894).{{citation needed|date=November 2018}} Writing {{math|z! {{=}} eP(z)}} where {{math|P(z)}} is Stieltjes gave a continued fraction for {{math|p(z)}}: The first few coefficients {{math|an}} are[16]
There is a misconception that {{math|ln z! {{=}} P(z)}} or {{math|ln Γ(z + 1) {{=}} P(z)}} for any complex {{math|z ≠ 0}}.{{citation needed|date=February 2015}} Indeed, the relation through the logarithm is valid only for a specific range of values of {{mvar|z}} in the vicinity of the real axis, where {{math|−π < Im(Γ(z + 1)) < π}}. The larger the real part of the argument, the smaller the imaginary part should be. However, the inverse relation, {{math|z! {{=}} eP(z)}}, is valid for the whole complex plane apart from {{math|z {{=}} 0}}. The convergence is poor in the vicinity of the negative part of the real axis;{{citation needed|date=February 2015}} it is difficult to have good convergence of any approximation in the vicinity of the singularities. When {{math|{{abs|Im z}} > 2}} or {{math|Re z > 2}}, the six coefficients above are sufficient for the evaluation of the factorial with complex double precision. For higher precision more coefficients can be computed by a rational QD scheme (Rutishauser's QD algorithm).[17] Non-extendability to negative integersThe relation {{math|n! {{=}} n × (n − 1)!}} allows one to compute the factorial for an integer given the factorial for a smaller integer. The relation can be inverted so that one can compute the factorial for an integer given the factorial for a larger integer: Note, however, that this recursion does not permit us to compute the factorial of a negative integer; use of the formula to compute (−1)! would require a division by zero, and thus blocks us from computing a factorial value for every negative integer. Similarly, the gamma function is not defined for zero or negative integers, though it is defined for all other complex numbers. Factorial-like products and functionsThere are several other integer sequences similar to the factorial that are used in mathematics: Double factorial{{main|Double factorial}}The product of all the odd integers up to some odd positive integer {{mvar|n}} is called the double factorial of {{mvar|n}}, and denoted by {{math|n!!}}.[18] That is, For example, {{nowrap|1=9!! = 1 × 3 × 5 × 7 × 9 = 945}}. The sequence of double factorials for {{math|n {{=}} 1, 3, 5, 7,...}} starts as 1, 3, 15, 105, 945, {{val|10395}}, {{val|135135}},... {{OEIS|id=A001147}} Double factorial notation may be used to simplify the expression of certain trigonometric integrals,[19] to provide an expression for the values of the gamma function at half-integer arguments and the volume of hyperspheres,[20] and to solve many counting problems in combinatorics including counting binary trees with labeled leaves and perfect matchings in complete graphs.[18][21] ===Multifactorials=== A common related notation is to use multiple exclamation points to denote a multifactorial, the product of integers in steps of two ({{math|n!!}}), three ({{math|n!!!}}), or more (see generalizations of the double factorial). The double factorial is the most commonly used variant, but one can similarly define the triple factorial ({{math|n!!!}}) and so on. One can define the {{mvar|k}}-tuple factorial, denoted by {{math|n!(k)}}, recursively for positive integers as In addition, similarly to {{nowrap|0! {{=}} {{sfrac|1!|1}} {{=}} 1}}, one can define: For sufficiently large {{math|n ≥ 1}}, the ordinary single factorial function is expanded through the multifactorial functions as follows: In the same way that {{math|n!}} is not defined for negative integers, and {{math|n!!}} is not defined for negative even integers, {{math|n!(k)}} is not defined for negative integers divisible by {{mvar|k}}. Primorial{{Main|Primorial}}The primorial ({{Math|n#}}) {{OEIS|id=A002110}} is similar to the factorial, but with the product taken only over the prime numbers. For example the primorial of 11 is In general, For the {{mvar|n}}th prime number {{mvar|pn}} where {{mvar|pk}} is the {{mvar|k}}th prime number. Superfactorial{{See also|Large numbers}}{{redirect|N$|the currency|Namibian dollar}}Neil Sloane and Simon Plouffe defined a superfactorial in The Encyclopedia of Integer Sequences (Academic Press, 1995) to be the product of the first {{mvar|n}} factorials. So the superfactorial of 4 is In general Equivalently, the superfactorial is given by the formula which is the determinant of a Vandermonde matrix. The sequence of superfactorials starts (from {{math|n {{=}} 0}}) as 1, 1, 2, 12, 288, {{val|34560}}, {{val|24883200}}, {{val|125411328000}},... {{OEIS|id=A000178}} By this definition, we can define the {{mvar|k}}-superfactorial of {{mvar|n}} (denoted {{math|sfk(n)}}) as: The 2-superfactorials of {{mvar|n}} are 1, 1, 2, 24, {{val|6912|fmt=gaps}}, {{val|238878720}}, {{val|5944066965504000}}, {{val|745453331864786829312000000}},... {{OEIS|id=A055462}} The 0-superfactorial of {{mvar|n}} is {{mvar|n}}. Pickover’s superfactorialIn his 1995 book Keys to Infinity, Clifford Pickover defined a different function {{math|n$}} that he called the superfactorial. It is defined by This sequence of superfactorials starts (Here, as is usual for compound exponentiation, the grouping is understood to be from right to left: {{math|abc {{=}} a(bc)}}.) This operation may also be expressed as the tetration or using Knuth's up-arrow notation as HyperfactorialOccasionally the hyperfactorial of n is considered. It is written as {{math|H(n)}} and defined by For {{math|n {{=}} 1, 2, 3, 4,...}} the values of {{math|H(n)}} are 1, 4, 108, {{val|27648}},... {{OEIS|id=A002109}}. The asymptotic growth rate is where {{mvar|A}} = 1.2824... is the Glaisher–Kinkelin constant.[22] {{math|H(14)}} ≈ {{val|1.8474e99}} is already almost equal to a googol, and {{math|H(15)}} ≈ {{val|8.0896e116}} is almost of the same magnitude as the Shannon number, the theoretical number of possible chess games. Compared to the Pickover definition of the superfactorial, the hyperfactorial grows relatively slowly. The hyperfactorial function can be generalized to complex numbers in a similar way as the factorial function. The resulting function is called the {{mvar|K}}-function. See also{{div col|colwidth=30em}}
References1. ^{{Cite journal |last=Biggs |first=Norman L. |author-link=Norman L. Biggs |date=May 1979 |title=The roots of combinatorics |journal=Historia Mathematica |volume=6 |issue=2 |pages=109–136 |doi=10.1016/0315-0860(79)90074-0 |issn=0315-0860 |via=ScienceDirect}} 2. ^{{harvnb|Higgins|2008|page=12}} 3. ^{{Cite book |title=Beyond Infinity: An expedition to the outer limits of the mathematical universe |last=Cheng |first=Eugenia |date=2017-03-09 |publisher=Profile Books |isbn=9781782830818 |language=en |author-link=Eugenia Cheng}} 4. ^1 {{Cite book |title=The Book of Numbers |last=Conway |first=John H. |last2=Guy |first2=Richard |date=1998-03-16 |publisher=Springer Science & Business Media |isbn=9780387979939 |language=en |author-link=John Horton Conway |author-link2=Richard K. Guy}} 5. ^1 {{Cite book |title=The Art of Computer Programming: Volume 1: Fundamental Algorithms |last=Knuth |first=Donald E. |date=1997-07-04 |publisher=Addison-Wesley Professional |isbn=9780321635747 |language=en |author-link=Donald Knuth}} 6. ^{{Cite web|url=https://ocw.mit.edu/courses/mathematics/18-01-single-variable-calculus-fall-2006/lecture-notes/|title=18.01 Single Variable Calculus, Lecture 37: Taylor Series|last=|first=|date=Fall 2006|website=MIT OpenCourseWare|archive-url=https://web.archive.org/web/20121706133400/http://ocw.mit.edu/courses/mathematics/18-01-single-variable-calculus-fall-2006/lecture-notes/|archive-date=2018-04-26|dead-url=no|access-date=2017-05-03|df=}} 7. ^{{Cite book |title=Statistical Physics of Particles |last=Kardar |first=Mehran |date=2007-06-25 |publisher=Cambridge University Press |isbn=9780521873420 |pages=35–56 |language=English |chapter=Chapter 2: Probability |author-link=Mehran Kardar}} 8. ^{{Cite web|url=https://ocw.mit.edu/courses/mathematics/18-01-single-variable-calculus-fall-2006/lecture-notes/|title=18.01 Single Variable Calculus, Lecture 4: Chain rule, higher derivatives|last=|first=|date=Fall 2006|website=MIT OpenCourseWare|archive-url=https://web.archive.org/web/20121706133400/http://ocw.mit.edu/courses/mathematics/18-01-single-variable-calculus-fall-2006/lecture-notes/|archive-date=2018-04-26|dead-url=no|access-date=2017-05-03|df=}} 9. ^{{cite web|url=https://github.com/wesselbosman/nFactorial|title=wesselbosman/nFactorial|author=|date=|website=GitHub|accessdate=26 April 2018|deadurl=no|archiveurl=https://web.archive.org/web/20180426001413/https://github.com/wesselbosman/nFactorial|archivedate=26 April 2018|df=}} 10. ^{{cite web|work=GNU MP Software Manual |url=http://gmplib.org/manual/Factorial-Algorithm.html |title=Factorial Algorithm |deadurl=yes |archive-url=https://web.archive.org/web/20130314174653/http://gmplib.org/manual/Factorial-Algorithm.html |archive-date=2013-03-14 |accessdate=2013-01-22}} 11. ^{{cite journal|first=Peter |last=Borwein |authorlink=Peter Borwein |title=On the Complexity of Calculating Factorials |journal=Journal of Algorithms |volume=6 |page=376–380 |date=1985}} 12. ^{{cite web|first=Peter |last=Luschny |url=http://www.luschny.de/math/factorial/FastFactorialFunctions.htm |title=Fast-Factorial-Functions: The Homepage of Factorial Algorithms |deadurl=yes |archive-url=https://web.archive.org/web/20050305083634/http://www.luschny.de/math/factorial/FastFactorialFunctions.htm |archive-date=2005-03-05 }} 13. ^{{MacTutor Biography|id=Al-Haytham|title=Abu Ali al-Hasan ibn al-Haytham}} 14. ^{{MathWorld|url=WilsonsTheorem.html|title=Wilson's Theorem|access-date=2017-05-17}} 15. ^{{cite web|first=Peter |last=Luschny |url=http://www.luschny.de/math/factorial/hadamard/HadamardsGammaFunction.html |title=Hadamard versus Euler – Who found the better Gamma function? |deadurl=yes |archive-url=https://web.archive.org/web/20090818171719/http://www.luschny.de/math/factorial/hadamard/HadamardsGammaFunction.html |archive-date=2009-08-18 }} 16. ^ {{cite web |url=http://dlmf.nist.gov/5.10 |title=5.10 |work=Digital Library of Mathematical Functions |accessdate=2010-10-17 |deadurl=no |archiveurl=https://web.archive.org/web/20100529224939/http://dlmf.nist.gov/5.10 |archivedate=2010-05-29 |df= }} 17. ^{{cite web|first=Peter |last=Luschny |url=http://www.luschny.de/math/factorial/approx/continuedfraction.html |title=On Stieltjes' Continued Fraction for the Gamma Function |dead-url=yes |archive-url=https://web.archive.org/web/20110514230817/http://www.luschny.de/math/factorial/approx/continuedfraction.html |archive-date=2011-05-14 }} 18. ^1 {{citation|title=A combinatorial survey of identities for the double factorial|first=David|last=Callan|arxiv=0906.1317|year=2009|bibcode=2009arXiv0906.1317C}}. 19. ^{{citation | last = Meserve | first = B. E. | doi = 10.2307/2306136 | issue = 7 | journal = The American Mathematical Monthly | mr = 1527019 | pages = 425–426 | title = Classroom Notes: Double Factorials | volume = 55 | year = 1948}} 20. ^{{citation|title=Some dimension problems in molecular databases|first=Paul G.|last=Mezey|year=2009|journal=Journal of Mathematical Chemistry|volume=45|issue=1|pages=1–6|doi=10.1007/s10910-008-9365-8}}. 21. ^{{citation | last1 = Dale | first1 = M. R. T. | last2 = Moon | first2 = J. W. | doi = 10.1016/0378-3758(93)90035-5 | issue = 1 | journal = Journal of Statistical Planning and Inference | mr = 1209991 | pages = 75–87 | title = The permuted analogues of three Catalan sets | volume = 34 | year = 1993}}. 22. ^{{MathWorld | urlname=Glaisher-KinkelinConstant | title=Glaisher–Kinkelin Constant}} Sources
Further reading{{refbegin}}
|chapter=Sur L’Expression Du Produit 1·2·3· · · · ·(n−1) Par Une Fonction Entière |title=Œuvres de Jacques Hadamard |publisher=Centre National de la Recherche Scientifiques |location=Paris (1968) |chapter-url=http://www.luschny.de/math/factorial/hadamard/HadamardFactorial.pdf|year=1894 |language=French}}
|publisher=Springer Berlin |page=339 |year=1988|isbn=3-540-18726-X}}{{refend}} External links{{commons category|Factorial (function)}}
4 : Combinatorics|Gamma and related functions|Factorial and binomial topics|Unary operations |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。