# Statistics / Probability - Gaussian function ($e^{-x^2}$)

In statistics and probability theory, Gaussian functions appear as the density function of the normal distribution, which is a limiting probability distribution of complicated sums, according to the central limit theorem.

## 3 - Syntax

### 3.1 - Simplified

A Gaussian function is generally simplified by:

$$f(x)=e^{\displaystyle -x^2}$$


var exponent = (x) => Math.pow(x,2)
var func = (x) =>  Math.pow( Math.E ,  -exponent(x) );

// The graph
var graph = new world.func(func)
.setTitle("The base gaussian function")
.render();



### 3.2 - Detailled

A Gaussian is a function of the form:

$$f(x)=ae^{-{\frac {\displaystyle(x-b)^{2}}{\displaystyle 2c^{2}}}}$$ where:

• The variable a defines the position of its mode (ie peak) on the y axis.
• The variable b defines the position of its mode (ie peak) on the x axis.
• The variable c defines the spread

// the position of the mode (ie peak) on the ''y'' axis.
var a = 0.5;
// The position of the mode on the x axis (ie the position of the pick on the x axis)
var b = -1;
var c = 1.5;

// The gaussian function
var exponent = (x) => Math.pow((x-b),2) / (2*Math.pow(c,2))
var func = (x) =>  a * Math.pow( Math.E ,  -exponent(x) );

// The graph
var graph = new world.func(func)
.setTitle("A gaussian function where a="+a+", b="+b+", c="+c)
.render();



## 4 - Play


// the position of the mode (ie peak) on the ''y'' axis.
var a = 0.9;
// The position of the modeon the x axis (ie the position of the pick on the x axis)
var b = -2;
var c = 2;

// The gaussian function
var exponent = (x) => Math.pow((x-b),2) / (2*Math.pow(c,2))
var func = (x) =>  a * Math.pow( Math.E ,  -exponent(x) );

// The graph
var graph = new world.func(func)
.setTitle("A gaussian function where a="+a+", b="+b+", c="+c)
.render();



## 5 - Documentation / Reference

Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry