## Frustrating Indefinite Integral

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

### Frustrating Indefinite Integral

While evaulating a infinite sum, I have encountered the following improper integral as a function of 'a'.
f(a) = \int^{\infty}_0 ln(x)/(1+e^{ax}),dx \

I have struggled in vain to evaluate this for any integer 'a' , but I am particularly interested in the case a=1
Any sort of method for evaluting this function at positive integers would be appreciated. Thanks!

Posts: 29
Joined: Mon May 28, 2012 7:11 pm UTC

### Re: Frustrating Indefinite Integral

I am particularly interested in the case a=1

Using the tanh-sinh quadrature function in Python's mpmath module yields -0.24022650695910071233355126316333...
for the integral from 0 to infinity for a = 1
Using Gauss-Legendre quadrature, the value differs at the 6th decimal place, but that method doesn't cope well with endpoint singularities.

Wolfram Alpha agrees with the above value.
http://www.wolframalpha.com/input/?i=integrate+ln%28x%29%2F%281%2Bexp%28x%29%29

PM 2Ring

Posts: 2581
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Mid north coast, NSW, Australia

### Re: Frustrating Indefinite Integral

I really would enjoy a closed form, for a=1 wolfram alpha give -((ln(2))^2)/2 , and also gives closed forms with logarithms for other positive integers, but does not prove its reasoning, although having the right answer helps for a start to work back to the proof...

Posts: 29
Joined: Mon May 28, 2012 7:11 pm UTC

### Re: Frustrating Indefinite Integral

If a is not a power of 2 the formula is: (-ln(2) * ln(2a^2)) / (2a)

otherwise: ((2 * log2(a) + 1) / (2a)) * ln^2(2)

Actually these are equivalent, so all you need is (-ln(2) * ln(2a^2)) / (2a).

Posts: 22
Joined: Wed Apr 21, 2010 8:33 pm UTC

### Re: Frustrating Indefinite Integral

Heptadecagon wrote:I really would enjoy a closed form, for a=1 wolfram alpha give -((ln(2))^2)/2 , and also gives closed forms with logarithms for other positive integers, but does not prove its reasoning, although having the right answer helps for a start to work back to the proof...

Shouldn't that be equal to -ln(2)? (Shift the 2 in the exponent down to get -2ln(2)/2 and cancel).
pizzazz

Posts: 487
Joined: Fri Mar 12, 2010 4:44 pm UTC

### Re: Frustrating Indefinite Integral

pizzazz wrote:
Heptadecagon wrote:I really would enjoy a closed form, for a=1 wolfram alpha give -((ln(2))^2)/2 , and also gives closed forms with logarithms for other positive integers, but does not prove its reasoning, although having the right answer helps for a start to work back to the proof...

Shouldn't that be equal to -ln(2)? (Shift the 2 in the exponent down to get -2ln(2)/2 and cancel).

Nope, you can't shift the exponent down like that here, since the exponent is outside the ln, rather than inside.

ln(a^b)=b*ln(a)=/=(ln(a))^b

Dopefish

Posts: 690
Joined: Sun Sep 20, 2009 5:46 am UTC
Location: The Well of Wishes

### Re: Frustrating Indefinite Integral

nadando wrote:...Actually these are equivalent, so all you need is (-ln(2) * ln(2a^2)) / (2a).

Awesome, have you proved this or is this from piecing a pattern together from wolfram alpha results, or something like that.
Still, I much would like a proof, but there is a small chance that by messing with some integrals/sums I'll be able to give the function of any integer in terms of f(1)

But that's just off the top of my head, could very well not work. Thanks for the help though! It's nice to know there is a clear formula out there.

Posts: 29
Joined: Mon May 28, 2012 7:11 pm UTC

### Re: Frustrating Indefinite Integral

It's easy enough to prove the formula under the assumption that f(1) = -(ln 2)². For note that by differentiating under the integral sign, we have that f is analytic in the right half plane, and that:

f'(a) = -\int_{0}^{\infty} \frac{x \log x e^{ax}}{(1+e^{ax})^2}\ dx

Now we evaluate af'(a) using integration by parts. Specifically, we let u=x log x and v = 1/(1+e^(ax)), then the integrand in af'(a) is u dv and so we have:

\begin{align*} af'(a) &= -\int_{0}^{\infty} \frac{ax \log x e^{ax}}{(1+e^{ax})^2}\ dx
&= \frac{x \log x}{1+e^{ax}} \Big\vert_{0}^{\infty} - \int_{0}^{\infty} \frac{\log x + 1}{1+e^{ax}}\ dx \\
&= - \int_{0}^{\infty} \frac{\log x + 1}{1+e^{ax}}\ dx \\
&= - \int_{0}^{\infty} \frac{\log x}{1+e^{ax}}\ dx - \int_{0}^{\infty} \frac{1}{1+e^{ax}}\ dx \\
&= -f(a) - \int_{0}^{\infty} \frac{e^{-ax}}{e^{-ax}+1}\ dx \\
&= -f(a) + \frac{1}{a} \log (e^{-ax}+1) \Big\vert_{0}^{\infty} \\
&= -f(a) + \frac{1}{a} \log 2 \end{align*}

Solving this differential equation for f(a) yields that f(a) = -log a log 2 + f(1), which is equivalent to the posted formula. Unfortunately I haven't yet found a way to prove that f(1) = -1/2 log² 2, but this will at least give you the value at every other point in terms of the value at a=1.
Citan Uzuki

Posts: 3
Joined: Sat Jul 28, 2012 5:11 am UTC

### Re: Frustrating Indefinite Integral

Dopefish wrote:
pizzazz wrote:
Heptadecagon wrote:I really would enjoy a closed form, for a=1 wolfram alpha give -((ln(2))^2)/2 , and also gives closed forms with logarithms for other positive integers, but does not prove its reasoning, although having the right answer helps for a start to work back to the proof...

Shouldn't that be equal to -ln(2)? (Shift the 2 in the exponent down to get -2ln(2)/2 and cancel).

Nope, you can't shift the exponent down like that here, since the exponent is outside the ln, rather than inside.

ln(a^b)=b*ln(a)=/=(ln(a))^b

Ah, missed a parentheses.
pizzazz

Posts: 487
Joined: Fri Mar 12, 2010 4:44 pm UTC

### Re: Frustrating Indefinite Integral

Integration by parts, u=ln(x), dv=dx/(1+e^(ax)) ?
Small Government Liberal

Qaanol

Posts: 2233
Joined: Sat May 09, 2009 11:55 pm UTC

### Re: Frustrating Indefinite Integral

Citan Uzuki wrote:-snipped math-

Solving this differential equation for f(a) yields that f(a) = -log a log 2 + f(1), which is equivalent to the posted formula. Unfortunately I haven't yet found a way to prove that f(1) = -1/2 log² 2, but this will at least give you the value at every other point in terms of the value at a=1.

Thanks, very cool method, I'm not too familiar with differentiating under the integral sign, but I followed it easily enough. But don't you mean f(a)=(-log a log 2 + f(1))/a , I think you just made a minor mistake. I was also thinking about trying to get f(a) in terms of f(1) , but I never thought of using that method.... Well, now I know f(a)-f(1)/a=-ln(a)*ln(2) (even works for non integers) , which gets me some sums, but rather ugly ones; any help would be appreciated to obtain a proof of f(1)=-((ln(2))^2)/2

Posts: 29
Joined: Mon May 28, 2012 7:11 pm UTC

### Re: Frustrating Indefinite Integral

Heptadecagon wrote:But don't you mean f(a)=(-log a log 2 + f(1))/a , I think you just made a minor mistake.

Ah yes, the typo fairy seems to have visited my post Also yours -- it should be f(a)-f(1)/a=-ln(a)*ln(2)/a.

Still thinking about how to get f(1).
Citan Uzuki

Posts: 3
Joined: Sat Jul 28, 2012 5:11 am UTC

### Re: Frustrating Indefinite Integral

Nice work, guys. That formula seems to be correct.

Code: Select all
#! /usr/bin/env python''' Integrate [0..infinity] log(x)/(1 + exp(ax)) for a>0From http://forums.xkcd.com/viewtopic.php?f=17&t=87908'''import sysfrom mpmath import mpdef calc(arange):    f = lambda x: mp.ln(x)/(1+mp.exp(a*x))    fa = lambda a: (-mp.ln(2) * mp.ln(2*a*a)) / (2*a)    print "a: integral, formula"     for a in arange:                print "%s: %s, %s" % (a, mp.quad(f, [0, mp.inf]), fa(a))def main():    workdigits = len(sys.argv) <= 1 and 30 or int(sys.argv[1])    mp.dps = workdigits    print "Precision is %d digits = %d bits" % (workdigits, mp.prec)        #Create a list of values for a. Should get these from command line...    astep = mp.mpf('0.5')    alo = astep    ahi = mp.mpf('10.0')        alen = int(1.5 + (ahi - alo) / astep)    arange = [alo + i*astep for i in xrange(alen)]    calc(arange)if __name__ == '__main__':    main()

Output
Code: Select all
Precision is 30 digits = 103 bitsa: integral, formula0.5: 0.480453013918201424667102526327, 0.4804530139182014246671025263271.0: -0.240226506959100712333551263163, -0.2402265069591007123335512631631.5: -0.347515668973138849397047635782, -0.3475156689731388493970476357822.0: -0.360339760438651068500326894745, -0.3603397604386510685003268947452.5: -0.35014033773235204320945806619, -0.350140337732352043209458066193.0: -0.333908839125969899587557993333, -0.3339088391259698995875579933333.5: -0.316735893280449322750746651496, -0.3167358932804493227507466514964.0: -0.300283133698875890416939078954, -0.3002831336988758904169390789544.5: -0.285060780861892724561043149002, -0.2850607808618927245610431490025.0: -0.27116077164981630653814953836, -0.271160771649816306538149538365.5: -0.258521425574383772610045907985, -0.2585214255743837726100459079856.0: -0.247029921882685187238296084388, -0.2470299218826851872382960843886.5: -0.236563216683754891743332121731, -0.2365632166837548917433321217317.0: -0.227004091485682007756387972366, -0.2270040914856820077563879723667.5: -0.218246780633291879260369050975, -0.2182467806332918792603690509758.0: -0.210198193589213123291857355268, -0.2101981935892131232918573552688.5: -0.202777333458621146793488964004, -0.2027773334586211467934889640049.0: -0.195914058644079853910199632982, -0.1959140586440798539101996329829.5: -0.189547691555886425095696890883, -0.18954769155588642509569689088310.0: -0.183625687216728295735785021813, -0.183625687216728295735785021813

PS. I'm curious as to which infinite sum led to this integral...

PM 2Ring

Posts: 2581
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Mid north coast, NSW, Australia

### Re: Frustrating Indefinite Integral

PM 2Ring wrote:PS. I'm curious as to which infinite sum led to this integral...

It's deals with of logarithms somewhat similar to to this thread viewtopic.php?f=17&t=87670 , and is in fact a more general continuation of my work there. If we can get this last integral maybe I'll post a few cool sums....

I must admit some of my work on these sums use techniques that are.... far from rigorous, but I'm glad to see that it's all turning out great. Anyways, how hard can this integral be? I don't have time to work on this problem now though unfortunately.

edit: I was sure I had it, but no, I just have another proof of what we already know. Here it is:

\int^\infty_0 ln(x)/(1+e^x)\,dx=\int^\infty_0 ln(ns)/(1+e^{ns})\,n ds=n\int^\infty_0 ln(n)/(1+e^{ns})ds+n\int^\infty_0 ln(s)/(1+e^{ns})\,ds

(second step is substitution x=ns , dx=n*ds) n\int^\infty_0 ln(n)/(1+e^{ns})ds can be simply enough evaluated as ln(2)*ln(n) , as an anti-derivative is easily found. The integral after that is n*f(n) . So we have f(1)=ln(2)*ln(n)+n*f(n) , which is equivalent to f(n)=(f(1)-ln(2)*ln(n))/n , which is what we already know.

Sorry if that was hard to follow, as I am rather bad at LaTeX. Anyways, this is just another proof, nothing really new.

Posts: 29
Joined: Mon May 28, 2012 7:11 pm UTC

### Re: Frustrating Indefinite Integral

I have it! After much mucking about with the Gamma function, I have a proof that our integral is indeed equal to -1/2 (log 2)^2. I've attached the proof as a pdf.
Attachments
Integral.pdf
Citan Uzuki

Posts: 3
Joined: Sat Jul 28, 2012 5:11 am UTC

### Re: Frustrating Indefinite Integral

Citan Uzuki wrote:I have it! After much mucking about with the Gamma function, I have a proof that our integral is indeed equal to -1/2 (log 2)^2. I've attached the proof as a pdf.

That is absolutely awesome! It's tool late for me to go through it all right now, but it sure is cool! Thanks for all the effort put in! I wonder if there is a less complicated method though. I chuckled when I saw the first thing you had to prove, because I myself had worked with all of those, except being fully sure of the second one. Rather then using the integral to find the sum you used the sum to help evaluate the integral. Very cool, sometime tomorrow I will perhaps post some fairly interesting sums I can evaluate using this and some previous information on this page. Thanks again for all the help!

Posts: 29
Joined: Mon May 28, 2012 7:11 pm UTC

### Re: Frustrating Indefinite Integral

http://math.stackexchange.com/questions ... -logarithm

Here's a stackexchange discussion on this integral if you're looking for more ways to derive f(1).