# Evaluate $\int_0^{\pi/2} \frac{\ln\left(e^{2x} + 1\right)}{1 + \sin2x}\mathrm dx$

Here's my Xmas gift to all of you! I just encountered a very tough integral. $$\int_{0}^{\pi/2} \frac{\ln\left(e^{2x} + 1\right)}{1 + \sin2x}\mathrm dx$$

I have tried for a few hours. This task is just daunting.

I've been using by-parts bcause that's the only tool I know how to use in this situation. Please educate me on how this integral can be evaluated.

Thank you :D

• Xmas is coming and this is your gift, I suppose ! Where did you find such a monster ? Any bounds ? Why to care about the absolute value in numerator ? Dec 19, 2014 at 9:55
• No need absolute sign here since for $x\in\mathbb{R}$ the term $e^x+1\ge1$. Dec 19, 2014 at 10:02
• @Nick Mathematica yields $$\int_{0}^{\pi/2} \frac{\ln\left(e^{2x} + 1\right)}{1 + \sin2x}\mathrm dx\approx1.830481056481482\cdots$$ Dec 19, 2014 at 10:38
• @Integrator: I knew that but I'm not Mathematica, how do I get there?
– Nick
Dec 19, 2014 at 10:39
• @Integrator. If I don't hear from you meanwhile about the solution, I wish you very merry Xmas 2015, 2016, 2017 (no limit) ! Dec 19, 2014 at 10:42

The OP asked for an answer using numerical analysis. Let me first say that even Mathematica and MAPLE do not give exactly the same answers for this integral. MAPLE gives:

F(x) := ln(exp(2*x)+1)/(1+sin(2*x));
evalf(int(F(x),x=0..Pi/2),16);
1.830481056481415

As compared with the value in the comment by Iuʇǝƃɹɐʇoɹ : $1.830481056481482$ .
Then OK, here is a very brute force (and therefore a piece of cake) program:

program numeric;
function F(x : double) : double;
begin
F := ln(exp(2*x)+1)/(1+sin(2*x));
end;
function lower(N : integer) : double;
var
k : integer;
x,dx,sum : double;
begin
sum := 0;
dx := (Pi/2)/N;
for k := 0 to N-1 do
begin
x := (Pi/2)*k/N+dx/2;
{ Midpoint rule }
sum := sum + F(x)*dx;
end;
lower := sum;
end;
function upper(N : integer) : double;
var
k : integer;
x1,x2,dx,sum : double;
begin
sum := 0;
dx := (Pi/2)/N;
x2 := 0;
for k := 1 to N do
begin
x1 := x2;
x2 := (Pi/2)*k/N;
{ Trapezium rule }
sum := sum + (F(x1)+F(x2))/2*dx;
end;
upper := sum;
end;
begin
Writeln(lower(1000000));
Writeln(upper(1000000));
end.

Output:
 1.83048105648054E+0000
1.83048105648321E+0000

It helps to make a little sketch of the function $F(x) = \ln(e^{2x}+1)/(1+\sin(2x))$ :

Due to this function behaviour, the Midpoint rule give a lower bound, while the Trapezium rule gives an upper bound for the integral. Thus we find with certainty that: $$1.830481056480 < \int_{0}^{\pi/2} \frac{\ln\left(e^{2x} + 1\right)}{1 + \sin2x}\mathrm dx < 1.830481056484$$ The results with Mathematica and MAPLE are well within these bounds.

• This might qualify as an answer, But it's not worth any bounty. Dec 29, 2014 at 2:26
• @Iuʇǝƃɹɐʇoɹ: Agreed with you about the bounty. So I'd say: keep the upvotes low (I don't care too much). There's an update forthcoming though. Dec 29, 2014 at 10:01
• The promised update has been done. Dec 29, 2014 at 11:07
• Ok, but Nick didn't commented anything about $1.830481056481482$ Dec 29, 2014 at 11:58
• @Iuʇǝƃɹɐʇoɹ: Sorry, my bad! I'm going to correct it. Dec 29, 2014 at 14:27

Just a method for estimating the integral $$I=\int_{0}^{\pi/2}\frac{\ln(1+e^{2x})}{1+\sin 2x}dx=-\frac{\ln(1+e^{2x})}{1+\tan x}\big|_{0}^{\pi/2}+\int_{0}^{\pi/2}\frac{2e^{2x}}{(1+e^{2x})(1+\tan x)}dx\\=\ln 2+J$$ Now, an estimation of $J$ can be found as below. Note that $\forall x\ge 0,\ e^x/(1+e^x)\le x/4+1/2$. Hence $$J<\int_{0}^{\pi/2}\frac{(x+1)dx}{1+\tan x}=\pi/4+\int_{0}^{\pi/2}\frac{x}{1+\tan x}dx$$ The latter integral is found to be $\approx 0.431066$ from Wolfram alpha. Hence $I<1.90961$.

For a lower bound note that due to concavity for $x>0,\ e^{2x}/(1+e^{2x})>1/2+(2e^\pi/(1+e^\pi)-1)x/\pi \ \forall x\in [0,\pi/2]$. Hence $$J>\int_{0}^{\pi/2}\frac{1+2x(2\dfrac{e^\pi}{1+e^\pi}-1)/\pi}{1+\tan x}dx=\pi/4+2(2\frac{e^\pi}{1+e^\pi}-1)/\pi\times 0.431066$$ Hence $I>1.7302$.

EDIT To defend the "purity" of my answer as demanded by Mr.G, I am giving a solution to the integral $\int_{0}^{\pi/2}\frac{x}{1+\tan x}dx$. This can be evaluated as below $$L=\int_{0}^{\pi/2}\frac{x}{1+\tan x}dx\\=x(x/2+1/2\ln(\sin x +\cos x))\big|_0^{\pi/2}-1/2\int_{0}^{\pi/2}\left[x+\ln(\sin x +\cos x)\right]dx\\ =\pi^2/16-\pi/8\ln 2+\int_{0}^{\pi/4}\ln \sec x dx$$ Now, $$\int_0^{\pi/4}\ln \sec^2 x dx=x\ln (\sec^2 x)\big|_{0}^{\pi/4}-2\int_{0}^{\pi/4}x\tan x dx$$ Let $J=\int_{0}^{\pi/4}x\tan x dx$ and introduce a new integral $K=\int_{0}^{\pi/2} \frac{x}{\tan x}dx$. We can then see after some manipulations that $$2J+K/2=\int_{0}^{\pi/4}\frac{x\sec^2 x}{\tan x} dx\\=\int_{0}^{1}\frac{\tan^{-1}x}{x}dx\\=\sum_{k\ge 0}\frac{(-1)^k}{(2k+1)^2}=:C$$ where $C$ is the Catalan's constant. We will evaluate $K$ using differentiation under integration trick. Define $$K_a=\int_{0}^{\pi/2}\frac{\tan^{-1}(a \tan x)}{\tan x}dx\\\Rightarrow \frac{dK_a}{da}=\int_{0}^{\pi/2}\frac{dx}{(a\tan x)^2+1}\\=\int_{0}^{\infty}\frac{dz}{(1+z^2)(1+a^2z^2)}dz=\frac{\pi}{2(a+1)}\\ \Rightarrow K_a=\frac{\pi}{2}\ln(a+1)$$using $K_0=0$. Then $K=K_1=\frac{\pi}{2}\ln 2$. Hence $$J=C/2-\pi/8\ln 2$$ So, we have $$L=\pi^2/16+\pi/8\ln 2-C/2\approx 0.431066$$

• The integral $\int_{0}^{\pi/2}x/(1 + \tan x)\,\text{d}x$ is not trivial; the integrand has no anti-derivative. How is finding its value numerically any easier than just estimating the original integral numerically? Jan 1, 2015 at 23:03
• @Mr.G this integral has a closed form solution in terms of the Catalan's constant, see this Wolfram alpha output to appreciate this fact. Jan 2, 2015 at 7:10
• I like your approach.
– Nick
Jan 2, 2015 at 7:45
• @Nick: Haven't seen Samrat Mukhopadhyay's closed form somewhere. So what's the big deal here ? Compare $1.7302 < I < 1.90961$ with $1.830481056480 < I < 1.830481056484$ and ask any layman. Jan 2, 2015 at 10:48
• @HandeBruijn, I stated in my answer that this is an approach to come up with some bounds and have not claimed them to be the best. My answer is something that involves "mathematics"(which I think your answer lacked), not just software, and that is why I posted it. Jan 3, 2015 at 5:21

$$u=\ln(e^{2x}+1)\to\:du=\frac{2e^{2x}}{e^{2x}+1}$$ $$dv=\frac{1}{1+\sin(2x)}\:\to v=\int{\frac{1}{1+\sin(2x)}}dx$$ To solve for v: $$dv*\frac{1-\sin(2x)}{1-\sin(2x)}=\frac{1-\sin(2x)}{1-\sin^2(2x)}=\frac{1-\sin(2x)}{\cos^2(2x)}=\frac{1}{\cos^2(2x)}+\frac{-\sin(2x)}{\cos^2(2x)}$$

$$\therefore v=\int{\sec^2(2x)+\frac{-\sin(2x)}{\cos^2(2x)}dx}=\frac{\tan(2x)}{2}+=\int{\frac{-\sin(2x)}{\cos^2(2x)}dx}+C$$ Using U-sub on $$\int{\frac{-\sin(2x)}{\cos^2(2x)}dx}$$:

$$u=\cos(2x);du=-2\sin(2x)dx\\=\frac{1}{2}\int{\frac{1}{u^2}du}=-\frac{1}{2u}=-\frac{\sec(2x)}{2}\\\therefore v=\frac{\tan(2x)}{2}+\frac{\sec(2x)}{2}$$

Then the new problem is to solve:

$$\frac{(\tan2x+\sec2x)\ln(e^{2x}+1)}{2}-\frac{2}{2}\int{\frac{e^{2x}(\tan2x+\sec2x)}{e^{2x}+1}}$$

And I've run out of time...

• $dv=\frac{1}{1+\sin 2x}!!??$ Jan 1, 2015 at 20:01
• This margin is too narrow to contain the full solution, huh?
– Nick
Jan 2, 2015 at 14:55