Mathematica's steps towards the result of a definite integral


I am interested in this definite integral:

$$ \eqalign{\int_0^\infty {x^2 \log(1-e^{-x})}\; dx\cr } $$

That is:

Integrate[x^2 Log[(1 - Exp[-x])], {x, 0, \[Infinity]}]

Mathematica outputs a nice result:

$-\frac{\pi ^4}{45}$

But is there any way for users like me to see what actual symbolic calculations were performed by Mathematica in order to get the result?

Using WolframAlpha:

There is a possibility of using WolframAlpha, like here:

WolframAlpha["Integrate[Sin[x]*Sin[x]], {x,0,\[Pi]}]", 
 IncludePods -> "Input", AppearanceElements -> {"Pods"}, 
 PodStates -> {"Show steps"}]

This is the output, which is really nice, I was impressed, it's almost like written by a human: (the only missing thing is some "handwriting" font ;) )

enter image description here

However, for my case, steps are not offered:

WolframAlpha["Integrate[x^2 Log[(1 - Exp[-x])], {x,0,\[Infinity]}]", 
 IncludePods -> "Input", AppearanceElements -> {"Pods"}, 
 PodStates -> {"Show steps"}]

enter image description here

Graph of the function:

enter image description here


Posted 2015-05-24T15:03:18.567

Reputation: 3 500

Did you try searching for duplicates ? (148)

– Sektor – 2015-05-24T15:08:23.413

@Sektor Do you see my example in the question you linked to? – VividD – 2015-05-24T15:11:40.250


Maybe you can look at Rubi, but I am not sure that thing knows about zeta functions or polylogarithms, which will more than likely pop up in the evaluation of this integral.

– J. M.'s ennui – 2015-05-24T15:18:39.027

1Sometimes using = to pass a result to WolframAlpha, expanding what is returned and selecting Show Steps can give you some steps, but for this and other complicated integrals there are often no steps available. Sometimes doing the indefinite integral, plotting that and looking at each term in the result evaluated at lower and upper bound can give some clues. That gives a few hints here, but not all the details you are asking for. – Bill – 2015-05-24T16:02:09.073

@J. M. Thanks for the hint. Rubi does seem to be too helpful. It doesn't handle definite integrals (or I don't know how to use it for that purpose). Correspondent indefinite integral is a complex expression involving polylogs, and the tricky part is reducing definite integral from the question to clean -pi^4/45. Are you saying that there is no way to expose Mathematica's internal steps to -pi^4/45? – VividD – 2015-05-24T16:07:51.463

2Well, internally, Mathematica uses a heavily modified (and proprietary!) version of the Risch algorithm, expanded to include things like exponential integrals and polylogarithms. That approach will certainly not be the way a human might go about it. I'm not even sure if Mathematica knows things like Landen's identity… – J. M.'s ennui – 2015-05-24T16:32:25.180

To add an example close to my heart: the usual result of Mathematica's evaluation of an elliptic integral is something that is correct, but somewhat useless (too complicated, involves complex numbers when the result is supposed to be real); on the other hand, someone with sufficient stamina and a copy of Byrd/Friedman close by will likely be able to produce a cleaner elliptic integral expression. So, with things like these, I'm not optimistic about getting Mathematica to show its nasty guts. – J. M.'s ennui – 2015-05-24T16:37:34.510

@J. M. I guess than the only hope is something external like Rubi or Wolfram. Thanks for your time, I appreciate your opinion. – VividD – 2015-05-24T16:40:39.320

@Bill I appreciate you hint. I updated the question with Wolfram approach. However, it didn't like my integral. Did I do everything right? – VividD – 2015-05-24T16:43:52.537

Since I mentioned Landen anyway… you might want to see this.

– J. M.'s ennui – 2015-05-26T11:31:45.897

@J. M. Great find, very interesting area, thank you! – VividD – 2015-05-26T18:00:12.603



As stated in the OP Mathematica finds this value of the integral within seconds

f0 = Integrate[x^2 Log[1 - E^-x], {x, 0, \[Infinity]}]

Out[21]= -(\[Pi]^4/45)

Most probably Mathematica employs this standard procedure:

1) solve the indefinte integral, i.e. find an antiderivative
2) check continuity of the antiderivative
3) use the fundamental theorem of calculus, i.e. find the difference of the antiderivative in the two ends of the integration interval

Step 1: find antiderivative fi

fi = Integrate[x^2 Log[1 - E^-x], x]

Out[9]= 1/12 (x^4 + 4 x^3 Log[1 - E^-x] - 4 x^3 Log[1 - E^x] - 
   12 x^2 PolyLog[2, E^x] + 24 x PolyLog[3, E^x] - 24 PolyLog[4, E^x])

Step 2: check continuity

Let's do this graphically

Plot[fi, {x, 0, 9}, PlotRange -> {-2, -5}, 
 PlotLabel -> 
  "Antiderivative fi of \!\(\*SuperscriptBox[\(x\), \
\(2\)]\)Log[1-\!\(\*SuperscriptBox[\(\[ExponentialE]\), \(-x\)]\)]", 
 AxesLabel -> {"x", "fi"}]
(* 150526_plot_fi.jpg *)

enter image description here

Check was affirmative.

Step 3: evaluate antiderivative at interval ends

fi /. x -> 0

During evaluation of In[19]:= Infinity::indet: Indeterminate expression 0 (-[Infinity]) encountered. >>

Out[19]= Indeterminate

Ok, so we must take the limit

fiLow = Limit[fi, x -> 0]

Out[16]= -(\[Pi]^4/45)

fiUp = Limit[fi, x -> \[Infinity]]

Out[17]= -((2 \[Pi]^4)/45)

Final result

f = fiUp - fiLow

Out[20]= -(\[Pi]^4/45)

which is identical to f0.

Dr. Wolfgang Hintze

Posted 2015-05-24T15:03:18.567

Reputation: 12 464