# Thread: How to numericall compute a series with a big factorial in it

1. ## How to numericall compute a series with a big factorial in it

Hi,

Imagine I got the following series:

$f(\alpha)=(n!/\alpha!)\sum_{i=0}^n(-1)^{(i-\alpha)}u^i/[(i-\alpha)!(n-i)!]$

In which u $\in$[0,1] (and u $\in$ REAL)
While $\alpha$ and i and n are INTEGERS

The (-1)^something causes an alternating sign, in this way the sum doesn't explode, but seems to end up with a real number between 0 and 1,
adding something big, substracting something even bigger and so on...

(In case the factorial of a negative number is needed, for example in (i- $\alpha$)! this is set to 1.

The problem is that I need to compute the result of this series for large n (say 10000) and my computer breaks down on n! (of couse) for large n.

Is there an easier way to get to a result without computer overflow?

Thanks,

Gerrit

2. ## Re: How to numericall compute a series with a big factorial in it

Consider:
1) Stirling's Formula has applications to #2 and #3
2) Gamma Functions instead of factorials
3) Combinations: Excluding the weird negative factorials, what you have there is "i choose alpha" times "n choose i"

3. ## Re: How to numericall compute a series with a big factorial in it

Thanks a lot! I'll look at it tomorrow. I forgot to tell that $\alpha \leq n$

I don't see how the negative factorial can be avoided, as in "i choose $\alpha$" you will also get (i- $\alpha$)<0

I looked the Gamma function up, but what's the advantage of using it? It's just the same as a factorial, so it will result in huge numbers as well, won't it?

The stirling formula looks promising (neither knew that one), I'll have a closer look at that.

Are you sure that adding and substracting huge numbers can be avoided by use of one of these functions? The term u^i seems to destroy the possibility to divide huge numbers between each other to small ones before adding them in the sum, as u^i is different for every i term.

BTW1: the formula came from: (n choose $\alpha$) times ([n- $\alpha$] choose [i- $\alpha$])
BTW2: What do you mean by #2 and #3?

4. ## Re: How to numericall compute a series with a big factorial in it

Compute one term in terms of the preceding one.
Suppose you have a series with general term $\frac{x^{n}}{n!},$ then if you have the value of, say, the 100th term, (n=99), the next term would be calculated by dividing that value by 100 and then multiplying by $x.$

5. ## Re: How to numericall compute a series with a big factorial in it

Thanks, but that doesn't make you get rid of the big numbers, does it?

Imagine that n=4 and $\alpha$=0, then you get:

+1*[4!/(0!0!4!)]u^0-1*[4!/(0!1!3!)]u^1+1*[4!/(0!2!2!)]u^2-1*[4!/(0!3!1!)]u^3+1*[4!/(0!4!0!)]u^4 =

= u^0 -4u^1 +6u^2 -4u^3 + u^4

Which you would compute as: u^0*(1-u*[4-u*{6-u*(4-u)}])

In that way, for huge n, you will still have the huge integers adding and substracting to eachother, or not?

Doesn't this series converge to something?