https://github.com/fako1024/numerics
Method / Tools for numerical methods / statistics
https://github.com/fako1024/numerics
beta-distribution binomial-distribution numerical-computation numerical-methods root-finding statistics
Last synced: 10 months ago
JSON representation
Method / Tools for numerical methods / statistics
- Host: GitHub
- URL: https://github.com/fako1024/numerics
- Owner: fako1024
- License: apache-2.0
- Created: 2019-09-17T09:35:29.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T10:07:34.000Z (almost 2 years ago)
- Last Synced: 2024-09-27T09:07:45.164Z (over 1 year ago)
- Topics: beta-distribution, binomial-distribution, numerical-computation, numerical-methods, root-finding, statistics
- Language: Go
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Method / Tools for numerical methods / statistics
[](https://github.com/fako1024/numerics/releases)
[](https://godoc.org/github.com/fako1024/numerics/)
[](https://goreportcard.com/report/github.com/fako1024/numerics)
[](https://github.com/fako1024/numerics/actions?query=workflow%3AGo)
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
```bash
go get -u github.com/fako1024/numerics
```
## API summary
The API of the package is fairly straight-forward. The following functions are exposed:
```Go
// 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.