Some more remarks and considerations: 

The last "::gf16" in Bill's statement  is not necessary!


(19) -> eval(p::POLY gf16, x,a)

           2
   (19)  %A  + 1
    Type: Polynomial(FiniteFieldExtensionByPolynomial(PrimeField(2),?^4+?+1))


However, what is really strange, is that the following does not wok: 


(20) -> eval(p::POLY gf16, x=a)
   There are 3 exposed and 0 unexposed library operations named 
      equation having 2 argument(s) but none was determined to be 
      applicable. Use HyperDoc Browse, or issue
                            )display op equation
      to learn more about the available operations. Perhaps 
      package-calling the operation or using coercions on the arguments
      will allow you to apply the operation.
 
   Cannot find a definition or applicable library operation named 
      equation with argument type(s) 
                                 Variable(x)
           FiniteFieldExtensionByPolynomial(PrimeField(2),?^4+?+1)
      
      Perhaps you should use "@" to indicate the required return type, 
      or "$" to specify which version of the function you need.


which should be corrected as the following works without problems:
(20) -> q := 3*x^2+x-4

           2
   (20)  3x  + x - 4
                                                    Type: Polynomial(Integer)
(21) -> eval(q, x=3)

   (21)  26
                                                    Type: Polynomial(Integer)
(22) -> eval(q, x, 3)

   (22)  26
                                                    Type: Polynomial(Integer)



While 

(23) -> eval(p, x, a)
 
   >> Error detected within library code:
   coerce: element doesn't belong to smaller field


directly tells you what the problem is, however, this is not consequent, look 
at the following: 

(23) -> eval(q, x, 4/3)

         8
   (23)  -
         3
                                          Type: Polynomial(Fraction(Integer))



hence the interpreter extends to a larger coefficient domain. 

Who can and wants to improve the coercion mechanism to have a predictable 
behaviour in all cases?




































Am 11.08.2011 um 00:39 schrieb Bill Page:

> Paul,
> 
> p is a polynomial over the base field. eval expects to return a
> polynomial of the same type.
> 
> Perhaps this is what you intended?
> 
> (6) -> eval(p::POLY gf16, x,a)::gf16
> 
>           2
>   (6)  %A  + 1
>                Type: FiniteFieldExtensionByPolynomial(PrimeField(2),?^4+?+1)
> 
> Regards,
> Bill Page.
> 
> On Wed, Aug 10, 2011 at 5:13 PM, Paul Onions <[email protected]> wrote:
>> I have the following problem when I try to evaluate a polynomial in a
>> finite-field extension:
>> 
>> -- START OF TRANSCRIPT --
>> gf2 := PrimeField 2   -- the base field
>> 
>>   (1)  PrimeField(2)
>> 
>> Type: Type
>> gf16 := FiniteFieldExtensionByPolynomial(gf2, x**4 + x + 1)  -- the
>> extension field
>> 
>>   (2)  FiniteFieldExtensionByPolynomial(PrimeField(2),?^4+?+1)
>> 
>> Type: Type
>> a := index(2)$gf16  -- a primitive element of the extension field
>> 
>>   (3)  %A
>>                Type: FiniteFieldExtensionByPolynomial(PrimeField(2),?
>> ^4+?+1)
>> order a  -- check primitiveness
>> 
>>   (4)  15
>>                                                        Type:
>> PositiveInteger
>> p := x**2 + 1 :: POLY gf2  -- a polynomial over the base field
>> 
>>         2
>>   (5)  x  + 1
>>                                              Type:
>> Polynomial(PrimeField(2))
>> eval(p, x=a)
>> 
>>   There are 3 exposed and 0 unexposed library operations named
>>      equation having 2 argument(s) but none was determined to be
>>      applicable. Use HyperDoc Browse, or issue
>>                            )display op equation
>>      to learn more about the available operations. Perhaps
>>      package-calling the operation or using coercions on the
>> arguments
>>      will allow you to apply the operation.
>> 
>>   Cannot find a definition or applicable library operation named
>>      equation with argument type(s)
>>                                 Variable(x)
>>           FiniteFieldExtensionByPolynomial(PrimeField(2),?^4+?+1)
>> 
>>      Perhaps you should use "@" to indicate the required return
>> type,
>>      or "$" to specify which version of the function you need.
>> -- END OF TRANSCRIPT --
>> 
>> where I expect
>>  eval(p,x=a)
>> to give the same result as
>>  a**2 + 1
>> which does indeed work, as follows:
>> 
>> -- START OF TRANSCRIPT --
>> (6) -> a**2 + 1
>> 
>>          2
>>   (6)  %A  + 1
>>                Type: FiniteFieldExtensionByPolynomial(PrimeField(2),?
>> ^4+?+1)
>> -- END OF TRANSCRIPT --
>> 
>> Any idea what I'm doing wrong?
>> 
>> Thanks,
>> Paul
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "FriCAS - computer algebra system" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/fricas-devel?hl=en.
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "FriCAS - computer algebra system" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/fricas-devel?hl=en.
> 

Mit freundlichen Grüßen

Johannes Grabmeier

Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-171-5503789
Tel. +49-(0)-991-3615-100 (d),  Fax: +49-(0)-1803-5518-17745

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to