problem evaluating integral

38 views
Skip to first unread message

andres.ordonez

unread,
Dec 10, 2011, 6:56:33 PM12/10/11
to sage-support
Hi, I'm having trouble evaluating this integral

integral( x / (exp(x) - 1) , (x,0,oo)).n()

I get

TypeError: cannot evaluate symbolic expression numerically

The answer (according to mathematica) should be pi^2 / 6

Is something wrong with my code?

Thanks!

Renan Birck Pinheiro

unread,
Dec 10, 2011, 8:19:44 PM12/10/11
to sage-s...@googlegroups.com
2011/12/10 andres.ordonez <andres.fel...@gmail.com>

Apparently it stumbles upon a limit which Maxima is incapable of doing.

sage: integrate(x/(exp(x)-1),(x,0,oo))
-1/6*pi^2 + limit(-1/2*x^2 + x*log(-e^x + 1) + polylog(2, e^x), x, +Infinity)

if oo is replaced by a very large number, seems to work...

sage: (real_part(integrate(x/(exp(x)-1),(x,0,1000)).n()) - (pi^2/6)).n()
-4.41002789841605e-11

--
Renan Birck Pinheiro - Grupo de Microeletrônica - Engenharia Elétrica/UFSM

http://renanbirck.blogspot.com / skype: renan.ee.ufsm



andres.ordonez

unread,
Dec 11, 2011, 12:45:50 PM12/11/11
to sage-support
That'll do. Thanks

On Dec 10, 8:19 pm, Renan Birck Pinheiro <renan.ee.u...@gmail.com>
wrote:
> 2011/12/10 andres.ordonez <andres.felipe.ordo...@gmail.com>


>
> > Hi, I'm having trouble evaluating this integral
>
> > integral( x / (exp(x) - 1) , (x,0,oo)).n()
>
> > I get
>
> > TypeError: cannot evaluate symbolic expression numerically
>
> > The answer (according to mathematica) should be pi^2 / 6
>
> > Is something wrong with my code?
>
> > Thanks!
>
> Apparently it stumbles upon a limit which Maxima is incapable of doing.
>
> sage: integrate(x/(exp(x)-1),(x,0,oo))
> -1/6*pi^2 + limit(-1/2*x^2 + x*log(-e^x + 1) + polylog(2, e^x), x,
> +Infinity)
>
> if oo is replaced by a very large number, seems to work...
>
> sage: (real_part(integrate(x/(exp(x)-1),(x,0,1000)).n()) - (pi^2/6)).n()
> -4.41002789841605e-11
>
> --
> Renan Birck Pinheiro - Grupo de Microeletrônica

> <http://www.ufsm.br/gmicro>- Engenharia
> Elétrica <http://www.ufsm.br/cee>/UFSM <http://www.ufsm.br>
>
> http://renanbirck.blogspot.com/ skype: renan.ee.ufsm

achrzesz

unread,
Dec 11, 2011, 1:30:05 PM12/11/11
to sage-support
sage: N(pi^2/6, digits=17)
1.6449340668482264
sage: numerical_integral(x/(exp(x)-1),0,oo)
(1.6449340668482264, 5.9356452836178026e-10)

On Dec 11, 6:45 pm, "andres.ordonez" <andres.felipe.ordo...@gmail.com>
wrote:

achrzesz

unread,
Dec 11, 2011, 4:59:16 PM12/11/11
to sage-support

Using the geometric series one can obtain

x/(e^x-1)=xe^(-x)/(1-e^(-x))=\sum_0^\infty x(e^(-(k+1)x)

Integrating term by term

sage: var('k x')
sage: maxima('assume(k>-1)')
[k>-1]
sage: maxima('integrate(x*exp(-(k+1)*x),x,0,inf)')
1/(k+1)^2

one can obtain the exact integral

sage: sum(1/k^2,k,1,oo)
1/6*pi^2

Andrzej Chrzeszczyk

achrzesz

unread,
Dec 11, 2011, 5:18:33 PM12/11/11
to sage-support

Maxima knows the expansion:

sage: maxima('powerseries(x*exp(-x)/(1-exp(-x)),exp(-x),0)')
x*%e^-x*'sum(%e^-(i1*x),i1,0,inf)

Andrzej Chrzeszczyk

Michael Orlitzky

unread,
Dec 11, 2011, 7:02:56 PM12/11/11
to sage-s...@googlegroups.com

I opened a ticket for this, so it doesn't get forgotten:

http://trac.sagemath.org/sage_trac/ticket/12145

Reply all
Reply to author
Forward
0 new messages