       Re: Re: Infinite sum of gaussians

```On Sat, 16 Apr 2005 08:13:12 +0000 (UTC), Andrzej Kozlowski
<akoz at mimuw.edu.pl> wrote:

> I now believe the equation is not true on mathematical grounds. But I
> would not trust any numerical verifications of it. To see why consider
> the following two series.
>
> Sum[Exp[-(30 - k)^2/2], {k, -Infinity, Infinity}]
>
> and
>
> Sum[Exp[-(-k)^2/2], {k, -Infinity, Infinity}]
>
>
> Now as k runs through integer values from -Infinity to +Infinity -(20 -
> k)^2/2 and -(-k)^2/2 must run though precisely the same set of values,
> so since the series are absolutely convergent they should be equal.
> However, Mathematica gives:
>
> N[FullSimplify[Sum[Exp[-(-k)^2/2],{k,-Infinity,Infinity}]],100]
>
>
> 2.5066282880429055448306790538639603781474512715189099785077187561072857
> 447639\
> 10390142584776971960969
>
>
> N[FullSimplify[Sum[Exp[-(30 - k)^2/2],
>      {k, -Infinity, Infinity}]], 100]
>
> various messages
>
> -2.0771591956161771304`2.107209964269863*^-48
>
> so one hundred digits of precision is insufficient to show that these
> two values are the same. This problem appears to be very ill posed and
> therefore I do not think numerical arguments are convincing.
> Nevertheless I think the identity is not satisfied.  This can be best
> proved by an argument involving Fourier series mentioned in Carl Woll's
> posting. However, I would like to return again to my original argument
> to try to understand where I went wrong. Consider again the function
>
>
> f[z_] := Sum[E^((-(1/2))*(z - k)^2),
>       {k, -Infinity, Infinity}] - Cos[2*Pi*z]*
>       (EllipticTheta[3, 0, 1/Sqrt[E]] - Sqrt[2*Pi])-Sqrt[2 Pi]
>
> we certainly have
>
> FullSimplify[f]
>
> 0
>
> What sort of function is f? Well, it is clearly not complex analytic.
> In fact the sum Sum[E^((-(1/2))*(z - k)^2),
>       {k, -Infinity, Infinity}] cannot converge for all complex z, since
> E^((-(1/2))*(z - k)^2) is certainly complex analytic as a function of
> k, and one can prove that if g is a complex analytic function in the
> entire complex plane we must have Sum[g[k],{k,-Infinity,Infinity}]==0.
> So f is not defined for all complex values of z. But it is defined for
> all real values and the function so obtained is real analytic. I think
> I can prove that but I admit I have not considered this carefully. But
> if it is a real analytic function it is also determined by its value at
> just one point and the valus of the derivatives at that point. Note
> also that the function f has obviously period 1.
> So let's consider again what happens that the point 0. We know that the
> f itself takes the value 0 there.
>
> Mathematica also returns:
>
> FullSimplify[D[f[x], {x, 3}] /. x -> 0]
>
>
> Sum[k^3/E^(k^2/2) - (3*k)/E^(k^2/2),
>    {k, -Infinity, Infinity}]
>
>
> This is clearly zero, and so are all the odd derivatives. What about
> the even ones. Well, I believe now i was wrong to say that they are 0
> but I think they are extremely small. Let's look again at the second
> derivative:
>
>
> FullSimplify[D[f[x], {x, 2}] /. x -> 0]
>
>
> Sum[k^2/E^(k^2/2) - E^(-(k^2/2)), {k, -Infinity,
>      Infinity}] + 4*Pi^2*(-Sqrt[2*Pi] +
>      EllipticTheta[3, 0, 1/Sqrt[E]])
>
> N[%]
>
> -2.2333485739105708*^-14
>
>
> I think this really is an extremly small number rather than 0. If this
> is indeed so and if the function is really real analytic, as I believe
> than we can see what happens. The function is 0 for integer values of
> x. For non-integer x it can be expressed as a power series in odd
> powers in  x-Floor[x], with extremely small coefficients. So the values
> of f remain always very close to zero, to an extent that is impossible
> to reliably determine by numerical means.
>
> Andrzej Kozlowski
>

This is wrong on several points. In fact, Sum[E^(-(z - k)^2/2), {k,
-Infinity, Infinity}] is analytic everywhere in the complex plane. Since
we already know that this sum is equal to Sqrt[2*Pi]*EllipticTheta[3,
Pi*z, E^(-2*Pi^2)], all its properties, including analyticity, follow from
the properties of EllipticTheta.

Actually, since the sum of E^(-(z - k)^2/2) is very well-behaved (the
terms decay faster than, say, E^(-k^2/4)), it is trivial to prove the
uniform convergence in z and therefore the validity of the termwise
differentiation as well as analyticity directly. The fact that the series
is double infinite is of no importance; we can always rewrite it as two
series from 1 to +Infinity.

Also it's not correct that a real infinitely differentiable function can
be defined by its value and the values of its derivatives at a point. If
we take f[z] == E^-z^-2 for z != 0 and f == 0, then all the (real)
derivatives at 0 vanish.

As to using N[Sum[...], prec], there is probably a minor inconsistence in
the semantics: if N has to call NSum, then it cannot guarantee that all
(or even any) of the returned digits will be correct, unlike, say, N[Pi,
prec]. WorkingPrecision in NSum, NIntegrate, NDSolve, etc. only determines
the precision used at each computation step; while it is useful for
keeping track of precision (for example, may detect the loss of digits),
in general it cannot give a reliable estimate of the error in the final
result.

I believe it is better to just use NSum, where we have more control over
the settings: for example,

NSum[Exp[-(30 - k)^2/2], {k, -Infinity, Infinity},
NSumTerms -> 50, WorkingPrecision -> 100]

gives the result with 100 digits of precision, that is, no digits are lost
at all. This is hardly surprising, since the sum converges very rapidly.
(Using N[Sum[...]] is just out of the question: thus, the correct value of
f'' is around -10^-32, not -10^-14).

In principle a rigorous proof can be numerical; if we take z == 1/2 and
expand EllipticTheta[3, 0, 1/Sqrt[E]] into a series, the identity becomes

Sum[E^(-(1/2 - k)^2/2) + E^(-k^2/2), {k, -Infinity, Infinity}] ==

2*Sqrt[2*Pi].

Now

In:=
Select[Range,
Sum[E^(-(1/2 - k)^2/2) + E^(-k^2/2), {k, -#, #}] > 2*Sqrt[2*Pi]&, 1]

Out=
{12}

This means that the left-hand side is already greater than 2*Sqrt[2*Pi] if
we take the sum from -12 to 12; since all the terms are positive, the
identity cannot be true. The point is that Less/Greater use significance
arithmetic; if we evaluate

In:=
N[Sum[E^(-(1/2 - k)^2/2) + E^(-k^2/2), {k, -12, 12}] - 2*Sqrt[2*Pi], 10]

Out=
3.95515733259688519694588`10.*^-34

then Mathematica tells us that the accuracy of the result is greater than
43 and so the absolute error is less than 10^-43, therefore the result is
verifiably different from zero. So this can be a proof, but only barring
the defects of Mathematica's significance arithmetic. Also it's possible
to use Interval.

Maxim Rytin
m.r at inbox.ru

```

• Prev by Date: Integrating a complicated expression involving Sign[...] etc.
• Next by Date: Re: Re: Re: Re: Infinite sum of gaussians
• Previous by thread: Re: Typesetting Mathematica code
• Next by thread: Re: Re: Re: Infinite sum of gaussians