#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.7.3
Component: number fields | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: Jeroen Demeyer
Merged: | Dependencies: #11130, #11321, #11891, #11890,
#11836
-----------------------------+----------------------------------------------
Comment(by jdemeyer):
Replying to [comment:9 was]:
> Quick question? What happens if I do:
> {{{
> sage: K.<a> = NumberField(x^3 + 2)
> sage: R.<y> = PolynomialRing(K)
> sage: pari(a*y)
> }}}
This fails by raising `PariError`.
The following ''does'' work (and it does ''not'' without the patch):
{{{
sage: K.<a> = NumberField(x^3 + 2)
sage: R.<y> = PolynomialRing(K)
sage: (a*y)._pari_with_name('x')
Mod(y, y^3 + 2)*x
}}}
> I would find out for myself, but with sage-4.7.2.alpha3, I get 13 hunks
fail, so I can't apply the patch. And I don't know which version of Sage
this patch is against.
Well, it should apply against sage-4.7.2.alpha3 (or more recent) if you
apply all the dependencies. But it is possible that I forgot a
dependency.
> If the above fails, isn't this a pretty bad approach to this problem?
Wouldn't it be better to call the variable in PARI something like
{{{__x}}} or {{{_x}}} (say).
No, this has to do with variable priorities and is not something which is
easily fixed. Besides, even if we do this, then you would still have
problems again with polynomial rings in multiple variables or relative
extensions.
So I'm not claiming this patch fixes all issues, it just ''improves'' on
the existing behaviour. My patch changes the `pari` function for number
field polynomials from '''never''' working to '''sometimes''' working (it
works if you use ''x'' as polynomial variable).
I also think this patch is important for the Sage library, since there we
can easily take the PARI variable to be ''x''. For example, my patch
changes
{{{
Kbnf = self.pari_bnf(proof=proof).nf_subst("'y")
coeffs = [ a._pari_("y") for a in relpoly.coeffs() ]
polrel = pari(coeffs).Polrev()
return Kbnf.rnfisnorminit(polrel)
}}}
to the much simpler
{{{
Kbnf = self.pari_bnf(proof=proof)
return Kbnf.rnfisnorminit(relpoly._pari_with_name())
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11904#comment:11>
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.