AW: [pstricks] drawing implicit (polar) plot

Manfred Braun m.braun at uni-duisburg.de
Mon Jun 6 16:17:54 CEST 2005


Wim Neimeijer wrote:

 

> I have a question concerning the implicit polar plot algorithm proposed by
Manfred Braun 
> and which is used as an example of  <http://www.pstricks.de>
http:/www.pstricks.de (polar2.tex) 

> In the postscript code where the streamlines and equipotential lines are
plotted 
> via a call to parametricplot, I am trying to figure out the mapping
between the complex function 
> $\Psi$ and the parameter $t$, excerpt of the code attached below. 

> Question : To be more specific, in the notes from polar2.tex it says,
solve the equation $f(z) = z + a^2/z$ 
> using $z = x + i y$, which would give a quadratic equation ? 

> My maths gives me : $f(z) = \phi(x,y) + i \Psi(x,y) = $ where $Re f(z) = (
r + \frac{a^2}{r} ) \cos \phi $ 
> and $Im f(z) = ( r - \frac{a^2}{r} ) \sin \phi$ 

> Question : How does this lead to a quadratic equation under which
assumption ? 



The equation  f = z + a^2/z  is converted into the quadratic equation

  z^2 - f z + a^2 z = 0

which can be solved for  z  by the standard formula. The unknown  z  and the
coefficient  f, however, are complex numbers. Having solved the equation,
just set  z = x + iy  and  f = phi + i psi. Thus the solution  z = .
provides the points (x, y) corresponding to the pair of potential and stream
function (phi, psi). This is just inverting the original setting  f = f(z),
where you obtain the complex potential  f  corresponding to a given point
z.  

> Question : How is the quadratic equation mapped to the variable $t$ in the
parametricplot ? 

If you fix the potential  phi  and let the stream function  psi  run over a
certain interval, you get an equipotential line. If you fix the stream
function  psi  and allow the potential  phi  to vary, you get a streamline.
Therefore the two commands intended to draw equipotential and stream lines
differ only in what is fixed and what is the running curve parameter  t.  In
the case of streamlines, for instance, the curve parameter  t  is the
potential phi, while the stream function  psi  is kept at the fixed value
#1.  

> I want to understand the lines of code which I indented with HOW 
> to plot an other function to make the code a bit more generic.

The code starting with  { t #1 . } puts the potential  phi = t  and the
stream function  psi = #1  on the stack.  These two values are regarded as
the real and imaginary parts of one complex number  f. What follows relies
on the operations performed with complex numbers.  For instance, if a
complex number is on the stack and you write  " 2 copy cmul ", the complex
number will be duplicated and then multiplied with itself. As a result the
complex number  z^2  is on the stack. The operations for complex addition,
multiplication, square root, etc. are provided by the command  \complex,
which simply writes the definitions of these operations using  \pstVerb{ .
}.  

I have used these complex operations only in some personal applications.
Therefore they are not documented. If there is a general need for complex
arithmetic, the operations could be included in some add-on package. 

Hopefully these explanations help understanding the basic idea.

Manfred Braun

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20050606/8a1a77ec/attachment.html 


More information about the PSTricks mailing list