資源簡介
Normal (aka Gaussian) distribution
代碼片段和文件信息
//*******************************************************************************
//?Repast?.NET?was?made?possible?in?part?by?the?Defense?Program?Office?for?Mission?
//?Assurance?Naval?Surface?Warfare?Center?Dahlgren?Virginia.
//?For?all?questions?please?send?e-mail?to?repast-interest@sourceforge.net.
//http://www.koders.com/csharp/fidA7F93CFAD1F8E5346FD77A83C36E8F103322793E.aspx
//********************************************************************************
/*
based?on?code?under?the?following?license:
Copyright??1999?CERN?-?European?Organization?for?Nuclear?Research.
Permission?to?use?copy?modify?distribute?and?sell?this?software?and?its?documentation?for?any?purpose?
is?hereby?granted?without?fee?provided?that?the?above?copyright?notice?appear?in?all?copies?and?
that?both?that?copyright?notice?and?this?permission?notice?appear?in?supporting?documentation.?
CERN?makes?no?representations?about?the?suitability?of?this?software?for?any?purpose.?
It?is?provided?“as?is“?without?expressed?or?implied?warranty.*/
using?System;
using?Probability?=?cern.jet.stat.Probability;
using?RandomStartingValueSource?=?cern.jet.random.engine.RandomStartingValueSource;
namespace?cern.jet.random
{
///?Normal?(aka?Gaussian)?distribution;?See?the??math?definition
///?and??animated?definition.
///????????????????????????
///?1???????????????????????2
///?pdf(x)?=?---------????exp(?-?(x-mean)?/?2v?)?
///?sqrt(2pi*v)
///?x
///?-
///?1????????|?|?????????????????2
///?cdf(x)?=?---------????|????exp(?-?(t-mean)?/?2v?)?dt
///?sqrt(2pi*v)|?|
///?-
///?-inf.
///?
///?where?v?=?variance?=?standardDeviation^2.
///?
///?Instance?methods?operate?on?a?user?supplied?uniform?random?number?generator;?they?are?unsynchronized.
///?
///?Static?methods?operate?on?a?default?uniform?random?number?generator;?they?are?synchronized.
///?
///?Implementation:?Polar?Box-Muller?transformation.?See?
///?G.E.P.?Box?M.E.?Muller?(1958):?A?note?on?the?generation?of?random?normal?deviates?Annals?Math.?Statist.?29?610-611.
///?
///?
///???wolfgang.hoschek@cern.ch
///?
///???1.0?09/24/99
///?
public?class?Normal:AbstractContinousDistribution
{
protected?internal?double?mean;
protected?internal?double?variance;
protected?internal?double?standardDeviation;
protected?internal?double?cache;?//?cache?for?Box-Mueller?algorithm?
protected?internal?bool?cacheFilled;?//?Box-Mueller
protected?internal?double?SQRT_INV;?//?performance?cache
//?The?uniform?random?number?generated?shared?by?all?static?methods.
protected?internal?static?Normal?shared;
///??Constructs?a?normal?(gauss)?distribution.
///?Example:
評論
共有 條評論