Laplace transform of the following function find the laplace transform of the function :
$$f(t) =\begin{cases}
t^2,  & 0<t<1 \\
2\cos t+2, & t>1  \\
\end{cases}$$
My attempt:
$$L\{f(t)\}=\int_{0}^{1}e^{-st} \ t^2 \ \text{d}t+\int_{1}^{\infty}e^{-st} \ (2\cos t+2) \ \text{d}t$$
Now,
$$\int_{0}^{1}e^{-st} \ t^2 \ \text{d}t=\frac{-1}{s}e^{-s}-\frac{2}{s}te^{-s}-\frac{2}{s^3}e^{-s}+\frac{2}{s^3}$$
And
$$\int_{1}^{\infty}e^{-st} \ (2\cos t+2) \ \text{d}t$$
But the integration is not stopping.
 A: Besides to @Ron's post, you can use the following fact:

If $$f(x)= \left\{
        \begin{array}{ll}
            f_1(x) & \quad 0\le x \leq a \\
            f_2(x) & \quad x \ge a
        \end{array}
    \right.$$ then it can be written as $f(x)=f_1(x)+(f_2(x)-f_1(x))u_a(x)$ in which $u_a(x)$ is step function.

Of course $\mathcal{L}(u_a(x))=\frac{e^{-as}}{s}$.
A: Integrals like $\int e^{-st}\cos(t)dt$ are circular and are handled as follows.  First set
$$F(s) = \int e^{-st}\cos(t)dt$$
Now using by parts with $u = e^{-st}$ we get
$$F(s) = e^{-st}\sin(t) + s\int e^{-st}\sin(t)dt$$
(assuming $s > 0$ for the limit).  Then do by parts again with $u = e^{-st}$ again and get
$$F(s) = e^{-st}\sin(t) + s\left(-e^{-st}\cos(t) - s\int e^{-st}\cos(t)dt\right) = e^{-st}\sin(t) -se^{-st}\cos(t) - s^2F(s)$$
So to finish solve
$$F(s) = e^{-st}\sin(t) -se^{-st}\cos(t) - s^2F(s)$$
for $F(s)$.
A: $$\begin{align} \int_1^{\infty} dt \, e^{-s t} \cos{t} &= \Re{\left [\int_1^{\infty} dt \, e^{-(s-i) t} \right ]}\\ &= \Re{\left [\frac{e^{-(s-i)}}{s-i} \right ]}\\ &= e^{-s} \Re{\left [(\cos{1}+i \sin{1}) \frac{s+i}{s^2+1}\right ]} \\ &= \frac{s \cos{1}-\sin{1}}{s^2+1} e^{-s} \end{align}$$
$$ \int_1^{\infty} dt \, e^{-s t} = \frac{e^{-s}}{s}$$
Multiply by $2$, add, done.
