[pstricks] Thomae's Function

Michael Hallgren m.hallgren at free.fr
Sun Jun 8 18:51:40 CEST 2008


Le dimanche 08 juin 2008 à 14:25 +0000, Juergen Rose a écrit :
> On So, 2008-06-08 at 11:19 +0200, Jean-Côme Charpentier wrote:
> > Herbert Voss a écrit :
> > > sebastian perez schrieb:
> > > 
> > >> I'd like to know if it is possible to use pstricks to make the graph of Thomae's function
> > >>
> > >>
> > >> http://en.wikipedia.org/wiki/Thomae's_function
> > > 
> > > 
> > > not yet possible
> > 
> > ... with a direct way. Otherwise, we can cheat :-)
> > 
> > \documentclass{article}
> > \usepackage{pstricks-add}
> > \usepackage{multido}
> > 
> > \makeatletter
> > \newcommand\IfRelPrime[4]{%
> >   \def\reserved at a{#1}%
> >   \def\reserved at b{#2}%
> >   \loop\ifnum\reserved at b>0
> >     \pst at mod\reserved at a\reserved at b\reserved at c
> >     \let\reserved at a\reserved at b
> >     \let\reserved at b\reserved at c
> >   \repeat
> >   \ifnum\reserved at a=1
> >     \def\reserved at c{#3}%
> >   \else
> >     \def\reserved at c{#4}%
> >   \fi
> >   \reserved at c\ignorespaces
> > }
> > \makeatother
> > 
> > \begin{document}
> > \begin{center}
> >   \psset{unit=4cm,dotsize=1pt 0}
> >   \begin{pspicture}(2.5,1.5)
> >     \psaxes{->}(0,0)(2.5,1.5)
> >     \multido{\ip=1+1}{50}{%
> >       \multido{\iq=1+1}{100}{%
> >         \unless\ifnum\ip>\numexpr2*\iq % for x \in [0,2]
> >           \IfRelPrime{\ip}{\iq}{%
> >             \psdots(!\ip\space \iq\space div 1 \iq\space div)
> >           }{\relax}
> >        \fi
> >       }%
> >     }%
> >   \end{pspicture}
> > \end{center}
> > \end{document}
> > 
> > Attention! The two loops can't be extended. For instance, with
> > 
> >   \multido{\ip=1+1}{80}{%
> >     \multido{\iq=1+1}{160}{%
> > 
> > I obtain a beautiful
> > 
> > Runaway text?
> > " tx at Dict begin STP newpath 0.8 SLW 0  setgray  [ 41 147 div 1 147 di\ETC.
> > ! TeX capacity exceeded, sorry [main memory size=1500000].
> > \pst at code ...r .5 add exch itransform Dot } repeat
> > 
> > l.36     }
> >           %
> > No pages of output.
> > 
> > I suppose (I'm not sure) that it's working with recursive macro rather
> > multido but I'm too lasy to test it :-)
> > 
> >   Jean-Côme Charpentier
> > 
> > _______________________________________________
> > PSTricks mailing list
> > PSTricks at tug.org
> > http://tug.org/mailman/listinfo/pstricks
> 
> 
> It seems that it works for me with tetex-3.0_p1-r6:

With an up to date TeX-Live in an Ubunto box (3.141592-1.40.3 (Web2C
7.5.6) as well.

mh

> 
> rose at condor:/home/rose/Txt_grizzly/Test/TeX(42)$ latex
> thomae_function.tex
> This is pdfeTeX, Version 3.141592-1.30.5-2.2 (Web2C 7.5.5)
> entering extended mode
> (./thomae_function.tex
> LaTeX2e <2003/12/01>
> Babel <v3.8d> and hyphenation patterns for american, french, german,
> ngerman, b
> ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
> esperanto, e
> stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
> norsk, polis
> h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
> swedish, tur
> kish, ukrainian, nohyphenation, loaded.
> (/usr/share/texmf/tex/latex/base/article.cls
> Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
> (/usr/share/texmf/tex/latex/base/size10.clo))
> (/usr/share/texmf/tex/latex/pstricks/pstricks-add.sty
> (/usr/share/texmf/tex/latex/pstricks/pstricks.sty
> (/usr/share/texmf/tex/generic/pstricks/pstricks.tex
> `PSTricks' v1.04  <2004/06/22> (tvz)
> (/usr/share/texmf/tex/generic/pstricks/pstricks.con))
> (/usr/share/texmf/tex/latex/xcolor/xcolor.sty
> (/usr/share/texmf/tex/latex/graphics/color.cfg)
> (/usr/share/texmf/tex/latex/graphics/dvips.def)))
> (/usr/share/texmf/tex/generic/pstricks/pstricks-add.tex
> (/usr/share/texmf/tex/generic/pstricks/pst-plot.tex  v97 patch 2,
> 1999/12/12
> (/usr/share/texmf/tex/generic/multido/multido.tex  v1.41, 2004/05/18
> <tvz>))
> (/usr/share/texmf/tex/generic/pstricks/pst-node.tex  v97 patch 11,
> 2000/11/09)
> (/usr/share/texmf/tex/generic/xkeyval/pst-xkey.tex
> (/usr/share/texmf/tex/latex/xkeyval/xkeyval.sty
> (/usr/share/texmf/tex/generic/xkeyval/xkeyval.tex
> (/usr/share/texmf/tex/generic/xkeyval/keyval.tex))))
> `pstricks-add' v2.32, 2005/01/16 (hv)))
> (/usr/share/texmf/tex/generic/multido/multido.sty)
> (./thomae_function.aux)
> [1] (./thomae_function.aux) )
> Output written on thomae_function.dvi (1 page, 976712 bytes).
> Transcript written on thomae_function.log.
> 
> and with app-text/texlive-2007-r3 respectively
> app-text/texlive-core-2007-r13
> 
> rose at grizzly:/home/rose/Txt/Test/TeX(15)$ latex  thomae_function.tex 
> This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
>  %&-line parsing enabled.
> entering extended mode
> (./thomae_function.tex
> LaTeX2e <2005/12/01>
> Babel <v3.8h> and hyphenation patterns for english, usenglishmax,
> dumylang, noh
> yphenation, basque, german, ngerman, french, loaded.
> (/usr/share/texmf-dist/tex/latex/base/article.cls
> Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
> (/usr/share/texmf-dist/tex/latex/base/size10.clo))
> (/usr/share/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty
> (/usr/share/texmf-dist/tex/latex/pstricks/pstricks.sty
> (/usr/share/texmf-dist/tex/generic/pstricks/pstricks.tex
> `PSTricks' v1.15  <2006/12/22> (tvz)
> (/usr/share/texmf-dist/tex/generic/pstricks/pstricks.con))
> (/usr/share/texmf-site/tex/latex/xcolor/xcolor.sty
> (/usr/share/texmf/tex/latex/config/color.cfg)
> (/usr/share/texmf-dist/tex/latex/graphics/dvips.def)))
> (/usr/share/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex
> (/usr/share/texmf-dist/tex/generic/pstricks/pst-plot.tex
>  v97 patch 2, 1999/12/12
> (/usr/share/texmf-dist/tex/generic/multido/multido.tex
>  v1.41, 2004/05/18 <tvz>))
> (/usr/share/texmf-dist/tex/generic/pstricks/pst-node.tex
>  v97 patch 11, 2000/11/09)
> (/usr/share/texmf-dist/tex/latex/xkeyval/pst-xkey.tex
> (/usr/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
> (/usr/share/texmf-dist/tex/latex/xkeyval/xkeyval.tex
> (/usr/share/texmf-dist/tex/latex/xkeyval/keyval.tex))))
> `pstricks-add' v2.82, 2006/11/22 (dr,hv)))
> (/usr/share/texmf-dist/tex/generic/multido/multido.sty)
> (./thomae_function.aux)
> [1] (./thomae_function.aux) )
> Output written on thomae_function.dvi (1 page, 979096 bytes).
> Transcript written on thomae_function.log.
> 
> as well.
> 
> Juergen
> 
> 
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks




More information about the PSTricks mailing list