Wallis' product exploration
|
02-08-2020, 02:13 AM
Post: #2
|
|||
|
|||
RE: Wallis' product exploration
You can check the result with a direct formula, for n terms, here
Or, using lgamma(), we have \(\log \left(2 \prod _{k=1} ^{k=n} {4k^2 \over 4k^2-1}\right) = 4\log(\Gamma(n)) - 2\log(\Gamma(2n)) + n \log(16) + 2 \log(n) - \log(4n+2) \) Example, using log1p and sum the logarithm of the terms backwards, this matched above formula lua> require'mathx' lua> log1p = mathx.log1p lua> s=0; for i=100e6, 1, -1 do s = s - log1p(-1/(4*i*i)) end lua> = 2*math.exp(s) 3.1415926457358117 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)