MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Moments of gaussian sums?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63535] Re: [mg63436] Moments of gaussian sums?
  • From: Devendra Kapadia <dkapadia at wolfram.com>
  • Date: Wed, 4 Jan 2006 03:17:12 -0500 (EST)
  • References: <200512311140.GAA28036@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Sat, 31 Dec 2005, AES wrote:

> Pardon me if this is mathematics and not Mathematica -- but is there a
> closed form for
>
>   Sum[n^2 Exp[ -a n^2], {n, -Infinity, Infinity}]
>
> or
>
>   Sum[n^2 k(n^2), {n, -Infinity, Infinity}]
>
> like the EllipticTheta result with the n^2 left out?
>
> (And just out of curiosity, how does Sum know to step over the integers
> in sums like these?  Is Infinity an Integer?)
>
Hello,

The Sum function divides the interval of summation for examples such
as the one given by you into two subintervals, (-Infinity, 0) and
(1, Infinity). Since one of the limits in each case is an integer,
the other (infinite) limit is effectively treated as an integer.

The above strategy allows us to find the sum for symmetric examples
(involving an even power of 'n') such as the following ('x' is a 
differentiation parameter which is used later to find moments)

============================================
In[1]:=  $Version

Out[1]= 5.2 for Linux (June 27, 2005)

In[2]:= s1 = Sum[ Exp[ -a*x* n^2], {n, -Infinity, Infinity}]

                              -(a x)
Out[2]= EllipticTheta[3, 0, E      ]

==========================================

As noted by you in an earlier email, Sum currently fails if a more
general quadratic (with a linear term in 'n') appears in the summand.

We now observe that the derivative of Exp[ -a*x* n^2] with respect to
'x' gives essentially the summand for the moment requested by you.

=======================================
In[3]:= D[ Exp[ -a*x* n^2], x]//InputForm

Out[3]//InputForm= -((a*n^2)/E^(a*n^2*x))

======================================

Hence, using the derivative we can derive a closed form result for
the moment as follows:

======================================
In[4]:= D[s1, x]

                          (0,0,1)        -(a x)
           a EllipticTheta       [3, 0, E      ]
Out[4]= -(-------------------------------------)
                            a x
                           E

In[5]:= % /. {x -> 1}

                          (0,0,1)        -a
           a EllipticTheta       [3, 0, E  ]
Out[5]= -(---------------------------------)
                           a
                          E

In[6]:= %/(-a)

                      (0,0,1)        -a
         EllipticTheta       [3, 0, E  ]
Out[6]= -------------------------------
                        a
                       E
===========================================

The answers from Out[6] agree well with those
given by NSum (which uses a numerical algorithm).

========================================
In[7]:=  Table[%, {a, 1., 3, 0.4}]

Out[7]= {0.884509, 0.522838, 0.336572, 0.222812, 0.148791, 0.0996233}

In[8]:= Table[NSum[n^2 Exp[ -a n^2], {n, -Infinity, Infinity}] , {a, 1, 3, 
0.4}]

Out[8]= {0.884509, 0.522838, 0.336572, 0.222812, 0.148791, 0.0996233}

=======================================

The general moment (with n^k instead of n^2) can be found by the
same method, since it is 0 for odd 'k' and for even 'k', repeated
differentiation yields the required result. This is summarized
in the GaussianMoment formula below.

=======================================
In[9]:=  GaussianMoment[k_Integer, a_] :=
             If[OddQ[k],
                0,
                (D[EllipticTheta[3, 0, E^((-a)*x)], {x, k/2}] /.
                   {x -> 1})/(-a)^(k/2)
              ]
======================================

Finally, we verify this formula by comparison with NSum.

======================================
In[10]:= Table[GaussianMoment[k, a] /. {a -> 1}, {k, 1, 5}] // InputForm

Out[10]//InputForm=
{0, Derivative[0, 0, 1][EllipticTheta][3, 0, E^(-1)]/E, 0,
  Derivative[0, 0, 1][EllipticTheta][3, 0, E^(-1)]/E +
   Derivative[0, 0, 2][EllipticTheta][3, 0, E^(-1)]/E^2, 0}

In[11]:=  N[%]

Out[11]= {0., 0.884509, 0., 1.34191, 0.}

In[12]:= Table[NSum[n^k* Exp[ - n^2], {n, -Infinity, Infinity}] ,
             {k, 1, 5}]

Out[12]= {0., 0.884509, 0., 1.34191, 0.}

In[13]:= a = 9/4

          9
Out[13]= -
          4

In[14]:= Table[GaussianMoment[k, a], {k, 1, 5}] // InputForm

Out[14]//InputForm=
{0, Derivative[0, 0, 1][EllipticTheta][3, 0, E^(-9/4)]/E^(9/4), 0,
  (16*((81*Derivative[0, 0, 1][EllipticTheta][3, 0, E^(-9/4)])/(16*E^(9/4))
   + (81*Derivative[0, 0, 2][EllipticTheta][3, 0, E^(-9/4)])/(16*E^(9/2))))/
   81, 0}

In[15]:= N[%]

Out[15]= {0., 0.211786, 0., 0.214748, 0.}

In[16]:= Table[NSum[n^k*Exp[(-a)*n^2], {n, -Infinity, Infinity}],
             {k, 1, 5}]

Out[16]= {0., 0.211786, 0., 0.214748, 0.}

===========================================

Thank you for these examples of Gaussian sums, which we hope to
include in a future release.

Sincerely,

Devendra Kapadia.
Wolfram Research, Inc.


  • Prev by Date: Re: Inplicit differentiation
  • Next by Date: A beginer's simple question about Mathematica...
  • Previous by thread: Re: PowerExpand
  • Next by thread: A beginer's simple question about Mathematica...