0

I am trying to calculate the sum of a A = $\sum_{1}^{\infty}\frac{1}{n^2 + 0.4}$ with precision $0.5\cdot 10^{-7}$


$R_{method} = |A - S_{N}| = \sum_{N+1}^{\infty}\frac{1}{n^2 + 0.4}$

$\sum_{N+1}^{\infty}\frac{1}{n^2 + 0.4} < \int_{N}^{\infty}\frac{dx}{x^2 + 0.4} < \int_{N}^{\infty}\frac{dx}{x^2} = \frac{1}{N} < 0.25 \cdot 10^{-7} \rightarrow N > 4 \cdot 10^7$

$S = \sum_{1}^{10^7}\frac{1}{n^2 + 0.4} = 1.3288275$

I have improved the convergence:

$\lim_{n -> \infty} \frac{a_{n}}{\frac{1}{n^2}} = lim_{n -> \infty}\frac{n^2}{0.4 + n^2} = 1$

$b_{n} = \frac{1}{n^2 + 0.4} - \frac{1}{n^2} = \frac {-0.4}{(n^2 + 0.4)n^2}$

$B = \sum b_{n} $

$R_{method} = |B - \overline{S_{N_0}}| = \sum_{N_{0} + 1}^{\infty}\frac {0.4}{(n^2 + 0.4)n^2} < \int_{N_{0}}^{\infty}\frac{0.4 dx}{x^4} = \frac{2} {15 N_{1}^3} < 0.25*10^{-7} \rightarrow N_{0} > 200 \cdot (\frac{2}{3})^\frac{1}{3}$

$200 \cdot (\frac{2}{3})^\frac{1}{3} < 175 $

$S_{0} = \sum_{1}^{175}\frac{-0.4}{(n^2 + 0.4)n^2} + \frac{\pi^2}{6} = 1.3288276$

Please tell me: Why aren't 7 digits after the decimal point equal in $S_{0}\: and \: S$?

Sh VavilenT
  • 171
  • 7

1 Answers1

1

Let's take some more digits and terms. For the second approach

 N        S2[N]
 173   1.3288276216043133
 174   1.3288276211679408
 175   1.3288276207414575
 176   1.3288276203245846
 177   1.3288276199170528
2000   1.3288275960922136

so that this result appears to be correctly rounded.

In the first, simple, approach, using the correct bound $\frac1N\le 0.5\cdot 10^{-7}\implies N\ge 2\cdot 10^7$, I get the partial sum at $N=2\cdot 10^7$ as $S_{1,N}=1.3288275460737846$, which is within the required distance to the more correct result, even if it rounds to a different final digit. This is normal, there is no way to get always the desired number of correct digits be prescribing absolute or relative error tolerances.


It is also useful to use the bounds of the remainder of the integral test to improve the accuracy. For instance, you found that $$ \int_{N+1}^\infty\frac1{x^2+0.4}dx\le \sum_{n=N+1}^\infty\frac1{n^2+0.4}\le\int_{N}^\infty\frac1{x^2+0.4}dx \\ \sqrt{2.5}\arctan\frac{\sqrt{0.4}}{N+1}\le \sum_{n=N+1}^\infty\frac1{n^2+0.4}\le\sqrt{2.5}\arctan\frac{\sqrt{0.4}}{N} $$ This would improve the first summation to $$ S_N+\sqrt{2.5}\arctan\frac{\sqrt{0.4}}{N+1}\le A\le S_N+\sqrt{2.5}\arctan\frac{\sqrt{0.4}}{N} \\ 1.328827596073782 \le A\le 1.3288275960737845 $$ which is much more accurate than desired. The difference between the bounds is essentially $\frac1{N^2}$, so using $N>\sqrt{2\cdot 10^7}=\sqrt{20}\cdot 10^3$ gives $N=5000$ as a nice number, where the above bounds result in $$ 1.328827576082216 \le A\le 1.3288276160742167 $$ which indeed has the required accuracy and not more.

Lutz Lehmann
  • 126,666
  • The problem is finding the correct number:

    A digit is called correct if the absolute error of the number does not exceed $\frac{1}{2}$ of the corresponding digit. $A_{x^{}} \leq \frac{1}{2} 10^{-m} A_{x^{}} - absolute : error$

    In my case, the digit 7 after the improvement is by definition correct, but as we can see, this is not true

    – Sh VavilenT Sep 26 '20 at 09:27
  • 1
    There always will be corner cases, the numbers that round to a specific digit sequence form not the same interval as the admissible numerical results. For instance, if the correct result is $1.9$ and the aim is to get the integer digit right under rounding, the correct digit sequence is $2$. The allowed error is $0.5$, which gives $[1.4,2.4]$ as interval for sufficiently correct numerical approximations. Results in $[1.4,1.5)$ are admissible and all round to $1$, the wrong digit. – Lutz Lehmann Sep 26 '20 at 10:16
  • Why does result in [1.4, 1.5)? – Sh VavilenT Sep 26 '20 at 12:19
  • I mean if a hypothetical method has results in $[1.4,1.5)$, which is within the imposed error bounds, then the rounded result is $1$. – Lutz Lehmann Sep 26 '20 at 12:20
  • Ok, thank you very much – Sh VavilenT Sep 26 '20 at 12:32