[pstricks] multido

Zbigniew Nitecki zbigniew.nitecki at tufts.edu
Fri Nov 21 19:26:31 CET 2008


The following is copied from one of Herbert's responses to someone else:
********************************************************************************
\documentclass{article}
\usepackage{amsmath}
\usepackage{pstricks-add}

\begin{document}

\begin{center}
\psset{xunit=2cm,yunit=2cm,algebraic=true}
\begin{pspicture}[showgrid=true](-5,-5)(1,1)
  \psaxes{->}(0,0)(-5,-5)(1,1)[$x$,-90][$y$,180]%
  \rput(-2,-3){{$y=\dfrac{-2x+8}{~~2x-2}$}}%
  \psplot {-5}{0.10}{x }%
  \psplot[linecolor=red,linewidth=1.5pt]{-5}{0.10}{(-2*x+8)/(2*x-2)}%
  \def\function{ -2 xVal mul 8 add 2 xVal mul -2 add div }%
  \pstVerb{ /xVal 0 def }% start value
  \multido{\nA=0+1}{4}{%
    \psline[linecolor=blue,linewidth=1.5pt]{->}(! xVal xVal )(! xVal
\function )
    \psline[linecolor=blue,linewidth=1.5pt]{->}(! xVal \function )(!
\function\space dup)
    \pstVerb{ /xVal \function\space def}
    \psline[linestyle=dashed,linecolor=blue]{->}(! xVal xVal)(! xVal 0 )
    \uput{1ex}[90](! xVal 0 ){$v_{\nA}$}
  }
\end{pspicture}
\end{center}

\end{document}
********************************************************************************************
I am trying to use this as a model for plotting a function using a  
rectangular grid, but over
a non-rectangular region.  My basic question can be formulated even  
letting the function be
the zero constant:  so filling say the circle of radius 1 in the xy- 
plane with lines parallel to the
coordinate axes, spaced 0.25 apart.  My model is as follows, but my  
question is what goes in the places marked with ??: I can't understand  
where in the example above the value of xVal is
incremented, or equivalently, the role of \nA.  Of course, if I am  
making other sytactic errors,
I'll be grateful for advice about them as well.
***********************************************************************************************
\def\function{1 tVal dup mul sub exp 0.5}
\pstVerb{tVal -0.75 def}
\multido{??=??}{6}{%
	\psline(!\function \neg tVal)(!\function tVal)
	\psline{!tVal \function \neg){!tVal \function)
}
***************************************************************************************************

Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

telephones:
Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966
http://www.tufts.edu/~znitecki/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20081121/4ba49648/attachment.html 


More information about the PSTricks mailing list