How can I integrate the following? By the way a and b are just contants.
$$\int e^{-(x-a)^2} \cos(bx) \, dx$$
How can I integrate the following? By the way a and b are just contants.
$$\int e^{-(x-a)^2} \cos(bx) \, dx$$
On
Hint: assuming $a,\,b\in\Bbb R$, the integrand is$$\Re\exp[-x^2+(2a+ib)x-a^2]=\exp(b^2/4)\Re\left(\exp(iab)\exp[-(x-a-ib/2)^2]\right).$$Now substitute $y=x-a-ib/2$, then write the integral in terms of the error function.
There are a few ways of doing this: $$I=\int e^{-(x-a)^2}\cos(bx)dx\tag{1}$$ we can introduce the substitution $u=x-a\Rightarrow dx=du$ to get: $$I=\int e^{-u^2}\cos(bu+ab)du\tag{2}$$ now we can try and split this cosine up: $$\cos(bu+ab)=\cos(bu)\cos(ab)-\sin(bu)\sin(ab)$$ now let us define the following: $$I=\cos(ab)I_1-\sin(ab)I_2\tag{3}$$ $$I_1=\int e^{-u^2}\cos(bu)du\tag{4}$$ $$I_2=\int e^{-u^2}\sin(bu)\tag{5}$$ now we will define a new integral: $$J=I_1+jI_2=\int e^{-u^2}e^{bju}du$$ then combine it and express it that way.
Alternatively you could say: $$I=\int e^{-(x-a)^2}\cos(bx)dx=\Re\int e^{-(x-a)^2+ibx}dx$$ $$=\Re\int e^{-\left[x^2-(2a+ib)x+a^2\right]}dx=\Re\int e^{-\left[(x+(a+ib/2))^2+(iab-b^2/4)\right]}dx$$ Or you could try integration by parts, I feel like whichever way you do it could be quite messy