5

In a work it was required to find an integral akin to $$I=\int_{0}^{\pi/2} \sin 2 \theta~\tanh(\sin\theta) \tanh(\cos \theta)~d\theta.$$ Since $\tanh x$ and $\operatorname{erf}(x)$ are similar functions so it was a pleasure to see that its variant namely $$J=\int_{0}^{\pi/2} \sin 2\theta ~ \operatorname{erf}(\sin \theta)~ \operatorname{erf}(\cos \theta)~d\theta=e^{-1}$$ could be solved by Mathematica.

So the question is: Can one do it ($J$) by hand?

user10354138
  • 33,239
Z Ahmed
  • 43,235

2 Answers2

5

The antiderivative can be found by hand. Integrate by parts $$\newcommand{\erf}{\operatorname{erf}} \mathrm{d}u=\sin 2\theta\,\mathrm{d}\theta,\quad v=\erf(\cos \theta)\erf(\sin \theta) $$ gives $$ -\frac12\cos 2\theta\erf(\sin \theta)\erf(\cos \theta)+ \frac1{\sqrt\pi}\int\cos(2\theta)\left[e^{-\sin^2 \theta}\cos \theta\erf(\cos \theta)-e^{-\cos^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta $$ Hence we are reduced to computing $$ \int\cos(2\theta)\left[e^{-\sin^2 \theta}\cos \theta\erf(\cos \theta)-e^{-\cos^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta\\ =e^{-1}\int\cos(2\theta)\left[e^{\cos^2 \theta}\cos \theta\erf(\cos \theta)-e^{\sin^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta $$ But note that \begin{align*} &\frac{\mathrm{d}}{\mathrm{d}\theta}\left[e^{\cos^2 \theta}\sin \theta\erf(\cos \theta)\right]\\ &=(-2\sin \theta\cos \theta)e^{\cos^2 \theta}\sin \theta\erf(\cos \theta) +e^{\cos^2 \theta}\cos \theta\erf(\cos \theta) +e^{\cos^2 \theta}\sin \theta\frac2{\sqrt\pi}e^{-\cos^2 \theta}(-\sin \theta)\\ &=(-2\sin^2 \theta+1)e^{\cos^2 \theta}\cos \theta\erf(\cos \theta) -\frac{2\sin^2 \theta}{\sqrt\pi}\\ &=\cos (2 \theta)e^{\cos^2 \theta}\cos \theta\erf(\cos \theta) -\frac{2\sin^2 \theta}{\sqrt\pi} \end{align*} and the similar equation with $\cos \theta$ and $\sin \theta$ interchanged. So putting these two together, \begin{align*} &\int\cos(2\theta)\left[e^{\cos^2 \theta}\cos \theta\erf(\cos \theta)-e^{\sin^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta\\ &=\left( e^{\cos^2 \theta} \erf(\cos \theta) \sin \theta - e^{\sin^2 \theta} \erf(\sin \theta) \cos \theta\right)+\int\frac2{\sqrt\pi}(\sin^2 \theta+\cos^2 \theta)\,\mathrm{d}\theta \end{align*} and of course you know how to do the final integral.

The final upshot is \begin{align*} &\int\sin(2\theta)\erf(\sin\theta)\erf(\cos\theta)\,\mathrm{d}\theta\\ &=\frac2{e\pi}\theta-\frac12\cos 2\theta\erf(\sin \theta)\erf(\cos \theta)\\ &\quad+\frac1{e\sqrt\pi} \left( e^{\cos^2 \theta} \erf(\cos \theta) \sin \theta - e^{\sin^2 \theta} \erf(\sin \theta) \cos \theta\right) \end{align*}


For $I$, this approach doesn't work, and I don't think there is a closd form solution to the definite integral. However, we can express the MacLaurin series $$ \tanh z=\sum_{k\geq 0} 2\frac{(-1)^k}{\pi^{2k+2}}\left(1-\frac1{4^{k+1}}\right)\zeta(2k+2)z^{2k+1} $$ so $$ I=4\sum_{k,k'\geq 0}(1-4^{-k-1})(1-4^{-k'-1})\frac{(-1)^{k+k'}\zeta(2k+2)\zeta(2k'+2)\Gamma(k+\frac12)\Gamma(k'+\frac12)}{\Gamma(k+k'+1)\pi^{2(k+k')+4}} $$ which doesn't really simplify the task.

user10354138
  • 33,239
  • This is very surprising...(+1) – Seewoo Lee Jun 20 '19 at 06:00
  • @User10354138 Your solution is amazing but there are typos which may spoil a general interest., for instance you are not carrying $1/\sqrt{\pi}$ after your first integration. Then, in the last equation $e^{-1}$ shouldn't be there. Also $\sin 2\theta$ is missing in the last equation. Your final answer is $e^{-1} \sqrt{\pi}$. You may edit your solution once. – Z Ahmed Jun 20 '19 at 08:40
  • @DrZafarAhmedDSc Where are you saying the missing $\sin 2\theta$ (in $I$? That already went in the Beta function as $2\sin\theta\cos\theta$)? And regarding the non-carrying of $1/\sqrt{\pi}$ that's the reason for taking it out of the integral so it doesn't waste space on my small screen. – user10354138 Jun 20 '19 at 08:52
  • @user10354138 I am bothering only about $J$ integral. In your last step I guess you are doing integration by parts taking $\cos 2 \theta$ as second function, then why $\frac{sin 2\theta }{2}$ is missing after the equality sign. – Z Ahmed Jun 20 '19 at 09:23
  • @DrZafarAhmedDSc No, the last step is to rewrite $\frac{\mathrm{d}}{\mathrm{d}\theta}[e^{\cos^2\theta}\sin\theta\operatorname{erf}(\cos\theta)]=\dots$ from the previous equation as $\int\dots,\mathrm{d}\theta=e^{\cos^2\theta}\sin\theta\operatorname{erf}(\cos\theta)$ and combining with the unwritten one where $\sin$ and $\cos$ are interchanged in $e^{\cos^2\theta}\sin\theta\operatorname{erf}(\cos\theta)$. There is no integration by parts there. – user10354138 Jun 20 '19 at 09:27
4

$$J=\int_{0}^{\pi/2} \sin 2\theta \mbox{erf}(\sin \theta) \mbox{erf}(\cos \theta). $$ I get clue from the fact that though $\tanh x$ and erf$(x)$ are similar, but the latter one enjoys beautiful expansions! Expanding $$\mbox{erf}(x)= e^{-x^2} \sum_{n=0}^{\infty} \frac{x^{2n+1}}{\Gamma(n+3/2)}.$$ We re-write $$J=2e^{-1}\sum_{m=0}^{\infty} \sum _{n=0}^{\infty} \int_{0}^{\pi/2} \frac{ \sin^{2m+2} \theta ~\ cos^{2n+2} \theta} {\Gamma(m+3/2)~\Gamma(n+3/2)} ~d \theta.$$
By Beta-integral, we get $$J=e^{-1}\sum_{m=0}^{\infty} \sum_{n=0}^{\infty} \frac{1}{\Gamma(m+n+2)}=e^{-1}\sum_{k=1}^{\infty} \sum_{m=0}^{k-1} \frac{1}{(m+1)!}=e^{-1}\sum_{k=1}^{\infty} \frac{k}{(k+1)!}.$$ $$\Rightarrow e^{-1} \sum_{k=0} \left( \frac{1}{k!}-\frac{1}{(k+1)!} \right)=e^{-1}.$$

Z Ahmed
  • 43,235