[R] help

David Winsemius dwinsemius at comcast.net
Wed Feb 2 00:12:44 CET 2011


On Feb 1, 2011, at 3:51 PM, Kiogou Lydie wrote:
>
> I actually want to do the following:
>
> a[j] = (1/(j!))*Π (i-1-d), j = 500, Π means product i = 1 to j

What is the purpose of this effort?

>
> Yet, j! will stop at 170 and Π (i-1-d) at 172; so, a[j] will
> not exceed 170.
>
> I would like to have at least 200 a[j].

 > factorial(200)
[1] Inf
Warning message:
In factorial(200) : value out of range in 'gammafn'

>
> WHAT SHOULD I DO?

You should review the mathematics involved in calculating factorials  
and think more deeply about the limitations of your machine and  
software.

?factorial

>
> PLEASE SEE MY CODE FOR DETAIL!!
>
>
> ####################################################
> R CODE:
> ###################################################
>
> d = .25
>
> # generate j!
> v=j=1
> for (i in 1:200){
> v[i] = i
>     for (i in 2:200){
> j[1]=1
> j[i] = j[i-1]*v[i]
>     }
> }
> j
>
> # generate aj
> l=A=a=0
> for (k in 1:200){
> l[k] = (k-1-d)
>   for (i in 2:200){
>     A[1] = l[1]
>     A[i] = A[i-1]*l[i]
>      for ( i in 1:200){
>   a[i]= (1/j[i])*A[i]
>     }
>
>     }
> }
> a
>
> ######################################## END CODE ##################
> #####################################################################
>
>
> With GOD, everything is POSSIBLE.
>

Except perhaps calculating unlogged factorials above 170 with 64 bit  
computers.


> Avec DIEU, tout est POSSIBLE.
>
>
>
> 	[[alternative HTML version deleted]]
-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list