# [pstricks] multido

Michael Sharpe msharpe at ucsd.edu
Fri Nov 21 20:08:59 CET 2008

In Herbert's code, xVal is incremented in PostScript code in the line
pstVerb{ /xVal \function\space def}

You might find it easier for your particular problem to use clipping,
as in:

\begin{pspicture}[showgrid=true](-1.5,-1.5)(1.5,1.5)
\begin{psclip}{\pscircle{1}}
\multido{\n=-1+.25}{9}{\psline(-1,\n)(1,\n)\psline(\n,-1)(\n,1)}
\end{psclip}
\end{pspicture}

Michael

On Nov 21, 2008, at 10:26 AM, Zbigniew Nitecki wrote:

> 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)
> }
> ***************************************************************************************************
>


More information about the PSTricks mailing list