Skip to content

Basic Math Functions

Arthur Guiot edited this page May 15, 2018 · 2 revisions

You can use the factorial function like this:

t.factorial(5) // 120 => BigNumber

It will take any number n to the power x (so we have n^x):

t.pow(4, 2) // 16 => BigNumber
t.sqrt(4) // 2 => BigNumber
t.sqrt(2) // 1.4142135623730951... => BigNumber

t.root(64, 3) // 4 => BigNumber
t.log(100, 10) // 2 => BigNumber
t.ln(1) // 0 => BigNumber
t.ln(2) // 0.69314718055995 => BigNumber()

Similar to factorial (n! = gamma(n + 1)), but will be able to process Float.

t.gamma(5) // 24 => BigNumber

t.pow(t.gamma(1.5), 2).times(4) // pi (approximation) => BigNumber
t.lngamma(5) // 3.1780538303 => BigNumber
t.sigmoid(0) // 0.5 => BigNumber