# Summation mollifier to ensure a certain alternating series has the correct value

I would like the function $f(n,M)$, where $n$ and $M$ are integers and $n\le M$, so that $f$ satisfies the following two conditions:

(1) $\sum_{n=0}^M (-1)^n f(n,M) = \tfrac{1}{2}$

(2) $f(n,M) \approx 1$ whenever $n\ll M$

The function is needed as a summation mollifier to ensure a piecewise function is continuous (each region of the piecewise function is a series expansion). The function $f(n,M) = e^{-\frac{k n^2}{M^2}}$ is close for large $k$, but the summation is not exactly $\frac{1}{2}$ and thus the piecewise function has a discontinuity.

I should also mention that $f(n,M) = 1$ for $n<M$ and $f(n,M) = 1/2$ for $n=M$ works, but I would prefer a smoother function.

I am computing a finite series approximation for $\frac{1}{1+g(x)}$ for smooth $g$ where $0<g(x)<1$ for $x<1$ and $1<g(x)$ for $x>1$.

For $x<1$, I would like to expand $\frac{1}{1+g(x)} = \sum_{n=0}^\infty (-1)^n g(x)^n$.

For $x>1$, I would like to expand $\frac{1}{1+g(x)} = \frac{g(x)^{-1}} {1+g(x)^{-1}} = g(x)^{-1} \sum_{n=0}^\infty (-1)^n g(x)^{-n}$.

Terms for both series converge to the alternating sequence $\sum_{n=0}^\infty (-1)^n$ as $x\rightarrow 1$. I want to introduce a mollifier $f(n,M)$ so that the $M$-term approximation to the function is continuous:

$\frac{1}{1+g(x)} \approx \begin{cases} \hphantom{g(x)^{-1}}\sum_{n=0}^M (-1)^n f(n,M) g(x)^n & x<1 \\ g(x)^{-1} \sum_{n=0}^M (-1)^n f(n,M) g(x)^{-n} & x \ge 1 \end{cases}$. The two requirements for $f(n,M)$ are intended to ensure that (1) the approximation is continuous at $x=1$ where $\frac{1}{1+g(1)} = 1/2$ and (2) the approximation is accurate far from the point $x=1$ where $g(x)$ is not near 1.

I am not very knowledgeable about divergent series or series acceleration, so I may be missing something easier. The reason I am leaning toward modifying the terms is that I would like to preserve the polynomial structure of the approximation in $g(x)$ or $g(x)^{-1}$.

• Hmm, if I understand things correctly it should be of vital interest how much the growth rate of the coefficients is which should be mollified (arithmetic/geometric/hypergeometric growth). The matrix given by Gerry Myerson can mollify geometric series with q=-2 at most. I think what you ask for is the transformation-matrix for Eulersummation (optimally: with configurable order). Is that correct so far? Second question: do you want to mollify the sequence of partial sums or the coefficients themselves? – Gottfried Helms Oct 1 '14 at 18:35
• I should mention that I have a satisfactory solution, so please don't spend too much time on this. Thank you for the information though. – John Jumper Oct 1 '14 at 19:43
• I used a van Wijngaarden transformation and it worked extremely well. – John Jumper Oct 1 '14 at 20:35
• Very well; I use Euler-summation with configurable order. The order must be adapted: when the series to mollify is $1-1+1-1...$ order 1 is needed, when it is $1-3+9-27+81-...+...$ order 3 is needed and so on. If I see it correctly the current proposal is the matrix (or a matrix very near to that) for Euler-summation of order 1. But after your last formula it seems that you can circumvent quotients of absolute values $\gt 1$, so that matrix should sufffice for all cases and no additional consideration is needed. – Gottfried Helms Oct 1 '14 at 23:57

I'm not sure what exactly "smoother" means in the context of a function defined on a discrete set, but maybe this will do you: $f(0,M)=1-2^{-(M+1)}$, $f(n,M)=1-3\times2^{-(M-n+2)}$ for $n\ge1$. In tabular form, $$\matrix{1/2&&&&\cr3/4&1/4&&&\cr7/8&5/8&1/4&&\cr15/16&13/16&5/8&1/4&\cr31/32&29/32&13/16&5/8&1/4\cr}$$ where the rows are for $M=0,1,\dots$ and the columns for $n=0,1,\dots$.
• By "smoother", I mean that $|f(n,M)-f(n+1,M)|$ is small. I like your function; it avoids the annoying optimization step in my function. – John Jumper Oct 1 '14 at 0:21
In case anyone stumbles on this question, the function $f(n,M) = \cos(\pi x n / 2M)$ works well, where $x$ is close to 1. In the limit $M \rightarrow \infty$, using $x=1$ is exact. For finite $M$, $x$ is slightly less than 1 (found by optimization).