\STATE [algorithmic package]

I fought with my LαTεX compiler this morning as it did not want to deal with my code:

 \begin{algorithmic}[1]
 \STATE N=1000
 \STATE $\hat\pi=0$
 \FOR {I=1,N}
 \STATE X=RDN(1), Y=RDN(1)
 \IF {$\text{X}^2+\text{Y}^2<1$}
 $\hat\pi$ = $\hat\pi +1$
 \ENDIF
 \ENDFOR
 \RETURN 4*$\hat\pi/$N
 \end{algorithmic}
 

looking on forums for incompatibilities between beamer and algorithmic, and adding all kinds of packages, to no avail. Until I realised one \STATE was missing:

 \begin{algorithmic}[1]
 \STATE N=1000
 \STATE $\hat\pi=0$
 \FOR {I=1,N}
 \STATE X=RDN(1), Y=RDN(1)
 \IF {$\text{X}^2+\text{Y}^2<1$}
 \STATE $\hat\pi$ = $\hat\pi +1$
 \ENDIF
 \ENDFOR
 \RETURN 4*$\hat\pi/$N
 \end{algorithmic}
 

(This is connected with my AMSI public lecture on simulation, obviously!)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 701 other followers