# Factorial function

**URL:** <https://discuss.elastic.co/t/factorial-function/240828>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [July 12, 2020, 9:56am UTC](https://discuss.elastic.co/t/factorial-function/240828 "2020-07-12T09:56:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hugo\_Pires](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugo_pires/32/68069_2.png) [@Hugo\_Pires](https://discuss.elastic.co/u/Hugo_Pires)\
**Post date:** [July 12, 2020, 9:56am UTC](https://discuss.elastic.co/t/factorial-function/240828/1 "2020-07-12T09:56:10Z")

</div>

Hello

Is it possible, using tiny math (or other solution), to calculate the factorial of an integer number in Kibana Canvas?

Thank you

Hugo

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [July 13, 2020, 3:53pm UTC](https://discuss.elastic.co/t/factorial-function/240828/2 "2020-07-13T15:53:08Z")

</div>

The factorial function is not one of the supported TinyMath functions, [https://www.elastic.co/guide/en/kibana/master/canvas-tinymath-functions.html](https://www.elastic.co/guide/en/kibana/master/canvas-tinymath-functions.html) .

I also can't think of a work-around.

I would log an ER here [https://github.com/elastic/kibana/issues/new](https://github.com/elastic/kibana/issues/new)

---

<div class="post-metadata">

**Author:** ![Hugo\_Pires](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugo_pires/32/68069_2.png) [@Hugo\_Pires](https://discuss.elastic.co/u/Hugo_Pires)\
**Post date:** [July 13, 2020, 4:04pm UTC](https://discuss.elastic.co/t/factorial-function/240828/3 "2020-07-13T16:04:05Z")

</div>

Thank you.

Meanwhile I found a possible math solution:

> **[Stirling's approximation](https://en.wikipedia.org/wiki/Stirling's_approximation)**
>
> In mathematics, Stirling's approximation (or Stirling's formula) is an approximation for factorials. It is a good approximation, leading to accurate results even for small values of n. It is named after James Stirling, though it was first stated by Abraham de Moivre.
> The version of the formula typically used in applications is
> (in big O notation, as 
>   
>     
>       
> n
> →
> ∞
>       
>     
> {\\displaystyle n\\to \\infty }
>   
> ), or, by changing the base of the logarithm (for ins...

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [July 13, 2020, 9:25pm UTC](https://discuss.elastic.co/t/factorial-function/240828/4 "2020-07-13T21:25:48Z")

</div>

> Meanwhile I found a possible math solution:

TIL 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 10, 2020, 9:25pm UTC](https://discuss.elastic.co/t/factorial-function/240828/5 "2020-08-10T21:25:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
