I've completed problem #2 on the sample problems handout. I was wondering if someone could confirm the solution, so I could make sure I'm doing things right.
Given: $\phi(x)=2$ if $|x|\leq 3$, or $\phi(x)=0$ otherwise (I couldn't figure out how to format the array for the piecewise function), express the solution to the heat problem $u_t=u_{xx}, u(x,0)=\phi(x)$ in terms of the error function.
Setting up the solution,
$$u(x,t)=\int_{-\infty}^\infty \phi(y)G(x-y,t)\ dy$$
Plugging in the bounds given by the $\phi$ function and using the heat kernel,
$$u(x,t)=\int_{-3}^3 2\frac{1}{\sqrt{4\pi k t}}e^{-\frac{(x-y)^2}{4kt}}\ dy$$
$$u(x,t)=\int_{-3}^3 2\frac{1}{\sqrt{4\pi k t}}e^{-\left(\frac{x-y}{2\sqrt{kt}}\right)^2}\ dy$$
Making the u-substitution requires the following:
$$u=\frac{x-y}{2\sqrt{kt}}$$
$$du=-\frac{1}{2\sqrt{kt}}\ dy$$
$$-2\sqrt{kt}\ du=dy$$
Also, the new bounds of integration will be $u=\frac{x+3}{2\sqrt{kt}}$ and $u=\frac{x-3}{2\sqrt{kt}}$ for $y=-3$ and $y=3$, respectively. Plugging all this in gives me:
$$u(x,t)=\int_{\frac{x+3}{2\sqrt{kt}}}^{\frac{x-3}{2\sqrt{kt}}} \frac{2}{\sqrt{4\pi k t}}e^{-u^2}\ (-2\sqrt{kt})\ du$$
Simplifying the integral in terms of the error function reduces the integral to this:
$$u(x,t)= \frac{-4\sqrt{kt}}{\sqrt{4\pi k t}} \int_{\frac{x+3}{2\sqrt{kt}}}^{\frac{x-3}{2\sqrt{kt}}}e^{-u^2}\ du=-\frac{2}{\sqrt{\pi}} \int_{\frac{x+3}{2\sqrt{kt}}}^{\frac{x-3}{2\sqrt{kt}}} e^{-u^2}\ du=\frac{2}{\sqrt{\pi}} \int_{\frac{x-3}{2\sqrt{kt}}}^{\frac{x+3}{2\sqrt{kt}}} e^{-u^2}\ du$$
The last step gives the integral in terms of the error function, which can be written as:
$$u(x,t)=erf\left(\frac{x+3}{2\sqrt{kt}}\right)-erf\left(\frac{x-3}{2\sqrt{kt}}\right)$$