numerics

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

README

Method / Tools for numerical methods / statistics

Github Release GoDoc Go Report Card Build/Test Status

This package provides several methods / tools that support numerical methods and statistics in Go.

Features

  • Various numeric methods, such as
    • Complete, incomplete and regularized incomplete Beta function
    • Binomial distribution function
    • Sign function
    • Lgamma function (without error return for ease of use)
  • Numerical root finding methods (sub-package root) via a generic interface, including
    • Linear root finding via Bisection
    • Non-linear root finding via Newton-Raphson and a cubic method
    • Adaptive / heuristic options to circumvent known limitations of root finding methods, i.e. detection of stationary and cyclic situations

Installation

go get -u github.com/fako1024/numerics

API summary

The API of the package is fairly straight-forward. The following functions are exposed:

// Sign returns the sign of a float64  
func Sign(x float64) int

// Lgamma return the logarithmic Gamma function (ignoring any error)  
func Lgamma(x float64) float64

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

// BetaIncomplete returns the value of the regularized incomplete beta  
// function Iₓ(a, b).  
//  
// This is not to be confused with the "incomplete beta function",  
// which can be computed as BetaIncomplete(x, a, b)*Beta(a, b).  
//  
// If x < 0 or x > 1, returns NaN.  
func BetaIncompleteRegular(x, a, b float64) float64

// BetaIncomplete returns the value of the (non-regularized) incomplete beta function  
func BetaIncomplete(x, a, b float64) float64

// Binomial returns the value of the probability distribution for a Bernoulli experiment.  
// Consequentially, this is also the differentiated value of the regularized incomplete  
// beta function, representing the cumulative distribution of the binomial PDF  
func Binomial(x, k, n float64) float64

The documentation for root finding methods can be found in the sub-package root.

Examples

For some simple examples, have a look at the numerics_test.go file.

Documentation

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 BetaIncomplete

func BetaIncomplete(x, a, b float64) float64

BetaIncomplete returns the value of the (non-regularized) incomplete beta function

func BetaIncompleteRegular

func BetaIncompleteRegular(x, a, b float64) float64

BetaIncompleteRegular returns the value of the regularized incomplete beta function Iₓ(a, b).

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

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

func Binomial

func Binomial(x, k, n float64) float64

Binomial returns the value of the probability distribution for a Bernoulli experiment. Consequentially, this is also the differentiated value of the regularized incomplete beta function, representing the cumulative distribution of the binomial PDF

func Lgamma

func Lgamma(x float64) float64

Lgamma return the logarithmic Gamma function (ignoring any error)

func Sign

func Sign(x float64) int

Sign returns the sign of a float64

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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