[pstricks] implicit plots

Herbert Voss LaTeX at zedat.fu-berlin.de
Wed Jun 1 16:17:17 CEST 2005


Hendrik Wouters wrote:
> Hi,
> 
> Is it possible to plot implicit functions like:
> 4*x^2+10*x*y+4*y*y-12*x-15*y=0
> 
> I've searched the web, but I can't find. 

only an idea ...

Herbert


\documentclass[12pt]{book}%
\usepackage{pstricks}%
\usepackage{pst-plot}%
\makeatletter
\def\psSteffensen{\tx at Steffensen}
\pst at def{Steffensen}<{
   /eps1 0.0001 def % x
   /eps2 0.001 def % y
   /MaxIter 10 def
     /y0 exch def % the start value
     /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
}>
\makeatother

\begin{document}

\pstVerb{%
%------------------------ the implicit function -----------------------
   /func { % parameter is the y value
     /yVal exch def
     x dup mul 4 mul
     x yVal mul 10 mul add
     yVal dup mul 4 mul add
     x 12 mul sub
     yVal 15 mul sub
   } def
%------------------------ the implicit function -----------------------
}
\psset{xunit=0.75}
\begin{pspicture*}(-10,-5)(10,5)
   \psaxes{->}(0,0)(-10,-5)(10,5)%
   \psplot[linecolor=red,plotpoints=1000]{-10}{10}{.1 \psSteffensen }% 
.4 the start value
\end{pspicture*}

\end{document}




More information about the PSTricks mailing list