Opened 6 years ago

Closed 6 years ago

#21740 closed defect (invalid)

Powers with rational exponents from QQbar fail

Reported by: rws Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: number fields Keywords:
Cc: Merged in:
Authors: Ralf Stephan Reviewers:
Report Upstream: N/A Work issues:
Branch: u/rws/powers_with_rational_exponents_from_qqbar_fail (Commits, GitHub, GitLab) Commit: bcdf0eda6640619524cdad4d5ae1023c883d7f3b
Dependencies: Stopgaps:

Status badges


sage: 2^(QQbar(1))
TypeError: no canonical coercion from Algebraic Field to Rational Field

Change History (9)

comment:1 Changed 6 years ago by rws

  • Branch set to u/rws/powers_with_rational_exponents_from_qqbar_fail

comment:2 Changed 6 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to d3f8911b56c5fa293b99f37371c6e5c511e7d78f
  • Status changed from new to needs_review

New commits:

d3f891121740: catch cases that can be converted to rational

comment:3 Changed 6 years ago by tscrim

The e = QQ(e) should call _coerce_ first then call the conversion, so _coerce_ shouldn't need to be called again. (We'd also then want e = QQ(e) to raise the error.)

comment:4 Changed 6 years ago by git

  • Commit changed from d3f8911b56c5fa293b99f37371c6e5c511e7d78f to bcdf0eda6640619524cdad4d5ae1023c883d7f3b

Branch pushed to git repo; I updated commit sha1. New commits:

bcdf0ed21740: change order of calls

comment:5 Changed 6 years ago by rws

You mean, this way?

comment:6 Changed 6 years ago by nbruin

If you're going to try conversion anyway, I don't think it makes much sense to try coercion explicitly first. I think it's good custom that if a coercion exists, conversion should agree with it. So, in effect (and possibly even in implementation!), conversion would try a coercion already.

One of the reasons why conversion might not be appropriate here is that, for instance, QQ("2") works just fine. So, if you use conversion in exponents the following probably would hold:

sage: 2^"2"
sage: a=GF(3)(-1)
sage: 2^a

That's a little too lenient to my taste.

Last edited 6 years ago by nbruin (previous) (diff)

comment:7 Changed 6 years ago by jdemeyer

As me and Vincent Delecroix wrote on sage-devel, it is a feature that 2 ^ QQbar(1) raises an exception.

comment:8 Changed 6 years ago by rws

  • Milestone changed from sage-7.5 to sage-duplicate/invalid/wontfix
  • Status changed from needs_review to positive_review

comment:9 Changed 6 years ago by vbraun

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.