Factorial
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon May 21, 2018 12:35 am
by Skrubs
Is there a way to calculate factorials in thyme ? if yes say how.
Re: Factorial
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Tue May 29, 2018 11:01 pm
by Xray
As far as I know there is no single operator in Thyme which will calculate factorials. So, I think the best way to handle it is to create a function which calculates the factorial, and simply call the function like a subroutine with a single argument. In case you didn't know, factorial is calculated as follows:
n!=n×(n−1)×(n−2)...×2×1
where, n is a positive integer.
Re: Factorial
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Tue Jun 05, 2018 6:25 pm
by FRA32
press f10 to open the console, then type this:
scene.my.factorial = (n)=>{
n>2 ? {
n*scene.my.factorial(n-1)
} : {
2
}
}
then you can use factorials in that scene by typing scene.my.factorial(number).