www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
NormalDistribution Class Reference

A class used to generate a normal distribution. More...

#include <NormalDistribution.h>

Inheritance diagram for NormalDistribution:
[legend]

Public Member Functions

 NormalDistribution (const InputParameters &parameters)
 
virtual Real pdf (const Real &x) const override
 
virtual Real cdf (const Real &x) const override
 
virtual Real quantile (const Real &p) const override
 
Real pdf (const Real &x, const Real &mean, const Real &std_dev) const
 
Real cdf (const Real &x, const Real &mean, const Real &std_dev) const
 
Real quantile (const Real &p, const Real &mean, const Real &std_dev) const
 

Protected Attributes

const Real & _mean
 The mean (or expectation) of the distribution (mu) More...
 
const Real & _standard_deviation
 The standard deviation of the distribution (sigma) More...
 
const std::vector< Real > _a
 
const std::vector< Real > _b
 

Detailed Description

A class used to generate a normal distribution.

Definition at line 23 of file NormalDistribution.h.

Constructor & Destructor Documentation

◆ NormalDistribution()

NormalDistribution::NormalDistribution ( const InputParameters &  parameters)

Definition at line 28 of file NormalDistribution.C.

29  : Distribution(parameters),
30  _mean(getParam<Real>("mean")),
31  _standard_deviation(getParam<Real>("standard_deviation"))
32 {
33 }
const Real & _standard_deviation
The standard deviation of the distribution (sigma)
const Real & _mean
The mean (or expectation) of the distribution (mu)

Member Function Documentation

◆ cdf() [1/2]

Real NormalDistribution::cdf ( const Real &  x) const
overridevirtual

Reimplemented in JohnsonSBDistribution, and TruncatedNormalDistribution.

Definition at line 67 of file NormalDistribution.C.

Referenced by JohnsonSBDistribution::cdf(), TruncatedNormalDistribution::cdf(), TestDistributionDirectPostprocessor::getValue(), TruncatedNormalDistribution::pdf(), and TruncatedNormalDistribution::quantile().

68 {
69  return cdf(x, _mean, _standard_deviation);
70 }
const Real & _standard_deviation
The standard deviation of the distribution (sigma)
const Real & _mean
The mean (or expectation) of the distribution (mu)
virtual Real cdf(const Real &x) const override

◆ cdf() [2/2]

Real NormalDistribution::cdf ( const Real &  x,
const Real &  mean,
const Real &  std_dev 
) const

Definition at line 42 of file NormalDistribution.C.

43 {
44  return 0.5 * (1.0 + std::erf((x - mean) / (std_dev * std::sqrt(2.0))));
45 }

◆ pdf() [1/2]

Real NormalDistribution::pdf ( const Real &  x) const
overridevirtual

Reimplemented in JohnsonSBDistribution, and TruncatedNormalDistribution.

Definition at line 61 of file NormalDistribution.C.

Referenced by TestDistributionDirectPostprocessor::getValue(), and TruncatedNormalDistribution::pdf().

62 {
63  return pdf(x, _mean, _standard_deviation);
64 }
const Real & _standard_deviation
The standard deviation of the distribution (sigma)
const Real & _mean
The mean (or expectation) of the distribution (mu)
virtual Real pdf(const Real &x) const override

◆ pdf() [2/2]

Real NormalDistribution::pdf ( const Real &  x,
const Real &  mean,
const Real &  std_dev 
) const

Definition at line 35 of file NormalDistribution.C.

36 {
37  return 1.0 / (std_dev * std::sqrt(2.0 * M_PI)) *
38  std::exp(-0.5 * Utility::pow<2>((x - mean) / std_dev));
39 }

◆ quantile() [1/2]

Real NormalDistribution::quantile ( const Real &  p) const
overridevirtual

Reimplemented in JohnsonSBDistribution, and TruncatedNormalDistribution.

Definition at line 73 of file NormalDistribution.C.

Referenced by TestDistributionDirectPostprocessor::getValue(), JohnsonSBDistribution::quantile(), and TruncatedNormalDistribution::quantile().

74 {
76 }
const Real & _standard_deviation
The standard deviation of the distribution (sigma)
virtual Real quantile(const Real &p) const override
const Real & _mean
The mean (or expectation) of the distribution (mu)

◆ quantile() [2/2]

Real NormalDistribution::quantile ( const Real &  p,
const Real &  mean,
const Real &  std_dev 
) const

Definition at line 48 of file NormalDistribution.C.

49 {
50  Real x = (p < 0.5 ? p : 1.0 - p);
51  Real y = std::sqrt(-2.0 * std::log(x));
52  Real sgn = (p - 0.5 < 0.0 ? -1.0 : 1.0);
53  Real Zp = sgn * (y + (_a[0] + _a[1] * y + _a[2] * Utility::pow<2>(y) +
54  _a[3] * Utility::pow<3>(y) + _a[4] * Utility::pow<4>(y)) /
55  (_b[0] + _b[1] * y + _b[2] * Utility::pow<2>(y) +
56  _b[3] * Utility::pow<3>(y) + _b[4] * Utility::pow<4>(y)));
57  return Zp * std_dev + mean;
58 }
const std::vector< Real > _a
const std::vector< Real > _b

Member Data Documentation

◆ _a

const std::vector<Real> NormalDistribution::_a
protected
Initial value:
= {
-0.322232431088, -1.0, -0.342242088547, -0.0204231210245, -0.0000453642210148}

Coefficients for the rational function used to approximate the quantile

Definition at line 39 of file NormalDistribution.h.

Referenced by quantile().

◆ _b

const std::vector<Real> NormalDistribution::_b
protected
Initial value:
= {
0.099348462606, 0.588581570495, 0.531103462366, 0.10353775285, 0.0038560700634}

Definition at line 42 of file NormalDistribution.h.

Referenced by quantile().

◆ _mean

const Real& NormalDistribution::_mean
protected

The mean (or expectation) of the distribution (mu)

Definition at line 47 of file NormalDistribution.h.

Referenced by cdf(), TruncatedNormalDistribution::cdf(), TruncatedNormalDistribution::pdf(), pdf(), TruncatedNormalDistribution::quantile(), and quantile().

◆ _standard_deviation

const Real& NormalDistribution::_standard_deviation
protected

The standard deviation of the distribution (sigma)

Definition at line 50 of file NormalDistribution.h.

Referenced by cdf(), TruncatedNormalDistribution::cdf(), TruncatedNormalDistribution::pdf(), pdf(), TruncatedNormalDistribution::quantile(), and quantile().


The documentation for this class was generated from the following files: