Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to evaluate composed rational maps over finite fields?

My actual aim is to evaluate the composition of $n$ maps $h(x, y)=f_n(x, y)\circ \cdots \circ f_1(x, y)$ over the finite field $GF(q)$ for a prime $q$ at specified point $(X, Y)$. The map $h(x, y)$ is specified as a composite map. The maps $f_i(x, y)$s are not accessible, so they can not be evaluated at $(X, Y)$, recursively. Here is a toy example.

from sage.categories.morphism import SetMorphism

F = GF(23)
R.<x, y> = PolynomialRing(F)

# This part is not accessible
f0 = ((x^2 + 1)/x, (x^2*y - y)/x^2)
f1 = ((x^2 - 2*x + 8)/(x - 2), (x^2*y - 4*x*y - 4*y)/(x^2 - 4*x + 4))
f2 = ((x^2 + x + 5)/(x + 1), (x^2*y + 2*x*y - 4*y)/(x^2 + 2*x + 1))
f3 = ((x^3 + 11*x^2 - x - 4)/(x^2 + 11*x - 10), (x^3*y + 5*x^2*y + 7*x*y - 9*y)/(x^3 + 5*x^2 - 7*x - 9))

h0 = SetMorphism(Hom(F, F), f0)
h1 = SetMorphism(Hom(F, F), f1)
h2 = SetMorphism(Hom(F, F), f2)
h3 = SetMorphism(Hom(F, F), f3)
# This part is not accessible

h = h0*h1*h2*h3
print (h)
print (h(2, 4))

This outputs

Composite map:
  From: Finite Field of size 23
  To:   Finite Field of size 23
  Defn:   Generic endomorphism of Finite Field of size 23
        then
          Generic endomorphism of Finite Field of size 23
        then
          Generic endomorphism of Finite Field of size 23
        then
          Generic endomorphism of Finite Field of size 23
   ---------------------------------------------------------------------------
   TypeError                                 Traceback (most recent call last)
   Cell In[1], line 23
   21 h = h0*h1*h2*h3
   22 print (h)
   ---> 23 print (h(Integer(2), Integer(4)))

   File /home/sc_serv/sage/src/sage/categories/map.pyx:825, in sage.categories.map.Map.__call__()
   823     if not args and not kwds:
   824         return self._call_(x)
   --> 825     return self._call_with_args(x, args, kwds)
   826 
   827 cpdef Element _call_(self, x):

   File /home/sc_serv/sage/src/sage/categories/map.pyx:1765, in 
   sage.categories.map.FormalCompositeMap._call_with_args()
   1763 """
   1764 for f in self.__list[:-1]:
   -> 1765     x = f._call_(x)
   1766 return self.__list[-1]._call_with_args(x, args, kwds)
   1767 

   File /home/sc_serv/sage/src/sage/categories/morphism.pyx:593, in sage.categories.morphism.SetMorphism._call_()
   591     self._function = function
   592 
   --> 593 cpdef Element _call_(self, x):
   594     """
   595     INPUT:

   File /home/sc_serv/sage/src/sage/categories/morphism.pyx:612, in sage.categories.morphism.SetMorphism._call_()
   610         3
   611     """
   --> 612     return self._function(x)
   613 
   614 cpdef Element _call_with_args(self, x, args=(), kwds={}):

   TypeError: 'tuple' object is not callable

But, the composed rational map should look like,

h = ((x^24 + 2*x^23 + 2*x^22 + 4*x^21 + 6*x^20 + 11*x^19 - 5*x^18 - 2*x^17 + 9*x^16 + 6*x^15 - 4*x^14 + 11*x^13 + 11*x^11 - 4*x^10 + 6*x^9 + 9*x^8 - 2*x^7 - 5*x^6 + 11*x^5 + 6*x^4 + 4*x^3 + 2*x^2 + 2*x + 1)/(x^23 + 2*x^22 + 2*x^21 + 4*x^20 + 6*x^19 + 11*x^18 - 5*x^17 - 2*x^16 + 9*x^15 + 6*x^14 - 4*x^13 + 9*x^12 - 4*x^11 + 6*x^10 + 9*x^9 - 2*x^8 - 5*x^7 + 11*x^6 + 6*x^5 + 4*x^4 + 2*x^3 + 2*x^2 + x), (x^35*y + 3*x^34*y - 7*x^33*y - 3*x^32*y + x^31*y + 8*x^30*y + x^29*y + 3*x^28*y + 3*x^27*y + 2*x^26*y + 3*x^25*y + 7*x^24*y - x^23*y - 2*x^21*y + 9*x^20*y + 11*x^19*y + x^18*y + x^17*y + 11*x^16*y + 9*x^15*y - 2*x^14*y - x^12*y + 7*x^11*y + 3*x^10*y + 2*x^9*y + 3*x^8*y + 3*x^7*y + x^6*y + 8*x^5*y + x^4*y - 3*x^3*y - 7*x^2*y + 3*x*y + y)/(x^35 + 3*x^34 - 7*x^33 - 3*x^32 + x^31 + 8*x^30 + x^29 + 3*x^28 + 3*x^27 + 2*x^26 + 3*x^25 + 4*x^24 - 10*x^23 + 10*x^22 - 3*x^21 - x^20 - 2*x^19 + 2*x^18 + x^17 + 3*x^16 - 10*x^15 + 10*x^14 - 4*x^13 - 3*x^12 - 2*x^11 - 3*x^10 - 3*x^9 - x^8 - 8*x^7 - x^6 + 3*x^5 + 7*x^4 - 3*x^3 - x^2))

My questions are,

  1. How to evaluate the map $h$ on the point $(X=2, Y= 4)$. i.e., how to find $h(2, 4)$?
  2. How to find the rational map of $h$ and its degree?

I would be thankful if anyone suggests the method.