# Monster double integral

Are there methods to analytically compute this integral, composed of the maximum function, $$max(\exp(x_{0})-\exp(z_{0}), 0)$$, and exponential functions?

$$\iint_{-\infty}^{\infty}\tilde{A}\max(\exp(x_{0})-\exp(z_{0}), 0)\exp(A_{2}(x_{M}-x_{0})^2)\exp(2A_{2}\alpha_{1}(x_{M}-x_{0}))\exp(-2A_{2}\Omega(x_{M}-x_{0}+\alpha_{1})(z_{M}-z_{0}))\exp(A_{2}\Omega^2(z_{M}-z_{0})^{2})\exp(A_{5}(z_{M}-z_{0}))\exp(A_{6}(z_{M}-z_{0})^{2})dx_{0}dz_{0}$$

$$\tilde{A},A_{2},\alpha_{1},\Omega,A_{5},A_{6},x_{M},z_{M}$$ are constants. Specifically, $$\tilde{A},A_{2},A_{5},A_{6}$$ are negative, while the others take on any real number.

So now let $$x_{M}-x_{0}= {x}'$$ and $$z_{M}-z_{0}= {z}'$$.

We transform the integral to:

$$\iint_{\infty}^{-\infty}\tilde{A}\max(\exp(x_{M}-{x}')-\exp(z_{M}-{z}'), 0)\exp(A_{2}({x}')^2)\exp(2A_{2}\alpha_{1}({x}'))\exp(-2A_{2}\Omega({x}')({z}'))\exp(A_{2}\Omega^2({z}')^{2})\exp((A_{5}-2A_{2}\Omega\alpha_{1})({z}'))\exp(A_{6}({z}')^{2})d{x}'d{z}'$$

where the limits have changed because of the substitution.

The exponent can now elegantly be written as:

$$\left ( {x}', {z}' \right )\begin{pmatrix} A_{2} & -A_{2}\Omega \\ -A_{2}\Omega & A_{6}+A_{2}\Omega^2 \end{pmatrix}\left ( {x}', {z}' \right )^{T} +\left ( 2A_{2}\alpha_{1},(A_{5}-2A_{2}\Omega\alpha_{1}) \right )\left ( {x}', {z}' \right )^{T}$$

and by letting $$\hat{A}=\begin{pmatrix} A_{2} & -A_{2}\Omega \\ -A_{2}\Omega & A_{6}+A_{2}\Omega^2 \end{pmatrix}$$ and $$J=\left ( 2A_{2}\alpha_{1},(A_{5}-2A_{2}\Omega\alpha_{1})\right )$$

The integral becomes $$\iint_{\infty}^{-\infty}\tilde{A}\max(\exp(x_{M}-{x}')-\exp(z_{M}-{z}'), 0)\exp(\left ( {x}', {z}' \right )\hat{A}\left ( {x}', {z}' \right )^{T}+J\left ( {x}', {z}' \right )^{T})d{x}'d{z}'$$

I have tried doing a simpler integral:

$$\iint_{-\infty}^{\infty}\tilde{A}\max(\exp(x_{0})-\exp(z_{0}), 0)\exp(A_{1}(x_{M}-x_{0}-\alpha_{1})^2)\exp(A_{6}(z_{M}-z_{0}-\alpha_{2})^{2})dx_{0}dz_{0}$$

but still can not reach a closed-form solution involving error function, dilogarithms, etc ...

• The expression can be simplified and written as an exponent of some inner product, the problem is I dont understand how double integration with the maximum function is done. Feb 15, 2021 at 14:13
• Just integrate over the region $-\infty <z < \infty,\ z< x<\infty$, and replace$\max(x-z, 0)$ by $x-z$. Feb 15, 2021 at 14:34
• Right but how does one integrate within this region given such exponential function. The exponent can be cast into an inner product and the standard wick theorem for Gaussian can be done, but in this case the region is different. Feb 15, 2021 at 14:40
• I don't know; you know more about this than I do. It's best to write what you know about the problem in your post, so that readers can judge what your background is. Feb 15, 2021 at 14:44

HINT.

The first integral can be presented in the form of $$I=\iint\limits_{-\infty}^{\infty}\tilde{A}\max\left(e^{\large x_0}-e^{\large z_0}, 0\right)e^{\large P_{20}(\vec v_0,x_0,z_0)}\,\text dz_0\,\text dx_0,$$ where $$\vec v_0 = \{x_M,z_M,A_2,A_5,A_6,\alpha_1,\Omega\},$$ $$P_{20}(\vec v_0, x_0, z_0) = A_{2}\bigg((x_{M}-x_{0})^2+2\alpha_{1}(x_{M}-x_{0})-2\Omega(x_{M}-x_{0})(z_{M}-z_{0}))$$ $$+\Omega^2(z_{M}-z_{0})^{2}\bigg) +(A_{5}-2\Omega\alpha_1)(z_{M}-z_{0})+A_{6}(z_{M}-z_{0})^{2},$$ or $$I=\iint\limits_{-\infty}^{\infty}\tilde{A}\max\left(e^{\large x_C+x_M}-e^{\large z_C+z_M }, 0\right)e^{\large P_{2C}(\vec v_C,x_C,z_C)}\,\text dz_C\,\text dx_C,\tag1$$ where $$\begin{cases} \vec v_C = \{A_2,A_5,A_6,\alpha_1,\Omega\}\\[4pt] P_{2C}(\vec v_C, x_C, z_C) = A_{2}\big(x_C^2-2\alpha_1x_C-2\Omega x_C z_C+\Omega^2z_C^2\big)\\[4pt] \qquad\qquad\qquad\;-(A_{5}-2\Omega\alpha_1)z_C+A_{6}z_C^2.\tag2 \end{cases}$$ Transformation of the coordinates in the form of $$x_C+iz_C = (x_R+iz_R)e^{\large i\varphi} + x_D +iz_D\tag3$$ should lead from $$(2)$$ to the expression in the form of $$P_{2R}(\vec p, x_R, z_R)= p_{xx} x_R^2+p_{zz} z_R^2+p_0.\tag4$$ This allows to get a system of equations for unknowns $$\;x_D,z_D,\varphi.\;$$

Really, from $$(3)$$ should

• $$\dbinom{x_C}{z_C}=\dbinom{x_R\cos\varphi-z_R\sin\varphi+x_D} {x_R\sin\varphi+z_R\cos\varphi+z_D},$$
• $$P_{2C}(\vec v_C, x_C, z_C) = p_{xx}x_R^2+p_{xz}x_Rz_R+p_{zz}z_R^2+p_x x_R+p_z z_R+p_0,$$ where $$p_{xx},p_{xz},p_{zz},p_{x},p_{z},p_{0}$$ are functions of $$v_C$$.

Obtaining $$x_D,z_D,\varphi$$ from the system $$p_{xz}=p_x=p_z=0,$$ we should get $$(4).$$

At the same time, is known closed form of the integral $$I=\int\limits_{-\infty}^\infty \int\limits_{ax+b}^\infty e^{\large -x^2-z^2} \, \text dx\, \text dz = \dfrac\pi2 \operatorname{erfc}\left(\dfrac b{\sqrt{1+a^2}}\right)\tag5$$ (pointed by DinosaurEgg), and this allows to get the closed form of the given integral.

Let $$x=r\cos t,\,z=r \sin t.$$

If $$\;a>0,\,b>0,\;$$ then the angle coordinate corresponds to line $$\;z=ax+b,\;$$ when $$\;t\in(\arctan a,\pi+\arctan a).$$

The polar radius can be obtained from the equation $$\;a r \cos t +b = r \sin t,\;$$ with the result $$r=\dfrac b{|\sin t - a\cos t|}=\dfrac b{\sqrt{a^2+1}\cos(t-\arctan a)}.$$ Therefore, $$I=\int\limits_{\arctan a}^{\pi+\arctan a} \int\limits_{\large \frac b{\sqrt{a^2+1}\cos(t-\arctan a)}}^\infty e^{\large -r^2} \, \text dr\, \text dt =\dfrac12 \int\limits_{0}^{\pi} e^{\left({\large \frac b{\sqrt{a^2+1}\cos t}}\right)^2} \, \text dt,$$ $$I= \dfrac\pi2 \operatorname{erfc}\left(\dfrac b{\sqrt{1+a^2}}\right).$$

About the factor with $$\;\max\;$$ function:

• Equation $$(3)$$ defines a linear transformation.
• Exponential function is monotonic.
• $$\max\left(e^{\large x_C+x_M}-e^{\large z_C+z_M}, 0\right)=\left(e^{\large x_C+x_M}-e^{\large z_C+z_M}\right)h\left(x_C+x_M-z_C-z_M\right).$$
• $$\;I=I^\star - I^\diamond,\;$$ where $$I^\star=\iint\limits_{-\infty}^{\infty}\tilde{A}h\left(x_C+x_M-z_C-z_M\right)e^{x_C+x_M+\large P_{2C}(\vec v_C,x_C,z_C)}\,\text dz_C\,\text dx_C,$$ $$I^\diamond =\iint\limits_{-\infty}^{\infty}\tilde{A}h\left(x_C+x_M-z_C-z_M\right)e^{z_C+z_M+\large P_{2C}(\vec v_C,x_C,z_C)}\,\text dz_C\,\text dx_C,$$ $$\hspace{100mu}h(t)=\begin{cases} 1,\; \text{if} \;t>0\\ 0,\; \text{otherwize} \end{cases}\quad$$ is the Heaviside step function.

Therefore, we have $$\;P_{2C}^\star =P_{2C}+x_C+x_M,\;P_{2C}^\diamond =P_{2C}+z_C+z_M,\;$$ with the same transformation technique.

On the other hand:

• Equation $$(4)$$ can define ellipse, parabola or hyperbola.
• Integral $$(1)$$ diverges in the hyperbolic case.
• Integral $$(1)$$ can be easily calculated in the parabolic case.
• Integral $$(1)$$ can be calculated via $$(5)$$ in the elliplic case.

• Is the form $\int_{-\infty}^\infty \int_{ax+b}^\infty e^{\large -x^2-z^2} \, \text dx\, \text dz= \pi-\frac{\pi}{2}\text{erfc}(b/\sqrt{1+a^2})$ not closed enough? Feb 17, 2021 at 20:45
• @DinosaurEgg If \;$a=b=1\;$ then LHS=0.49843, RHS=2.64316 :( Feb 17, 2021 at 21:31
• Yes I apologize for I made a mistake $\int_{-\infty}^{\infty}\int_{ax+b}^{\infty}dx dz e^{-x^2-z^2}=\frac{\pi}{2}\text{erfc}(b/\sqrt{1+a^2})$ Feb 17, 2021 at 22:17
• Thanks for your answer, tough I am not sure what you intend by $\vec v$, do you intend by the list of all constants? Also, using your substitution, you say we can solve for constants $x_D,z_D,\varphi$, where does $p_{0}$ come from ? Assuming equation (4), I dont see how that leads to equation (5), especially because we need to take into consideration the maximum function and upon your substitution (3), the integral limits are certainly non-trivial, I am not sure myself what the limits become upon substitution (3). Feb 18, 2021 at 9:11
• @TheDawg Thank you for the constructive comment. The answer is detalized. Feb 18, 2021 at 14:08