package math

import "git.sr.ht/~shulhan/pakakeh.go/lib/math"

Package math provide generic functions working with math.

Index

Functions

func BinomialCoefficient

func BinomialCoefficient(n int, k int) int

BinomialCoefficient or combination, compute number of picking k from n possibilities.

Result is n! / ((n - k)! * k!)

func Factorial

func Factorial(n int) (f int)

Factorial compute the factorial of n.

func StirlingS2

func StirlingS2(n int, k int) int

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

math.go

Directories

PathSynopsis
lib/math/bigPackage 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.