help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Negative zeros?


From: Tom Holroyd
Subject: Re: Negative zeros?
Date: Wed, 14 Sep 2005 17:11:32 -0400
User-agent: Mozilla Thunderbird 1.0.6-1.1.fc3 (X11/20050720)

Przemek Klosowski wrote:
OK, so as a mathematician you should be well receptive to Kahan's
arguments, stemming from the complex analysis where there is a
definite need to distinguish lim(x>0, x->0) from lim(x<0, x->0)
because of branch cuts---otherwise, what would be the value of
sqrt(i*x-1) in each case?

Hmm.  YaCaS gets this wrong.

In> Limit(x, 0, Left) Sqrt(I*x-1)
Out> Complex(0,1)

Should be Complex(0,-1) (== -i).

Mathematica gets it right:

In[1]:= Limit[Sqrt[I*x - 1], x -> 0, Direction -> 1]
Out[1]= -i
In[2]:= Limit[Sqrt[I*x - 1], x -> 0, Direction -> -1]
Out[2]= i

It should be quite clear, however, that this has nothing to do with floating point representation (or Octave, for that matter). But I like the idea of thinking of -0 as the limit from the left. As for Octave:

octave:1> sqrt(-.1i-1)
ans = 0.049938 - 1.001246i
octave:2> sqrt(-.00001i-1)
ans = 5.0000e-06 - 1.0000e+00i
octave:3> sqrt(-0*i-1)
ans = 0 + 1i

The problem, of course, is the subtraction,

octave:4> -0
ans = -0
octave:5> -0*i
ans = -0
octave:6> -0*i - 1
ans = -1

since there aren't two forms of -1 (from the left and from the right) in floating point.

--
Dr. Tom Holroyd
"A man of genius makes no mistakes. His errors are volitional and
are the portals of discovery." -- James Joyce



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]