7

Can anyone think of any smart way of approximating this nasty integral $$F = \int_{-c}^c f_X(x) \, dx $$

where $c$ is a non-negative constant (for example $\frac{1}{64}$) and where the integrand is given by

$$f_X(x)= \int_{\max\{-1,-1-x\}}^{\min\{1,1-x\}} \left( \frac{1}{\pi^2\sqrt{1-(x+y)^2}} \frac{1}{\sqrt{1-y^2}}\right) \, dy$$

I would really like to avoid numerical integration. Can anyone think of any simplifications that can reduce the complexity of my problem.

Please read comments below on why I have such a problem in the first place...

Thanks

Henry
  • 1,204
  • How does it arise? Maybe it can be avoided and computed another way. It does look painful. – MPW Jan 24 '15 at 03:39
  • The function $f_X(x)$is the probability density function of $X=\cos(U)-\cos(V)$ where $U,V$ are uniform random variables. The reason I am integrating $F$ is because I had a function of this random variable $X$ and I had to take the expectation with respect to it.... does that make any sense? @MPW – Henry Jan 24 '15 at 03:42
  • I should say $U,V\sim [-\pi,\pi]$... – Henry Jan 24 '15 at 03:48
  • So is the question really "what is the expected value of $\cos U +\cos V$ where $U$ and $V$ are independent random variables uniformly distributed on $[-\pi,\pi]$?"? – MPW Jan 24 '15 at 03:48
  • No the function that I had to average (take the expectation over) was $\mathbb{E}[G(X)]$ where $G(x)= 1, -c\leq x\leq c$. and 0 everywhere else, this is why I have $F$ in this form shown above..@MPW – Henry Jan 24 '15 at 03:54
  • Maple and WolframAlpha can calculate the indefinite integral; they give an answer using an elliptic function. – MasB Jan 24 '15 at 03:54
  • @BernardMassé thanks, do you mean by indefinite integral $f_X(x)$? – Henry Jan 24 '15 at 03:56
  • @MPW i have already found the distribution of $X=\cos(U)-\cos V$, then I took an expectation of a piecewise function of $X$... – Henry Jan 24 '15 at 04:00
  • @Henry Yes the integral without bounds. – MasB Jan 24 '15 at 04:01
  • can you take the answer and put the bounds that I have here and still have the right answer? @BernardMassé.... also can you please show me how one can write it wolfram alpha.. – Henry Jan 24 '15 at 04:03

2 Answers2

1

The following answer provides the result in terms of a convergent series in Eq. (1).

The inner integral can be solved explicitly in terms of the complete elliptic integral of the first kind with the result (valid for $|x|<2$) $$ f_X(x) = \frac1{\pi^2} K\Bigl(\sqrt{1-x^2/4}\Bigr) = \frac{1}{\pi^2}K'(|x|/2).$$

Using the expansion of $K$ around 1, we can obtain the expression $$ F= \frac{2 c \log(2^3e/c)}{\pi^2} + \frac{c^3 \log(2^9/e^2 c^3)}{72 \pi^2} + O(c^5 \log c)$$ valid for $c\ll1$.

In fact using the formula 19.12.1, the integral $F$ can be obtained as a convergent series. Indeed, we have that $$K'(k)= \sum_{m=0}^\infty \left(\frac{\left(\tfrac12\right)_m k^m}{m!}\right)^2 \left[\log(1/k) + d(m)\right] $$ for $k<1$ with $d(m)= \psi(1+m) - \psi(1/2 +m)$; here, $\psi$ is the digamma function and $(a)_n =\Gamma(a+n)/\Gamma(a)$ the Pochhammer symbol.

Integrating $F= \int_{-c}^c f_X(x)$ term by term yields $$ F= \frac{1}{\pi^2} \sum_{m=0}^\infty \left(\frac{\left(\tfrac12\right)_m }{m!}\right)^2 \frac{c^{2m+1}}{(2m+1)2^{2m-1}} \left[\frac{1 + (2m+1) \log(2/c)}{2m+1} + d(m)\right] \tag{1},$$ where we have used that $$\int_{-c}^c \!dx\,x^{2m}= \frac{2 c^{2m+1}}{2m+1}$$ and $$\int_{-c}^c\!dx\,x^{2m}\log(1/x) = \frac{2 c^{2m+1} [1 + (2m+1) \log(1/c)]}{(2m+1)^2}.$$

A special point occurs at $c=2$ where the logarithmic terms in (1) vanish and we simply obtain $F(c=2) = 1$.

Edit: Following the general procedure and specifying $0<x<1$ (it can be checked that the result remains unmodified in the other cases), we factor $$(1- (x+y)^2)(1-y^2) =(1-y) (1-x-y) (y+1)(y+1+x) .$$ This leads to the substitution $$ t= \sqrt{\frac{2 (1+y)}{(2-x)(1+x+y)}}.$$ Via this substitution the boundaries $y=-1$ and $y=1-x$ are transformed to $t=0$ and $t=1$ and we obtain $$\int_{-1}^{1-x}\frac{dx}{\sqrt{(1- (x+y)^2)(1-y^2)}} = \int_0^1\frac{dt}{\sqrt{(1-t^2)[1-(1-x^2/4) t^2]}}$$ which is the standard form of the complete elliptic integral of the first kind.

Fabian
  • 23,360
  • wow impressive can you please provide more details....i dont understand how you were able to do it – Henry Jan 24 '15 at 06:34
  • @Henry: Of course it is not the first time, I have solved an ellliptic integral... ;-) – Fabian Jan 24 '15 at 07:52
  • thank you. If you dont mind i want to ask : what to do you mean by expansion of $K $ around 1. Also why did you take x between 0 and 1... in my case its between -1 and 1. Thanks – Henry Jan 24 '15 at 12:52
  • @Henry: you have to treat the cases $x<-1$, $-1<x<0$, $0<x<1$, $x>1$ differently as they ask for different substitutions. It turns out that they all the cases lead to the result quoted in particular it is not difficult to convince yourself that $x$ and $-x$ lead to the same result. – Fabian Jan 24 '15 at 15:14
  • thank you and i agree.. cam you please tell me how you got the expansiom aroung $K=1$us that an approximation? – Henry Jan 24 '15 at 15:16
  • The expansion around $k=1$ you can find here (19.12.1). Note that by definition $k'= \sqrt{1-k^2}$. In principle, you can obtain term by term and obtain a convergent series in $c$ for your integral. The approximation, I have given is reasonably accurate up to $c \simeq 2$. I will add the complete answer as well. – Fabian Jan 24 '15 at 15:18
  • this work is fabulous can I ask is the $\log$ in your answer base what? and why is it that the expansion is only valid for $c<<<1$? – Henry Jan 24 '15 at 23:08
  • @Henry: it is the natural logarithm. – Fabian Jan 24 '15 at 23:09
  • Is the expansion only valid for very small positive $c$? – Henry Jan 24 '15 at 23:12
  • It is valid up to $c=2$. – Fabian Jan 25 '15 at 08:05
0

According to your comments, for $$G(x) = \mathbb{1}(|x|\le c) = \begin{cases} 1, & -c \le x \le c \\ 0, & \text{otherwise} \end{cases}$$ we then simply have $$\mathbb E[G(X)] = \Pr[|X| \le c].$$ If $X = \cos U - \cos V$ where $U, V \sim \operatorname{Uniform}(?,?)$ are independent, then you need to specify the support of the uniform distribution before we can proceed further.

heropup
  • 135,869
  • Thanks, the support of $U,V \sim U(-\pi,\pi)$, for which I think the distribution of $X$ is $f_X(x)$ in my question.... – Henry Jan 24 '15 at 04:18