13 if (nL <= 1 || nR <= 1)
18 double N = 1 / (sigma * (nL / aL * 1 / (nL - 1) * Exp(-aL * aL / 2) +
19 Sqrt(
Pi() / 2) * (Erf(aL / Sqrt(2)) + Erf(aR / Sqrt(2))) +
20 nR / aR * 1 / (nR - 1) * Exp(-aR * aR / 2)));
31 double AL = dL / (nL - 1) * Exp(-aL * aL / 2);
32 double CL = Sqrt(
Pi() / 2) * Erf(aL / Sqrt(2));
33 double CR = Sqrt(
Pi() / 2) * Erf(aR / Sqrt(2));
34 if (
y < sigma *
N * AL) {
35 double BL = dL / (nL - 1) * Exp(-aL * aL / 2);
36 x =
mu + sigma * (-dL * Power(
y / (sigma *
N * BL), 1 / (-nL + 1)) - aL + dL);
37 }
else if (
y > sigma *
N * (AL +
CL + CR)) {
38 double AR =
dR / (nR - 1) * Exp(-aR * aR / 2);
39 double BR =
dR / (1 - nR) * Exp(-aR * aR / 2);
40 double D = (
y / (sigma *
N) - AL -
CL - CR - AR) / BR;
41 x =
mu + sigma * (
dR * Power(
D, 1 / (-nR + 1)) + aR -
dR);
43 double D = 1 - Sqrt(2 /
Pi()) * (
y / (sigma *
N) - AL -
CL);
44 x =
mu + sigma * Sqrt(2) * ErfcInverse(
D);