Home»Documentation»Mathematics Library User's Guide»Mathematical Functions»Special Functions»Combinatorics and Probability Theory

## Combinatorics and Probability Theory | Extreme Optimization Numerical Libraries for .NET Professional |

Combinatorics is the branch of mathematics studying the enumeration, combination, and permutation of sets of elements and the mathematical relations which characterize these properties. The Special class contains methods that implement many of these properties.

The Factorial method returns n!, the product of all integers up to and including its argument n. It counts the number of ways to arrange n objects in a specific order. The LogFactorial method returns the logarithm of the factorial. This is useful in calculations where explicitly using Factorial may cause an overflow, even though the final result is small enough.

The Variations method takes two integer parameters, n and k. It returns the number of ways to pick an ordered set of k objects out of a total of n objects. The Combinations method returns a binomial coefficient. It counts the number of ways to pick an unordered set of k objects out of a total of n objects. Alternatively, it counts the number of ways to divide a set of n objects into two sets of k and n-k elements. The LogCombinations method returns the logarithm of the number of combinations.

The MultinomialCoefficient method can be used in two ways. The first variant takes two arguments: an integer n and an integer array nk. It counts the number of ways to divide a set of n objects into sets of nk[0], nk[1]... elements. The sum of the nk[k] must equal n or an exception is thrown. The second variant has the same n parameter, but the nk[k] are passed as individual parameters. The same condition on the sum of the nk[k] applies.

The Fibonacci method returns the nth number in the Fibonacci sequence. Passing an argument greater than 44 causes an overflow.

The error function and the complimentary error function appear in probability in relation to the normal distribution. The Special class contains methods that implement many of these properties.

The table below summarizes the static methods defined by the x class:

Method | Description |
---|---|

Evaluates the Error function for real argument. | |

Evaluates the Complimentary Error function for real argument. | |

Evaluates the Error function between two points. This is equivalent to Erf(x2)-Erf(x1). | |

Evaluates the inverse of the Error function for real argument. | |

Evaluates the inverse of the Complimentary Error function for real argument. |

Copyright Â© 2004-2023,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.