time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

lowRegGamma-test.js (804B)


      1 var vows = require('vows');
      2 var assert = require('assert');
      3 var suite = vows.describe('jStat.lowRegGamma');
      4 
      5 require('../env.js');
      6 
      7 suite.addBatch({
      8   'lowRegGamma': {
      9     'topic': function() {
     10       return jStat;
     11     },
     12 
     13     // Checked against Mathematica Gamma[a, 0, x]
     14     // Also checked against R's gammainc(a, x) via the pracma library
     15     // gammainc() outputs three values, this matches 'reginc'.
     16     // Note that R and jStat swap the operators; so
     17     // gammainc(a, x) == jStat.lowRegGamma(x, a)
     18     'check lowRegGamma': function(jStat) {
     19       var tol = 0.000001;
     20       assert.epsilon(tol, jStat.lowRegGamma(5, 5), 0.5595067);
     21       assert.epsilon(tol, jStat.lowRegGamma(4, 5), 0.7349741);
     22       assert.epsilon(tol, jStat.lowRegGamma(11, 10), 0.4169602);
     23     }
     24   }
     25 });
     26 
     27 suite.export(module);
     28