#2420: [with patch, needs work] Extending the gap interface to uni- and
multivariate polynomial rings over number fields
----------------------------------------------------------------------+-----
   Reporter:  SimonKing                                               |       
Owner:  SimonKing                                                     
       Type:  enhancement                                             |      
Status:  needs_work                                                    
   Priority:  major                                                   |   
Milestone:  sage-4.5                                                      
  Component:  interfaces                                              |    
Keywords:  gap interface, polynomial rings, number fields, editor_mhansen
     Author:  Simon King                                              |    
Upstream:  N/A                                                           
   Reviewer:                                                          |      
Merged:                                                                
Work_issues:  Consider stacks of polynomial rings over number fields  |  
----------------------------------------------------------------------+-----
Changes (by SimonKing):

  * work_issues:  Side effect of GAP on Pari => Consider stacks of
                  polynomial rings over number fields


Comment:

 OK, problem solved!

 It is a bug in {{IntegerMod_int.log()}}}, which had a side effect in PARI
 and is fixed at #9438. Apply
 {{{trac_2420_GAP_interface_polynomials.patch}}} after applying the patches
 from #8909, #9423 and #9438, and {{{sage -testall}}} passes!

 Here is a summary of the features:

 Univariate
 {{{
 sage: F.<zeta> = CyclotomicField(8)
 sage: R.<x> = F[]
 sage: gap(R)
 PolynomialRing( CF(8), ["x"] )
 sage: p = zeta^2*x+2*zeta
 sage: gap(p)^3
 (-E(4))*x^3+(-6*E(8))*x^2-12*x+8*E(8)^3
 sage: p^3
 -zeta^2*x^3 - 6*zeta*x^2 - 12*x + 8*zeta^3
 }}}

 Multivariate
 {{{
 sage: R.<x,y> = F[]
 sage: p = zeta*x+zeta^2*y
 sage: gap(p)^2
 E(4)*x^2+2*E(8)^3*x*y-y^2
 sage: p^2
 (zeta^2)*x^2 + (2*zeta^3)*x*y - y^2
 }}}

 O dear! A stack of polynomial rings does not work as it should:
 {{{
 sage: P.<y> = QQ[]
 sage: K.<tau> = NumberField(y^2+y+1)
 sage: R.<x,y> = K[]
 sage: S.<z> = R[]
 sage: p = tau*x+tau^2*z+3*tau^3*x*y*z
 sage: p
 (3*x*y + (-tau - 1))*z + (tau)*x
 sage: gap(p)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/king/SAGE/work/Tickets/9438/<ipython console> in <module>()

 /home/king/SAGE/sage-4.4.2/local/lib/python2.6/site-
 packages/sage/interfaces/expect.pyc in __call__(self, x, name)
    1032             return cls(self, x, name=name)
    1033         try:
 -> 1034             return self._coerce_from_special_method(x)
    1035         except TypeError:
    1036             raise

 /home/king/SAGE/sage-4.4.2/local/lib/python2.6/site-
 packages/sage/interfaces/expect.pyc in _coerce_from_special_method(self,
 x)
    1056             s = '_gp_'
    1057         try:
 -> 1058             return (x.__getattribute__(s))(self)
    1059         except AttributeError:
    1060             return self(x._interface_init_())

 /home/king/SAGE/sage-4.4.2/local/lib/python2.6/site-
 packages/sage/rings/polynomial/polynomial_element.so in
 sage.rings.polynomial.polynomial_element.Polynomial._gap_
 (sage/rings/polynomial/polynomial_element.c:27411)()

 /home/king/SAGE/sage-4.4.2/local/lib/python2.6/site-
 packages/sage/interfaces/expect.pyc in __call__(self, x, name)
    1030
    1031         if isinstance(x, basestring):
 -> 1032             return cls(self, x, name=name)
    1033         try:
    1034             return self._coerce_from_special_method(x)

 /home/king/SAGE/sage-4.4.2/local/lib/python2.6/site-
 packages/sage/interfaces/expect.pyc in __init__(self, parent, value,
 is_name, name)
    1449             except (TypeError, KeyboardInterrupt, RuntimeError,
 ValueError), x:
    1450                 self._session_number = -1
 -> 1451                 raise TypeError, x
    1452         self._session_number = parent._session_number
    1453

 TypeError: Gap produced error output
 Error, no 1st choice method found for `PROD' on 2 arguments

    executing
 Read("/home/king/.sage//temp/gauss/30709//interface//tmp30709");
 }}}

 The string that was supposed to be executed is
 {{{
 sage: p._gap_init_()
 'CallFuncList(function() local z; z:=Indeterminate($sage12,"z"); return
 (CallFuncList(function() local x,y; x:=Indeterminate($sage5,"x");
 y:=Indeterminate($sage5,"y"); return (GeneratorsOfField($sage5)[1])*x;
 end,[]))*1+(CallFuncList(function() local x,y;
 x:=Indeterminate($sage5,"x"); y:=Indeterminate($sage5,"y"); return
 (3)*x*y+(-GeneratorsOfField($sage5)[1] - 1)*1; end,[]))*z; end,[])'
 }}}

 So, it is almost done, but I'd like to fix the last problem too.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2420#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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/sage-trac?hl=en.

Reply via email to