Package org.arakhne.afc.math.stochastic
Class GaussianStochasticLaw
- java.lang.Object
-
- org.arakhne.afc.math.stochastic.StochasticLaw
-
- org.arakhne.afc.math.stochastic.GaussianStochasticLaw
-
- All Implemented Interfaces:
MathFunction,MathInversableFunction,JsonableObject
public class GaussianStochasticLaw extends StochasticLaw
Law that representes a gaussian density.Reference: Normal Distribution.
This class uses the gaussian random number distribution provided by
Random.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:41
- Author:
- Christophe BOHRHAUER
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathstochastic
-
-
Field Summary
-
Fields inherited from class org.arakhne.afc.math.stochastic.StochasticLaw
NAME_NAME
-
-
Constructor Summary
Constructors Constructor Description GaussianStochasticLaw(double mean, double standardDeviation)Constructor.GaussianStochasticLaw(Map<String,String> parameters)Construct a law with the following parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublef(double x)Replies the value of the function.MathFunctionRange[]getRange()Replies the range of the function.doubleinverseF(double u)Replies the x according to the value of the distribution function.protected doubleinverseF(Random rnd)Replies the x according to the value of the inverted cummulative distribution functionF<sup>-1</sup>(u)whereu = U(0, 1).static doublerandom(double mean, double standardDeviation)Replies a random value that respect the current stochastic law.voidtoJson(JsonBuffer buffer)Replies the Json representation of this node.-
Methods inherited from class org.arakhne.afc.math.stochastic.StochasticLaw
generateRandomValue, getLawName, paramBoolean, paramDouble, toString
-
-
-
-
Constructor Detail
-
GaussianStochasticLaw
public GaussianStochasticLaw(Map<String,String> parameters) throws OutsideDomainException, LawParameterNotFoundException
Construct a law with the following parameters.meanstandardDeviation
- Parameters:
parameters- is the set of accepted paramters.- Throws:
OutsideDomainException- when standardDeviation is not positive or nul.LawParameterNotFoundException- when a mandatory parameter was not found.
-
GaussianStochasticLaw
public GaussianStochasticLaw(double mean, double standardDeviation) throws OutsideDomainExceptionConstructor.- Parameters:
mean- is the mean of the normal distribution.standardDeviation- is the standard deviation associated to the nromal distribution.- Throws:
OutsideDomainException- when standardDeviation is not positive or nul.
-
-
Method Detail
-
random
@Pure public static double random(double mean, double standardDeviation) throws MathExceptionReplies a random value that respect the current stochastic law.- Parameters:
mean- is the mean of the normal distribution.standardDeviation- is the standard deviation associated to the nromal distribution.- Returns:
- a value depending of the stochastic law parameters
- Throws:
MathException- when error in mah definition.
-
f
@Pure public double f(double x) throws MathExceptionDescription copied from interface:MathFunctionReplies the value of the function.- Parameters:
x- the x.- Returns:
- the value of
f(x). - Throws:
MathException- in casef(x)could not be computed
-
getRange
@Pure public MathFunctionRange[] getRange()
Description copied from interface:MathFunctionReplies the range of the function.- Returns:
- a array of ranges. It corresponds to a list of couples that defined the set of valid values.
-
inverseF
@Pure public double inverseF(double u) throws MathExceptionReplies the x according to the value of the distribution function.- Specified by:
inverseFin interfaceMathInversableFunction- Specified by:
inverseFin classStochasticLaw- Parameters:
u- is a value given by the uniform random variable generatorU(0, 1).- Returns:
F<sup>-1</sup>(u)- Throws:
MathException- in caseF<sup>-1</sup>(u)could not be computed
-
inverseF
protected final double inverseF(Random rnd) throws MathException
Replies the x according to the value of the inverted cummulative distribution functionF<sup>-1</sup>(u)whereu = U(0, 1).- Overrides:
inverseFin classStochasticLaw- Parameters:
rnd- is the uniform random variable generatorU(0, 1).- Returns:
F<sup>-1</sup>(u)- Throws:
MathException- in caseF<sup>-1</sup>(u)could not be computed
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObjectReplies the Json representation of this node.- Parameters:
buffer- the Json buffer.
-
-