Find and specify the type of all singularities 
Find and specify the type of all singularities of the function $$f(z)=\frac{(z-\frac{\pi}{2})z\sin(\frac{1}{z})}{\cos z}$$

I have some difficulties doing this
When it comes to singularities, there are $w_0:=0$ and $z_n:=\frac{\pi}{2}+n\pi$, $n\in\mathbb{Z}$
Do you have any hint for me? Should I use d'Hospital?
 A: First $z\sin(\frac{1}{z})$ has an essential singularity at $z=0$ since $z^n\cdot (z\sin(\frac{1}{z}))$ is not differentiable for any $n>0$ at that point. Regarding the rest of the expression. Notice that for $z=\frac{\pi}{2}+k\pi$ where $k\in\mathbb{Z}$, we have $\cos(z)=0$. On the other hand for $k=0$ we have both the numerator and the denominator equal to zero. Evaluating the value of the function as $z\to\frac{\pi}{2}$ we get$$\lim_{z\to\frac{\pi}{2}}f(z)=\lim_{z\to\frac{\pi}{2}}\Big(\frac{z-\frac{\pi}{2}}{\cos(z)}\cdot z\sin(\frac{1}{z})\Big)=\frac{\pi}{2}\sin(\frac{2}{\pi})\lim_{z\to\frac{\pi}{2}}\Big(\frac{z-\frac{\pi}{2}}{\cos(z)}\Big)$$$$=\frac{\pi}{2}\sin(\frac{2}{\pi})\frac{1}{\lim_{z\to\frac{\pi}{2}}\Big(\frac{\cos(z)-\cos(\frac{\pi}{2})}{z-\frac{\pi}{2}}\Big)}=\frac{\pi}{2}\sin(\frac{2}{\pi})\cdot\frac{1}{-\sin(\frac{\pi}{2})}=-\frac{\pi}{2}\sin(\frac{2}{\pi})<\infty$$
So for $z=\frac{\pi}{2}$ the function is finite. For all other $k\neq0$ we have the denominator equal to zero while the numerator a finite number different from zero and hence the function has singularities for all $z=\frac{\pi}{2}+k\pi$ where $k\in\mathbb{Z}-\{0\}$. These singularities are simple poles with residue
$$\lim_{z\to\frac{\pi}{2}+k\pi}(z-\frac{\pi}{2}-k\pi)f(z)=k\pi\Big(\frac{\pi}{2}+k\pi\Big)\sin(\frac{1}{\frac{\pi}{2}+k\pi})\cdot\lim_{z\to\frac{\pi}{2}+k\pi}\frac{z-\frac{\pi}{2}-k\pi}{\cos(z)}$$
$$=k\pi\Big(\frac{\pi}{2}+k\pi\Big)\sin(\frac{1}{\frac{\pi}{2}+k\pi})\cdot\lim_{z\to\frac{\pi}{2}+k\pi}\frac{z-\frac{\pi}{2}-k\pi}{\cos(z)-\cos(\frac{\pi}{2}+k\pi)}$$
$$=k\pi\Big(\frac{\pi}{2}+k\pi\Big)\sin(\frac{1}{\frac{\pi}{2}+k\pi})\cdot\frac{1}{-\sin(\frac{\pi}{2}+k\pi)}=k\pi\Big(\frac{\pi}{2}+k\pi\Big)\sin(\frac{1}{\frac{\pi}{2}+k\pi})(-1)^{k+1}$$ 
