[pstricks] graph like-Thomae function
Hamed Al-Sulami
hhaalsalmi at kau.edu.sa
Sat Sep 24 23:27:44 CEST 2011
Hi all,
I try to imetate the code for Thomae function to graph like Thomae function
F(p/q)=sin(1/sqrt(q)).
What I got does not look right and I'm not sure what did I do wrong.
Here is my try
\documentclass{article}
\usepackage{pstricks-add}
\usepackage{multido}
\makeatletter
\def\psThomae{\pst at object{psThomae}}
\def\psThomae at i(#1,#2)#3{%
\addbefore at par{dotsize=1pt}
\begin at ClosedObj
\addto at pscode{
1 1 #3 {
dup
/ipSave ED % save loop value
/ip ED % dito
1 1 #3 {
dup
/iqSave ED % sabve loop value
/iq ED % dito
{
iq 0 le { exit } if
ip iq mod
/ip iq def
/iq ED
} loop
ip 1 eq {
/xVal ipSave iqSave div def
xVal #1 ge { xVal #2 le {
\psk at dotsize
\@nameuse{psds@\psk at dotstyle}
\pst at usecolor\pslinecolor xVal 1 iqSave sqrt div RadtoDeg sin
\tx at ScreenCoor
2 copy moveto Dot } if } if
} if
} for
} for
}%
\end at ClosedObj%
}
\makeatother
\begin{document}
\begin{center}
\psset{unit=4cm,dotsize=1pt 0}
\begin{pspicture}(2.5,1.5)
\psaxes{->}(0,0)(2.5,1.5)
\psThomae(0,2){300}
\end{pspicture}
\end{center}
\end{document}
Thanks a lot
--
Regards,
Hamed Al-Sulami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20110925/4ecf469d/attachment.html>
More information about the PSTricks
mailing list