For this infinite product, what is the error or remainder term? Thanks!
$$\prod_{k=0}^na_k=\left(1\pm\frac{x}{2^n}\right)^{\pm2^n}$$
If x >= 0 then,
$$a_0=1+x,\qquad a_{n+1}=\left(1+\frac{x^2}{2^{n+2}(x+2^n)}\right)^{2^n}$$
If x <= 0 then,
$$a_0=\frac1{1-x},\qquad a_{n+1}=\left(1-\frac{x^2}{(2^{n+1}-x)^2}\right)^{2^n}$$
Python code:
import mpmath
def exp_err(x, ipow2):
n = mpmath.mpf(2)ipow2
return mpmath.fabs(mpmath.exp(x) - (1 + x/n)n)
for x in [3, 7, 15, 31, 63]:
for iprec, ipow2 in [(64, 32), (128, 64), (256, 128)]:
mpmath.mp.prec = iprec
err = exp_err(mpmath.mpf(x), ipow2)
flog2 = mpmath.log(err, 2)
print(f"# For x={x:,} and n=2{ipow2}, the error term is 2{round(flog2, 8)}")
For x=3 and n=232, the error term is 2-25.50198988
For x=3 and n=264, the error term is 2-57.50198988
For x=3 and n=2128, the error term is 2-121.50198988
For x=7 and n=232, the error term is 2-17.28642488
For x=7 and n=264, the error term is 2-49.28642487
For x=7 and n=2128, the error term is 2-113.28642487
For x=15 and n=232, the error term is 2-3.54579322
For x=15 and n=264, the error term is 2-35.5457932
For x=15 and n=2128, the error term is 2-99.5457932
For x=31 and n=232, the error term is 221.6319388
For x=31 and n=264, the error term is 2-10.36806111
For x=31 and n=2128, the error term is 2-74.36806111
For x=63 and n=232, the error term is 269.84434708
For x=63 and n=264, the error term is 237.84434742
For x=63 and n=2128, the error term is 2-26.15565258