I need to find the laurent series and the residue of the following complex function $$f(z)=(z+1)^2e^{3/z^2}$$ at $z=0$.
Since $e^z=\sum z^n/n!$, then $$e^{3/z^2}=\sum_{n=0}^\infty \frac{3^n/n!}{z^{2n}}$$ thus $$f(z)=(z^2+2z+1)\sum_{n=0}^\infty \frac{3^n/n!}{z^{2n}}=\sum_{n=0}^\infty \frac{3^n/n!}{z^{2(n-1)}}+\sum_{n=0}^\infty \frac{2\cdot3^n/n!}{z^{2n-1}}+\sum_{n=0}^\infty \frac{3^n/n!}{z^{2n}}$$ which, with a shift of index and expansion of positive powers, can be expressed as $$f(z)=z^2+3+\sum_{n=1}^\infty\left(\frac{3}{n+1}+1\right)\frac{3^n/n!}{z^{2n}}+\sum_{n=1}^\infty\frac{2\cdot3^n/n!}{z^{2n-1}}$$ so the residue is given by evaluating the numerator of the second series at $n=1$, so its value is $6$. I tried using WolframAlpha and Mathematica to check my answer, but both would not return a value. Would this be correct? Also, is there a way to put the two sums together (one gives the coefficients of even powers, while the other of the odd) so I can have the principal part of the laurent series expressed only with one sum?
Expanding $f$ into a Laurent series at $z=0$ we obtain \begin{align*} \color{blue}{f(z)}&\color{blue}{=(z+1)^2e^{3/z^2}}\\ &=(z^2+2z+1)\sum_{n=0}^\infty \frac{3^n}{n!}\frac{1}{z^{2n}}\\ &=\sum_{n=0}^\infty \frac{3^{n}}{n!}\frac{1}{z^{2n-2}} +2\sum_{n=0}^\infty \frac{3^n}{n!}\frac{1}{z^{2n-1}} +\sum_{n=0}^\infty \frac{3^n}{n!}\frac{1}{z^{2n}}\\ &=\sum_{n=-1}^\infty \frac{3^{n+1}}{(n+1)!}\frac{1}{z^{2n}} +2\sum_{n=-1}^\infty \frac{3^{(n+1)}}{(n+1)!}\frac{1}{z^{2n+1}} +\sum_{n=0}^\infty \frac{3^n}{n!}\frac{1}{z^{2n}}\\ &\color{blue}{=z^2+2z+\sum_{n=0}^\infty\frac{3^n}{n!}\left(\frac{3}{n+1}+1\right)\frac{1}{z^{2n}} +2\sum_{n=0}^\infty \frac{3^{(n+1)}}{(n+1)!}\frac{1}{z^{2n+1}}}\tag{1}\\ &=z^2+2z+\sum_{m=0}^\infty\frac{3^{\frac{m}{2}}}{(\frac{m}{2})!}\left(\frac{3}{\frac{m}{2}+1}+1\right)\frac{1+(-1)^m}{2}\frac{1}{z^{m}}\\ &\qquad+2\sum_{m=0}^\infty \frac{3^{(\frac{m-1}{2}+1)}}{(\frac{m-1}{2}+1)!}\cdot\frac{1-(-1)^m}{2}\frac{1}{z^{m}}\\ &=z^2+2z+\sum_{m=0}^\infty\left(\frac{3^{\frac{m}{2}}}{2(\frac{m}{2})!}\left(\frac{m+8}{m+2}\right)\left(1+(-1)^m\right)\right.\\ &\qquad\qquad\qquad\qquad\quad\left.+ \frac{3^{\frac{m+1}{2}}}{\left(\frac{m+1}{2}\right)!}\left(1-(-1)^m\right)\right)\frac{1}{z^{m}}\tag{2} \end{align*}
We observe that putting all terms together as in (2) is rather cumbersome and the representation in (1) seems to be more convenient. It clearly shows the terms for odd and even powers and we can also easily derive from (1) the residue by inspecting the right-most sum in (1) with $n=0$.