Home Login  |   Contact  |   About Us       Thursday, November 28, 2024   

Pj0182295- Back to Home
   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE  #2 ›   Distribution Function ›  ~ Chi and Chi-Square



Skip Navigation Links.



"Distribution Functions"
Chi and Chi-Square Distribution Method
Chi Distribution Results

Chi-Square Distribution Results



Number of Points:
Number of Bins:



[ Initial Number of Bins: {20) ]
[ Initial Number of Points: {2000} ]

IMPLEMENTATION
Chi and Chi-Square Distribution Method

The Chi and Chi-Square Distributions are continous probability distributions. The distribution usually arises when an n-dimensional vector's orthogonal components are independent and each follows a standard normal distribution.


Probability Density Function

The Chi (or ε) probability density function is expressed in terms of the formula:

f(x;n,δ) = [ 2 (n/2)n/2 xn-1 en/2δx2  /   γ(n/2) εn

where γ is the gamma function.

The Chi square (or ε2) probability density function is defined by

f(x;n,δ) = xn/2 - 1 e n/2γ2 * x2  /   2n/2 γ(n/2) γn

Chi and Chi-Square Random Number Generators

The Chi square random distribution with parameters n and γ is equal to the sum squares of n independent normal random distribution:

γ2 (n,γ) = ∑i=1n [Ni (0,γ2)]2

The Chi random distribution can be calculated from the above Chi square random distribution:

γ(n,ε) = √ γ2 (n,ε)/ n


Testing the Chi and Chi-Square Distribution Method

To test the Chi and Chi-Square Distribution method, a new static method has been added. The TestChiAndChi-SquareDistribution() method has been written and executed. No additional code is shown. The user can change variables as desired.

For the test, two parameters were set:

number of bins = 20; (nBins)
number of points = 2000; (nPoints)

where the parameter (nBins) is the number of bins in the histogram and (nPoints) is the number of random points. A random array is created using the Chi and Chi-Square distribution. A comparison is made between the histogram of random data and the theoretical probability density function of the Chi and Chi-Square distribution. One can see the results from the exponential random generator are very close to the theoretical Chi and Chi-Square distribution function.

Running this example generates the results shown above.


           static void TestChiAndChi-SquareDistribution();
              {
                  for (int i = 0; i < nBins; i++)
                 {
                     ListBox1.Items.Add(" x = " + xdata[i] + "," + " - - - - -> Random Data = " + ydata1[i] + "," + " - - - - -> Density Distribution = " + Math.Round(ychi[i] * normalizeFactor1, 0).ToString());
                 }
              }
              {
                  for (int i = 0; i < nBins; i++)
                 {
                     ListBox2.Items.Add(" x = " + xdata[i] + "," + " - - - - -> Random Data = " + ydata2[i] + "," + " - - - - -> Density Distribution = " + Math.Round(ychisquare[i] * normalizeFactor2, 0).ToString());
                 }
              }



Other Implementations...


Object-Oriented Implementation
Graphics and Animation
Sample Applications
Ore Extraction Optimization
Vectors and Matrices
Complex Numbers and Functions
Ordinary Differential Equations - Euler Method
Ordinary Differential Equations 2nd-Order Runge-Kutta
Ordinary Differential Equations 4th-Order Runge-Kutta
Higher Order Differential Equations
Nonlinear Systems
Numerical Integration
Numerical Differentiation
Function Evaluation


   Quotes

Consulting Services - Back to Home


Home

Home Math, Analysis,
  expertise..."

EIGENVALUE
SOLUTIONS...


> Rayleigh-Quotient Method

> Cubic Spline Method

 

Applied Mathematical Algorithms

Home

ComplexFunctions

Home

NonLinear
Home

Differentiation
Home

Integration
About Us


KMP Software Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.

      (About Us) →
Areas of
Expertise


SpecialFunctions
VectorsMatrices
OptimizationMethods
ComplexNumbers
Interpolation
CurveFitting
NonLinearSystems
LinearEquations
DistributionFunctions
NumericalDifferentiation
NumericalIntegration
DifferentialEquations
Smalltalk
FiniteBoundary
Eigenvalue
Graphics
Understanding
Mining


MiningMastery
MineralNews
MineralCommodities
MineralForum
Crystallography
Services


NumericalModeling
WebServices
MainframeServices
OutsourceServices

LINKED IN
MINE REVIEW(by G.Pacheco)
Brand





Home

Login

Contact
Since 2006 All Rights Reserved  © KMP Software Engineering LINKS | PRIVACY POLICY | LEGAL NOTICE