Group Abstract Group Abstract

Message Boards Message Boards

0
|
1.8K Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Unexpected output from Integrate

Posted 1 year ago
POSTED BY: Carlo Wood
4 Replies

The imaginary parts will cancel.

ii = Integrate[(1/(1 + Exp[-x]))*Log[1/(1 + Exp[-x])], x]

(* Out[359]=Log[-E^x] Log[1/(1 + E^x)] + 1/2 Log[1/(1 + E^x)]^2 - 
 Log[1/(1 + E^x)] Log[E^x/(1 + E^x)] - PolyLog[2, 1 + E^x] *)

hi = Limit[ii, x -> Infinity]
lo = Limit[ii, x -> -Infinity]

(* Out[360]= -(\[Pi]^2/3)

Out[361]= -(\[Pi]^2/6) *)

hi - lo

(* Out[362]= -(\[Pi]^2/6) *)
POSTED BY: Daniel Lichtblau

Use Integrate, not Integral.

In[316]:= Integrate[(1/(1 + Exp[-x]))*
  Log[1/(1 + Exp[-x])], {x, -Infinity, Infinity}]

Out[316]= -(\[Pi]^2/6)

In[317]:= NIntegrate[(1/(1 + Exp[-x]))*
  Log[1/(1 + Exp[-x])], {x, -Infinity, Infinity}]

Out[317]= -1.64493
POSTED BY: Daniel Lichtblau

The output contains functions with complex values, but the end result is real:

int = Integrate[(1/(1 + Exp[-x]))*Log[1/(1 + Exp[-x])], x]
int2 = FullSimplify[ComplexExpand[int], Element[x, Reals]]
FullSimplify[ComplexExpand[int] == int2, Element[x, Reals]]
Plot[int - int2, {x, -1, 1}]

Unfortunately we cannot check the derivative of int2, because int2 contains Re, which is not differentiable in the complex sense.

POSTED BY: Gianluca Gorni
Posted 1 year ago

Sorry, I was typing that from my head - I use Integrate in the notebook example. What can you say about the log(-exp(x)) in the answer? I knew that the integral with limits for the simpler form is -pi^2/6; I either need the definite integral with the w and b, or an explanation of the logarithm of a negative value in an answer that should be just real function.

POSTED BY: Carlo Wood
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard