Frustrating Indefinite Integral

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

User avatar
Heptadecagon
Posts: 36
Joined: Mon May 28, 2012 7:11 pm UTC

Frustrating Indefinite Integral

Postby Heptadecagon » Fri Jul 27, 2012 2:37 am UTC

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

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!

User avatar
PM 2Ring
Posts: 3715
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Frustrating Indefinite Integral

Postby PM 2Ring » Fri Jul 27, 2012 7:04 am UTC

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

User avatar
Heptadecagon
Posts: 36
Joined: Mon May 28, 2012 7:11 pm UTC

Re: Frustrating Indefinite Integral

Postby Heptadecagon » Fri Jul 27, 2012 10:01 pm UTC

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...

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

Re: Frustrating Indefinite Integral

Postby nadando » Sat Jul 28, 2012 12:11 am UTC

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).

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

Re: Frustrating Indefinite Integral

Postby pizzazz » Sat Jul 28, 2012 3:18 am UTC

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).

User avatar
Dopefish
Posts: 855
Joined: Sun Sep 20, 2009 5:46 am UTC
Location: The Well of Wishes

Re: Frustrating Indefinite Integral

Postby Dopefish » Sat Jul 28, 2012 3:39 am UTC

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

User avatar
Heptadecagon
Posts: 36
Joined: Mon May 28, 2012 7:11 pm UTC

Re: Frustrating Indefinite Integral

Postby Heptadecagon » Sat Jul 28, 2012 5:01 am UTC

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.

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

Re: Frustrating Indefinite Integral

Postby Citan Uzuki » Sat Jul 28, 2012 5:37 am UTC

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:

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

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:

[math]\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*}[/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.

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

Re: Frustrating Indefinite Integral

Postby pizzazz » Sat Jul 28, 2012 4:35 pm UTC

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.

User avatar
Qaanol
The Cheshirest Catamount
Posts: 3069
Joined: Sat May 09, 2009 11:55 pm UTC

Re: Frustrating Indefinite Integral

Postby Qaanol » Sat Jul 28, 2012 8:01 pm UTC

Integration by parts, u=ln(x), dv=dx/(1+e^(ax)) ?
wee free kings

User avatar
Heptadecagon
Posts: 36
Joined: Mon May 28, 2012 7:11 pm UTC

Re: Frustrating Indefinite Integral

Postby Heptadecagon » Sat Jul 28, 2012 11:43 pm UTC

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

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

Re: Frustrating Indefinite Integral

Postby Citan Uzuki » Sun Jul 29, 2012 12:29 am UTC

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 :oops: Also yours -- it should be f(a)-f(1)/a=-ln(a)*ln(2)/a.

Still thinking about how to get f(1).

User avatar
PM 2Ring
Posts: 3715
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Frustrating Indefinite Integral

Postby PM 2Ring » Sun Jul 29, 2012 3:37 am UTC

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>0
From http://forums.xkcd.com/viewtopic.php?f=17&t=87908

'''

import sys
from mpmath import mp

def 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 bits
a: integral, formula
0.5: 0.480453013918201424667102526327, 0.480453013918201424667102526327
1.0: -0.240226506959100712333551263163, -0.240226506959100712333551263163
1.5: -0.347515668973138849397047635782, -0.347515668973138849397047635782
2.0: -0.360339760438651068500326894745, -0.360339760438651068500326894745
2.5: -0.35014033773235204320945806619, -0.35014033773235204320945806619
3.0: -0.333908839125969899587557993333, -0.333908839125969899587557993333
3.5: -0.316735893280449322750746651496, -0.316735893280449322750746651496
4.0: -0.300283133698875890416939078954, -0.300283133698875890416939078954
4.5: -0.285060780861892724561043149002, -0.285060780861892724561043149002
5.0: -0.27116077164981630653814953836, -0.27116077164981630653814953836
5.5: -0.258521425574383772610045907985, -0.258521425574383772610045907985
6.0: -0.247029921882685187238296084388, -0.247029921882685187238296084388
6.5: -0.236563216683754891743332121731, -0.236563216683754891743332121731
7.0: -0.227004091485682007756387972366, -0.227004091485682007756387972366
7.5: -0.218246780633291879260369050975, -0.218246780633291879260369050975
8.0: -0.210198193589213123291857355268, -0.210198193589213123291857355268
8.5: -0.202777333458621146793488964004, -0.202777333458621146793488964004
9.0: -0.195914058644079853910199632982, -0.195914058644079853910199632982
9.5: -0.189547691555886425095696890883, -0.189547691555886425095696890883
10.0: -0.183625687216728295735785021813, -0.183625687216728295735785021813


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

User avatar
Heptadecagon
Posts: 36
Joined: Mon May 28, 2012 7:11 pm UTC

Re: Frustrating Indefinite Integral

Postby Heptadecagon » Sun Jul 29, 2012 4:50 am UTC

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:

[math]\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[/math]
(second step is substitution x=ns , dx=n*ds) [imath]n\int^\infty_0 ln(n)/(1+e^{ns})ds[/imath] 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.

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

Re: Frustrating Indefinite Integral

Postby Citan Uzuki » Tue Jul 31, 2012 3:46 am UTC

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
(231.27 KiB) Downloaded 130 times

User avatar
Heptadecagon
Posts: 36
Joined: Mon May 28, 2012 7:11 pm UTC

Re: Frustrating Indefinite Integral

Postby Heptadecagon » Tue Jul 31, 2012 6:42 am UTC

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!

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

Re: Frustrating Indefinite Integral

Postby nadando » Tue Jul 31, 2012 10:23 pm UTC

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).


Return to “Mathematics”

Who is online

Users browsing this forum: No registered users and 11 guests