#11904: Change default variable name for NumberField and NumberFieldElement -> 
PARI
conversion
-----------------------------+----------------------------------------------
   Reporter:  jdemeyer       |          Owner:  davidloeffler                   
              
       Type:  defect         |         Status:  needs_review                    
              
   Priority:  major          |      Milestone:  sage-4.8                        
              
  Component:  number fields  |       Keywords:                                  
              
Work_issues:                 |       Upstream:  N/A                             
              
   Reviewer:                 |         Author:  Jeroen Demeyer                  
              
     Merged:                 |   Dependencies:  #11130, #11321, #11891, #11890, 
#11836, #11952
-----------------------------+----------------------------------------------
Description changed by jdemeyer:

Old description:

> This should be fixed:
> {{{
> sage: K.<a> = NumberField(x^3 + 2)
> sage: R.<x> = PolynomialRing(K)
> sage: pari(a*x)
> ---------------------------------------------------------------------------
> PariError                                 Traceback (most recent call
> last)
>
> /usr/local/src/sage-4.7.2.alpha2/<ipython console> in <module>()
>
> /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
> packages/sage/libs/pari/gen.so in
> sage.libs.pari.gen.PariInstance.__call__ (sage/libs/pari/gen.c:43353)()
>
> /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
> packages/sage/rings/polynomial/polynomial_element.so in
> sage.rings.polynomial.polynomial_element.Polynomial._pari_
> (sage/rings/polynomial/polynomial_element.c:27815)()
>
> /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
> packages/sage/rings/polynomial/polynomial_element.so in
> sage.rings.polynomial.polynomial_element.Polynomial._pari_with_name
> (sage/rings/polynomial/polynomial_element.c:28109)()
>
> /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
> packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap
> (sage/libs/pari/gen.c:48151)()
>
> PariError:  (5)
> }}}
>
> The reason is:
> {{{
> sage: K.<a> = NumberField(x^3 + 2)
> sage: a._pari_()
> Mod(x, x^3 + 2)
> }}}
> Note that the variable `x` is used. Since polynomials prefer the variable
> name `x`, it might be better to use `z` by default (or any other name)
> for number field elements.
>
> There is no good way to fix this for relative number fields, so we don't
> change that.
>
> Also, the `_pari_()` methods for `NumberFieldElement_absolute` and
> `NumberFieldElement_relative` are exactly the same, so we should avoid
> code duplication.

New description:

 This should be fixed:
 {{{
 sage: K.<a> = NumberField(x^3 + 2)
 sage: R.<x> = PolynomialRing(K)
 sage: pari(a*x)
 ---------------------------------------------------------------------------
 PariError                                 Traceback (most recent call
 last)

 /usr/local/src/sage-4.7.2.alpha2/<ipython console> in <module>()

 /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
 packages/sage/libs/pari/gen.so in sage.libs.pari.gen.PariInstance.__call__
 (sage/libs/pari/gen.c:43353)()

 /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
 packages/sage/rings/polynomial/polynomial_element.so in
 sage.rings.polynomial.polynomial_element.Polynomial._pari_
 (sage/rings/polynomial/polynomial_element.c:27815)()

 /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
 packages/sage/rings/polynomial/polynomial_element.so in
 sage.rings.polynomial.polynomial_element.Polynomial._pari_with_name
 (sage/rings/polynomial/polynomial_element.c:28109)()

 /usr/local/src/sage-4.7.2.alpha2/local/lib/python2.6/site-
 packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap
 (sage/libs/pari/gen.c:48151)()

 PariError:  (5)
 }}}

 The reason is:
 {{{
 sage: K.<a> = NumberField(x^3 + 2)
 sage: a._pari_()
 Mod(x, x^3 + 2)
 }}}
 Note that the variable `x` is used. Since polynomials prefer the variable
 name `x`, it might be better to use `y` by default (or any other name) for
 number field elements.

 There is no good way to fix this for relative number fields, so we don't
 change that.

 Also, the `_pari_()` methods for `NumberFieldElement_absolute` and
 `NumberFieldElement_relative` are exactly the same, so we should avoid
 code duplication.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11904#comment:17>
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