[Tex/LaTex] Undefined control sequence for {align*}

align

Could someone tell me what have I done wrong here. I keep looking but seems I cannot find the mistake:

\begin{align*}
a_n=\frac{L}{n^2\pi^2}(sin(\frac{4n\pi}{10})
-\frac{4n\pi}{10}cos(\frac{4n\pi}{10})+
\\frac{2L}{3n^2\pi^2}(-n\picos(n\pi)-sin(\frac{4n\pi}{10}
+\frac{4n\pi}{10} cos(\frac{4n\pi}{10}))
+\frac{2L}{3n^2\pi^2}(-cos(n\pi)
+cos(\frac{4n\pi}{10}))
\end{align*}

so when I want to build it, it keeps telling me "Undefined control sequence "

All the previous code worked fine before I typed this

Best Answer

In addition to inserting a space after \pi in "\picos" and changing \\frac to \\ \frac, you should also change all instances of sin and cos to \sin and \cos, respectively, and insert an additional line break. Since you're using an align* environment, do provide suitable alignment points ("&") in all three rows. You should also enlarge the sizes of most (but not all) round parentheses. A separate issue: some parentheses appear have gone AWOL and need to be (re)supplied. Finally, to improve legibility and parsability of the expression, consider replacing the "outer" round parentheses with square brackets.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "align*" environment
\begin{document}
\begin{align*}
a_n &= \frac{L}{n^2\pi^2}\Bigl[\sin\Bigl(\frac{4n\pi}{10}\Bigr)
-\frac{4n\pi}{10}\cos\Bigl(\frac{4n\pi}{10}\Bigr)\Bigr]\\
&\quad+ \frac{2L}{3n^2\pi^2}\Bigl[-n\pi \cos(n\pi)
-\sin\Bigl(\frac{4n\pi}{10}\Bigr)
+\frac{4n\pi}{10} \cos\Bigl(\frac{4n\pi}{10}\Bigr)\Bigr]\\
&\quad+ \frac{2L}{3n^2\pi^2}\Bigl[-\cos(n\pi)
+\cos\Bigl(\frac{4n\pi}{10}\Bigr)\Bigr]
\end{align*}
\end{document}