1 | initial version |
Regarding your main problem, you should not use a symbolic expression but a Python function:
sage: exp = lambda r : prod(1-2**(-i) for i in range(1,r-1))
Or, equivalently:
sage: def exp(r):
....: return prod(1-2**(-i) for i in range(1,r-1))
Then you can do:
sage: a = exp(12345)
which is a rational number with huge numerator and denominator, but you can get an approximation with:
sage: RDF(a)
0.2887880950866024
Regarding your side question, i did not see anything like that in Sage source code, so i guess you have to define such a symbolic function yourself.