16 Factorial

0 views
Skip to first unread message

Nicandro Aaronson

unread,
Aug 5, 2024, 2:59:25 AM8/5/24
to awsindema
Muchof the mathematics of the factorial function was developed beginning in the late 18th and early 19th centuries.Stirling's approximation provides an accurate approximation to the factorial of large numbers, showing that it grows more quickly than exponential growth. Legendre's formula describes the exponents of the prime numbers in a prime factorization of the factorials, and can be used to count the trailing zeros of the factorials. Daniel Bernoulli and Leonhard Euler interpolated the factorial function to a continuous function of complex numbers, except at the negative integers, the (offset) gamma function.

Many other notable functions and number sequences are closely related to the factorials, including the binomial coefficients, double factorials, falling factorials, primorials, and subfactorials. Implementations of the factorial function are commonly used as an example of different computer programming styles, and are included in scientific calculators and scientific computing software libraries. Although directly computing large factorials using the product formula or recurrence is not efficient, faster algorithms are known, matching to within a constant factor the time for fast multiplication algorithms for numbers with the same number of digits.


From the late 15th century onward, factorials became the subject of study by Western mathematicians. In a 1494 treatise, Italian mathematician Luca Pacioli calculated factorials up to 11!, in connection with a problem of dining table arrangements.[12] Christopher Clavius discussed factorials in a 1603 commentary on the work of Johannes de Sacrobosco, and in the 1640s, French polymath Marin Mersenne published large (but not entirely correct) tables of factorials, up to 64!, based on the work of Clavius.[13] The power series for the exponential function, with the reciprocals of factorials for its coefficients, was first formulated in 1676 by Isaac Newton in a letter to Gottfried Wilhelm Leibniz.[14] Other important works of early European mathematics on factorials include extensive coverage in a 1685 treatise by John Wallis, a study of their approximate values for large values of n \displaystyle n by Abraham de Moivre in 1721, a 1729 letter from James Stirling to de Moivre stating what became known as Stirling's approximation, and work at the same time by Daniel Bernoulli and Leonhard Euler formulating the continuous extension of the factorial function to the gamma function.[15] Adrien-Marie Legendre included Legendre's formula, describing the exponents in the factorization of factorials into prime powers, in an 1808 text on number theory.[16]


The notation n ! \displaystyle n! for factorials was introduced by the French mathematician Christian Kramp in 1808.[17] Many other notations have also been used. Another later notation n _ \displaystyle \vert \!\underline \,n , in which the argument of the factorial was half-enclosed by the left and bottom sides of a box, was popular for some time in Britain and America but fell out of use, perhaps because it is difficult to typeset.[17] The word "factorial" (originally French: factorielle) was first used in 1800 by Louis Franois Antoine Arbogast,[18] in the first work on Fa di Bruno's formula,[19] but referring to a more general concept of products of arithmetic progressions. The "factors" that this name refers to are the terms of the product formula for the factorial.[20]


The special case of Legendre's formula for p = 5 \displaystyle p=5 gives the number of trailing zeros in the decimal representation of the factorials.[57] According to this formula, the number of zeros can be obtained by subtracting the base-5 digits of n \displaystyle n from n \displaystyle n , and dividing the result by four.[58] Legendre's formula implies that the exponent of the prime p = 2 \displaystyle p=2 is always larger than the exponent for p = 5 \displaystyle p=5 , so each factor of five can be paired with a factor of two to produce one of these trailing zeros.[57] The leading digits of the factorials are distributed according to Benford's law.[59] Every sequence of digits, in any base, is the sequence of initial digits of some factorial number in that base.[60]


Other complex functions that interpolate the factorial values include Hadamard's gamma function, which is an entire function over all the complex numbers, including the non-positive integers.[69][70] In the p-adic numbers, it is not possible to continuously interpolate the factorial function directly, because the factorials of large integers (a dense subset of the p-adics) converge to zero according to Legendre's formula, forcing any continuous function that is close to their values to be zero everywhere. Instead, the p-adic gamma function provides a continuous interpolation of a modified form of the factorial, omitting the factors in the factorial that are divisible by p.[71]


The factorial function is a common feature in scientific calculators.[73] It is also included in scientific programming libraries such as the Python mathematical functions module[74] and the Boost C++ library.[75] If efficiency is not a concern, computing factorials is trivial: just successively multiply a variable initialized to 1 \displaystyle 1 by the integers up to n \displaystyle n . The simplicity of this computation makes it a common example in the use of different computer programming styles and methods.[76]


Other methods suitable for its computation include memoization,[79] dynamic programming,[80] and functional programming.[81] The computational complexity of these algorithms may be analyzed using the unit-cost random-access machine model of computation, in which each arithmetic operation takes constant time and each number uses a constant amount of storage space. In this model, these methods can compute n ! \displaystyle n! in time O ( n ) \displaystyle O(n) , and the iterative version uses space O ( 1 ) \displaystyle O(1) . Unless optimized for tail recursion, the recursive version takes linear space to store its call stack.[82] However, this model of computation is only suitable when n \displaystyle n is small enough to allow n ! \displaystyle n! to fit into a machine word.[83] The values 12! and 20! are the largest factorials that can be stored in, respectively, the 32-bit[84] and 64-bit integers.[85] Floating point can represent larger factorials, but approximately rather than exactly, and will still overflow for factorials larger than 170 ! \displaystyle 170! .[84]


Even better efficiency is obtained by computing n! from its prime factorization, based on the principle that exponentiation by squaring is faster than expanding an exponent into a product.[86][89] An algorithm for this by Arnold Schnhage begins by finding the list of the primes up to n \displaystyle n , for instance using the sieve of Eratosthenes, and uses Legendre's formula to compute the exponent for each prime. Then it computes the product of the prime powers with these exponents, using a recursive algorithm, as follows:


I'm new to JMP. I would like to learn and understand the difference between the Custom DOE design and the Full Factorial DOE design. I am designing an experiment using 4 variables (2 levels each, 4th variable is categorical). A full factorial requires 16 runs. When I build the experiment in Custom design however, the default # of runs in JMP is 12. Why are the # of runs in each of these different? I get why it is 16 in the full factorial (2^4). But why is JMP recommending just 12 in the custom design? What's been assumed/factored into each of these designs?


That's a whole course of study contained in that question, but I'll try to summarize as best I can. Custom Design is built on a completely different paradigm of "optimal" or "algorithmic" designs. Full factorial designs are a classical type of DOE. They enforce all possible combinations of factor levels into the design. This gives the design some very desirable properties, such as orthogonal effects (no correlation between model terms, so coefficients are estimated with maximal precision for given number of runs). You can also estimate all main effects and higher order terms up to n-way interactions for n factors. However, you'll find that these designs quickly explode in size. A full factorial with 8 factors, each with 2 levels, has 2^8 = 256 runs. In most cases that is way too many runs.


In classical designs, you would look to fractional factorials to reduce the number of runs. These designs strategically confound the higher order model terms in order to reduce the design size significantly. In many cases, experimenters are only interested in main effects and 2 factor interactions. So losing the ability to estimate an 8, 7, 6, 5, 4-way interactions is of little consequence. For example, I could do a fractional factorial with 8 factors in only 64 runs (quite a bit lower than 254!), and still have uncorrelated main effects and 2-factor interactions, and can maybe even estimate higher orders than that depending on the level of fractionization. These designs, amongst many other classical designs, are all derived from theory.


Optimal designs are generated from computer algorithms where you basically describe what you want as inputs into the algorithm, and it returns a design with the most optimal set of design points to meet your experimental objectives. It does so through a process of rearranging design points (aka your run conditions) inside the design space until some optimization criteria is optimized (maximized for some criteria or minimized for others). There are 2 really prominent optimality criteria, D- and I-optimality. D-optimality emphasizes precise estimates of model coefficients (makes it a pretty good all-around choice, but excels in screening situations where people would commonly choose fractional factorial designs). I-optimality emphasizes low prediction variance, and is more associated with response surface designs. The basic idea is that while classical designs are very rigid and uncompromising, optimal designs can tailor an experiment to your needs. I can do a decent design for the 8-factor situation with something like 48 runs and still be able to estimate all the model terms I care about (main effects and 2-factor interactions). I pay for this convenience by allowing some partial correlations between the model terms, but that is often of little consequence.

3a8082e126
Reply all
Reply to author
Forward
0 new messages