[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Re: [Axiom-mail] Problem with real/imag/conjugate
From: |
Bill Page |
Subject: |
Re: [Axiom-developer] Re: [Axiom-mail] Problem with real/imag/conjugate |
Date: |
Thu, 18 Jun 2009 01:08:24 -0400 |
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.
See also comments here:
https://sourceforge.net/tracker/?func=detail&atid=984524&aid=2806053&group_id=203172
----
address@hidden:~$ svn diff ~/open-axiom-src/src/algebra > itrigmnp.patch
address@hidden:~$ cat itrigmnp.patch
Index: /home/wspage/open-axiom-src/src/algebra/efstruc.spad.pamphlet
===================================================================
--- /home/wspage/open-axiom-src/src/algebra/efstruc.spad.pamphlet
(revision
1216)
+++ /home/wspage/open-axiom-src/src/algebra/efstruc.spad.pamphlet
(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
address@hidden:~$
----
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
>>
itrigmnp.patch
Description: Binary data