Complex bakeoff - example 3

Harry H. Cheng uunet!dragon.engr.ucdavis.edu!chengh
Thu Oct 12 06:59:12 PDT 1995


> To plot several streamlines, we run  r  through  0 <= r <= 0.6 , in steps of 
> dr = 0.05 .  For each such  r  we plot two streamlines,  z = g(r + i*h(s))
> to the right of the circle and  z = g(-r + i*h(s))  to the left.

Essentially, in this example, you have obtained two different results
from g(0.0 + i*h(s)) and g(-0.0 + i*h(s)) in a complex system
with the sign of zeros being honored. If the programmer knows
that the sign is ignored in the complex system. 
One will program differently than you did. Certainly, one will not expect
two different solutions from these two identical expressions,
if the sign is ignored in the complex system.

On the other hand, if the step size dr is tighten, say dr = 0.005,
the missing left half circle is almost not noticable.
The problem becomes the numerical accuracy issue.

In my implementation, I expect that
g(0.0 + i*h(s)) and g(-0.0 + i*h(s)) will produce the same result.
For visual purpose, I can add the streamline g(-tiny_value + i*h(s)) easily.
But, the plus side of my impplementation is that
the programmer does not have to remember the sign of zeros of the results 
from sqrt(+-0.0, +-0.0) as well as many other functions and operations,
which is a big relief to the programmer.

Therefore, my conclusion is that the undue complexity of
the sign of zeros in complex number does not solve any problem.


Harry Cheng
UC Davis
 



More information about the Numeric-interest mailing list