Finding the constants for a PDE
Supposing an additional condition, for instance $U_t(0,x)=0$ we can solve the problem by using the Laplace Transform. After transforming, the problem to solve for $x$ now is
$$ s^2U(x,s)=4U_{xx}(x,s),\ \ U(0,s)=0, U\left(\frac{\pi}{2},s\right)= \frac{2}{s^2+4} $$
thus we obtain the transformed solution
$$ U(x,s) = \frac{2 e^{\frac{\pi s}{4}-\frac{s x}{2}} \left(e^{s x}-1\right)}{\left(e^{\frac{\pi s}{2}}-1\right) \left(s^2+4\right)} $$
now to invert $U(x,s)$ we use the residues at the solutions for $\left(e^{\frac{\pi s}{2}}-1\right) \left(s^2+4\right)=0$ which are $s=\{\pm 2i\}\cup\{ \pm 4i k\}, k\in \mathbb{Z}$
and the residues at $\{\pm 2i\}$ are
$$ \lim_{s\to\pm 2i}\frac{2 e^{\frac{\pi s}{4}-\frac{s x}{2}} \left(e^{s x}-1\right)}{\left(e^{\frac{\pi s}{2}}-1\right) \left(s\pm 2i\right)} $$
giving $\frac{2 \sin (x)}{s^2+4}$ and the residues at $\pm 4ik,\ \ k\in \mathbb{Z}$
$$ \lim_{s\to\pm 4ik}\frac{2 e^{\frac{\pi s}{4}-\frac{s x}{2}} \left(e^{s x}-1\right)}{\left(s^2+4\right)} $$
giving
$$ \frac{2 \sin (2 k x) (s \sin (\pi k)+4 k \cos (\pi k))}{\left(4 k^2-1\right) \left(16 k^2+s^2\right)},\ \ k\in \mathbb{Z}_{\ge 0} $$
and after inversion we have
$$ U(x,t) = \sin (2 t) \sin (x)+\sum_{k=0}^n\frac{2 \sin (2 k x) (\sin (\pi k) \cos (4 k t)+\cos (\pi k) \sin (4 k t))}{4 k^2-1} $$
Follows a plot with $n=10$