How to use the gamma function from mathjs

Find comprehensive JavaScript mathjs.gamma code examples handpicked from public code repositorys.

14
15
16
17
18
19
20
21
22
23
const csqrt = math.sqrt;
const cpow = math.pow;
const csquare = z => cmul(z, z);
const ccis = z => cexp(cmul_i(z));

const gamma_right = math.gamma;
const gamma_left = z => math.divide(math.pi, math.multiply(
    math.sin(math.multiply(z, math.pi)),
    gamma_right(math.subtract(1, z))
));
fork icon8
star icon29
watch icon3

+ 3 other calls in file

54
55
56
57
58
59
60
  var upper_incomplete_gamma = function(s, x){
    // ref: https://en.wikipedia.org/wiki/Incomplete_gamma_function#Properties
    return math.gamma(s) - lower_incomplete_gamma(s, x);
  };

  return upper_incomplete_gamma(a, x) / math.gamma(a);
};
fork icon0
star icon10
watch icon1

+ 3 other calls in file