Displaying 3 results from an estimated 3 matches for "gchoose".
Did you mean:
choose
2020 Jan 15
1
[R] choose(n, k) as n approaches k
...tional values of choose() doesn't it make sense to look to the gamma function for the correct analytic continuation? In particular k<0 may not imply the function should evaluate to zero until we get k<=-1.
>
> Example:
>
> ``` r
> choose(5, 4)
> #> [1] 5
>
> gchoose <- function(n, k) {
> gamma(n+1)/(gamma(n+1-k) * gamma(k+1))
> }
>
> gchoose(5, 4)
> #> [1] 5
> gchoose(5, 0)
> #> [1] 1
> gchoose(5, -0.5)
> #> [1] 0.2351727
> ```
>
>> On Jan 14, 2020, at 10:20 AM, peter dalgaard <pdalgd at gmail.com>...
2020 Jan 14
0
[R] choose(n, k) as n approaches k
...on a fire. If we are talking about fractional values of choose() doesn't it make sense to look to the gamma function for the correct analytic continuation? In particular k<0 may not imply the function should evaluate to zero until we get k<=-1.
Example:
``` r
choose(5, 4)
#> [1] 5
gchoose <- function(n, k) {
gamma(n+1)/(gamma(n+1-k) * gamma(k+1))
}
gchoose(5, 4)
#> [1] 5
gchoose(5, 0)
#> [1] 1
gchoose(5, -0.5)
#> [1] 0.2351727
```
> On Jan 14, 2020, at 10:20 AM, peter dalgaard <pdalgd at gmail.com> wrote:
>
> OK, I see what you mean. But in those cas...
2020 Jan 14
4
[R] choose(n, k) as n approaches k
OK, I see what you mean. But in those cases, we don't get the catastrophic failures from the
if (k < 0) return 0.;
if (k == 0) return 1.;
/* else: k >= 1 */
part, because at that point k is sure to be integer, possibly after rounding.
It is when n-k is approximately but not exactly zero and we should return 1, that we either return 0 (negative case) or n