Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
Function: sumnumlagrangeinit Section: sums C-Name: sumnumlagrangeinit Prototype: DGDGp Help: sumnumlagrangeinit({asymp}, {c1}): initialize tables for Lagrange summation of a series. Doc: initialize tables for Lagrange summation of a series. By default, assume that the remainder $R(n) = \sum_{m \geq n} f(m)$ has an asymptotic expansion $$R(n) = \sum_{m \geq n} f(n) \approx \sum_{i\geq 1} a_i / n^i$$ at infinity. The argument \kbd{asymp} allows to specify different expansions: \item a real number $\beta$ means $$ R(n) = n^{-\beta} \sum_{i\geq 1} a_i / n^i $$ \item a \typ{CLOSURE} $g$ means $$R(n) = g(n) \sum_{i\geq 1} a_i / n^i$$ (The preceding case corresponds to $g(n) = n^{-\beta}$.) \item a pair $[\alpha,\beta]$ where $\beta$ is as above and $\alpha\in \{2, 1, 1/2, 1/3, 1/4\}$. We let $R_2(n) = R(n) - f(n)/2$ and $R_\alpha(n) = R(n)$ for $\alpha\neq 2$. Then $$R_\alpha(n) = g(n) \sum_{i\geq 1} a_i / n^{i\alpha}$$ Note that the initialization times increase considerable for the $\alpha$ is this list ($1/4$ being the slowest). The constant $c1$ is technical and computed by the program, but can be set by the user: the number of interpolation steps will be chosen close to $c1\cdot B$, where $B$ is the bit accuracy. \bprog ? \p2000 ? sumnumlagrange(n=1, n^-2); time = 173 ms. ? tab = sumnumlagrangeinit(); time = 172 ms. ? sumnumlagrange(n=1, n^-2, tab); time = 4 ms. ? \p115 ? sumnumlagrange(n=1, n^(-4/3)) - zeta(4/3); %1 = -0.1093[...] \\ junk: expansion in n^(1/3) time = 84 ms. ? tab = sumnumlagrangeinit([1/3,0]); \\ alpha = 1/3 time = 336 ms. ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3) time = 84 ms. %3 = 1.0151767349262596893 E-115 \\ now OK ? tab = sumnumlagrangeinit(1/3); \\ alpha = 1, beta = 1/3: much faster time = 3ms ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3) \\ ... but wrong %5 = -0.273825[...] \\ junk ! ? tab = sumnumlagrangeinit(-2/3); \\ alpha = 1, beta = -2/3 time = 3ms ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3) %6 = 2.030353469852519379 E-115 \\ now OK @eprog\noindent in The final example with $\zeta(4/3)$, the remainder $R_1(n)$ is of the form $n^{-1/3} \sum_{i\geq 0} a_i / n^i$, i.e. $n^{2/3} \sum_{i\geq 1} a_i / n^i$. The explains the wrong result for $\beta = 1/3$ and the correction with $\beta = -2/3$.