axiom-developer
[Top][All Lists]

Re: [Axiom-developer] Bug in complexForm : complexForm(log(%i) - log(-%i

 From: Martin Rubey Subject: Re: [Axiom-developer] Bug in complexForm : complexForm(log(%i) - log(-%i)) -> 0 Date: Wed, 19 Jan 2005 16:55:21 +0100

```Dear Vladimir,

> AXIOM ->         complexForm(log(%i) - log(-%i))
>
>                  0

could you please file this as a bug on issuetracker? The problem is in the
operation "argument":

(8) -> argument(%i)

%pi
(8)  ---
2
Type: Expression Integer
(9) -> argument(-%i)

%pi
(9)  ---
2
Type: Expression Integer

the latter should be -pi/2, of course. The problem is in gaussian.spad,
COMPCAT:

if R has TranscendentalFunctionCategory then
half := recip(2::R)::R

if R has RealNumberSystem then
atan2loc(y: R, x: R): R ==
pi1 := pi()\$R
pi2 := pi1 * half
x = 0 => if y >= 0 then pi2 else -pi2

-- Atan in (-pi/2,pi/2]
theta := atan(y * recip(x)::R)
while theta <= -pi2 repeat theta := theta + pi1
while theta >   pi2 repeat theta := theta - pi1

x >= 0 => theta      -- I or IV

if y >= 0 then
theta + pi1      -- II
else
theta - pi1      -- III

argument x == atan2loc(imag x, real x)

else
-- Not ordered so dictate two quadrants
argument x ==
zero? real x => pi()\$R * half
atan(imag(x) * recip(real x)::R)

so the problem occurs if R does not have "RealNumberSystem":

(15) -> argument(-%i*1.0)

(15)  - 1.5707963267 948966192

since Float does have RNS, but INT does not. I'm not quite sure what the
condition should be. OrderedSet?

Martin

```