0

I wanted to write down an equation however it seems that whenever I use \pi I keep on getting Missing $ inserted error Here is my code:

$u_k = 2\cos(2^kr\pi)$
\subsection{Create an equation for $u\textsubscript{k+1}$  using $u_k$}
$u_k = 2 \times  \Re(e\textsuperscript{2ir$\pi$ })$ 
\\
$u\textsubscript{k+1}
=  2 \times \Re(e\textsuperscript{2\textsuperscript{k+1}ir\pi })
= 2 \times \Re(e\textsuperscript{2\superscript{k}ir\pi }\textsuperscript{2})
\Leftrightarrow
\\ 
2 \times( \cos^2(2^kr\pi ) - \sin^2(2^kr\pi ) )= 4\cos^2(2^kr\pi ) - 2$

Here of a few of my many errors:

! Missing $ inserted.
<inserted text> 
                $
l.125 ...superscript{2\textsuperscript{k+1}ir\pi }
                                                  )
? 
! Extra }, or forgotten $.
\mbox  #1->\leavevmode \hbox {#1}
                                 
l.125 ...superscript{2\textsuperscript{k+1}ir\pi }
                                                  )
? 

Just in case it matters I'm using the amsmath package.

Thanks

5
  • 2
    Welcome. For superscripts in math mode there is ^: e^{2^{k+1}ir\pi} is the correct code. Similarly $u_{k+1}$ for subscripts.
    – egreg
    Aug 17, 2020 at 16:54
  • Hmm, It doesn't seem to work. The errors are excactly the same.
    – scaraven
    Aug 17, 2020 at 17:05
  • 1
    Fix \Re(e\textsuperscript{2ir$\pi$ }) into \Re(e^{2ir\pi})
    – egreg
    Aug 17, 2020 at 17:13
  • Thanks it works now.
    – scaraven
    Aug 17, 2020 at 17:20
  • \textsuperscript is for when you're in text mode, and what's inside is also in text mode.
    – Teepeemm
    Aug 17, 2020 at 17:44

1 Answer 1

2

I supposed it is something like this you're trying to obtain:

\documentclass{article}%
\usepackage{nccmath, mathtools}
\usepackage{amssymb} 
\begin{document}

$u_k = 2\cos(2^kr\pi)$
\subsection{Create an equation for \boldmath $u_{k+1}$ using $u_k$}
\begin{fleqn}
 \begin{alignat*}{2}
  u_k = {}& 2 \times \Re(e^{2ir\pi}) & & \\
u_{k+1}={} & 2 \times \Re(e^{2^{k+1}ir\pi }) = 2 \times \Re(e^{2^{k}ir\pi^{2}}) & & \\[-1ex]
\ArrowBetweenLines*[\Updownarrow]
 & 2 \times( \cos^2(2^kr\pi ) - \sin^2(2^kr\pi ) )= 4\cos^2(2^kr\pi ) - 2
\end{alignat*}
\end{fleqn}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.