Opened 7 years ago

Last modified 4 months ago

#14602 needs_work defect

Symbolic expression to number fields

Reported by: vdelecroix Owned by: davidloeffler
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: number fields Keywords:
Cc: vdelecroix, mkoeppe Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by vdelecroix)

The ticket stands to improve the AlgebraicConverter in sage.symbolic.expression_converters and make it works with number fields.

As mentioned on ask the following fails

sage: K = QuadraticField(3)
sage: K(sqrt(3))
Traceback (most recent call last):
...
TypeError: ...

The following gives an answer with a wrong parent

sage: x = K(3)**(1/2); x
sqrt(3)
sage: a.parent()
Symbolic Ring

while it is possible to do

sage: y = K(3).sqrt(); y
a
sage: y == K.gen()
True

Finally, we hopefully have

sage: K.gen() == sqrt(3)
sqrt(3) == sqrt(3)
sage: bool(K.gen() == sqrt(3))
True

Change History (11)

comment:1 Changed 7 years ago by vdelecroix

  • Description modified (diff)

comment:2 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:6 Changed 3 years ago by mkoeppe

  • Cc mkoeppe added

comment:7 Changed 4 months ago by chapoton

everything seems to work fine now (sage 8.9.b7)

comment:8 Changed 4 months ago by vdelecroix

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Indeed. The situation improved.

comment:9 Changed 4 months ago by klui

  • Status changed from needs_review to positive_review

Yep.

Every example in the ticket text now works!

comment:10 follow-up: Changed 4 months ago by chapoton

Is this doctested somewhere ?

comment:11 in reply to: ↑ 10 Changed 4 months ago by klui

  • Status changed from positive_review to needs_work

Replying to chapoton:

Is this doctested somewhere ?

Not as far as I can tell. Good point. Forgot to check that.

Note: See TracTickets for help on using tickets.