statistic
Class Mathematic

java.lang.Object
  |
  +--statistic.Mathematic
All Implemented Interfaces:
ComputerArithmetic, statistic.UNKComputer

public class Mathematic
extends java.lang.Object
implements ComputerArithmetic


Field Summary
 
Fields inherited from interface statistic.ComputerArithmetic
MACHEP, MAXGAM, MAXLOG, MAXNUM, MAXSTIR, MINLOG, P, P0, P1, P2, Q, Q0, Q1, Q2, s2pi, SQTPI, STIR
 
Constructor Summary
Mathematic()
           
 
Method Summary
static double factorial(double n)
          Method factorial : Factorial function: compute factorial of n
static double gamma(double x)
          Returns the Gamma function of a double.
static double gcf(double a, double x)
          Returns the incomplete gamma function Q(a,x) evaluated by its continued fraction representation as gammcf.
static double gser(double a, double x)
          Returns the incomplete gamma function P(a,x) evaluated by its series representation as gamser
static double incompleteGamma(double a, double x)
          left tail of incomplete gamma function: inf.
static double incompleteGammaComplemented(double a, double x)
           
static double incompleteGammaComplementedInverse(double a, double y0)
          Inverse of complemented imcomplete gamma integral
static double invNormal(double y0)
          Inverse of Normal distribution function
static double lnGamma(double xx)
          Returns the logarithm of the Gamma function of a double.
static void main(java.lang.String[] args)
          Methode: Main pour tester la classe
static int pgcd(int a, int b)
          Method pgcd : calcule le PGCD de 2 entiers passes en arguments (on utilisera le fait que le PGCD de 2 nbs divise le reste de la divisionm de ces 2 nombres en iterant)
static double pol1Eval(double x, double[] coef, int N)
          Evaluate polynomial when coefficient of x^N is 1.0 => Cn=1.
static double polEval(double x, double[] coef, int N)
          Evaluate polynomial
static int ppcm(int a, int b)
          Calcule le PPCM de deux entiers passes en arguments
static int ppcmComplex(int[] nbs)
          Method ppcmComplex : to compute the MCM(Minimum Commun Multiple) of a table of int Property: MCM(A,B,C) = MCM( MCM(A,B),C)....
static double stirlingFormula(double x)
          Gamma function computed by Stirling's formula.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mathematic

public Mathematic()
Method Detail

polEval

public static double polEval(double x,
                             double[] coef,
                             int N)
Evaluate polynomial

Parameters:
x - : value
N - : degree y = polEval( x, coef, N ); DESCRIPTION: Evaluates polynomial of degree N: y(x) = C + C x + C x^2 +...+ C x^N 0 1 2 N Coefficients are stored in reverse order: coef[0] = C , ..., coef[N] = C . N 0 The function p1evl() assumes that coef[N] = 1.0 and is omitted from the array. Its calling arguments are otherwise the same as polevl(). SPEED: In the interest of speed, there are no checks for out of bounds arithmetic. This routine is used by most of the functions in the library. Depending on available equipment features, the user may wish to rewrite the program in microcode or assembly language. Cephes Math Library Release 2.1: December, 1988 Copyright 1984, 1987, 1988 by Stephen L. Moshier Direct inquiries to 30 Frost Street, Cambridge, MA 02140

pol1Eval

public static double pol1Eval(double x,
                              double[] coef,
                              int N)
                       throws java.lang.IllegalArgumentException
Evaluate polynomial when coefficient of x^N is 1.0 => Cn=1. Otherwise same as polEval.

java.lang.IllegalArgumentException

invNormal

public static double invNormal(double y0)
Inverse of Normal distribution function


incompleteGammaComplementedInverse

public static double incompleteGammaComplementedInverse(double a,
                                                        double y0)
Inverse of complemented imcomplete gamma integral

Parameters:
a -
y0 - DESCRIPTION: Given p, the function finds x such that incompleteGammaComplemented( a, x ) = p. Starting with the approximate value x = a t^3 where : t = 1 - d - invNormal(p) sqrt(d) and d = 1/9a, It performs up to 10 Newton iterations to find the root of incompleteGammaComplemented(a,x) - p = 0. ACCURACY: Tested at random a, p in the intervals indicated. a p Relative error: arithmetic domain domain # trials peak rms IEEE 0.5,100 0,0.5 100000 1.0e-14 1.7e-15 IEEE 0.01,0.5 0,0.5 100000 9.0e-14 3.4e-15 IEEE 0.5,10000 0,0.5 20000 2.3e-13 3.8e-14 Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier

incompleteGammaComplemented

public static double incompleteGammaComplemented(double a,
                                                 double x)

incompleteGamma

public static double incompleteGamma(double a,
                                     double x)
left tail of incomplete gamma function: inf. k a -x - x x e > ---------- - - k=0 | (a+k+1)


lnGamma

public static double lnGamma(double xx)
                      throws java.lang.IllegalArgumentException
Returns the logarithm of the Gamma function of a double.

Parameters:
xx - A double value Returns the value of ln[Gamma(xx)] for xx>0 Methodes takes from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING If x is a negative integer, the result is NaN.
java.lang.IllegalArgumentException

gamma

public static double gamma(double x)
Returns the Gamma function of a double.

Parameters:
x - A double value.
Returns:
The Gamma function of x. If x is a negative integer, the result is NaN.

gser

public static double gser(double a,
                          double x)
                   throws java.lang.IllegalArgumentException
Returns the incomplete gamma function P(a,x) evaluated by its series representation as gamser

java.lang.IllegalArgumentException

gcf

public static double gcf(double a,
                         double x)
                  throws java.lang.IllegalArgumentException
Returns the incomplete gamma function Q(a,x) evaluated by its continued fraction representation as gammcf.

java.lang.IllegalArgumentException

stirlingFormula

public static double stirlingFormula(double x)
Gamma function computed by Stirling's formula. The polynomial STIR is valid for 33 <= x <= 172.


factorial

public static double factorial(double n)
                        throws java.lang.IllegalArgumentException
Method factorial : Factorial function: compute factorial of n

Parameters:
n - it'a a long
Returns:
n!
java.lang.IllegalArgumentException

pgcd

public static int pgcd(int a,
                       int b)
Method pgcd : calcule le PGCD de 2 entiers passes en arguments (on utilisera le fait que le PGCD de 2 nbs divise le reste de la divisionm de ces 2 nombres en iterant)

Parameters:
a -
b -
Returns:

ppcm

public static int ppcm(int a,
                       int b)
Calcule le PPCM de deux entiers passes en arguments

Parameters:
a - an int
b - an int
Returns:
an int

ppcmComplex

public static int ppcmComplex(int[] nbs)
Method ppcmComplex : to compute the MCM(Minimum Commun Multiple) of a table of int Property: MCM(A,B,C) = MCM( MCM(A,B),C)....

Parameters:
nbs -
Returns:
an int

main

public static void main(java.lang.String[] args)
Methode: Main pour tester la classe