# How can I express this solution in terms of the error function?

If I have this expression:

$$u(x,t) = \frac {U_o}{\pi} \int_{-\infty}^{\infty} \!\frac{\sin(\alpha) \cos(\alpha x) e^{-k\alpha^2 t}}{\alpha} \,d\alpha,$$ how can I rewrite it in terms of the error function ?

The is a solution to the following equation using Fourier transform $$k \frac {\partial^2 u }{\partial x^2} = \frac{\partial u}{\partial t}$$ whit this initial conditions $$\infty < x < \infty ; t>0$$ $$u (x,0) = f(x) \hspace{3mm} \text{where} \hspace{3mm} f(x) = U_o, |x| < 1 ; f(x) = 0, |x| > 1.$$

Define $$I(b,x):=\int_{-\infty}^\infty \frac{du}{u} \sin(u) \cos(x\,u)\,e^{-b u^2}$$ where in the problem statement $$b=k\,t.$$ Then $$\frac{d}{dx} I(b,x) = -\int_{-\infty}^\infty du \sin(u) \cos(x\,u)\,e^{-b u^2} = \frac{1}{2}\int_{-\infty}^\infty du \Big(\cos(u(x+1))-\cos(u(x-1))\Big)e^{-b u^2}$$ where a trig ID has been used in the second step. Use a CAS or an integral table to find the well-known $$\int_{-\infty}^\infty du \cos(a\,u)e^{-b u^2} = \sqrt{\frac{\pi}{b}}\exp{\big(-\dfrac{a^2}{4b} \,\big) }$$ Thus $$\frac{d}{dx} I(b,x) = \frac{1}{2} \sqrt{\frac{\pi}{b}} \Big(\exp{\big(-\dfrac{(x+1)^2}{4b} \,\big) } - \exp{\big(-\dfrac{(x-1)^2}{4b} \,\big) } \Big)$$
It is well-known that the indefinite integral $$\int \exp{\big(-\dfrac{(x+c)^2}{4b} \big)} \,dx=\sqrt{\pi \, b}\, \text{erf} \big(\frac{x+c}{2\sqrt{b}} \big)$$ Integrating the penultimate equation therefore gives us $$I(b,x)=\frac{\pi}{2} \Big( \text{erf} \big(\frac{x+1}{2\sqrt{b}} \big) - \text{erf} \big(\frac{x-1}{2\sqrt{b}} \big) \Big) + \kappa(b)$$ where the constant may depend on $$b$$ but not $$x.$$ However, letting $$b \to \infty$$ in the definition implies the constant is 0 because erf($$\,0 \,$$)=1. This answer is the same as that which Claude Leibovici presented, but hopefully the derivation provides insight into why there are two terms, and why the arguments are such as they are.
Under the conditions $$(\Re(k)\neq 0\lor k\notin \mathbb{R})\land \Re(k t)>0$$, a CAS produced $$\int_{-\infty}^{\infty} \!\frac{\sin(\alpha) \cos(\alpha x) e^{-k\alpha^2 t}}{\alpha} \,d\alpha=\frac{1}{2} \pi \left(\text{erf}\left(\frac{x+1}{2 \sqrt{k t}}\right)-\text{erf}\left(\frac{x-1}{2 \sqrt{k t}}\right)\right)$$