Gauss

Description

struct Tinman.Core.Math.Gauss

Helper class for computing samples along a Gaussian distribution curve.

The curve is defined by this function (and its inverse):

y = e ^ (((x - expected) / deviation) ^ 2 / -2) * scale
x = (ln(y / scale) * -2) ^ 0.5 * deviation + expected

where expected is the expected value of the distribution, deviation is the standard deviation and scale is a factor chosen so that Compute returns the specified maximum value when passing expected.

Public / Constructors

Gauss

2 overloads


public constructor Gauss1 → (2)

expected in : float64

The expected value.

deviation in : float64

[>0]
The mean deviation.

Creates a new instance of Gauss.


public constructor Gauss2 → (3)

expected in : float64

The expected value.

deviation in : float64

[>0]
The mean deviation.

maximum in : float64

The value to return at x = expected in.

Creates a new instance of Gauss.

Public / Methods

Compute


[Pure]
public method Compute → (1)

in : float64

The X-coordinate.

returns → float64

The resulting Y-coordinate.

Evaluates the Gaussian curve at the given X-coordinate.

Compute​Inv


[Pure]
public method ComputeInv → (1)

in : float64

The Y-coordinate.

returns → Vec2D

The resulting X-coordinates, with Vec2D.X <= Vec2D.Y.

Evaluates the Gaussian curve at the given Y-coordinate.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<Gauss>)

The serialization helper object for values of Gauss.