On Nov 17, 9:28 pm, Robert Bradshaw <rober...@math.washington.edu>
wrote:
> How about doing
>
> sage: f = legendre_P(3, GF(11)['x'].gen()); f
>  8*x^3 + 4*x
> sage: parent(f)
>  Univariate Polynomial Ring in x over Finite Field of size 11
> sage: f(5)
>  8
>
> However, the implementation (manipulating strings) is pretty horrid.

That can be cleaned up quite a bit if this were rewritten to use
maxima_lib. In that case the multiplications would probably be actual
sage multiplications too, so would likely lead to the same errors as
in Sage, though.

The issue really is whether "rational number"*"finite field element"
should be supported. The problem is of course that there is no common
parent for *all* possible element pairs, so the coercion framework
rightfully refuses. It would be awfully convenient if it were allowed
when it makes sense (and just throw a ZeroDivision otherwise).

Conversion does do the right thing,you just need to phrase your
problem in a way that allows conversion rules come into play:

sage: Qx.<x>=QQ[]
sage: Fy.<y>=GF(101)[]
sage: f=legendr
legendre_P       legendre_Q       legendre_symbol
sage: f=legendre_P(3,x)
sage: f
5/2*x^3 - 3/2*x
sage: Fy(f)
53*y^3 + 49*y

After that you can of course evaluate the converted polynomial. The
issue of course is that Legendre polynomials cannot be defined this
way in all characteristics:

sage: Fz.<z>=GF(2)[]
sage: Fz(f)
ZeroDivisionError: Inverse does not exist.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to