<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4630.0">
<TITLE>[pstricks] drawing implicit (polar) plot</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">I have a question concerning the implicit polar plot algorithm proposed by Manfred Braun</FONT>

<BR><FONT SIZE=2 FACE="Arial">and which is used as an example of </FONT><A HREF="http:/www.pstricks.de"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http:/www.pstricks.de</FONT></U></A><FONT SIZE=2 FACE="Arial"> (polar2.tex)</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">In the postscript code where the streamlines and equipotential functions are plotted</FONT>

<BR><FONT SIZE=2 FACE="Arial">via a call to parametricplot, I am trying to figure out the mapping between the complex function</FONT>

<BR><FONT SIZE=2 FACE="Arial">$\Psi$ and the parameter $t$, excerpt of the code attached below.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Question : To be more specific, in the notes from polar2.tex it says, solve the equation $f(z) = z + a^2/z$</FONT>

<BR><FONT SIZE=2 FACE="Arial">using $z = x + i y$, which would give a quadratic equation ?</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">My maths gives me : $f(z) = \phi(x,y) + i \Psi(x,y) = $ where $Re f(z) = ( r + \frac{a^2}{r} ) \cos \phi $</FONT>

<BR><FONT SIZE=2 FACE="Arial">and $Im f(z) = ( r - \frac{a^2}{r} ) \sin \phi$ </FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Question : How does this lead to a quadratic equation under which assumption ? </FONT>

<BR><FONT SIZE=2 FACE="Arial">Question : How is the quadratic equation mapped to the variable $t$ in the parametricplot ?</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">I want to understand the lines of code which I indented with HOW </FONT>

<BR><FONT SIZE=2 FACE="Arial">to plot an other function to make the code a bit more generic.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">If someone could help me, I greatly appreciated it.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Thanks in advance</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Example taken from </FONT><A HREF="file://www.pstricks.de"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">www.pstricks.de</FONT></U></A>
</P>

<P><FONT SIZE=2 FACE="Arial">=============== EXAMPLE ===============================</FONT>

<BR><FONT SIZE=2 FACE="Arial">\listfiles</FONT>

<BR><FONT SIZE=2 FACE="Arial">\documentclass[a4paper]{article}%&nbsp; Herbert Voss 2004-10-06</FONT>

<BR><FONT SIZE=2 FACE="Arial">\usepackage{pstricks}</FONT>

<BR><FONT SIZE=2 FACE="Arial">\usepackage{pst-plot}</FONT>

<BR><FONT SIZE=2 FACE="Arial">\usepackage{pstricks-add}</FONT>

<BR><FONT SIZE=2 FACE="Arial">\usepackage{multido}</FONT>

<BR><FONT SIZE=2 FACE="Arial">\usepackage{url}</FONT>

<BR><FONT SIZE=2 FACE="Arial">%</FONT>

<BR><FONT SIZE=2 FACE="Arial">% ----------- first example --------------------</FONT>

<BR><FONT SIZE=2 FACE="Arial">%</FONT>

<BR><FONT SIZE=2 FACE="Arial">\def\func{%</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; const0 x sin dup mul 3 mul div neg /p exch def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; p abs sqrt neg /r exch def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; const1 2.0 div neg /q exch def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; p 0 lt {</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p dup mul p mul q dup mul add 0 le {</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; q r 3 exp div arccos </FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 div cos r dup add neg mul</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }{</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; q r 3 exp div arch</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 div cosh r dup add neg mul</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } ifelse</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; }{</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; q r 3 exp div arsh</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 div sinh r dup add neg mul&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; } ifelse</FONT>

<BR><FONT SIZE=2 FACE="Arial">}</FONT>

<BR><FONT SIZE=2 FACE="Arial">%</FONT>

<BR><FONT SIZE=2 FACE="Arial">% ----------- second example --------------------</FONT>

<BR><FONT SIZE=2 FACE="Arial">\def\compl{%</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; \pstVerb{</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /cadd { 3 -1 roll add 3 1 roll add exch } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /csub { exch 4 -1 roll sub neg 3 1 roll sub } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /cmul { 3 index 2 index mul 3 index 2 index mul sub 5 1 roll</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 -1 roll mul 3 1 roll mul add } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /crec { 2 copy dup mul exch dup mul add 3 -1 roll 1 index div</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 1 roll div neg } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /creal { pop } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /cimag { exch pop } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /cabs { dup mul exch dup mul add sqrt } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /carg { exch atan } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; /csqrt { 2 copy cabs sqrt 3 1 roll carg 2 div 2 copy cos mul 3 1</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; roll sin mul } def</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; }%</FONT>

<BR><FONT SIZE=2 FACE="Arial">}</FONT>

<BR><FONT SIZE=2 FACE="Arial">%</FONT>

<BR><FONT SIZE=2 FACE="Arial">\newcommand\streamline[2]{%</FONT>

<BR><FONT SIZE=2 FACE="Arial">% A streamline is drawn for #1 as the value of the stream function</FONT>

<BR><FONT SIZE=2 FACE="Arial">% (divided by $2u_\infty$).&nbsp; The potential function, also normalized,</FONT>

<BR><FONT SIZE=2 FACE="Arial">% takes values in the range (-1.5,+1.5).&nbsp; The (x, y)-coordinates of</FONT>

<BR><FONT SIZE=2 FACE="Arial">% the points may be modified by providing PostScript commands in #2.</FONT>

<BR><FONT SIZE=2 FACE="Arial">% The streamline through the stagnation points (#1 = 0) is excluded.</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; \parametricplot{-1.5}{1.5}{</FONT>

<BR><B><FONT SIZE=2 FACE="Arial">HOW&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; t #1 2 copy 2 copy cmul 1 0 csub csqrt cadd #2</FONT></B>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; }%</FONT>

<BR><FONT SIZE=2 FACE="Arial">}</FONT>

<BR><FONT SIZE=2 FACE="Arial">\newcommand\equipotline[2]{%</FONT>

<BR><FONT SIZE=2 FACE="Arial">% An equipotential line is drawn in the same way.&nbsp; The potential must</FONT>

<BR><FONT SIZE=2 FACE="Arial">% not assume the value 1 exactly, because of the singularity at the</FONT>

<BR><FONT SIZE=2 FACE="Arial">% stagnation points.</FONT>

<BR><FONT SIZE=2 FACE="Arial">%&nbsp; \parametricplot{0}{1.25}{</FONT>

<BR><FONT SIZE=2 FACE="Arial">%&nbsp;&nbsp;&nbsp; #1 t 2 copy 2 copy cmul 1 0 csub csqrt cadd #2</FONT>

<BR><FONT SIZE=2 FACE="Arial">%&nbsp; }%</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&nbsp; \parametricplot{0}{1.25}{</FONT>

<BR><FONT SIZE=2 FACE="Arial">HOW&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><B> <FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; #1 t 2 copy 2 copy cmul 1 0 csub csqrt cadd #2</FONT></B>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; }%</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">}</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">\begin{document}</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">% This command provides PostScript commands for complex addition,</FONT>

<BR><FONT SIZE=2 FACE="Arial">% subtraction, multiplication etc.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">\psset{unit=2cm}</FONT>

<BR><FONT SIZE=2 FACE="Arial">% \compl invokes the predefined complex arithmetics extensions</FONT>

<BR><FONT SIZE=2 FACE="Arial">\begin{pspicture}(-3,-3)(3,3)%</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; \compl</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; \psset{linecolor=blue}</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %\psline(-3,0)(-1,0) \pscircle(0,0){1} %\psline(1,0)(3,0)</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %\multido{\n=0.125+0.125}{10}{</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %&nbsp; \streamline{\n}{ }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %&nbsp; \streamline{\n}{ neg }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %}</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; \psset{linecolor=red}</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; \multido{\n=0+0.125}{8}{</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \equipotline{\n}{ }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %\equipotline{\n}{ neg }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %\equipotline{\n}{ exch neg exch }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %\equipotline{\n}{ neg exch neg exch }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %\equipotline{0.9999}{ }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %\equipotline{0.9999}{ neg }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %\equipotline{0.9999}{ exch neg exch }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %\equipotline{0.9999}{ neg exch neg exch }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %\multido{\n=1.125+0.125}{4}{</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %&nbsp; \equipotline{\n}{ }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %&nbsp; \equipotline{\n}{ neg }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %&nbsp; \equipotline{\n}{ exch neg exch }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %&nbsp; \equipotline{\n}{ neg exch neg exch }</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; %}</FONT>

<BR><FONT SIZE=2 FACE="Arial">\end{pspicture}</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">\end{document}</FONT>
</P>

</BODY>
</HTML>