I am trying to find the numerical value of $\displaystyle \sum_{n=1}^\infty \frac{e^{-n^2/\pi^2}}{n^2}$ up to 50 digits. I used

NSum[E^(-n^2/Pi^2)/n^2, {n, 1, Infinity}, WorkingPrecision -> 50]

and it came out


How to get the other digits? Thanks

  • 6
    $\begingroup$ For this series, I'd just use something like N[Total@Table[N[E^(-n^2/Pi^2)/n^2, 60], {n, 1, 35}], 50], where the truncation at n = 35 is found with something like NSolve[E^(-n^2/Pi^2)/n^2 == 1/2*10^-51], due to the rate at which the terms decrease. $\endgroup$
    – Michael E2
    May 25, 2022 at 3:10
  • 1
    $\begingroup$ The answer to the question in the title is N[Sum[E^(-n^2/Pi^2)/n^2, {n, 1, Infinity}], 50], but it fails. $\endgroup$
    – Michael E2
    May 25, 2022 at 3:11
  • 3
    $\begingroup$ NSum[E^(-n^2/Pi^2)/n^2, {n, 1, Infinity}, WorkingPrecision -> 80, NSumTerms -> 25] seems to work. $\endgroup$ May 25, 2022 at 5:58
  • 1
    $\begingroup$ According to the documentation (Details section of NSum) it's the "number of terms to use before extrapolation'. I think this might refer to Richardson extrapolation (or something similar appropriate for infinite sums). $\endgroup$ May 25, 2022 at 6:36
  • 1
    $\begingroup$ @user64494 Asking how to get 50 digits of a number in Mathematica is a perfectly valid question. People compute pi up to umpty digits as well; I have no idea what point you're trying to make here. $\endgroup$ May 26, 2022 at 8:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.