[pstricks] implicit plots
Oscar Ecenarro
oecenarro at euskalnet.net
Mon Dec 12 21:07:23 CET 2005
Herbert,
I'm trying to draw the equipotential lines of a system of two equal charges at short distances (not a dipolar field), using the implicit plotting scheme that you sugests.
Briefly, the function to be plotted is:
V=k(1/r+1/r')
Placing the origin at the first charge, I use the next definition at the pstVerb environment in Cartesian coordinates:
\pstVerb{%
%------------------------ the implicit function -----------------------
/func { % parameter is the y value
/yVal exch def
1
x 2 exp
yVal 2 exp add sqrt div
1
x 10 sub 2 exp
yVal 2 exp add sqrt div
add
1 sub
} def
%------------------------ the implicit function -----------------------
}
The compilation is OK, whith no errors, no warnings, but when I try to open the ps file, I have a fatal error. This is what apear at the screen:
--- Begin offending input ---
t begin STP newpath 0.8 SLW 0 setgray 90 rotate /n -2 def
/dx 28.45274 def n 0 lt { /dx dx neg def /n n neg def } if /y2 3.0
CLW 2 div add def /y1 y2 neg def /x dx def n { x y1 moveto x y2 lineto
stroke /x x dx add def } repeat end
@endspecial 779 1185 a Fa(\000)p Fb(1)779
1421 y Fa(\000)p Fb(2)975 921 y @beginspecial @setspecial
tx at Dict begin STP newpath 0.8 SLW 1 0 0 setrgbcolor /ArrowA { moveto
} def /ArrowB { } def /x 0.2 def /x1 8 def /dx x1 x sub 999 div def
/xy { x 28.45274 mul .1 /eps1 0.0001 def /eps2 0.001 def /MaxIter
10 def /y0 exch def /Iter 0 def { y0 func /F exch def F abs eps2 lt
{ exit } if y0 F sub /Phi exch def Phi func /F2 exch def F2 abs eps2
le { exit }{ Phi y0 sub dup mul Phi F2 sub 2 Phi mul sub y0 add div
/Diff exch def y0 Diff sub /y0 exch def Diff abs eps1 le { exit } if
} ifelse /Iter Iter 1 add def Iter MaxIter gt { exit } if } loop y0
28.45274 mul } def xy moveto 999 1 sub { /x x dx add def xy L }
repeat /x x1 def xy L gsave 0.8 SLW 1 0 0 setrgbcolor 0 setlinecap
s
--- End offending input ---
file offset = 39411
gsapi_run_string_continue returns -101
What is the problem? It works fine with others implicit functions, say xy=1.
Oscar Ecenarro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20051212/ca22b3aa/attachment.html
More information about the PSTricks
mailing list