#17974: Fix conversion from PARI to multivariate polynomial rings
-------------------------------------+-------------------------------------
Reporter: pbruin | Owner:
Type: defect | Status: needs_info
Priority: major | Milestone: sage-6.6
Component: algebra | Resolution:
Keywords: multivariate | Merged in:
polynomials pari | Reviewers:
Authors: Peter Bruin | Work issues:
Report Upstream: N/A | Commit:
Branch: | 8be3fe6225d04415b144c8d36e87ec0e2595921e
u/pbruin/17974-multivariate_polynomials_pari| Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by pbruin):
Hello Vincent,
> Do you know how pari chooses the order of the variables
> {{{
> sage: A.<a> = PolynomialRing(QQ)
> sage: B.<d,e> = PolynomialRing(A)
> sage: f = pari(a*d)
> sage: f
> d*a
> sage: B(f)
> a*d
In PARI, the variables `x` and `y` are predefined (with `x` of higher
priority) and subsequent variables get a successively lower priority in
the order in which they are encountered. Polynomials are printed with the
variable of highest priority on the right. In this example PARI sees `a`
first, therefore it has higher priority than `d`. Compare
{{{
sage: gp('a*d')
d*a
}}}
> On the other hand, what do you think of
> {{{
> sage: f.sage()
> Traceback (most recent call last):
> ...
> NameError: name 'd' is not defined
> }}}
This is because user-defined names are not part of the default context in
which the evaluation is done. You have to do
{{{
sage: f.sage({'a': a, 'd': d})
a*d
}}}
or
{{{
sage: f.sage(globals())
a*d
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/17974#comment:3>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.