I have a particular PDE as shown below:
$$ \frac{\partial u}{\partial t} = \nu \frac{\partial^2 u}{\partial x^2} + xe^{-\gamma x} $$
with Boundary conditions as shown,
$$ \nu, \gamma >0 ~~~~1)~u(0, t) = 0 ~~~~~ 2)~u(\infty, t) = 0 ~~~~ 3)~u(x, 0) = 0 $$
I was supposed to solve this using Laplace Transform thus, I go on doing my thing as shown.
$$ sU - 0 = \nu \frac{d^2U}{dx^2} + \frac{xe^{-\gamma x}}{s} \implies \frac{d^2U}{dx^2} - \frac{s}{\nu}U = -\frac{x}{s\nu}e^{-\gamma x} $$
And the solution of this ODE is
$$ U = c_1\exp\bigg(\sqrt{\frac{s}{\nu}}x\bigg) + c_2\exp\bigg(-\sqrt{\frac{s}{\nu}}x\bigg) + \frac{e^{-\gamma x}}{s}\bigg[ \frac{x}{s-\gamma^2\nu} - \frac{2\gamma \nu}{(s-\gamma^2\nu)^2} \bigg] $$
We already used BC3 initially. Now from, BC2 we would get, $c_1 = 0$. And Now from BC1 we would finally get our solution in Laplace domain as,
$$ U = \frac{2\gamma \nu}{s(s-\gamma^2\nu)^2}\bigg[ \exp\bigg(-\sqrt{\frac{s}{\nu}}x\bigg) - \exp(-\gamma x) \bigg] + \frac{xe^{-\gamma x}}{s(s-\gamma^2\nu)}$$
The answer that was mentioned by the author of the problem was not even close to the above. It was as shown.
$$ u(x, t) = \int_0^td\tau\int_0^{\infty}\xi e^{-\gamma \xi}G(x, \xi, t - \tau) d\xi $$
Where, G is the time-dependent Green's function defined as shown
$$ G(x, \xi, t) = \frac{1}{\sqrt{4\pi \nu t}}\bigg[ e^{-(x-\xi)^2/4\nu t} - e^{-(x+\xi)^2/4\nu t}\bigg]$$
The difference in Answer is so big, that I don't even understand where to start. I am starting to question whether my solution derived is correct or not.
The solution in s-domain must be inverted
$$U(x,s)=e^{-x \sqrt{\frac{s}{\nu }}} \frac{2 \gamma \nu}{s \left(s-\gamma ^2 \nu \right)^2}-\frac{2 \gamma \nu e^{-\gamma x}}{s \left(s-\gamma ^2 \nu \right)^2}+\frac{x e^{-\gamma x}}{s \left(s-\gamma ^2 \nu \right)}$$
The first summand is the most complicated so we separate 2 factors
$$f(x,t)=\mathcal{L}_s^{-1}\left[e^{-x \sqrt{\frac{s}{\nu }}}\right](t)=\frac{\nu x e^{-\frac{x^2}{4 \nu t}}}{2 \sqrt{\pi } \sqrt{\nu ^3 t^3}}$$
$$g(t)=\mathcal{L}_s^{-1}\left[\frac{2 \gamma \nu }{s \left(s-\gamma ^2 \nu \right)^2}\right](t)=\frac{2 \left(e^{\gamma ^2 \nu t} \left(\gamma ^2 \nu t-1\right)+1\right)}{\gamma ^3 \nu }$$
With the convolution theorem we get
$$u_1(x,t)=(f*g)(t)=\int_0^{t} f(x,\tau)\cdot g(t-\tau)\ d\tau= \int_0^{t} \frac{x e^{-\frac{x^2}{4 \nu \tau }} \left(e^{\gamma ^2 \nu (t-\tau )} \left(\gamma ^2 \nu (t-\tau )-1\right)+1\right)}{\sqrt{\pi } \gamma ^3 \sqrt{\nu ^3 \tau ^3}} d\tau$$
Mathematica is able so solve the integral
$$u_1(x,t)=\frac{\frac{t^{3/2} \left(e^{\gamma (\gamma \nu t-x)} \left(-\left(\left(-2 \gamma ^2 \nu t+\gamma x+2\right) \text{erf}\left(\frac{2 \gamma \nu t-x}{2 \sqrt{\nu t}}\right)\right)-\left(2 \gamma ^2 \nu t+\gamma x-2\right) \left(e^{2 \gamma x} \text{erf}\left(\frac{2 \gamma \nu t+x}{2 \sqrt{\nu t}}\right)-e^{2 \gamma x}+1\right)\right)-4 \text{erf}\left(\frac{x}{2 \sqrt{\nu t}}\right)\right)}{\sqrt{\frac{t^3}{\nu }}}+4 \sqrt{\nu } \left(\left(\gamma ^2 \nu t-1\right) e^{\gamma (\gamma \nu t-x)}+1\right)}{2 \gamma ^3 \nu ^{3/2}}$$
Now we invert the remaining 2 summands
$$u_2(x,t)=\mathcal{L}_s^{-1}\left[\frac{x e^{-\gamma x}}{s \left(s-\gamma ^2 \nu \right)}-\frac{2 \gamma \nu e^{-\gamma x}}{s \left(s-\gamma ^2 \nu \right)^2}\right](t)=\frac{e^{-\gamma x} \left(e^{\gamma ^2 \nu t} \left(-2 \gamma ^2 \nu t+\gamma x+2\right)-\gamma x-2\right)}{\gamma ^3 \nu }$$
Finally
$$u(x,t)=u_1(x,t)+u_2(x,t)=\frac{1}{2 \gamma ^3 \nu ^{3/2}}\left(\frac{t^{3/2} \left(e^{\gamma (\gamma \nu t-x)} \left(-\left(\left(-2 \gamma ^2 \nu t+\gamma x+2\right) \text{erf}\left(\frac{2 \gamma \nu t-x}{2 \sqrt{\nu t}}\right)\right)-\left(2 \gamma ^2 \nu t+\gamma x-2\right) \left(e^{2 \gamma x} \text{erf}\left(\frac{2 \gamma \nu t+x}{2 \sqrt{\nu t}}\right)-e^{2 \gamma x}+1\right)\right)-4 \text{erf}\left(\frac{x}{2 \sqrt{\nu t}}\right)\right)}{\sqrt{\frac{t^3}{\nu }}}+4 \sqrt{\nu } \left(\left(\gamma ^2 \nu t-1\right) e^{\gamma (\gamma \nu t-x)}+1\right)+2 \sqrt{\nu } e^{\gamma (-x)} \left(e^{\gamma ^2 \nu t} \left(-2 \gamma ^2 \nu t+\gamma x+2\right)+\gamma (-x)-2\right)\right.$$
Visualize $u(x,t)$ with $\gamma=1,\nu=1$
Addendum
If you want to evaluate $u(x,t)$ at higher $t$ values, you'll need higher working precision, let's say $\ge 30$ digits.
You may use the python mpmath library.
$u1= 0.085508458409477041667594945072565843650674779347076$