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

Tim Daly <[email protected]> Thu, 18 Jun 2009 07:01:57 -0400
Newsgroups gmane.comp.mathematics.axiom.user,gmane.comp.mathematics.axiom.devel
Message-ID <[email protected]>
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.
>
> See also comments here:
>
> https://sourceforge.net/tracker/?func=detail&atid=984524&aid=2806053&group_id=203172
>
> ----
>
> wspage@debian:~$ svn diff ~/open-axiom-src/src/algebra > itrigmnp.patch
> wspage@debian:~$ 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
>
> wspage@debian:~$
>
> ----
>
> Regards,
> Bill Page.
>
> On Tue, Jun 16, 2009 at 5:45 PM, Tim Daly<[email protected]> 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
>>> [email protected]
>>> http://lists.nongnu.org/mailman/listinfo/axiom-developer
>>>       
Excellent. I will try to apply the patch and test it. --Tim