I am attempting to wrap document text around the equation below using the following code.
\begin{wrapfigure}{left}{0pt}
$$ \begin{aligned}
\sum\limits_{i=0}^{15} \frac{\cos{\frac{(2i+17)\pi}{32}}}{\frac{(2i+17)\pi}{32}}\frac{\pi}{16} &= \sum\limits_{i=0}^{15} \frac{\cos{\left(\frac{(2i+17)\pi}{32}\right)}\cdot \cancelto{2}{32}}{(2i+17)\cancel{\pi}}\frac{\cancel{\pi}}{\cancel{16}} \\
&= \sum\limits_{i=0}^{15}\frac{2\cos{\frac{(2i+17)\pi}{32}}}{2i+17}.
\end{aligned} $$
\end{wrapfigure}
However, when I compile the document, I receive errors "\begin{align} only allowed in math environment" and "missing $ inserted." I've tried using equation*, as I've seen it used in the wrapfigure environment (here), but none of them will give me multiline equations.
I'm using Overleaf with the pdfLaTeX compiler, and the document still compiles and actually displays correctly, but I'm not sure why the error is there.
P.S. I apologize if my formatting is poor, this is my first Tex.SE, and if my question has a very simple answer, I am very new to LaTeX.
