axiom-mail
[Top][All Lists]

## Re: [Axiom-developer] Re: [Axiom-mail] Problem with real/imag/conjugate

 From: Tim Daly Subject: Re: [Axiom-developer] Re: [Axiom-mail] Problem with real/imag/conjugate Date: Thu, 18 Jun 2009 07:01:57 -0400 User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

```Bill Page wrote:
```
```Tim,

I think the following patch fixes this problem but I have not yet done
very extensive testing. It might well have some impact on results in
the regression tests.

The patch is against open-axiom sources so you might have to apply it
manually but I do not think this code has changed much in other
versions.

https://sourceforge.net/tracker/?func=detail&atid=984524&aid=2806053&group_id=203172

----

address@hidden:~\$ svn diff ~/open-axiom-src/src/algebra > itrigmnp.patch

===================================================================
(revision
1216)
(working copy)
@@ -545,6 +545,7 @@
macro NTHR == 'nthRoot
ker2explogs: (KG, List KG, List SY) -> FG
smp2explogs: (PG, List KG, List SY) -> FG
+    nthroot:     (GF,GF) -> GF
supexp     : (UP, GF, GF, Z) -> GF
GR2GF      : GR -> GF
GR2F       : GR -> F
@@ -626,13 +627,23 @@
map(explogs2trigs(#1::FG),GR2GF, p)\$PolynomialCategoryLifting(
IndexedExponents KG, KG, GR, PG, GF)

-    explogs2trigs f ==
-      (m := mainKernel f) case "failed" =>
+    nthroot(a:GF,n:GF):GF ==
+      r := nthRoot(sqrt(norm(a)),retract(n)@Z)
+      e := exp(complex(0, 1)*argument(a)/n)
+      r*e
+
+    explogs2trigs(f:FG):GF ==
+      m := mainKernel f
+      m case "failed" =>
GR2GF(retract(numer f)@GR) / GR2GF(retract(denom f)@GR)
-      op  := operator(operator(k := m::KG))\$F
+      k := m::KG
+      op  := operator(operator(k))\$F
arg := [explogs2trigs x for x in argument k]
num := univariate(numer f, k)
den := univariate(denom f, k)
+      is?(op,'nthRoot) =>
+        h := nthroot(first arg, second arg)
+        supexp(num,h,0,0)/supexp(den,h,0,0)
is?(op,'exp) =>
e  := exp real first arg
y  := imag first arg

----

Regards,
Bill Page.

On Tue, Jun 16, 2009 at 5:45 PM, Tim Daly<address@hidden> wrote:
```
```This one is queued as bug number 7199.

When you say the latest "Gold" sources can you tell me the
result of the "Version" and "Timestamp" lines from the Axiom banner?
Where did you get the sources?

Tim

Arnold Doray wrote:
```
```I get the wrong answer for real/imag for some forms of complex numbers.
For example:

a := (-1*%i)^(1/2)
b := (%i)^(3/2)

are both equivalent, but imag/real gives complex (and incorrect) answers
for "a" (ie, real(a) and imag(a) are both complex), but I get the right
answers for "b". Also "conjugate" fails on both with an error message.

Am I missing something here?
I am using Axiom compiled from the latest "Gold" source.
Thanks,
Arnold

```
------------------------------------------------------------------------
```
_______________________________________________
Axiom-developer mailing list
```Excellent. I will try to apply the patch and test it. --Tim