shooflenet/articles/dynamic_systems_in_games/supporting_math.js
2013-09-12 01:41:58 -04:00

20 lines
525 B
JavaScript

function make_gaussian(mean, standard_deviation) {
return function (x) {
return Math.exp(-Math.pow((x-mean)/standard_deviation, 2))/(standard_deviation * Math.sqrt(2*Math.PI));
};
}
function make_bell(mean, standard_deviation) {
return function (x) {
return Math.exp(-Math.pow((x-mean)/standard_deviation, 2));
};
}
function exp_decay(height, width) {
return function (x) {
return height*Math.exp(-x/width);
};
}
function exp_growth(height, width) {
return function (x) {
return height*Math.exp(x/width);
};
}