C# 클래스 NSoft.NFramework.Numerics.SpecialFunctions

파일 보기 프로젝트 열기: debop/NFramework

공개 메소드들

메소드 설명
Beta ( this xs, IEnumerable ys ) : IEnumerable

Beta Function

Beta ( double x, double y ) : double

Beta Function

BetaIncomplete ( double a, double b, double x ) : double

Returns the lower incomplete (unregularized) beta function I_x(a,b) = int(t^(a-1)*(1-t)^(b-1),t=0..x) for real a > 0, b > 0, 1 >= x >= 0.

BetaLn ( this xs, IEnumerable ys ) : IEnumerable

Log Beta Function

BetaLn ( double x, double y ) : double

Log Beta Function

BetaRegularized ( double a, double b, double x ) : double

Returns the regularized lower incomplete beta function I_x(a,b) = 1/Beta(a,b) * int(t^(a-1)*(1-t)^(b-1),t=0..x) for real a > 0, b > 0, 1 >= x >= 0.

BetaRegularized ( double a, double b, double x, int maxIteration ) : double

Returns the regularized lower incomplete beta function I_x(a,b) = 1/Beta(a,b) * int(t^(a-1)*(1-t)^(b-1),t=0..x) for real a > 0, b > 0, 1 >= x >= 0.

Binomial ( int n, int k ) : double

Computes the binomial coefficient: n choose k.

BinomialLn ( int n, int k ) : double

Computes the natural logarithm of the binomial coefficient: ln(n choose k).

DiGamma ( double x ) : double

Computes the Digamma function which is mathematically defined as the derivative of the logarithm of the gamma function. This implementation is based on Jose Bernardo Algorithm AS 103: Psi ( Digamma ) Function, Applied Statistics, Volume 25, Number 3, 1976, pages 315-317. Using the modifications as in Tom Minka's lightspeed toolbox.

DiGammaInv ( double p ) : double

Computes the inverse Digamma function: this is the inverse of the logarithm of the gamma function. This function will only return solutions that are positive.

This implementation is based on the bisection method.

Erf ( double x ) : double

Calculates the error function.

returns 1 if x == Double.PositiveInfinity. returns -1 if x == Double.NegativeInfinity.

ErfInv ( double z ) : double

Calculates the inverse error function evaluated at z.

Calculates the inverse error function evaluated at z.

returns Double.PositiveInfinity if z >= 1.0. returns Double.NegativeInfinity if z <= -1.0.

Erfc ( double x ) : double

Calculates the complementary error function.

returns 0 if x == Double.PositiveInfinity. returns 2 if x == Double.NegativeInfinity.

ErfcInv ( double z ) : double

Calculates the complementary inverse error function evaluated at z.

calculates the complementary inverse error function evaluated at z.

We have tested this implementation against the arbitrary precision mpmath library and found cases where we can only guarantee 9 significant figures correct. returns Double.PositiveInfinity if z <= 0.0. returns Double.NegativeInfinity if z >= 2.0.

ExponentialMinusOne ( double power ) : double

Numerically stable exponential minus one, i.e. x -> exp(x)-1

Factorial ( int x ) : double

Computes the factorial function x -> x! of an integer number > 0. The function can represent all number up to 22! exactly, all numbers up to 170! using a double representation. All larger values will overflow.

If you need to multiply or divide various such factorials, consider using the logarithmic version FactorialLn instead so you can add instead of multiply and subtract instead of divide, and then exponentiate the result using System.Math.Exp. This will also circumvent the problem that factorials become very large even for small parameters.

FactorialLn ( int x ) : double

Computes the logarithmic factorial function x -> ln(x!) of an integer number > 0.

GeneralHarmonic ( int n, double m ) : double

Compute the generalized harmonic number of order n of m. (1 + 1/2^m + 1/3^m + ... + 1/n^m)

Harmonic ( int t ) : double

Computes the t'th Harmonic number.

Hypotenuse ( System.Complex a, System.Complex b ) : System.Complex

Numerically stable hypotenuse of a right angle triangle, i.e. (a,b) -> sqrt(a^2 + b^2)

Hypotenuse ( double a, double b ) : double

Numerically stable hypotenuse of a right angle triangle, i.e. (a,b) -> sqrt(a^2 + b^2)

Hypotenuse ( float a, float b ) : float

Numerically stable hypotenuse of a right angle triangle, i.e. (a,b) -> sqrt(a^2 + b^2)

Logistic ( double p ) : double

Computes the logistic function. see: http://en.wikipedia.org/wiki/Logistic

Logit ( double p ) : double

Computes the logit function. see: http://en.wikipedia.org/wiki/Logit

Multinomial ( int n, int ni ) : double

Computes the multinomial coefficient: n choose n1, n2, n3, ...

비공개 메소드들

메소드 설명
ErfImp ( double z, bool invert ) : double

Implementation of the error function.

ErfInvImpl ( double p, double q, double s ) : double

The implementation of the inverse error function.

EvaluatePolynomial ( double poly, double z ) : double

A helper function to evaluate polynomials fast.

IntializeFactorial ( ) : void
Series ( Func nextSummand ) : double

Numerically stable series summation

SpecialFunctions ( )

메소드 상세

Beta() 공개 정적인 메소드

Beta Function
public static Beta ( this xs, IEnumerable ys ) : IEnumerable
xs this
ys IEnumerable
리턴 IEnumerable

Beta() 공개 정적인 메소드

Beta Function
public static Beta ( double x, double y ) : double
x double
y double
리턴 double

BetaIncomplete() 공개 정적인 메소드

Returns the lower incomplete (unregularized) beta function I_x(a,b) = int(t^(a-1)*(1-t)^(b-1),t=0..x) for real a > 0, b > 0, 1 >= x >= 0.
public static BetaIncomplete ( double a, double b, double x ) : double
a double The first Beta parameter, a positive real number.
b double The second Beta parameter, a positive real number.
x double The upper limit of the integral.
리턴 double

BetaLn() 공개 정적인 메소드

Log Beta Function
public static BetaLn ( this xs, IEnumerable ys ) : IEnumerable
xs this
ys IEnumerable
리턴 IEnumerable

BetaLn() 공개 정적인 메소드

Log Beta Function
public static BetaLn ( double x, double y ) : double
x double
y double
리턴 double

BetaRegularized() 공개 정적인 메소드

Returns the regularized lower incomplete beta function I_x(a,b) = 1/Beta(a,b) * int(t^(a-1)*(1-t)^(b-1),t=0..x) for real a > 0, b > 0, 1 >= x >= 0.
public static BetaRegularized ( double a, double b, double x ) : double
a double The first Beta parameter, a positive real number.
b double The second Beta parameter, a positive real number.
x double The upper limit of the integral.
리턴 double

BetaRegularized() 공개 정적인 메소드

Returns the regularized lower incomplete beta function I_x(a,b) = 1/Beta(a,b) * int(t^(a-1)*(1-t)^(b-1),t=0..x) for real a > 0, b > 0, 1 >= x >= 0.
public static BetaRegularized ( double a, double b, double x, int maxIteration ) : double
a double The first Beta parameter, a positive real number.
b double The second Beta parameter, a positive real number.
x double The upper limit of the integral.
maxIteration int 최대 반복 횟수
리턴 double

Binomial() 공개 정적인 메소드

Computes the binomial coefficient: n choose k.
public static Binomial ( int n, int k ) : double
n int A nonnegative value n.
k int A nonnegative value h.
리턴 double

BinomialLn() 공개 정적인 메소드

Computes the natural logarithm of the binomial coefficient: ln(n choose k).
public static BinomialLn ( int n, int k ) : double
n int A nonnegative value n.
k int A nonnegative value h.
리턴 double

DiGamma() 공개 정적인 메소드

Computes the Digamma function which is mathematically defined as the derivative of the logarithm of the gamma function. This implementation is based on Jose Bernardo Algorithm AS 103: Psi ( Digamma ) Function, Applied Statistics, Volume 25, Number 3, 1976, pages 315-317. Using the modifications as in Tom Minka's lightspeed toolbox.
public static DiGamma ( double x ) : double
x double The argument of the digamma function.
리턴 double

DiGammaInv() 공개 정적인 메소드

Computes the inverse Digamma function: this is the inverse of the logarithm of the gamma function. This function will only return solutions that are positive.

This implementation is based on the bisection method.

public static DiGammaInv ( double p ) : double
p double The argument of the inverse digamma function.
리턴 double

Erf() 공개 정적인 메소드

Calculates the error function.
returns 1 if x == Double.PositiveInfinity. returns -1 if x == Double.NegativeInfinity.
public static Erf ( double x ) : double
x double The value to evaluate.
리턴 double

ErfInv() 공개 정적인 메소드

Calculates the inverse error function evaluated at z. Calculates the inverse error function evaluated at z.
returns Double.PositiveInfinity if z >= 1.0. returns Double.NegativeInfinity if z <= -1.0.
public static ErfInv ( double z ) : double
z double value to evaluate.
리턴 double

Erfc() 공개 정적인 메소드

Calculates the complementary error function.
returns 0 if x == Double.PositiveInfinity. returns 2 if x == Double.NegativeInfinity.
public static Erfc ( double x ) : double
x double The value to evaluate.
리턴 double

ErfcInv() 공개 정적인 메소드

Calculates the complementary inverse error function evaluated at z. calculates the complementary inverse error function evaluated at z.
We have tested this implementation against the arbitrary precision mpmath library and found cases where we can only guarantee 9 significant figures correct. returns Double.PositiveInfinity if z <= 0.0. returns Double.NegativeInfinity if z >= 2.0.
public static ErfcInv ( double z ) : double
z double value to evaluate.
리턴 double

ExponentialMinusOne() 공개 정적인 메소드

Numerically stable exponential minus one, i.e. x -> exp(x)-1
public static ExponentialMinusOne ( double power ) : double
power double A number specifying a power.
리턴 double

Factorial() 공개 정적인 메소드

Computes the factorial function x -> x! of an integer number > 0. The function can represent all number up to 22! exactly, all numbers up to 170! using a double representation. All larger values will overflow.
If you need to multiply or divide various such factorials, consider using the logarithmic version FactorialLn instead so you can add instead of multiply and subtract instead of divide, and then exponentiate the result using System.Math.Exp. This will also circumvent the problem that factorials become very large even for small parameters.
public static Factorial ( int x ) : double
x int
리턴 double

FactorialLn() 공개 정적인 메소드

Computes the logarithmic factorial function x -> ln(x!) of an integer number > 0.
public static FactorialLn ( int x ) : double
x int
리턴 double

GeneralHarmonic() 공개 정적인 메소드

Compute the generalized harmonic number of order n of m. (1 + 1/2^m + 1/3^m + ... + 1/n^m)
public static GeneralHarmonic ( int n, double m ) : double
n int The order parameter.
m double The power parameter.
리턴 double

Harmonic() 공개 정적인 메소드

Computes the t'th Harmonic number.
public static Harmonic ( int t ) : double
t int The Harmonic number which needs to be computed.
리턴 double

Hypotenuse() 공개 정적인 메소드

Numerically stable hypotenuse of a right angle triangle, i.e. (a,b) -> sqrt(a^2 + b^2)
public static Hypotenuse ( System.Complex a, System.Complex b ) : System.Complex
a System.Complex The length of side a of the triangle.
b System.Complex The length of side b of the triangle.
리턴 System.Complex

Hypotenuse() 공개 정적인 메소드

Numerically stable hypotenuse of a right angle triangle, i.e. (a,b) -> sqrt(a^2 + b^2)
public static Hypotenuse ( double a, double b ) : double
a double The length of side a of the triangle.
b double The length of side b of the triangle.
리턴 double

Hypotenuse() 공개 정적인 메소드

Numerically stable hypotenuse of a right angle triangle, i.e. (a,b) -> sqrt(a^2 + b^2)
public static Hypotenuse ( float a, float b ) : float
a float The length of side a of the triangle.
b float The length of side b of the triangle.
리턴 float

Logistic() 공개 정적인 메소드

Computes the logistic function. see: http://en.wikipedia.org/wiki/Logistic
public static Logistic ( double p ) : double
p double The parameter for which to compute the logistic function.
리턴 double

Logit() 공개 정적인 메소드

Computes the logit function. see: http://en.wikipedia.org/wiki/Logit
public static Logit ( double p ) : double
p double The parameter for which to compute the logit function. This number should be /// between 0 and 1.
리턴 double

Multinomial() 공개 정적인 메소드

Computes the multinomial coefficient: n choose n1, n2, n3, ...
if is . If or any of the are negative. If the sum of all is not equal to .
public static Multinomial ( int n, int ni ) : double
n int A nonnegative value n.
ni int An array of nonnegative values that sum to .
리턴 double