mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
added factorial
This commit is contained in:
parent
4a28cab81d
commit
38a8f30267
1 changed files with 5 additions and 0 deletions
|
@ -22,6 +22,11 @@ def delta [ a: number, b: number, c: number ] {
|
|||
( $b ** 2 ) - ( 4 * $a * $c)
|
||||
}
|
||||
|
||||
#factorial of a given number, works fine only for n<21 (integer range)
|
||||
def fact [num:number] {
|
||||
if $num >= 0 { if $num < 2 {$num} {seq 2 $num | math product} } { echo 'Error: can only calculate non-negative integers'}
|
||||
}
|
||||
|
||||
#TODO:
|
||||
# -sin, cos, tan table for 0-90 degrees
|
||||
# -radians to degrees and reversed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue