Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Playing Up

  1. May 8, 2007 #1

    Gib Z

    User Avatar
    Homework Helper

    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...
     
  2. jcsd
  3. May 8, 2007 #2
    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.
     
  4. May 8, 2007 #3

    Gib Z

    User Avatar
    Homework Helper

    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]..
     
  5. May 9, 2007 #4
    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!
     
  6. May 9, 2007 #5

    Gib Z

    User Avatar
    Homework Helper

    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
     
  7. May 9, 2007 #6
    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 (Text):
    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.
     
  8. May 9, 2007 #7

    Gib Z

    User Avatar
    Homework Helper

    Sorry about that then, Im new with mathematicia just got the trial version to see what its like. THanks
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Mathematica Playing Up
  1. Mathematica pooping up (Replies: 0)

  2. In mathematica (Replies: 4)

Loading...