math

package
v1.1.34 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Erfc

func Erfc(x float64) float64

Erfc Complementary error function From Numerical Recipes in C 2e p221

func Ierfc

func Ierfc(x float64) float64

Ierfc Inverse complementary error function From Numerical Recipes 3e p265

func Mean

func Mean(num []float64) float64

Mean 计算给定数据的平均值

func Sign

func Sign[T int | int8 | int16 | int32 | int64 | float32 | float64](x T) T

Sign 符号函数(Sign function,简称sgn)是一个逻辑函数,用以判断实数的正负号。为避免和英文读音相似的正弦函数(sine)混淆,它亦称为Signum function。

func StandardDeviation

func StandardDeviation(num []float64) float64

StandardDeviation 使用方差计算给定数据的标准偏差

func SumFloat

func SumFloat[T float32 | float64](array []T) float64

SumFloat 计算浮点数数组的和

func SumInt

func SumInt[T int | int32 | int64](array []T) int64

SumInt 计算整数数组的和

func SumUint

func SumUint[T uint | uint32 | uint64](array []T) uint64

SumUint 计算整数数组的和

func Variance

func Variance(mean float64, num []float64) float64

Variance 使用平均值计算给定数据的方差

Types

type Gaussian

type Gaussian struct {
	// contains filtered or unexported fields
}

func NewGaussian

func NewGaussian(mean, variance float64) *Gaussian

func (*Gaussian) Add

func (g *Gaussian) Add(d *Gaussian) *Gaussian

Add add(d): returns the result of adding this and the given distribution

func (*Gaussian) Cdf

func (g *Gaussian) Cdf(x float64) float64

Cdf cdf(x): the cumulative distribution function, which describes the probability of a random variable falling in the interval (−∞, x]

func (*Gaussian) Div

func (g *Gaussian) Div(d *Gaussian) *Gaussian

Div div(d): returns the quotient distribution of this and the given distribution. If a constant is passed in the distribution is scaled by 1/d.

func (*Gaussian) Mul

func (g *Gaussian) Mul(d *Gaussian) *Gaussian

Mul mul(d): returns the product distribution of this and the given distribution. If a constant is passed in the distribution is scaled.

func (*Gaussian) Pdf

func (g *Gaussian) Pdf(x float64) float64

Pdf pdf(x): the probability density function, which describes the probability of a random variable taking on the value x

func (*Gaussian) Ppf

func (g *Gaussian) Ppf(x float64) float64

Ppf ppf(x): the percent point function, the inverse of cdf

func (*Gaussian) Scale

func (g *Gaussian) Scale(c float64) *Gaussian

Scale scale(c): returns the result of scaling this distribution by the given constant

func (*Gaussian) Sub

func (g *Gaussian) Sub(d *Gaussian) *Gaussian

Sub sub(d): returns the result of subtracting this and the given distribution

Jump to

Keyboard shortcuts

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