Changes between Initial Version and Version 11 of Ticket #15709


Ignore:
Timestamp:
09/10/14 11:51:24 (7 years ago)
Author:
jdemeyer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15709

    • Property Cc mmezzarobba added
    • Property Summary changed from silent conversion of mod to int to Powering with IntegerMod/GF exponents
    • Property Milestone changed from sage-6.1 to sage-6.4
  • Ticket #15709 – Description

    initial v11  
    1212}}}
    1313
    14 ''This must surely have been discussed before. I would have tried to look up the discussion if I thought there was any hope that someone could convince me that this is not actually a bug.''
     14This must surely have been discussed before. I would have tried to look up the discussion if I thought there was any hope that someone could convince me that this is not actually a bug.
    1515
    16 ''Mod is not a synonym for remainder, and Sage is very good about not making the answer an integer. By later silently converting the answer into a remainder it has forsaken me, and undermined my trust.''
     16Related, Nils Bruin reported on #11797:
    1717
    18 (P.S.: The "I" above is not me. -ppurka)
     18{{{
     19sage: p=7
     20sage: k=GF(p)
     21sage: k(2)^k(p)
     221
     23sage: (GF(7)(2))^(GF(5)(2))
     244
     25sage: k(2)^p
     262
     27}}}
     28It looks like it's simply quietly lifting the exponent to the integers, which it shouldn't do because there is no coercion in that direction (only a conversion):
     29{{{
     30sage: k.<a>=GF(p^2)
     31sage: k(2)^k(p)
     321
     33sage: k(2)^k(a)
     34TypeError: not in prime subfield
     35sage: ZZ(k(1))
     361
     37sage: ZZ(k(a))
     38TypeError: not in prime subfield
     39}}}
     40There is one side-effect of this that does look elegant:
     41{{{
     42sage: R=Integers(p-1)
     43sage: (k(2))^(R(p))
     442
     45}}}
     46but in general I'd say an error should result from exponentiations like this.