public interface PDF(T)

Probability density function interface

Example

import std.traits, std.mathspecial;

class NormalPDF : PDF!real
{
	real opCall(real x)
	{
		// 1/sqrt(2 PI)
		enum c = 0.398942280401432677939946L;
		return c * exp(-0.5f * x * x);
	}
}

auto pdf = new NormalPDF;
auto x = pdf(0.1);
assert(x.isNormal);

import scid.calculus : integrate;
auto result = pdf.integrate(-double.infinity, double.infinity);
assert(fabs(result.value - 1) < result.error);

Example

PDF!double pdf = GammaSPDF!double(1, 3).toPDF;

public T opCall(T x)

Call operator

Functions

opCall

Call operator