As part of a drawing that will go with an explanation of diffraction, I want to draw the "outer rays" of a beam of light and draw several rays in between. An MWE of how I'm going about this is shown below:
\documentclass{standalone}
\usepackage{pgfplots,tikz}
\usetikzlibrary{calc}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}[scale=1]
\draw[black,semithick] (-3,1) -- (0,1);
\draw[black,semithick] (-3,-1) -- (0,-1);
\def \n {10}
\foreach \s in {1,...\n-1}
{
\draw[lightgray,semithick] ($(-3,1)!\s/\n!(-3,-1)$) -- ($(0,1)!\s/\n!(0,-1)$);
}
\end{tikzpicture}
\end{document}
This gives me the following error:
Runaway argument?
\pgffor@stop \pgffor@@stop \expandafter \pgffor@dots@charcheck \pgffor@dotsvalue \ETC.
! File ended while scanning use of \pgffor@dots@stripcontext.
The pgffor@dots stuff makes me suspect the problem might lie in the range specification for \s but as far as I can tell there's nothing wrong with it. Can anyone enlighten me?

1,...\n-1but that arithmetic also won't work. Use\foreach \s in {1,...,\number\numexpr\n-1}– percusse May 13 '15 at 14:15