gaussian_function

Function gaussian_function 

Source
pub fn gaussian_function(x: &Z, c: &Q, s: &Q) -> f64
Expand description

Computes the value of the Gaussian function for x.

Warning: This functions assumes s != 0.

Parameters:

  • x: specifies the value/ sample for which the Gaussian function’s value is computed
  • c: specifies the position of the center with peak probability
  • s: specifies the Gaussian parameter, which is proportional to the standard deviation sigma * sqrt(2 * pi) = s

Returns the computed value of the Gaussian function for x.

§Examples

use qfall_math::{integer::Z, rational::Q};
use qfall_math::utils::sample::discrete_gauss::gaussian_function;
let sample = Z::ONE;
let center = Q::ZERO;
let gaussian_parameter = Q::ONE;

let probability = gaussian_function(&sample, &center, &gaussian_parameter);

§Panics …

  • if s = 0.
  • if -π * (x - c)^2 / s^2 is larger than f64::MAX