<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks, Juergen and Michael. I don't know what was going on, but somehow things seemed to work in the end. But now trying a more complicated but analogous version of this, I run into trouble. I now want to draw arrows from the plane tangent at (0,1,1) to z=x^2+y^2, which has the<div>equation z=2y-1, to the graph. Here is my code, including some function definitions (I will comment on the comments (:-) below):</div><div>*********************************************</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>\begin{pspicture}(-2.5,-3)(2.5,3.5)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\psset{Alpha=30}</div><div>%<span class="Apple-tab-span" style="white-space:pre">                </span>\psset{xunit=2cm, yunit=2cm}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\pstThreeDCoor[xMax=2,yMax=2,zMax=3]</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\psplotThreeD[linecolor=gray, drawStyle=xyLines,xPlotpoints=50,yPlotpoints=50]%</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>(-1.5,1.5)(0,1.5){x 2 exp y 2 exp add}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\newcommand{\zgraph}[2]{#1\space dup mul #2\space dup mul add}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\newcommand{\zplane}[2]{#2\space 2 mul 1 sub}<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\newcommand{\thit}[2]%</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{#2\space 2.5 #2\space mul 0.0625 add %</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>#1\space dup mul sub 1 sub 0.5 exp sub %</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>0.5 mul 0.125 add}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\newcommand{\yhit}[2]{#2\space \thit{#1}{#2}\space 2 mul sub}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\newcommand{\zhit}[2]{\zgraph{#1}{\yhit{#1}{#2}}}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\multido{\rx=-0.9+0.4}{6}{%</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>\multido{\ry=0.1+0.5}{3}{%</div><div>%<span class="Apple-tab-span" style="white-space:pre">                                </span>\pstThreeDDot(\rx\space,\ry\space,\zplane{\rs}{\ry})</div><div>%<span class="Apple-tab-span" style="white-space:pre">                                </span>\pstThreeDDot(\rx\space,\yhit{\rx}{\ry},\zhit{\rx}{\ry})</div><div>%<span class="Apple-tab-span" style="white-space:pre">                                </span>\pstThreeDLine[linestyle=dashed, arrows=->]%</div><div>%<span class="Apple-tab-span" style="white-space:pre">                                        </span>(\rx\space,\ry\space,\zplane{\rs}{\ry})%</div><div>%<span class="Apple-tab-span" style="white-space:pre">                                        </span>(\rx\space,\yhit{\rx}{\ry},\zhit{\rx}{\ry})</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div>%<span class="Apple-tab-span" style="white-space:pre">                                </span>\pstThreeDDot(1,\yhit{1}{1},\zhit{1}{1})</div><div><br></div><div>%<span class="Apple-tab-span" style="white-space:pre">                        </span>\pstThreeDLine[arrows=->](0.8,1,1)(0.8,0.62,1.18)</div><div>%<span class="Apple-tab-span" style="white-space:pre">                        </span>\pstThreeDLine[arrows=->](1,1.5,2)(1,1.1,2.2)</div><div>%<span class="Apple-tab-span" style="white-space:pre">                        </span>\pstThreeDLine[arrows=->](1,1.3,1.6)(1,0.9,1.8)</div><div>%<span class="Apple-tab-span" style="white-space:pre">                        </span>\pstThreeDLine[arrows=->](1,1,1)(1,0.5,1.25)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\psplotThreeD[linecolor=lightgray, drawStyle=xyLines](-1,1)(0,2){y 2 mul 1 sub}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>\pstThreeDDot(0,1,1)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>\end{pspicture}</div><div>****************************************************************************************************</div><div>1. When the first line inside the multido is uncommented, it works fine.</div><div>2. When the second line inside the multido is uncommented, I get</div><div>*************************************************************************</div><div><div>Error: /undefinedresult in --exp--</div><div>Operand stack:</div><div> -0.9 0.1 0.1 -1.4975 0.5</div><div>Execution stack:</div><div> %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1813 1 3 %oparray_pop 1812 1 3 %oparray_pop 1808 1 3 %oparray_pop 1691 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval--</div><div>Dictionary stack:</div><div> --<a href="dict:1084/1123(ro)(G)--">dict:1084/1123(ro)(G)--</a> --<a href="dict:0/20(G)--">dict:0/20(G)--</a> --<a href="dict:113/200(L)--">dict:113/200(L)--</a> --<a href="dict:179/300(L)--">dict:179/300(L)--</a> --<a href="dict:102/200(L)--">dict:102/200(L)--</a> --<a href="dict:56/400(L)--">dict:56/400(L)--</a> --<a href="dict:0/10(L)--">dict:0/10(L)--</a> --<a href="dict:102/200(L)--">dict:102/200(L)--</a> --<a href="dict:95/200(L)--">dict:95/200(L)--</a></div><div>Current allocation mode is local</div><div>Last OS error: 2</div><div>Current file position is 187224</div><div>GPL Ghostscript 8.57: Unrecoverable error, exit code 1</div><div>### FAILED to generate /tmp/altpdflatex.1535-1218220543/picturetest.pdf ()</div><div>*************************************************************************************</div><div>I had initially thought that trying to square \ry=-0.9 via 2 exp could hang up because of the exp of a negative, so I replaced 2 exp with dup mul. This didn't help. However, the function definitions do seem to work: when I put in explicit numbers (eg, commented line immediately following the multido) it works fine.</div><div><br></div><div>I am of course not interested in placing these dots, but rather want the arrows given by the third to fifth lines inside the multido. But the dot placement commands tell me that the problem is with computing the coordinates from parameters \rx and \ry. </div><div><br></div><div>Any suggestions?</div><div><br></div></div></div><div><br><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Zbigniew Nitecki</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Department of Mathematics</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Tufts University</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Medford, MA 02155</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">telephones:</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Office<span class="Apple-converted-space"><span class="Apple-converted-tab"> <span class="Apple-converted-space"> </span></span></span>(617)627-3843</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Dept.<span class="Apple-converted-space"><span class="Apple-converted-tab"> <span class="Apple-converted-space"> </span></span></span>(617)627-3234</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Dept. fax<span class="Apple-converted-space"><span class="Apple-converted-tab"> <span class="Apple-converted-space"> </span></span></span>(617)627-3966</font></p><a href="http://www.tufts.edu/~znitecki/">http://www.tufts.edu/~znitecki/</a></span> </div><br></div></body></html>