%binomial and fix
Posted: Thu Dec 15, 2011 4:01 am
Hi,
I want to construct a n-vector containing the integer binomial coefficients (n,i) where i is the row of the vector. I found that transforming the real binomial coefficients into integers by using the FIX command leads to changes in the coefficient's values.
Here is an example code. The problem seems to occur only for n<=5.
declare integer n
compute n=5
declare vector[integer] bincoeff(n)
do i=1,n
compute bincoeff(i)=fix(%binomial(n,i))
display %binomial(n,i) fix(%binomial(n,i))
end do i
Regards,
Martin
I want to construct a n-vector containing the integer binomial coefficients (n,i) where i is the row of the vector. I found that transforming the real binomial coefficients into integers by using the FIX command leads to changes in the coefficient's values.
Here is an example code. The problem seems to occur only for n<=5.
declare integer n
compute n=5
declare vector[integer] bincoeff(n)
do i=1,n
compute bincoeff(i)=fix(%binomial(n,i))
display %binomial(n,i) fix(%binomial(n,i))
end do i
Regards,
Martin