[pstricks] PSTricks test numérique
Manfred Braun
manfred.braun at uni-due.de
Tue Jun 19 13:34:22 CEST 2007
A less elegant solution than Herbert's, which might be easier to understand,
consists in throwing the dots that should not be plotted to a position far
outside the paper, e.g., to (1000,1000).
\documentclass[11pt]{article}
\usepackage{pstricks,multido}
\begin{document}
\psset{unit=1cm}
\begin{pspicture}(-5,0)(5,5)
\SpecialCoor
\psset{linecolor=red}
\multido{\rk=-5.0+0.5}{21}{%
\multido{\rn=-5.0+0.5}{21}{%
\psdot(! \rn\space dup mul 3 add \rn\space \rk\space dup mul
mul lt { \rk\space \rn\space } { 1000 dup } ifelse )
}
}
\end{pspicture}
\end{document}
Manfred
-----Ursprüngliche Nachricht-----
Von: pstricks-bounces at tug.org [mailto:pstricks-bounces at tug.org] Im Auftrag
von Herbert Voss
Gesendet: Montag, 18. Juni 2007 18:18
An: Graphics with PSTricks
Betreff: Re: [pstricks] PSTricks test numérique
mathsattacks at free.fr wrote:
> Bonjour à tous.
>
> Je voudrais savoir, s'il est possibe avec PSTricks de faire quelque
> chose du genre :
> (je fais du langage formel juste pour la compréhension et rendre la
> chose intelligible)
>
> \begin{pspicture}(-5,5)(-5,5)
> "for k from -5 to 5 step 0.5 do
> for n from -5 to 5 step 0.5 do
> if n^2+3<n*k^2 then faire \psdots(k,n) fi
> od
> od"
> \end{pspicture}
>
> Bien sûr, je sais que les boucles "for" se font très bien avec la
> commande \multido, ce n'est pas l'objet de ma question (j'ai mis des
> for... juste pour qu'on voit en un coup d'oeil). Par contre, l'objet
> de ma question se porte sur la ligne :
> "if n^2+3<n*k^2 then faire \psdots(k,n) fi" (et là je sèche)
> Comment faire proprement ce genre de test numérique sous PSTricks ?
\documentclass{article}
\usepackage{pstricks,multido}
\makeatletter
\def\psDot{\pst at object{psDot}}% a modified \psdot
\def\psDot at i(#1,#2){%
\begin at SpecialObj%
\pst@@getcoor{#1,#2}%
\addto at pscode{
#2 dup mul 3 add % n^2+3
#2 #1 dup mul mul % n*k^2
lt {
\psk at dotsize
\@nameuse{psds@\psk at dotstyle}%
\pst at coor Dot } if }%
\end at SpecialObj}
\makeatother
\begin{document}
\begin{pspicture}(-5,5)(-5,5)
\multido{\rk=-5.0+0.5}{21}{%
\multido{\rn=-5.0+0.5}{21}{\psDot[linecolor=red](\rk,\rn)}}
\end{pspicture}
\end{document}
Herbert
--
http://PSTricks.tug.org
http://tug.org/CTAN/info/math/voss/
_______________________________________________
pstricks mailing list
pstricks at tug.org
http://tug.org/mailman/listinfo/pstricks
More information about the PSTricks
mailing list