a new continued fraction for $\sqrt{2}$
Solution 1:
I will stick to verifying the identity numerically. A backwards recursion formula for the $n$'th partial quotient of the continued fraction is
$$s_{k-1} = 1 - e^{-(2k-1)\pi} + \frac{e^{-k\pi}(1+e^{-k\pi})^2}{s_{k}}$$
for $k=n,n-1,\ldots,3,2,1$ and $s_n = 1$. Having calculated $s_0$ the $n$'th partial quotient is then given as $1 + \frac{2e^{-\pi/2}}{s_0}$.
Here is a numerical implementation of this recursion in Mathematica:
n = 5;
s = 1;
Do[
s = 1 - Exp[-(2 j + 1) \[Pi]] + (Exp[-\[Pi] (j + 1)] (1 + Exp[-\[Pi] (j + 1)])^2)/s;
, {j, n, 0, -1}]
(1 + (2 Exp[-\[Pi]/2])/s) - Sqrt[2]
Below is a plot of the difference between the $n$'th partial quotient of the continued fraction and $\sqrt{2}$. Even for $n=3$ the error is found to be smaller than double precision $\sim 10^{-16}$ and one needs to use higher precision in the calculation to be able to find any difference. With higher precision I find that at $n=25$ the agreement is better than $500$ digits.
$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$
For completeness here is the code used to calculate to arbitrary precision (here for $500$ digits):
Block[{$MinPrecision = 500, $MaxPrecision = 500},
n = 25;
s = 1;
Do[
s = 1 - Exp[-\[Pi] (2 j + 1)] + (Exp[-\[Pi] (j + 1)] (1 + Exp[-\[Pi] (j + 1)])^2)/s;
, {j, n, 0, -1}];
N[(1 + (2 Exp[-\[Pi]/2])/s) - Sqrt[2], 500]
]
Solution 2:
If $|q|<1$ and we set $$ (a;q)_{\infty}=\prod^{\infty}_{n=0}\left(1-aq^n\right), $$ then (see [1]): $$ P(a,q):=\left(\frac{(-a;q)_{\infty}}{(a;q)_{\infty}}\right)^2= $$ $$ =-1+\frac{2}{1-}\frac{2a}{1-q+}\frac{a^2(1+q)^2}{1-q^3+}\frac{a^2q(1+q^2)^2}{1-q^5+}\frac{a^2q^2(1+q^3)^2}{1-q^7+}\ldots,\tag 1 $$ where $a$ is a complex number.
Take the logarithms in (1) and expand the two products in Taylor series (of $\log(1-x)$). Then the double sums are easily rearranged and we get $$ 4\sum^{\infty}_{n=0}\frac{a^{2n+1}}{(2n+1)(1-q^{2n+1})}=\log P(a,q). \tag 2 $$ Set also $$ u_0(a,q):=\frac{P(a,q)-1}{P(a,q)+1}. \tag 3 $$ Then we have $$ u_0(a,q):=\frac{2a}{1-q+}\frac{a^2(1+q)^2}{1-q^3+}\frac{a^2q(1+q^2)^2}{1-q^5+}\frac{a^2q^2(1+q^3)^2}{1-q^7+}\ldots,\tag 4 $$ Set now the value $a=q^{\nu+1/2}$, $\nu\in\{0,1,2,\ldots\}$ in (2) to get $$ P\left(q^{\nu+1/2},q\right)=\exp\left(-4\sum^{\infty}_{n=0}\frac{q^{(2n+1)(\nu+1/2)}}{(2n+1)(1-q^{2n+1})}\right)= $$ $$ =\exp\left(-4\sum^{\nu-1}_{j=0}\textrm{arctanh}(q^{j+1/2})+\textrm{arctanh}(k_r)\right) \tag 5 $$
( For many applications and very interested notes see:
http://www-elsa.physik.uni-bonn.de/~dieckman/InfProd/InfProd.html )
Here the function $k_r$ is the elliptic singular modulus and $k'_r=\sqrt{1-k_r^2}$.
For $\nu=0$ in (5) we get $$ P\left(q^{1/2},q\right)=\frac{k'_r}{1-k_r}. $$ Hence your continued fraction $u_0(q^{1/2},q)$ is $$ u_0(q^{1/2},q)=\frac{k'_r+k_r-1}{k'_r-(k_r-1)}=\frac{2q^{1/2}}{1-q+}\frac{q(1+q)^2}{1-q^3+}\frac{q^2(1+q^2)^2}{1-q^5+}\frac{q^3(1+q^3)^2}{1-q^7+}\ldots,\tag 6 $$ where $q=e^{-\pi\sqrt{r}}$, $r>0$.
Relation (6) with $r=1$, $k_1=k'_1=\frac{1}{\sqrt{2}}$ gives: $$ u_0\left(e^{-\pi/2},e^{-\pi}\right)=\sqrt{2}-1. $$
References
[1]: N.D. Bagis and M.L. Glasser. "Evaluations of a Continued Fraction of Ramanujan". Rend. Sem. Mat. Univ. Padova, Vol. 133 (2015). (submited 2013)