SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
NormalDistQuick.java
1/*
2 * Class: NormalDistQuick
3 * Description: normal distribution
4 * Environment: Java
5 * Software: SSJ
6 * Organization: DIRO, Universite de Montreal
7 * @author
8 * @since
9 */
10package umontreal.ssj.probdist;
11
12import umontreal.ssj.util.Num;
13
26public class NormalDistQuick extends NormalDist {
27
33 public NormalDistQuick() {
34 super();
35 }
36
41 public NormalDistQuick(double mu, double sigma) {
42 setParams(mu, sigma);
43 }
44
45 /**************************************************************/
46 /*
47 * These public methods are necessary so that the methods cdf01, barF01 and
48 * inverseF01 that are used are those of the present class and not those of
49 * 'NormalDist'
50 */
51
52 public double cdf(double x) {
53 return cdf01((x - mu) / sigma);
54 }
55
56 public double barF(double x) {
57 return barF01((x - mu) / sigma);
58 }
59
60 public double inverseF(double u) {
61 return mu + sigma * inverseF01(u);
62 }
63
64 /*************************************************************/
65
66 private static final double V[] = { 1.2533141373155, 1.137490921203605, 1.037824575853727, 0.951527192071207,
67 0.8763644564536924, 0.8105337152790306, 0.7525711790634081, 0.7012808218544303, 0.6556795424187987,
68 0.61495459615093, 0.5784303460476312, 0.5455421356582171, 0.5158156382179634, 0.4888504415275737,
69 0.4643069280394423, 0.4418957328326002, 0.4213692292880546, 0.4025146181296722, 0.3851482907984348,
70 0.3691112106902635, 0.3542651113297938, 0.3404893532870847, 0.3276783146905521, 0.31573921586941,
71 0.3045902987101033, 0.2941592970402893, 0.284382146748493, 0.2752018941576065, 0.2665677689682238,
72 0.2584343943120386, 0.2507611114439651, 0.243511400615456, 0.2366523829135607, 0.230154390478801,
73 0.2239905946538289, 0.2181366833614714, 0.2125705804420318, 0.2072722008565011, 0.2022232366330547,
74 0.1974069692375194, 0.1928081047153158, 0.1884126285076003, 0.1842076773079702, 0.1801814257143918,
75 0.1763229857571027, 0.1726223176578506, 0.1690701504076941, 0.1656579109468773, 0.1623776608968675,
76 0.1592220399363674, 0.1561842150339759, 0.153257834853479, 0.1504369887362691, 0.1477161697413935,
77 0.145090241289131, 0.1425544070104023, 0.1401041834530503, 0.1377353753382303, 0.1354440530967635,
78 0.1332265324471292, 0.1310793558044918, 0.1289992753343376, 0.126983237485437, 0.1250283688553504,
79 0.1231319632579323, 0.1212914698765462, 0.119504482399253, 0.1177687290432979, 0.1160820633859823,
80 0.1144424559276431, 0.112847986320103, 0.1112968362007359, 0.1097872825783083, 0.1083176917221132,
81 0.1068865135106745, 0.1054922762005562, 0.1041335815795983, 0.1028091004723001, 0.1015175685681028,
82 0.1002577825460485, 0.09902859647173194, 0.09782891844465691, 0.09665770747608191, 0.09551397057921558,
83 0.09439676005522439, 0.09330517095996169, 0.09223833873763035, 0.09119543700877471, 0.09017567550106469,
84 0.08917829811230435, 0.08820258109597616, 0.08724783136042988, 0.08631338487354936, 0.08539860516539227,
85 0.08450288192189578, 0.08362562966329139, 0.08276628650136918, 0.08192431297018954, 0.08109919092525536,
86 0.08029042250654048, 0.07949752916111721, 0.07872005072144664, 0.07795754453568722, 0.07720958464664668,
87 0.07647576101624852, 0.07575567879261112, 0.07504895761704659, 0.07435523096847724, 0.07367414554294564,
88 0.07300536066605566, 0.07234854773633338, 0.07170338969763433, 0.07106958053885212, 0.07044682481930167,
89 0.06983483721825942, 0.06923334210724434, 0.06864207314371742, 0.06806077288496332, 0.0674891924209997,
90 0.06692709102543307, 0.06637423582325017 };
91
95 public static double cdf01(double x) {
96 if (x >= XBIG)
97 return 1.0;
98 if (x <= -XBIG)
99 return 0.0;
100
101 /*
102 * The relative precision of NormalDistQuick decreases gradually: at x = -8,
103 * there are 15 decimals; at x = -26, there are about 2 decimals. NormalDist is
104 * more precise.
105 */
106 if (x < -8.0)
107 return NormalDist.cdf01(x);
108
109 boolean negatif;
110 if (x < 0.0) {
111 negatif = true;
112 x = -x;
113 } else {
114 negatif = false;
115 }
116 int j = (int) (8.0 * x + 0.5);
117 if (j > 120)
118 j = 120;
119 double r = V[j];
120 double z = 0.125 * j;
121 double h = x - z;
122 double r1 = r * z - 1.0;
123 double r2 = 0.5 * (r + z * r1);
124 double r3 = (r1 + z * r2) / 3.0;
125 double r4 = 0.25 * (r2 + z * r3);
126 double r5 = 0.2 * (r3 + z * r4);
127 double r6 = (r4 + z * r5) / 6.0;
128 double r7 = (r5 + z * r6) / 7.0;
129 double r8 = 0.125 * (r6 + z * r7);
130 double t = r + h * (r1 + h * (r2 + h * (r3 + h * (r4 + h * (r5 + h * (r6 + h * (r7 + h * r8)))))));
131 double u = t * Math.exp(-0.5 * x * x - 0.9189385332046727);
132 if (negatif)
133 return u;
134 else
135 return 1.0 - u;
136 }
137
145 public static double cdf(double mu, double sigma, double x) {
146 if (sigma <= 0)
147 throw new IllegalArgumentException("sigma <= 0");
148 return cdf01((x - mu) / sigma);
149 }
150
154 public static double barF01(double x) {
155 return cdf01(-x);
156 }
157
165 public static double barF(double mu, double sigma, double x) {
166 if (sigma <= 0)
167 throw new IllegalArgumentException("sigma <= 0");
168 return barF01((x - mu) / sigma);
169 }
170
171 private static final double[] A = {
172
173 6.33795775455, 6.33321372178, 6.32860807635, 6.32413288056, 6.31978086301, 6.31554534594, 6.31142018224,
174 6.30739970055, 6.30347865735, 6.29965219486, 6.29591580408, 6.29226529211, 6.28869675323, 6.28520654322,
175 6.28179125646, 6.27844770553, 6.27517290294, 6.27196404468, 6.2688184955, 6.26573377562, 6.26270754867,
176 6.25973761088, 6.25682188116, 6.25395839218, 6.25114528219, 6.24838078761, 6.2456632362, 6.24299104087,
177 6.240362694, 6.23777676216, 6.23523188139, 6.23272675268, 6.23026013799, 6.22543778081, 6.22075598811,
178 6.2162067, 6.21178253304, 6.20747670647, 6.20328297819, 6.19919558917, 6.19520921468, 6.19131892165,
179 6.18752013112, 6.18380858505, 6.180180317, 6.17663162601, 6.1731590534, 6.16975936206, 6.16642951782,
180 6.16316667288, 6.15996815078, 6.1568314329, 6.15375414629, 6.15073405259, 6.14776903807, 6.14485710448,
181 6.14199636082, 6.13918501574, 6.13642137069, 6.13370381356, 6.13103081295, 6.12840091282, 6.12581272765,
182 6.12326493791, 6.12075628597, 6.11585165173, 6.11108986339, 6.10646273321, 6.10196276044, 6.09758305644,
183 6.09331727974, 6.08915957943, 6.08510454578, 6.08114716689, 6.07728279052, 6.07350709041, 6.06981603653,
184 6.06620586849, 6.06267307204, 6.05921435799, 6.05582664334, 6.05250703436, 6.04925281142, 6.04606141524,
185 6.0429304345, 6.03985759465, 6.03684074773, 6.03387786311, 6.03096701912, 6.02810639533, 6.02529426559,
186 6.0225289916, 6.01980901702, 6.01713286212, 6.01449911878, 6.01190644597, 6.00935356553, 6.00436236049,
187 5.99951639563, 5.99480734912, 5.99022759726, 5.98577013833, 5.98142852661, 5.9771968149, 5.97306950434,
188 5.96904150032, 5.96510807378, 5.96126482692, 5.95750766299, 5.95383275929, 5.95023654327, 5.94671567111,
189 5.94326700856, 5.93988761376, 5.93657472175, 5.9333257306, 5.93013818875, 5.92700978364, 5.92393833142,
190 5.92092176747, 5.91795813793, 5.91504559188, 5.91218237419, 5.90936681905, 5.90659734398, 5.90387244436,
191 5.90119068838, 5.89855071241, 5.89595121674, 5.89086876372, 5.88593406746, 5.88113866541, 5.87647480476,
192 5.87193536504, 5.86751379108, 5.86320403456, 5.85900050299, 5.85489801495, 5.85089176064, 5.84697726716,
193 5.84315036764, 5.83940717394, 5.83574405227, 5.83215760142, 5.82864463328, 5.82520215541, 5.82182735527,
194 5.81851758606, 5.81527035394, 5.81208330646, 5.80895422198, 5.80588100021, 5.80286165344, 5.79989429868,
195 5.79697715037, 5.79410851379, 5.79128677896, 5.78851041509, 5.78577796547, 5.78308804272, 5.78043932448,
196 5.7752605134, 5.77023210866, 5.76534549972, 5.76059279799, 5.75596675813, 5.75146070984, 5.74706849845,
197 5.74278443301, 5.73860324073, 5.73452002692, 5.73053023962, 5.72662963823, 5.72281426575, 5.71908042393,
198 5.71542465116, 5.7118437027, 5.70833453283, 5.70489427893, 5.70152024702, 5.69820989876, 5.69496083963,
199 5.69177080831, 5.68863766688, 5.68555939205, 5.68253406704, 5.67955987426, 5.67663508853, 5.67375807094,
200 5.67092726314, 5.66814118219, 5.6653984157, 5.66269761746, 5.65741684752, 5.65228927845, 5.64730614385,
201 5.64245941209, 5.6377417063, 5.63314623489, 5.62866673113, 5.62429740032, 5.6200328734, 5.61586816622,
202 5.61179864349, 5.60781998693, 5.60392816693, 5.6001194173, 5.5963902128, 5.59273724893, 5.58915742386,
203 5.58564782214, 5.58220570003, 5.57882847227, 5.57551370004, 5.57225908009, 5.56906243489, 5.56592170358,
204 5.56283493377, 5.55980027406, 5.55681596716, 5.55388034364, 5.55099181609, 5.54814887388, 5.54535007824,
205 5.5425940578, 5.53720516928, 5.53197243466, 5.52688692307, 5.52194045196, 5.5171255056, 5.51243516442,
206 5.50786304341, 5.50340323832, 5.49905027849, 5.4947990853, 5.49064493552, 5.4865834288, 5.48261045887,
207 5.47872218783, 5.4749150232, 5.47118559738, 5.46753074927, 5.46394750763, 5.46043307616, 5.45698482001,
208 5.45360025356, 5.45027702931, 5.44701292782, 5.44380584855, 5.44065380149, 5.43755489952, 5.43450735142,
209 5.43150945548, 5.42855959358, 5.42565622584, 5.42279788561, 5.41998317492, 5.41447936842, 5.40913484272,
210 5.40394049304, 5.39888797725, 5.39396963282, 5.38917840481, 5.38450778312, 5.37995174765, 5.37550472027,
211 5.37116152244, 5.36691733786, 5.36276767939, 5.35870835965, 5.35473546482, 5.3508453313, 5.34703452473,
212 5.34329982125, 5.33963819058, 5.3360467808, 5.33252290459, 5.32906402674, 5.32566775291, 5.32233181932,
213 5.31905408341, 5.31583251534, 5.31266519015, 5.30955028069, 5.30648605108, 5.30347085068, 5.30050310862,
214 5.29758132874, 5.29470408485, 5.28907782499, 5.28361416415, 5.27830381332, 5.2731382613, 5.26810969,
215 5.26321090103, 5.25843525172, 5.2537765992, 5.24922925139, 5.24478792384, 5.24044770161, 5.23620400551,
216 5.23205256217, 5.22798937729, 5.22401071182, 5.2201130606, 5.21629313323, 5.21254783681, 5.20887426039,
217 5.205269661, 5.20173145085, 5.19825718588, 5.19484455528, 5.19149137189, 5.1881955636, 5.18495516531,
218 5.18176831175, 5.17863323075, 5.17554823716, 5.17251172724, 5.16952217346, 5.16657811973, 5.16082101937,
219 5.15523004763, 5.14979571985, 5.14450934531, 5.13936294072, 5.13434915534, 5.12946120568, 5.12469281843,
220 5.1200381805, 5.11549189488, 5.11104894181, 5.10670464433, 5.10245463765, 5.09829484194, 5.09422143797,
221 5.09023084532, 5.08631970285, 5.08248485106, 5.0787233163, 5.07503229637, 5.0714091476, 5.06785137307,
222 5.06435661191, 5.06092262957, 5.05754730896, 5.05422864229, 5.05096472372, 5.0477537425, 5.04459397676,
223 5.04148378777, 5.03842161464, 5.03540596946, 5.02950864968, 5.02378122248, 5.01821399503, 5.01279808548,
224 5.00752533468, 5.0023882297, 4.99737983708, 4.99249374467, 4.98772401045, 4.98306511755, 4.97851193459,
225 4.97405968039, 4.96970389282, 4.96544040091, 4.96126529999, 4.95717492946, 4.95316585275, 4.94923483945,
226 4.94537884901, 4.94159501614, 4.93788063759, 4.93423316006, 4.93065016935, 4.92712938035, 4.92366862801,
227 4.92026585904, 4.91691912431, 4.91362657193, 4.91038644087, 4.90719705507, 4.90405681805, 4.90096420796,
228 4.89491612703, 4.8890419637, 4.88333180298, 4.87777655906, 4.87236788511, 4.86709809501, 4.86196009527,
229 4.85694732544, 4.85205370587, 4.8472735917, 4.84260173228, 4.8380332352, 4.8335635343, 4.82918836126,
230 4.82490372013, 4.8207058646, 4.81659127758, 4.81255665279, 4.80859887824, 4.8047150212, 4.80090231471,
231 4.79715814524, 4.79348004153, 4.78986566443, 4.78631279763, 4.78281933914, 4.77938329358, 4.77600276506,
232 4.77267595063, 4.76940113431, 4.76617668159, 4.76300103427, 4.75679027709, 4.7507577546, 4.7448933141,
233 4.73918765149, 4.73363221901, 4.72821914523, 4.72294116527, 4.71779155991, 4.71276410212, 4.70785300996,
234 4.70305290507, 4.69835877584, 4.6937659447, 4.689270039, 4.68486696501, 4.68055288459, 4.67632419431,
235 4.67217750662, 4.66810963292, 4.6641175682, 4.66019847719, 4.65634968177, 4.65256864953, 4.64885298336,
236 4.64520041195, 4.64160878112, 4.63807604585, 4.63460026304, 4.63117958481, 4.62781225236, 4.6244965903,
237 4.6212310015, 4.61484401763, 4.60863991397, 4.60260828265, 4.59673958525, 4.59102505831, 4.58545663137,
238 4.58002685553, 4.57472884104, 4.56955620253, 4.56450301082, 4.55956375032, 4.55473328135, 4.55000680661,
239 4.54537984133, 4.54084818664, 4.5364079057, 4.53205530226, 4.52778690138, 4.52359943209, 4.51948981163,
240 4.51545513127, 4.51149264343, 4.5075997499, 4.50377399122, 4.50001303691, 4.49631467662, 4.49267681191,
241 4.4890974489, 4.48557469132, 4.48210673427, 4.47869185842, 4.47532842465, 4.46874969883, 4.46235887005,
242 4.45614525563, 4.45009906476, 4.44421130165, 4.43847368137, 4.43287855675, 4.42741885424, 4.42208801786,
243 4.41687995966, 4.41178901614, 4.4068099095, 4.40193771332, 4.39716782193, 4.39249592307, 4.3879179734,
244 4.38343017655, 4.37902896328, 4.37471097372, 4.37047304122, 4.36631217778, 4.3622255608, 4.35821052107,
245 4.35426453179, 4.35038519863, 4.34657025053, 4.34281753142, 4.33912499252, 4.33549068532, 4.33191275513,
246 4.32838943511, 4.32491904083, 4.31813067359, 4.31153564248, 4.3051229678, 4.29888258592, 4.2928052498,
247 4.28688244266, 4.28110630283, 4.27546955801, 4.26996546758, 4.26458777186, 4.25933064724, 4.25418866648,
248 4.24915676339, 4.2442302014, 4.23940454548, 4.234675637, 4.23003957111, 4.22549267647, 4.22103149691,
249 4.2166527749, 4.21235343653, 4.20813057793, 4.20398145293, 4.19990346176, 4.19589414084, 4.19195115337,
250 4.18807228072, 4.18425541464, 4.18049854994, 4.17679977794, 4.17315728028, 4.16956932335, 4.16255048996,
251 4.15573091512, 4.14909929681, 4.14264527528, 4.13635933075, 4.1302326947, 4.12425727258, 4.11842557618,
252 4.11273066434, 4.1071660908, 4.10172585798, 4.09640437621, 4.0911964274, 4.08609713269, 4.08110192358,
253 4.07620651603, 4.07140688728, 4.0666992549, 4.06208005798, 4.05754594009, 4.05309373387, 4.04872044701,
254 4.04442324957, 4.04019946237, 4.03604654644, 4.03196209338, 4.02794381649, 4.0239895427, 4.02009720515,
255 4.0162648363, 4.01249056171, 4.00877259417, 4.00149883606, 3.99443081604, 3.98755688078, 3.98086634771,
256 3.97434939969, 3.96799699364, 3.96180078097, 3.95575303793, 3.94984660457, 3.94407483096, 3.93843152965,
257 3.93291093367, 3.92750765903, 3.9222166715, 3.91703325678, 3.91195299388, 3.90697173117, 3.90208556486,
258 3.89729081955, 3.89258403075, 3.88796192889, 3.88342142501, 3.87895959754, 3.87457368047, 3.87026105237,
259 3.86601922652, 3.86184584173, 3.85773865405, 3.85369552908, 3.84971443491, 3.84579343567, 3.8419306855,
260 3.83437296653, 3.82702811235, 3.81988408487, 3.81292984787, 3.80615525838, 3.79955097242, 3.79310836293,
261 3.78681944792, 3.7806768275, 3.77467362835, 3.76880345477, 3.76306034518, 3.75743873361, 3.75193341525,
262 3.74653951576, 3.74125246377, 3.73606796613, 3.73098198575, 3.72599072151, 3.72109059012, 3.71627820978,
263 3.71155038522, 3.70690409424, 3.70233647531, 3.69784481637, 3.69342654456, 3.68907921677, 3.68480051108,
264 3.68058821879, 3.67644023716, 3.67235456274, 3.66832928512, 3.66045271041, 3.65279688532, 3.64534934809,
265 3.63809867295, 3.63103435798, 3.62414672762, 3.61742684789, 3.6108664521, 3.60445787576, 3.59819399923,
266 3.592068197, 3.58607429286, 3.58020651993, 3.57445948514, 3.56882813748, 3.5633077395, 3.5578938418,
267 3.55258226001, 3.54736905409, 3.54225050954, 3.53722312046, 3.53228357414, 3.52742873704, 3.52265564207,
268 3.51796147693, 3.51334357346, 3.50879939795, 3.50432654219, 3.49992271527, 3.49558573607, 3.4913135263,
269 3.48710410411, 3.47886614237, 3.47085771144, 3.46306588016, 3.45547879117, 3.44808554464, 3.44087609744,
270 3.4338411752, 3.42697219544, 3.42026120015, 3.41370079626, 3.40728410324, 3.40100470653, 3.39485661617,
271 3.38883422999, 3.38293230069, 3.37714590628, 3.37147042368, 3.36590150482, 3.36043505519, 3.35506721435,
272 3.34979433839, 3.34461298392, 3.33951989355, 3.33451198267, 3.3295863274, 3.32474015352, 3.3199708264,
273 3.31527584174, 3.31065281706, 3.3060994839, 3.3016136806, 3.29719334569, 3.28854129969, 3.28012863599,
274 3.27194189999, 3.26396875282, 3.25619785067, 3.24861874006, 3.24122176661, 3.23399799517, 3.22693913976,
275 3.22003750184, 3.21328591581, 3.20667770063, 3.2002066169, 3.19386682855, 3.18765286865, 3.18155960874,
276 3.17558223129, 3.16971620498, 3.1639572623, 3.15830137938, 3.15274475767, 3.14728380734, 3.14191513221,
277 3.13663551594, 3.13144190952, 3.12633141979, 3.12130129892, 3.11634893481, 3.11147184224, 3.10666765471,
278 3.10193411699, 3.0972690782, 3.08813637782, 3.07925420286, 3.07060851058, 3.0621864209, 3.0539760908,
279 3.04596660532, 3.03814788252, 3.03051059033, 3.02304607359, 3.01574628977, 3.00860375216, 3.00161147949,
280 2.9947629512, 2.98805206756, 2.98147311398, 2.97502072908, 2.96868987601, 2.96247581659, 2.95637408809,
281 2.95038048206, 2.94449102535, 2.93870196271, 2.93300974113, 2.92741099539, 2.92190253507, 2.9164813325,
282 2.91114451188, 2.90588933915, 2.90071321284, 2.89561365554, 2.8905883061, 2.88563491243, 2.8759354898,
283 2.86649931119, 2.85731166746, 2.84835906508, 2.83962909503, 2.83111031887, 2.82279216952, 2.8146648644,
284 2.80671932916, 2.79894713055, 2.79134041701, 2.78389186607, 2.77659463754, 2.76944233182, 2.76242895259,
285 2.75554887345, 2.74879680789, 2.74216778225, 2.73565711142, 2.72926037674, 2.72297340607, 2.71679225565,
286 2.71071319364, 2.70473268509, 2.69884737824, 2.693054092, 2.68734980447, 2.68173164244, 2.6761968717,
287 2.67074288817, 2.66536720972, 2.66006746862, 2.64968685818, 2.63958415075, 2.6297438751, 2.62015183589,
288 2.61079497623, 2.60166125833, 2.59273955939, 2.5840195806, 2.5754917671, 2.5671472376, 2.55897772201,
289 2.55097550632, 2.54313338341, 2.53544460937, 2.52790286427, 2.52050221719, 2.51323709464, 2.50610225225,
290 2.49909274914, 2.4922039248, 2.4854313781, 2.4787709483, 2.47221869765, 2.4657708957, 2.45942400483,
291 2.45317466714, 2.44701969236, 2.44095604678, 2.43498084314, 2.42909133123, 2.42328488933, 2.41755901624,
292 2.40633953091, 2.39541501107, 2.38476910497, 2.37438680605, 2.36425430827, 2.35435888041, 2.34468875653,
293 2.33523304007, 2.3259816196, 2.31692509462, 2.30805470992, 2.2993622974, 2.29084022432, 2.28248134715,
294 2.27427897031, 2.26622680921, 2.25831895701, 2.25054985471, 2.24291426415, 2.23540724356, 2.22802412548,
295 2.22076049665, 2.2136121797, 2.20657521654, 2.19964585312, 2.19282052555, 2.18609584736, 2.17946859779,
296 2.1729357111, 2.1664942667, 2.16014147999, 2.15387469406, 2.14158908915, 2.12961846912, 2.11794545368,
297 2.10655408816, 2.09542969053, 2.08455871841, 2.07392865314, 2.06352789832, 2.05334569055, 2.04337202094,
298 2.03359756554, 2.02401362372, 2.01461206336, 2.00538527192, 1.99632611278, 1.98742788593, 1.97868429286,
299 1.97008940476, 1.9616376339, 1.95332370775, 1.94514264545, 1.93708973655, 1.92916052156, 1.92135077429,
300 1.91365648573, 1.90607384923, 1.89859924703, 1.89122923782, 1.88396054536, 1.87679004798, 1.86971476892,
301 1.86273186742, 1.84903246517, 1.83567153691, 1.82263048664, 1.80989223848, 1.79744107395, 1.78526249044,
302 1.77334307781, 1.76167041036, 1.75023295184, 1.73901997173, 1.72802147122, 1.71722811751, 1.70663118536,
303 1.69622250501, 1.68599441547, 1.67593972277, 1.66605166239, 1.65632386534, 1.64675032767, 1.63732538277,
304 1.62804367632, 1.61890014354, 1.60988998842, 1.60100866489, 1.59225185952, 1.5836154758, 1.57509561963,
305 1.56668858607, 1.55839084718, 1.55019904079, 1.54210996014, 1.53412054435, 1.51842914115, 1.50310294313,
306 1.48812189602, 1.47346757795, 1.45912302502, 1.44507257982, 1.4313017591, 1.417797138, 1.40454624816,
307 1.391537488, 1.37876004322, 1.36620381637, 1.35385936408, 1.34171784108, 1.32977095018, 1.3180108973,
308 1.30643035113, 1.29502240671, 1.28378055261, 1.27269864119, 1.26177086164, 1.25099171546, 1.24035599423,
309 1.22985875922, 1.21949532285, 1.20926123171, 1.19915225099, 1.1891643502, 1.17929369001, 1.16953661021,
310 1.15988961853, 1.15034938038, 1.13157655839, 1.11319427716, 1.09518065276, 1.07751556704, 1.06018047944,
311 1.04315826332, 1.02643306314, 1.00999016925, 0.993815907861, 0.977897543941, 0.962223195295, 0.946781756301,
312 0.931562830007, 0.916556667533, 0.90175411383, 0.887146559019, 0.872725894627, 0.858484474142, 0.844415077375,
313 0.830510878205, 0.816765415315, 0.803172565598, 0.789726519943, 0.776421761148, 0.763253043733, 0.750215375468,
314 0.737304000439, 0.724514383492, 0.711842195939, 0.699283302383, 0.686833748575, 0.674489750196, 0.650104070648,
315 0.626099012346, 0.602449453164, 0.579132162256, 0.556125593619, 0.533409706241, 0.510965806738, 0.488776411115,
316 0.466825122853, 0.445096524986, 0.423576084201, 0.402250065322, 0.381105454764, 0.36012989179, 0.339311606539,
317 0.318639363964, 0.29810241293, 0.277690439822, 0.257393526101, 0.237202109329, 0.21710694721, 0.197099084294,
318 0.177169820992, 0.15731068461, 0.137513402144, 0.117769874579, 0.0980721524887, 0.0784124127331,
319 0.0587829360689, 0.0391760855031, 0.0195842852301, 0 };
320
321 private static final double[] B = {
322
323 468043598.745, 454185281.982, 441133386.786, 428819269.757, 417181876.023, 406166717.813, 395725013.783,
324 385812960.329, 376391111.851, 367423851.404, 358878936.738, 350727109.464, 342941757.343, 335498621.458,
325 328375541.45, 321552233.174, 315010094.053, 308732032.185, 302702315.899, 296906440.935, 291331012.915,
326 285963643.058, 280792855.461, 275808004.446, 270999200.737, 266357245.389, 261873570.517, 257540186.041,
327 253349631.735, 249294933.976, 245369566.664, 241567415.856, 237882747.698, 230844652.301, 224215968.814,
328 217961855.044, 212051320.023, 206456705.678, 201153250.091, 196118717.706, 191333084.832, 186778271.013,
329 182437908.646, 178297144.629, 174342468.981, 170561566.22, 166943186.067, 163477030.605, 160153655.481,
330 156964383.183, 153901226.667, 150956821.959, 148124368.489, 145397576.172, 142770618.331, 140238089.759,
331 137794969.238, 135436586.005, 133158589.665, 130956923.161, 128827798.432, 126767674.455, 124773237.414,
332 122841382.741, 120969198.842, 117393074.498, 114024901.787, 110846987.361, 107843593.262, 105000673.785,
333 102305653.75, 99747240.7669, 97315265.5629, 95000545.5991, 92794768.101, 90690389.3539, 88680547.6828,
334 86758987.9953, 84919996.1313, 83158341.5649, 81469227.2427, 79848245.5433, 78291339.5027, 76794768.5853,
335 75355078.3902, 73969073.775, 72633794.9552, 71346496.2016, 70104626.8117, 68905814.0771, 67747848.0069,
336 66628667.5985, 65546348.4768, 64499091.7445, 63485213.9074, 62503137.7568, 61551384.1017, 59733373.2481,
337 58021039.3817, 56405393.2293, 54878438.8023, 53433039.7483, 52062806.7313, 50762002.0764, 49525458.6675,
338 48348510.6706, 47226934.1194, 46156895.7613, 45134908.8531, 44157794.8309, 43222649.9599, 42326816.2279,
339 41467855.862, 40643528.9565, 39851773.7738, 39090689.3553, 38358520.1316, 37653642.2677, 36974551.5205,
340 36319852.4159, 35688248.581, 35078534.0907, 34489585.7054, 33920355.8956, 33369866.562, 32837203.3696,
341 32321510.6295, 31821986.6654, 31337879.6134, 30413135.3113, 29542122.4706, 28720271.6567, 27943518.2501,
342 27208234.5323, 26511172.4564, 25849415.1891, 25220335.8956, 24621562.5335, 24050947.6575, 23506542.4223,
343 22986574.1168, 22489426.6833, 22013623.7674, 21557813.9244, 21120757.6673, 20701316.0956, 20298440.8828,
344 19911165.4376, 19538597.0812, 19179910.1071, 18834339.6081, 18501175.9757, 18179759.9851, 17869478.3966,
345 17569760.0097, 17280072.1174, 16999917.3132, 16728830.6117, 16466376.8456, 16212148.3111, 15965762.6321,
346 15495105.5155, 15051783.6023, 14633472.8806, 14238106.0377, 13863837.9303, 13509016.4872, 13172158.0713,
347 12851926.5229, 12547115.2589, 12256631.9188, 11979485.1457, 11714773.1625, 11461673.8654, 11219436.2047,
348 10987372.6619, 10764852.663, 10551296.7957, 10346171.7177, 10148985.6613, 9959284.45525, 9776647.99501,
349 9600687.10337, 9431040.73252, 9267373.46466, 9109373.27455, 8956749.52272, 8809231.15191, 8666565.06313,
350 8528514.65085, 8394858.47935, 8265389.08465, 8139911.88833, 7900214.37602, 7674431.7041, 7461381.19,
351 7260010.7574, 7069381.37083, 6888652.23304, 6717068.2507, 6553949.37303, 6398681.4844, 6250708.59292,
352 6109526.10467, 5974675.01146, 5845736.85046, 5722329.31864, 5604102.4449, 5490735.23866, 5381932.74725,
353 5277423.465, 5176957.04587, 5080302.27894, 4987245.29223, 4897587.95517, 4811146.45477, 4727750.02357,
354 4647239.80112, 4569467.81256, 4494296.05084, 4421595.65018, 4351246.14058, 4283134.77418, 4217155.91547,
355 4153210.48844, 4031053.45636, 3915984.28239, 3807400.7263, 3704767.03978, 3607605.02544, 3515486.5018,
356 3428026.92286, 3344879.95083, 3265732.81994, 3190302.35977, 3118331.57125, 3049586.66763, 2983854.50841,
357 2920940.3665, 2860665.97936, 2802867.84264, 2747395.71194, 2694111.28361, 2642887.03006, 2593605.16898,
358 2546156.74866, 2500440.83456, 2456363.78429, 2413838.59984, 2372784.34781, 2333125.63928, 2294792.16242,
359 2257718.26156, 2221842.55759, 2187107.60483, 2153459.58052, 2120848.00323, 2058547.45994, 1999859.79463,
360 1944478.13147, 1892129.468, 1842570.12107, 1795581.88886, 1750968.80087, 1708554.35336, 1668179.14769,
361 1629698.86458, 1592982.5198, 1557910.95684, 1524375.53953, 1492277.01457, 1461524.51863, 1432034.70898,
362 1403731.00015, 1376542.89185, 1350405.37546, 1325258.40889, 1301046.45049, 1277718.04459, 1255225.45204,
363 1233524.32016, 1212573.38728, 1192334.21771, 1172770.96356, 1153850.15023, 1135540.48296, 1117812.67195,
364 1100639.27416, 1083994.54978, 1052195.90814, 1022240.22693, 993971.022577, 967249.079973, 941950.131258,
365 917962.899577, 895187.442482, 873533.742731, 852920.504418, 833274.120331, 814527.782755, 796620.715006,
366 779497.504963, 763107.525152, 747404.426526, 732345.695244, 717892.263476, 704008.166703, 690660.241153,
367 677817.855988, 665452.675682, 653538.448664, 642050.818932, 630967.157747, 620266.41297, 609928.973904,
368 599936.549831, 590272.060629, 580919.538101, 571864.036815, 563091.553384, 554588.953291, 538344.816665,
369 523041.548206, 508599.29108, 494946.998456, 482021.249542, 469765.251724, 458127.995525, 447063.535752,
370 436530.377359, 426490.948641, 416911.147609, 407759.949924, 399009.068882, 390632.659531, 382607.060391,
371 374910.567309, 367523.234875, 360426.701557, 353604.035312, 347039.596927, 340718.91876, 334628.596889,
372 328756.19497, 323090.158348, 317619.737168, 312334.917401, 307226.358847, 302285.339317, 297503.704266,
373 292873.821293, 288388.538937, 284041.149331, 275735.234396, 267910.070584, 260524.871062, 253543.347354,
374 246933.104947, 240665.13389, 234713.377391, 229054.364815, 223666.898142, 218531.783, 213631.597053,
375 208950.489813, 204474.009027, 200188.949594, 196083.221672, 192145.735205, 188366.298503, 184735.528953,
376 181244.774164, 177886.04218, 174651.939551, 171535.616247, 168530.716557, 165631.335218, 162831.978148,
377 160127.527208, 157513.208541, 154984.564055, 152537.425701, 150167.892222, 147872.308115, 145647.244544,
378 141395.994603, 137390.624505, 133610.283442, 130036.419482, 126652.470773, 123443.605264, 120396.500282,
379 117499.155002, 114740.730226, 112111.41094, 109602.287952, 107205.255591, 104912.922975, 102718.536798,
380 100615.913924, 98599.3823607, 96663.7294285, 94804.156116, 93016.2367777, 91295.8834589, 89639.3142378,
381 88043.0250685, 86503.7646782, 85018.5121417, 83584.4568033, 82198.980265, 80859.6401976, 79564.1557618,
382 78310.3944557, 77096.3602287, 75920.1827217, 74780.1075103, 72601.7735874, 70549.3244291, 68612.0902638,
383 66780.5772822, 65046.3097201, 63401.6967477, 61839.9197339, 60354.8363331, 58940.8985361, 57593.0823673,
384 56306.8273413, 55077.9841309, 53902.7691783, 52777.7251933, 51699.6866696, 50665.7496879, 49673.2453971,
385 48719.716661, 47802.8974376, 46920.6945257, 46071.1713659, 45252.5336325, 44463.1163889, 43701.3726106,
386 42965.8629118, 42255.2463268, 41568.2720255, 40903.7718523, 40260.6535941, 39637.8948977, 39034.5377622,
387 38449.6835453, 37332.1592893, 36279.1577368, 35285.2130631, 34345.4616221, 33455.5611057, 32611.6223983,
388 31810.1518596, 31048.0022185, 30322.3306142, 29630.5625994, 28970.3611385, 28339.5998107, 27736.3395662,
389 27158.8084976, 26605.3841795, 26074.5782033, 25565.0225957, 25075.4578572, 24604.7224005, 24151.7432007,
390 23715.5274976, 23295.1554155, 22889.7733832, 22498.5882546, 22120.8620455, 21755.9072116, 21403.082403,
391 21061.7886423, 20731.4658758, 20411.5898558, 20101.6693198, 19801.2434311, 19227.1706446, 18686.2100916,
392 18175.5584758, 17692.7212135, 17235.4710025, 16801.8128973, 16389.9547259, 15998.2819199, 15625.3360073,
393 15269.7961595, 14930.463299, 14606.2463622, 14296.1503821, 13999.2661181, 13714.7610004, 13441.871201,
394 13179.8946694, 12928.184999, 12686.1460114, 12453.2269616, 12228.9182827, 12012.7478009, 11804.2773608,
395 11603.0998103, 11408.8363005, 11221.1338643, 11039.6632386, 10864.1169034, 10694.2073132, 10529.6652976,
396 10370.2386141, 10215.690635, 9920.35530902, 9642.03589933, 9379.29279296, 9130.84483975, 8895.54809344,
397 8672.3778898, 8460.41366569, 8258.82604172, 8066.86578413, 7883.85433402, 7709.17565017, 7542.26915762,
398 7382.6236306, 7229.77186868, 7083.28604825, 6942.7736517, 6807.8738919, 6678.25456313, 6553.60926028,
399 6433.65491683, 6318.12961989, 6206.79066653, 6099.41283073, 5995.78681498, 5895.71786375, 5799.02451956,
400 5705.53750473, 5615.09871424, 5527.56030707, 5442.78388486, 5360.63974837, 5281.00622313, 5128.82081305,
401 4985.39281878, 4849.98187786, 4721.92907957, 4600.64604199, 4485.60570297, 4376.33451913, 4272.40582769,
402 4173.43417369, 4079.07044241, 3988.99766684, 3902.92740311, 3820.59658617, 3741.76479301, 3666.21185297,
403 3593.73575486, 3524.1508087, 3457.28602662, 3392.98369304, 3331.09809869, 3271.49441705, 3214.04770487,
404 3158.64201089, 3105.16957952, 3053.53013775, 3003.63025539, 2955.38276983, 2908.70626808, 2863.52461931,
405 2819.76655239, 2777.36527337, 2736.25811858, 2657.69431628, 2583.6451563, 2513.72928085, 2447.60726343,
406 2384.97598811, 2325.56391052, 2269.1270432, 2215.44553905, 2164.32077155, 2115.57282931, 2069.03835784,
407 2024.56869368, 1982.02824566, 1941.29308582, 1902.24971907, 1864.79400552, 1828.83021394, 1794.27018797,
408 1761.03260977, 1729.04234809, 1698.22987957, 1668.53077394, 1639.88523494, 1612.23769017, 1585.53642374,
409 1559.73324667, 1534.78320059, 1510.64429085, 1487.27724571, 1464.64529866, 1442.7139913, 1421.45099465,
410 1380.81030481, 1342.50136932, 1306.32740443, 1272.1132493, 1239.70246899, 1208.95491167, 1179.74463906,
411 1151.9581651, 1125.49295061, 1100.25611146, 1076.16330573, 1053.13777154, 1031.10949225, 1010.01446977,
412 989.794089986, 970.394566925, 951.766454485, 933.864216342, 916.645846088, 900.072530873, 884.108352851,
413 868.720023553, 853.876647032, 839.549508182, 825.711883191, 812.33886945, 799.407232626, 786.895268923,
414 774.782680783, 763.050464528, 751.680808624, 740.657001406, 719.585090388, 699.720033366, 680.960086838,
415 663.214678935, 646.402913465, 630.452308433, 615.297727189, 600.880468722, 587.147490089, 574.050739088,
416 561.546579359, 549.59529327, 538.160650604, 527.209533055, 516.711606313, 506.639032813, 496.96621939,
417 487.669594983, 478.727414292, 470.119583902, 461.827507957, 453.833950828, 446.122914658, 438.679529921,
418 431.489957406, 424.541300267, 417.821524944, 411.319389924, 405.024381463, 398.926655468, 393.01698488,
419 387.286711944, 376.332318284, 366.004045462, 356.249171211, 347.020757519, 338.276876563, 329.979957895,
420 322.096235284, 314.59527586, 307.449577629, 300.634224017, 294.126586238, 287.906065913, 281.95387174,
421 276.252825046, 270.787189968, 265.542524683, 260.50555071, 255.664037759, 251.006702025, 246.523116109,
422 242.203629065, 238.039295241, 234.021810832, 230.143457166, 226.397049911, 222.775893491, 219.273740104,
423 215.884752796, 212.60347214, 209.424786113, 206.343902815, 203.356325724, 197.644448118, 192.25828345,
424 187.17044241, 182.356537811, 177.794783117, 173.465653828, 169.351600521, 165.436804568, 161.706969302,
425 158.149140755, 154.751553204, 151.503495587, 148.395195583, 145.417718676, 142.562879997, 139.823167083,
426 137.191672013, 134.662031621, 132.228374673, 129.885275086, 127.627710402, 125.451024827, 123.350896269,
427 121.323306878, 119.364516656, 117.471039772, 115.639623265, 113.867227861, 112.151010651, 110.488309437,
428 108.876628554, 107.313626007, 104.324987222, 101.506311917, 98.8433301246, 96.3233343285, 93.9349706793,
429 91.6680628859, 89.5134629529, 87.4629241036, 85.5089921298, 83.6449121192, 81.8645480786, 80.1623134152,
430 78.5331106002, 76.9722786296, 75.4755471284, 74.0389961376, 72.6590207791, 71.3323001202, 70.0557696658,
431 68.8265969947, 67.6421601273, 66.5000282736, 65.3979446612, 64.3338111858, 63.3056746605, 62.3117144747,
432 61.3502314957, 60.4196380687, 59.5184489908, 58.6452733506, 57.7988071362, 56.9778265301, 55.4077918373,
433 53.9267643608, 52.5272846644, 51.2027090519, 49.9471006653, 48.7551376125, 47.622035089, 46.5434790675,
434 45.5155695954, 44.5347721114, 43.5978754878, 42.7019557373, 41.8443445089, 41.0226016526, 40.2344912502,
435 39.4779606118, 38.751121818, 38.0522354538, 37.3796962368, 36.7320202863, 36.1078338186, 35.5058630854,
436 34.9249253981, 34.3639211041, 33.8218263982, 33.2976868701, 32.7906117014, 32.2997684362, 31.8243782605,
437 31.3637117346, 30.917084926, 30.4838559023, 29.6552146411, 28.8733782988, 28.134432563, 27.4348905633,
438 26.7716358691, 26.1418743927, 25.5430936131, 24.9730278502, 24.4296285677, 23.9110388709, 23.4155715259,
439 22.9416899422, 22.4879916639, 22.0531939906, 21.6361214127, 21.2356946011, 20.8509207292, 20.4808849434,
440 20.1247428261, 19.7817137183, 19.4510747894, 19.132155759, 18.824334187, 18.5270312637, 18.2397080369,
441 17.9618620255, 17.6930241733, 17.4327561035, 17.1806476409, 16.9363145704, 16.6993966065, 16.4695555516,
442 16.0298519219, 15.6148798725, 15.2225761964, 14.8511026109, 14.4988157995, 14.1642421305, 13.8460562183,
443 13.5430626642, 13.2541804371, 12.97842946, 12.7149190454, 12.4628378888, 12.2214453808, 11.9900640388,
444 11.7680728923, 11.5549016866, 11.3500257858, 11.1529616813, 10.9632630215, 10.7805170944, 10.6043417028,
445 10.4343823832, 10.2703099236, 10.1118181445, 9.95862191002, 9.81045534239, 9.6670702159, 9.52823450908,
446 9.3937310977, 9.26335657253, 9.13692016828, 9.01424279167, 8.77950188724, 8.5579029016, 8.34835265336,
447 8.14987690272, 7.96160453251, 7.78275419548, 7.61262298955, 7.45057681007, 7.29604209573, 7.14849873828,
448 7.00747396878, 6.87253706654, 6.74329476426, 6.6193872446, 6.50048464099, 6.38628396998, 6.27650643422,
449 6.17089504471, 6.06921251895, 5.97123941835, 5.87677249363, 5.78562321153, 5.69761644002, 5.61258927241,
450 5.53038997362, 5.45087703381, 5.37391831699, 5.29939029358, 5.22717734731, 5.15717114836, 5.08927008528,
451 5.02337874941, 4.89727186893, 4.77819450111, 4.66556389779, 4.5588605707, 4.45761989234, 4.36142500459,
452 4.26990080294, 4.18270881023, 4.09954278998, 4.02012497734, 3.9442028284, 3.87154620636, 3.8019449374,
453 3.73520668068, 3.67115506623, 3.60962806223, 3.5504765392, 3.49356300388, 3.43876047989, 3.38595151559,
454 3.33502730255, 3.28588689046, 3.2384364864, 3.19258882806, 3.14826262191, 3.10538203853, 3.06387625858,
455 3.0236790634, 2.98472846526, 2.9469663728, 2.91033828793, 2.8747930306, 2.8067613898, 2.74251940505,
456 2.68175424311, 2.62418694186, 2.56956792209, 2.51767319702, 2.46830115574, 2.42126982168, 2.37641450585,
457 2.33358579, 2.29264778675, 2.2534766331, 2.21595918157, 2.17999185932, 2.14547967046, 2.11233532111,
458 2.08047844974, 2.0498349484, 2.02033636247, 1.99191935846, 1.9645252511, 1.93809958206, 1.91259174386,
459 1.8879546434, 1.86414440028, 1.84112007579, 1.81884342903, 1.79727869694, 1.77639239563, 1.75615314058,
460 1.73653148369, 1.71749976531, 1.68110365251, 1.64677447223, 1.61434304574, 1.58365847132, 1.55458570812,
461 1.5270035349, 1.50080281743, 1.47588503118, 1.45216099646, 1.42954979098, 1.40797781157, 1.38737796141,
462 1.36768894386, 1.34885464657, 1.33082360294, 1.31354851955, 1.2969858605, 1.28109548066, 1.2658403013,
463 1.25118602242, 1.23710086713, 1.22355535382, 1.21052209274, 1.19797560406, 1.18589215458, 1.17424961117,
464 1.16302730872, 1.15220593111, 1.14176740369, 1.1316947959, 1.12197223308, 1.11258481634, 1.09476027388,
465 1.07811888208, 1.06256992542, 1.04803270312, 1.03443522136, 1.02171308882, 1.00980857969, 0.998669835485,
466 0.988250182301, 0.978507544678, 0.96940394074, 0.960905045915, 0.952979814867, 0.945600153008, 0.938740630449,
467 0.932378232401, 0.926492141047, 0.921063544663, 0.916075470469, 0.911512638216, 0.907361331987, 0.903609288065,
468 0.900245597058, 0.897260618748, 0.894645908353, 0.892394153106, 0.890499118227, 0.888955601518, 0.887759395947,
469 0.886907259694, 0.886396893265, 0
470
471 };
472
476 public static double inverseF01(double u) {
477
478 /* Method of Marsaglia. REF : ? */
479
480 int n, k, j;
481 double v, x, w;
482 boolean negatif;
483
484 if (u <= 0.0)
485 return Double.NEGATIVE_INFINITY;
486 if (u >= 1.0)
487 return Double.POSITIVE_INFINITY;
488 /*
489 * if (u >= 1.0) return XBIG; if (u <= 0.0) return -XBIG;
490 */
491 if (u < 0.5) {
492 negatif = true;
493 u = 2.0 * u;
494 } else {
495 negatif = false;
496 u = 2.0 * (1.0 - u);
497 }
498
499 k = 0;
500 w = u;
501 while (w < 0.5) {
502 ++k;
503 w *= 2.0;
504 }
505 j = (int) ((w - 0.5) * 64.0);
506 n = 992 - 32 * k + j;
507 if (n < 0) {
508 if (negatif)
509 return -XBIG;
510 else
511 return XBIG;
512 }
513 v = ((int) (Num.TWOEXP[k + 6] * u)) / Num.TWOEXP[k + 6];
514 v = (u - v) * B[n];
515
516 x = A[n] - v * (1.414214 - v * (A[n] - 0.4714045 * (1.0 + 2.0 * A[n] * A[n]) * v));
517 if (negatif)
518 return -x;
519 else
520 return x;
521
522 }
523
533 public static double inverseF(double mu, double sigma, double u) {
534 if (sigma <= 0)
535 throw new IllegalArgumentException("sigma <= 0");
536 return mu + sigma * inverseF01(u);
537 }
538
539}
static double cdf(double mu, double sigma, double x)
Returns an approximation of , where is the standard normal distribution function,...
NormalDistQuick(double mu, double sigma)
Constructs a NormalDistQuick object with mean = mu and standard deviation = sigma.
static double inverseF01(double u)
Same as inverseF(0.0, 1.0, u).
static double barF(double mu, double sigma, double x)
Returns an approximation of , where is the standard normal distribution function,...
static double inverseF(double mu, double sigma, double u)
Returns an approximation of , where is the standard normal distribution function,...
double inverseF(double u)
Returns the inverse distribution function .
static double cdf01(double x)
Same as cdf(0.0, 1.0, x).
NormalDistQuick()
Constructs a NormalDistQuick object with default parameters.
double barF(double x)
Returns the complementary distribution function.
static double barF01(double x)
Same as barF(0.0, 1.0, x).
double cdf(double x)
Returns the distribution function .
NormalDist()
Constructs a NormalDist object with default parameters and .
void setParams(double mu, double sigma)
Sets the parameters and of this object.
This class provides various constants and methods to compute numerical quantities such as factorials,...
Definition Num.java:35
static final double TWOEXP[]
Contains the precomputed positive powers of 2.
Definition Num.java:170