[pstricks] multido

Michael Sharpe msharpe at ucsd.edu
Fri Nov 21 22:33:30 CET 2008


Because of the prior definition of \function as a TeX macro, the line

\pstVerb{/xVal \function\space def}

inserts into the PostScript stream the code

/xVal  -2 xVal mul 8 add 2 xVal mul -2 add div def

which redefines the PostScript variable xVal as a specific function of  
its prior value. Algebraically, this amounts to replacing the prior  
value of xVal with the new value (-2*xVal+8)/(2*xVal-2). So, xVal is  
defined initially to be 0, and after the next loop through \multido,  
its value is -4, and so on.

Clipping is strictly for planar objects, as far as I know.

Michael

On Nov 21, 2008, at 12:09 PM, Zbigniew Nitecki wrote:

> As a solution to the baby problem, this is brilliant.  But is there  
> a way to clip a \pstThreeDPlot
> or \parametricplotThreeD?
> What I really want to do is to graph a function (in my case, (x^2- 
> y^2)/2 ) over a circle (but both the above-mentioned allow only  
> graphs over a rectangle;  if I translate into a polar form to get  
> the circular domain, then the lines go radially (or are circles)  
> instead of being x-lines and y-lines.
> This is why I wanted to use the multido.
>
> Perhaps I am unclear on the function of \function in Herbert's  
> example.  I thought that it is defined as the calculation [-2(xVal) 
> +8]/[2(xVal)-2].  So where it says
> \pstVerb{/xVal \function\space def}, what is the function of  
> \function?
>
>> 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