# How to evaluate the infinite sum of 1/(2^n-1) over all positive integers?

I have tried

s = sum(1/(2^x-1), x, 1, oo)
s.n()


But I got

cannot evaluate symbolic expression numerically


The sum does not have a simple form, but it is finite. So is there a way to evaluate it numerically in sage?

edit retag close merge delete

Sort by » oldest newest most voted

One possibility to get around this infinite sumation is to use truncation

sage: sum(1 / (2^x - 1), x, 1, 10).n()
1.60571827189075
sage: sum(1 / (2^x - 1), x, 1, 30).n()
1.60669515148397
sage: sum(1 / (2^x - 1), x, 1, 100).n()
1.60669515241529


Your sum is converging pretty fast. The tail after $n$ is of the order of $2^{-n}$. In particular, since real numbers have a default of 53 bits of precision, the evaluation of the sum is the same at 53 and 100 (but not at 52)

sage: sum(1 / (2^x - 1), x, 1, 52).n() == sum(1 / (2^x - 1), x, 1, 100).n()
False
sage: sum(1 / (2^x - 1), x, 1, 53).n() == sum(1 / (2^x - 1), x, 1, 100).n()
True


The fact that it is exactly 53 in this case is because the size of the tail is exactly $2^{-n}$... for other sums it might be different. But whatever convergent series you are considering, its numerical evaluation will be constant from a certain point.

more

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Another way to do that is by using SymPy:

from sympy import Sum, Symbol
x = Symbol('x')
s = Sum( 1/(x**2-1), (x, 1, 00))
s.doit()


Give the result[1]:

0

I remember seeing a way to convert SymPy expression to SAGE format, but I don't know how exactly.

[1] I apologize I typed another function in the command line which is $\frac{1}{x^2 -1}$. After realizing that, I tried to evaluate your function but ipython always crash.

more