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

  • Thread starter Thread starter Gib Z
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
The discussion revolves around the calculation of the series \sum_{n=1}^{1998} (-1)^{n+1} \frac{n+1}{n!} using Mathematica, which initially produced a large number due to the factorial in the denominator. The user manually simplified the series into a telescoping form, arriving at the conclusion that the result should be approximately 1 + 1/(1998!). There was confusion regarding Mathematica's output, which was not expressed in simpler terms, leading to a discussion about how Mathematica performs calculations. It was clarified that Mathematica calculates directly and can simplify results, particularly when using the Sum function with symbolic upper limits. The conversation emphasized the importance of using NSum for finite integer limits to achieve more manageable results.
Gib Z
Homework Helper
Messages
3,341
Reaction score
7
I just tried doing \sum_{n=1}^{1998} (-1)^{n+1} \frac{n+1}{n!} 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- 1+\frac{1}{1998!}..
 
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
 

Similar threads

Replies
2
Views
2K
Replies
19
Views
2K
Replies
10
Views
2K
Replies
3
Views
2K
Replies
5
Views
2K
Replies
6
Views
4K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
5K
Replies
1
Views
5K
Back
Top