12 #include "libmesh/utility.h"
19 {-0.322232431088, -1.0, -0.342242088547, -0.0204231210245, -0.0000453642210148}};
22 {0.099348462606, 0.588581570495, 0.531103462366, 0.10353775285, 0.0038560700634}};
28 params.addClassDescription(
"Normal distribution");
29 params.addRequiredParam<Real>(
"mean",
"Mean (or expectation) of the distribution.");
30 params.addRequiredRangeCheckedParam<Real>(
31 "standard_deviation",
"standard_deviation > 0",
"Standard deviation of the distribution ");
36 : Distribution(parameters),
37 _mean(getParam<Real>(
"mean")),
38 _standard_deviation(getParam<Real>(
"standard_deviation"))
45 return 1.0 / (std_dev * std::sqrt(2.0 * M_PI)) *
46 std::exp(-0.5 * Utility::pow<2>((x - mean) / std_dev));
52 return 0.5 * (1.0 + std::erf((x - mean) / (std_dev * std::sqrt(2.0))));
58 Real x = (p < 0.5 ? p : 1.0 - p);
59 Real y = std::sqrt(-2.0 * std::log(x));
60 Real sgn = (p - 0.5 < 0.0 ? -1.0 : 1.0);
61 Real Zp = sgn * (y + (
_a[0] +
_a[1] * y +
_a[2] * Utility::pow<2>(y) +
62 _a[3] * Utility::pow<3>(y) +
_a[4] * Utility::pow<4>(y)) /
63 (
_b[0] +
_b[1] * y +
_b[2] * Utility::pow<2>(y) +
64 _b[3] * Utility::pow<3>(y) +
_b[4] * Utility::pow<4>(y)));
65 return Zp * std_dev + mean;
71 TIME_SECTION(_perf_pdf);
78 TIME_SECTION(_perf_cdf);
85 TIME_SECTION(_perf_quantile);