How to integrate $Ae^{-\frac{y^2}{B}}\cdot \cos^2\left(\frac{2\pi }{L}y\right)$?

84 Views Asked by At

I have the following function,

$$\psi (y)=Ae^{-\frac{y^2}{B}}\cdot \cos^2\left(\frac{2\pi }{L}y\right)$$

and need to find the indefinite integral:

$$\int \:\psi\left(y\right)\:dy$$

I can integrate each term seperately, for example with the first term:

$$ \begin{split} \int \:Ae^{-\frac{y^2}{B}}\:dy&= A\:\int \:e^{-\left(\frac{y}{\sqrt{B}}\right)^2}\:dy\\ &=A\sqrt{B}\:\int \:e^{-u^2}\:du\\ &=A\sqrt{B}\:\cdot \frac{\sqrt{\pi }}{2}\operatorname{erf}\left(u\right)+C\\ &=A\sqrt{B}\:\cdot \frac{\sqrt{\pi }}{2}\operatorname{erf}\left(\frac{y}{\sqrt{B}}\right)+C\\ \end{split} $$

However, I can't seem to figure out how to integrate the whole function. I would be grateful if anyone could lend me a hand with this.

1

There are 1 best solutions below

3
On BEST ANSWER

First step: reduce the power of cosine.

Since $$\cos^2 x=\frac{1+\cos{(2x)}}{2}$$ the integral becomes $$ \begin{split} I &= \int A e^{-\frac{y^2}{B}}\left(\frac{1+\cos{\left(\frac{4\pi y}{L}\right)}}{2} \right) \operatorname{d}y\\ &=\frac{A}{2} \left[\int e^{-\frac{y^2}{B}} \operatorname{d}y+ \int e^{-\frac{y^2}{ B}} \cos{\left(\frac{4\pi y}{L}\right)} \operatorname{d}y \right] \\ &=\frac{A}{2} \left[\frac{\sqrt{B\pi}}{2} \operatorname{erf}\left(\frac{y}{\sqrt B}\right)+ \int e^{-\frac{y^2}{B}} \cos{\left(\frac{4\pi y}{L}\right)} \operatorname{d}y \right]\\ \end{split} $$

Second step: transform the cosine into the exponential form

Let $$ J_{\alpha,\beta} =\int e^{-\alpha y^2} \cos{(\beta y)} \operatorname{d}y $$

For the Euler's formula we have $$ \cos(\beta y) = \frac{e^{\operatorname{i}\beta y} + e^{-\operatorname{i}\beta y}}{2} $$ where $\operatorname{i}$ is the imaginary unit ($\operatorname{i}^2=-1$). Therefore $$ J_{\alpha,\beta}=\int e^{-\alpha y^2} \cos{(\beta y)} \operatorname{d}y =\frac{1}{2}\int e^{-\alpha y^2+i\beta y} \operatorname{d}y +\frac{1}{2}\int e^{-\alpha y^2-i\beta y} \operatorname{d}y $$

Third step: Solve generalized gaussian integral. For the solution we requires to solve $$ \int e^{-(ax^2+bx)} \operatorname d x $$ completing the square we get $$ ax^2+bx = (\sqrt{a}x)^2+bx+\frac{b^2}{4a}- \frac{b^2}{4a} = \left(\sqrt{a}x+\frac{b}{2\sqrt{a}}\right)^2 + \frac{b^2}{4a} $$

So the integral became $$ \begin{split} \int e^{-\left(\sqrt{a}x+\frac{b}{2\sqrt{a}}\right)^2 - \frac{b^2}{4a}} \operatorname d x &= e^{-\frac{b^2}{4a}} \int e^{-\left(\sqrt{a}x+\frac{b}{2\sqrt{a}}\right)^2 } \operatorname d x \\ &= \frac{1}{\sqrt a} e^{-\frac{b^2}{4a}} \int e^{-z^2} \operatorname d z \\ &= \frac{1}{\sqrt a} \frac{\sqrt\pi}{2} e^{-\frac{b^2}{4a}}\operatorname{erf}(z) \\ &= \frac{1}{2} \sqrt{\frac{\pi}{a}}e^{-\frac{b^2}{4a}}\operatorname{erf} \left(\sqrt a x + \frac{b}{2 \sqrt a} \right) \end{split} $$ when we used the substitution $z = \sqrt a x + \frac{b}{2 \sqrt a} $, $\operatorname dx = \frac{1}{\sqrt a} \operatorname d y$.

Now in our case $\alpha = a$ and $b = \pm i \beta$ (hence $b^2 = -\beta^2$), so we get $$ J_{\alpha,\beta}=\frac{1}{4} \sqrt{\frac{\pi}{\alpha}}e^{\frac{\beta^2}{4\alpha}}\left[\operatorname{erf} \left(\sqrt \alpha x - \operatorname i\frac{\beta}{2 \sqrt \alpha} \right)+\operatorname{erf} \left(\sqrt \alpha x + \operatorname i\frac{\beta}{2 \sqrt \alpha} \right)\right] $$ In our case $\alpha = \frac{1}{B}$ and $\beta = \frac{4 \pi }{L} $, so $$ \begin{split} \int e^{-\frac{y^2}{B}} \cos{\left(\frac{4\pi y}{L}\right)} \operatorname{d}y &= \frac{1}{4} \sqrt{B\pi}e^{\frac{B\left(\frac{4 \pi }{L}\right)^2}{4}}\left[\operatorname{erf} \left(\frac{x}{\sqrt{\frac{4 \pi }{L}}} - \operatorname i\frac{4 \pi \sqrt B}{2L} \right)+\operatorname{erf} \left(\frac{x}{\sqrt{\frac{4 \pi }{L}}} + \operatorname i\frac{4 \pi \sqrt B}{2L} \right)\right] \\ &=\frac{1}{4} \sqrt{B\pi}e^{\frac{4B\pi}{L^2}}\left[\operatorname{erf} \left(\sqrt{\frac{L}{\pi}}\frac{x}{2} - \operatorname i\frac{2 \pi \sqrt B}{L}\right)+\operatorname{erf} \left(\sqrt{\frac{L}{\pi}}\frac{x}{2} + \operatorname i\frac{2 \pi \sqrt B}{L} \right)\right] \\ \end{split}$$

Finally, the results is

$$ \boxed{I = \frac{A\sqrt{B\pi}}{8} \left\{ 2\operatorname{erf}\left(\frac{y}{\sqrt B}\right) + e^{\frac{4B\pi}{L^2}}\left[\operatorname{erf} \left(\sqrt{\frac{L}{\pi}}\frac{x}{2} - \operatorname i\frac{2 \pi \sqrt B}{L} \right)+\operatorname{erf} \left(\sqrt{\frac{L}{\pi}}\frac{x}{2} + \operatorname i\frac{2 \pi \sqrt B}{L} \right)\right] \right\}\\+C} $$

PS: I'm not sure about this, because Wolfram Alpha returns other solution.