# Calculation of the integral (triangular function)

The following function f(t) could be used as a window function in Fourier transform. I would like to ask your help to see the intermediate steps(where the ???? are) of calculation of the following integral. Moreover, Q(W) makes it confusing for me to compute the integral. \begin{align} f(t)=trig(t) = \frac{1}{π}\int_{0}^{ω}Q(W)cos(Wt) dW\ =????=\frac{1}{πωt^2}(1-cos(ωt) ) \end{align}

where Q(W) = \begin{align}\begin{cases} 1-\left(\biggl\vert\frac{W}{\omega}\biggl\vert \right) & - \omega \leq W \leq \omega \\ 0 & \textrm{ otherwise} \end{cases} \end{align}

W = variable,

$$\omega$$ = constant

(Disclaimer: i do not know how to write properly Q(W) as a piece-wise function using Mathjax)

Since $$0\leq W\leq\omega$$ in $$\frac1\pi\int_0^\omega Q(W)\cos(Wt)\,\mathrm{d}W$$, we have $$Q(W)=1-W/\omega$$ and so it is just an integration by parts: \begin{align*} &\frac1\pi\int_0^\omega Q(W)\cos(Wt)\,\mathrm{d}W\\ &=\frac1\pi\int_0^\omega \left(1-\frac{W}\omega\right)\cos(Wt)\,\mathrm{d}W\\ &=\frac1\pi\left[\left(1-\frac{W}\omega\right)\frac1t\sin(Wt)\right]_{W=0}^{W=\omega} -\frac1\pi\int_0^\omega-\frac1{\omega t}\sin(Wt)\,\mathrm{d}W\\ &=\frac1{\pi\omega t}\int_0^\omega\sin(Wt)\,\mathrm{d}W\\ &=\frac1{\pi\omega t}\left[-\frac{\cos(Wt)}t\right]_{W=0}^{W=\omega}=\frac1{\pi\omega t^2}(1-\cos \omega t) \end{align*}