[R] large factorials
Murray Cooper
myrmail at earthlink.net
Wed Apr 22 23:04:51 CEST 2009
You don't say what the error was, for the R factorial function,
but it is probably irrelevant for your question.
Factorials get to be big numbers rather quickly and unless you
are using a program that does arbitrary precission arithmetic
you will quickly exceed the precission limits, for storing a number.
If you have Maple, do 170! and count the number of digits in the
result. You will see what I mean.
There are some tricks when working with large factorials, depending
on what you are doing with them. I'd first try the log factorial function
in R I think its called lfactorial. Just do a ?factorial and you'll find
documentation. If this doesn't work, for you, repost with a clear
description of what you're trying to do and someone may be able
to help.
Murray M Cooper, Ph.D.
Richland Statistics
9800 N 24th St
Richland, MI, USA 49083
Mail: richstat at earthlink.net
----- Original Message -----
From: "molinar" <sky2k2 at hotmail.com>
To: <r-help at r-project.org>
Sent: Wednesday, April 22, 2009 3:21 PM
Subject: [R] large factorials
>
> I am working on a project that requires me to do very large factorial
> evaluations. On R the built in factorial function and the one I created
> both are not able to do factorials over 170. The first gives an error and
> mine return Inf.
>
> Is there a way to have R do these larger calculations (the calculator in
> accessories can do 10000 factorial and Maple can do even larger)
> --
> View this message in context:
> http://www.nabble.com/large-factorials-tp23175816p23175816.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list