3
$\begingroup$

Take the following symbolic sum:

Sum[(-1)^n/Factorial[2*n]*(Pi/2)^(2*n)*n, {n, 1, Infinity}]

Mathematica answers me: $- \frac{\pi}{4}$

It is great, I have an exact expression for this complicated sum. But I would like to know how mathematica knows this result.

Is there a way to ask him which function he used to compute it ?

$\endgroup$

2 Answers 2

3
$\begingroup$

You can use a Wolfram|Alpha query and then look at the Series Representation results.

In Mathematica, the easiest way to do this is start your input with == and it will change it to a spikey input symbol.

==Sum[(-1)^n/Factorial[2*n]*(Pi/2)^(2*n)*n, {n, 1, Infinity}]

Result: enter image description here

$\endgroup$
10
$\begingroup$

In general, symbolic sums are evaluated by using a combination of internal methods and it is usually difficult to give insight into the evaluation process.

However, this sum is evaluated by using a representation in terms of HypergeometricPFQ (strictly speaking, this is a Hypergeometric0F1).

This may be seen by using the (undocumented) Method option setting "InactivePFQ" as shown below.


In[1]:= Sum[(-1)^n/Factorial[2*n]*(Pi/2)^(2*n)*n, {n, 1, Infinity}, 
  Method -> "InactivePFQ"] // InputForm

Out[1]//InputForm=
-(Pi^2*Inactive[HypergeometricPFQ][{}, {3/2}, -Pi^2/16])/8

In[2]:= Activate[%] // FullSimplify // InputForm

Out[2]//InputForm=
-Pi/4

In[3]:= N[%]

Out[3]= -0.785398

In[4]:= NSum[(-1)^n/Factorial[2*n]*(Pi/2)^(2*n)*n, {n, 1, Infinity}]

Out[4]= -0.785398

The representation in terms of HypergeometricPFQ can be understood by defining a sequence corresponding to the first argument of Sum as follows (the sequence has been shifted so that it starts at 0, rather than 1).

a[n_] = (-1)^n/Factorial[2*n]*(Pi/2)^(2*n)*n /. {n -> n + 1};

The factor of-Pi^2/8 in the answer from Sum is the zeroth term of this sequence.


In[6]:= a[0] // InputForm

Out[6]//InputForm=
-Pi^2/8

The arguments of HypergeometricPFQ in this case can be understood by computing the ratio of the adjacent terms of a[n].

In[7]:= DiscreteRatio[a[n], n] // InputForm

Out[7]//InputForm=
-Pi^2/(8*(1 + n)*(3 + 2*n))

In[8]:=
Simplify[% == -(Pi^2/16)*(1/((n + 1)*(n + 3/2)))]

Out[8]= True

The factor of (n+1) in the denominator of the above comes from the definition of Hypergoemetric0F1 and can be ignored.

Hope this helps in understanding the result from Sum.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.