How to classify singularities and calculate residues of $f(z)=\frac{(\cos(z)-1)\sin(z)}{e^{3z}z^4(z-\pi)^2}$ How to classify singularities and calculate residues of 
$$f(z)=\frac{(\cos(z)-1)\sin(z)}{e^{3z}z^4(z-\pi)^2}$$
I have found the singularities to be $z=0,\pi$. They are both isolated. I first thought they might both be poles of order $4$ and $2$ respectively but I'm not sure that is right any more as it seems quite an ugly derivative to take to find the residue.
Any ideas of how to proceed with classifying the singularities and the figuring out the residues?
Thanks.
 A: An important notion is the algebraic order of a meromorphic function at a point.
If $f$ is meromorphic on the connected open set $U \subset \mathbb{C}$, not vanishing identically, and $z_0\in U$, then the algebraic order of $f$ at $z_0$, denoted by $\mathscr{o}_{z_0}(f)$ or $\mathscr{o}(f; z_0)$ (or similar) is defined to be the (unique) $k \in \mathbb{Z}$ such that
$$g(z) = (z - z_0)^k \cdot f(z)$$
has a removable singularity at $z_0$ and $g(z_0) \neq 0$. Sometimes one also uses $\mathscr{o}(0;z_0) := -\infty$. So the algebraic order of $f$ at $z_0$ is positive if $f$ has a pole at $z_0$, and negative if $f$ has a zero at $z_0$.
It is easily verified that the algebraic order satisfies $\mathscr{o}(f\cdot g; z_0) = \mathscr{o}(f; z_0) + \mathscr{o}(g; z_0)$ and $\mathscr{o}(f/g; z_0) = \mathscr{o}(f; z_0) - \mathscr{o}(g; z_0)$.
So to determine the algebraic order of a function that is given as a quotient of products, one can determine the order of each factor, and add (subtract for functions in the denominator).
Here, for $z_0 = 0$ we find
$$\mathscr{o}(f; 0) = \mathscr{o}(\cos z - 1; 0) + \mathscr{o}(\sin z; 0) - \mathscr{o}(e^{3z}; 0) - \mathscr{o}(z^4;0) - \mathscr{o}\bigl(z-\pi)^2;0\bigr) = -2 + (-1) - 0 - (-4) - 0 = 4 - 3 = 1.$$
Since we have a simple pole at $0$, the residue is
$$\lim_{z \to 0} z\cdot f(z) = \lim_{z \to 0} \frac{1}{e^{3z}(z-\pi)^2}\cdot \frac{\cos z - 1}{z^2} \cdot \frac{\sin z}{z} = \frac{1}{\pi^2} \cdot \biggl(-\frac{1}{2}\biggr)\cdot 1 = - \frac{1}{2\pi^2}.$$
At $z_0 = \pi$, the working is similar. In the denominator, the factor $(z - \pi)^2$ has a zero of order $2$, and in the numerator the factor $\sin z$ has a zero of order $1$, while all other factors have the algebraic order $0$ there. So altogether, $f$ has a pole of order $1$ at $\pi$, and the residue is
$$\lim_{z\to \pi} (z-\pi)\cdot f(z) = \frac{-2}{e^{3\pi}\pi^4}\lim_{z\to \pi} \frac{\sin z}{z-\pi} = \frac{2}{e^{3\pi}\pi^4}.$$
