Skip to content
Advertisement

Find the sum of an infinite series

How can I find the sum of an infinite series?

enter image description here

Series:

My misbehaving example:

JavaScript

Is it possible to carry out this method correct calculation or how to resolve this problem in other ways?

Advertisement

Answer

This series does not converge. It’s called the harmonic series and it’s known to do not converge.

Moreover, as a comment says, you need to start at 1 instead of 0 because otherwise it’s not defined (division by 0).

Try this:

JavaScript

However, this doesn’t work well for higher iterations, because number format representations are not compatible and the precision of the internally used number representation is not sufficient.

To make more precise calculations for estimating the value of a convergent series, you should use a scientific calculation package of a better suited programming language like Java, Python or C++.

Here is a complete working example in Java:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement