Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

DoubleFactorial

Double factorial


Description

Calculate the double factorial of a number, or its logarithm.

Usage

DoubleFactorial(n)

DoubleFactorial64(n)

LnDoubleFactorial(n)

Log2DoubleFactorial(n)

LogDoubleFactorial(n)

LnDoubleFactorial.int(n)

LogDoubleFactorial.int(n)

Arguments

n

Vector of integers.

Value

Returns the double factorial, n * (n - 2) * (n - 4) * (n - 6) * ...

Functions

  • DoubleFactorial64: Returns the exact double factorial as a 64-bit integer64, for n < 34.

  • LnDoubleFactorial: Returns the logarithm of the double factorial.

  • Log2DoubleFactorial: Returns the logarithm of the double factorial.

  • LnDoubleFactorial.int: Slightly faster, when x is known to be length one and below 50001

Author(s)

Martin R. Smith (martin.smith@durham.ac.uk)

See Also

Other double factorials: doubleFactorials, logDoubleFactorials

Examples

DoubleFactorial (-4:0) # Return 1 if n < 2
DoubleFactorial (2) # 2
DoubleFactorial (5) # 1 * 3 * 5
exp(LnDoubleFactorial.int (8)) # log(2 * 4 * 6 * 8)
DoubleFactorial64(31)

TreeTools

Create, Modify and Analyse Phylogenetic Trees

v1.4.4
GPL (>= 3)
Authors
Martin R. Smith [aut, cre, cph] (<https://orcid.org/0000-0001-5660-1727>), Emmanuel Paradis [cph] (<https://orcid.org/0000-0003-3092-2199>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.