Opened 10 years ago
Closed 7 years ago
#11368 closed defect (fixed)
can't coerce pari to rational function field
Reported by:  katestange  Owned by:  robertwb 

Priority:  minor  Milestone:  sage6.1 
Component:  coercion  Keywords:  coercion pari rational fraction_field string 
Cc:  katestange  Merged in:  
Authors:  Peter Bruin  Reviewers:  Marco Streng 
Report Upstream:  N/A  Work issues:  
Branch:  u/pbruin/11368coerce_rational_function_field (Commits)  Commit:  a9fcc831dca865c0adf7feceb8413d7dc7b5cf8c 
Dependencies:  Stopgaps: 
Description (last modified by )
The following fails
sage: R.<x,y> = PolynomialRing(QQ) sage: S = R.fraction_field() sage: S(pari((x+y)/y)) TypeError: no canonical coercion from Fraction Field of Multivariate Polynomial Ring in x, y over Rational Field to Rational Field
However, if you replace (x+y)/y with x+y, it works (in other words, polynomials work but rational functions don't).
Change History (8)
comment:1 Changed 10 years ago by
 Description modified (diff)
 Keywords string added
comment:2 Changed 7 years ago by
 Milestone changed from sage5.11 to sage5.12
comment:3 Changed 7 years ago by
 Description modified (diff)
In newer Sage versions (for example 5.13.beta0), the example S('(x+y)/y')
works correctly, but the original example (converting from PARI) still fails.
comment:4 Changed 7 years ago by
The problem seems to be this:
sage: R.<x,y> = PolynomialRing(QQ) sage: a=pari((x+y)/y); a 1/y*x + 1 sage: a.numerator() 1/y*x + 1 sage: a.denominator() 1
Note that the following does work:
sage: b=pari((x+y)/x); b (x + y)/x sage: b.numerator() x + y sage: b.denominator() x
Note also that the PARI types are different:
sage: a.type() 't_POL' sage: b.type() 't_RFRAC'
This difference arises because PARI treats multivariate polynomials as iterated univariate polynomials. To PARI, a lives in Q(y)[x], and b in Frac(Q[y][x]).
The solution is probably to convert PARI elements of type t_POL
coefficientwise into S.
comment:5 Changed 7 years ago by
 Branch set to u/pbruin/11368coerce_rational_function_field
 Description modified (diff)
 Modified changed from 12/20/13 14:19:13 to 12/20/13 14:19:13
 Status changed from new to needs_review
comment:6 Changed 7 years ago by
 Commit set to a9fcc831dca865c0adf7feceb8413d7dc7b5cf8c
 Reviewers set to Marco Streng
I'll review this as my first git review.
New commits:
a9fcc83  fix conversion PARI > rational function field in several variables

comment:7 Changed 7 years ago by
 Modified changed from 12/23/13 14:19:35 to 12/23/13 14:19:35
 Status changed from needs_review to positive_review
comment:8 Changed 7 years ago by
 Resolution set to fixed
 Status changed from positive_review to closed
I think it is probably related that the following fails: (with R and S as above)
with the same error. Again, polynomial coercion like
succeeds. (If someone finds that this is a different problem, please put in a separate ticket, but I'm guessing it's related.)