[pstricks] Large numbers in double multido and memory problems

Herbert Voss Herbert.Voss at fu-berlin.de
Sun Nov 11 13:28:18 CET 2007


Poul Riis schrieb:
> How can I increase the number of points in the double slit interference
> pattern below without getting memory problems?
> Any other improvements will be appreciated, too...

define _always_ Macros, which let the calculating done
by PostScript and not TeX.

Herbert

\documentclass{article}
\usepackage[x11names]{xcolor}
\usepackage{pstricks-add}
\usepackage{geometry}
\makeatletter
\def\psSlit{\pst at object{psSlit}}
\def\psSlit at i#1#2{%
   \begin at SpecialObj
   \addto at pscode{
     1 1 #1 {
       /x1 ED
       1 1 #2 {
         /x2 ED
	/r1 x1 dup mul x2 35 sub dup mul add sqrt def
	/r2 x1 dup mul x2 15 sub dup mul add sqrt def
	r1 10 div 360 mul sin r2 10 div 360 mul sin add 2
	add 75 mul 379 add dup /lambda exch def
	tx at addDict begin wavelengthToRGB Red Green Blue end setrgbcolor
         x1 x2 1 0 360 arc gsave fill grestore stroke
       } for
     } for
   }%
   \end at SpecialObj}
\makeatother


\begin{document}
\psset{unit=1pt}
\begin{pspicture}(0,0)(60,50)
   \psSlit{50}{60}
\end{pspicture}
%
\begin{pspicture}(0,0)(120,100)
   \psSlit{100}{120}
\end{pspicture}

\end{document}





More information about the PSTricks mailing list