mathx

package
v0.0.0-...-f10218a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2021 License: BSD-3-Clause Imports: 1 Imported by: 6

Documentation

Overview

Package mathx implements special functions not provided by the standard math package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Beta

func Beta(a, b float64) float64

Beta returns the value of the complete beta function B(a, b).

func BetaInc

func BetaInc(x, a, b float64) float64

BetaInc returns the value of the regularized incomplete beta function Iₓ(a, b) = 1 / B(a, b) * ∫₀ˣ tᵃ⁻¹ (1-t)ᵇ⁻¹ dt.

This is not to be confused with the "incomplete beta function", which can be computed as BetaInc(x, a, b)*Beta(a, b).

If x < 0 or x > 1, returns NaN.

func Choose

func Choose(n, k int) float64

Choose returns the binomial coefficient of n and k.

func GammaInc

func GammaInc(a, x float64) float64

GammaInc returns the value of the incomplete gamma function (also known as the regularized gamma function):

P(a, x) = 1 / Γ(a) * ∫₀ˣ exp(-t) t**(a-1) dt

func GammaIncComp

func GammaIncComp(a, x float64) float64

GammaIncComp returns the complement of the incomplete gamma function 1 - GammaInc(a, x). This is more numerically stable for values near 0.

func Lchoose

func Lchoose(n, k int) float64

Lchoose returns math.Log(Choose(n, k)).

func Sign

func Sign(x float64) float64

Sign returns the sign of x: -1 if x < 0, 0 if x == 0, 1 if x > 0. If x is NaN, it returns NaN.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL