Mathematica Playing Up: Solving for 1+1/1998!

  • Context: Mathematica 
  • Thread starter Thread starter Gib Z
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
6 replies · 3K views
Messages
3,341
Reaction score
7
I just tried doing [tex]\sum_{n=1}^{1998} (-1)^{n+1} \frac{n+1}{n!}[/tex] in mathematicia and it gives me some fat long long big number, But I did it manually by splitting the numerator and it seemed to give me a telescoping series which solved to 1+ 1/(1998!), so the answer should be around 1 shouldn't it...
 
Physics news on Phys.org
I did it in Mathematica and was surprised by the huge number as well... until I realized that there is a / in the middle, and it's really a fraction. Approximate it numerically and you'll get 1.
 
Ahh I see >.< thanks for that but I wish mathematicia would express the answer in what I would think is simpler terms- [tex]1+\frac{1}{1998!}[/tex]..
 
The problem is the difficulty of recognizing the factorial in its long form.

With 5028 digits, that would be quite a number to guess at formulae for!
 
Does mathematicia calculate directly, then attempt a simplification? I always used to think it was just somehow smart, like knowing that the sum of (1/n^2) to infinity it pi^2/6. How does it get that...Anyway, I would have thought mathematicia would have done the same trick I did >.< damn
 
Gib Z said:
Does mathematicia calculate directly, then attempt a simplification? I always used to think it was just somehow smart, like knowing that the sum of (1/n^2) to infinity it pi^2/6. How does it get that...Anyway, I would have thought mathematicia would have done the same trick I did >.< damn

In this case the calculation is direct. If you like, do the Sum as n goes from 1 to some finite integer h. The result (after some simplification) is in terms of the Gamma functions (factorial since the arguments are integers). This code is an attempt to control the evaluation a bit:

Code:
Hold[Evaluate[Sum[((-1)^(1 +
       n)*(1 + n))/n!, {n, 1, h}] // FullSimplify]] /. h -> 1998

The result is not as simple as possible, but with some more work controlling the evaluation it could be. The moral of the story is:

1) Use Sum when the upper limit is a symbol, or infinity.

2) When the upper limit is a number, use NSum.
 
Sorry about that then, I am new with mathematicia just got the trial version to see what its like. THanks