package math
import "git.sr.ht/~shulhan/pakakeh.go/lib/math"
Package math provide generic functions working with math.
Index ¶
- func BinomialCoefficient(n int, k int) int
- func Factorial(n int) (f int)
- func StirlingS2(n int, k int) int
Functions ¶
func BinomialCoefficient ¶
BinomialCoefficient or combination, compute number of picking k from n possibilities.
Result is n! / ((n - k)! * k!)
func Factorial ¶
Factorial compute the factorial of n.
func StirlingS2 ¶
StirlingS2 The number of ways of partitioning a set of n elements into k nonempty sets (i.e., k set blocks), also called a Stirling set number.
For example, the set {1,2,3} can be partitioned into three subsets in one way: {{1},{2},{3}}; into two subsets in three ways: {{1,2},{3}}, {{1,3},{2}}, and {{1},{2,3}}; and into one subset in one way: {{1,2,3}}.
Ref: http://mathworld.wolfram.com/StirlingNumberoftheSecondKind.html
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
lib/math/big | Package big extends the capabilities of standard "math/big" package by adding custom global precision to Float and Rat; and global rounding mode, and bits precision to Float. |
- Version
- v0.60.0 (latest)
- Published
- Feb 1, 2025
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 4 minutes ago –
Tools for package owners.