time-to-botec/squiggle/node_modules/jstat/test/special/lowRegGamma-test.js
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

29 lines
804 B
JavaScript

var vows = require('vows');
var assert = require('assert');
var suite = vows.describe('jStat.lowRegGamma');
require('../env.js');
suite.addBatch({
'lowRegGamma': {
'topic': function() {
return jStat;
},
// Checked against Mathematica Gamma[a, 0, x]
// Also checked against R's gammainc(a, x) via the pracma library
// gammainc() outputs three values, this matches 'reginc'.
// Note that R and jStat swap the operators; so
// gammainc(a, x) == jStat.lowRegGamma(x, a)
'check lowRegGamma': function(jStat) {
var tol = 0.000001;
assert.epsilon(tol, jStat.lowRegGamma(5, 5), 0.5595067);
assert.epsilon(tol, jStat.lowRegGamma(4, 5), 0.7349741);
assert.epsilon(tol, jStat.lowRegGamma(11, 10), 0.4169602);
}
}
});
suite.export(module);