# How to evaluate this definite integral in Mathematica?

I am a beginner in Mathematica. I tried to evaluate this integral, but was unable to do so. Can anybody help me evaluate this integral in Mathematica? Here is my integral: $$\int_{a}^{b} \frac{dx}{G(x)}\sum\limits_{n=0}^{\infty}\Big{[}\frac{1+x}{n-x}\Big{]}e^{-\beta E_{n}(x)}$$ where $G(x)=\sum\limits_{n=0}^{\infty}e^{-\beta E_{n}(x)}$ and $E_{n}(x)=-nx$ and $\beta$ is a constant.

• Can you provide the code you used? – thils Oct 31 '15 at 10:41
• Do you know how to sum a geometric series? – J. M. will be back soon Oct 31 '15 at 10:48

Edited to correct error noted by José Antonio Díaz Navas in the comment below.

As noted by J.M., the series can be summed explicitly.

g = Sum[Exp[β n x], {n, 0, Infinity}]
(* -(1/(-1 + E^(x β))) *)
h = Sum[Exp[β n x] (1 + x)/(n - x), {n, 0, Infinity}]
(* HurwitzLerchPhi[E^(x β), 1, -x] + x HurwitzLerchPhi[E^(x β), 1, -x] *)


Repeating these summations with GenerateConditions -> True indicates that E^Re[x β] < 1 is needed for convergence. In addition, it is necessary to avoid integer values of x, as can be seen from

Plot[Evaluate[(h/g) /. β -> -1], {x, 0, 4}, PlotRange -> {-3, 1}, PlotPoints -> 1000,
AxesLabel -> Automatic, LabelStyle -> Directive[Bold, Black, Medium], ImageSize -> Large]


Even with these constraints, attempting to solve the integral by, for instance,

Integrate[h/g, {x, a, b}, Assumptions -> β a < 0 && β b < 0 && 1 < x < 2]


returns unevaluated. To make progress, choose values for the constants and use NIntegrate. For instance,

NIntegrate[h/g /. β -> -1, {x, 1.0001, 1.9999}]
(* -4.96337 *)

• Is not the integrand $h/g$ ? – José Antonio Díaz Navas Nov 6 '17 at 9:59
• @JoséAntonioDíazNavas indeed it is. And perhaps even if the two series are divergent, maybe their ratio is finite? – LLlAMnYP Nov 6 '17 at 11:11
• @JoséAntonioDíazNavas Thanks you for identifying my error, which I have corrected. – bbgodfrey Nov 6 '17 at 23:53