Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#17539 closed enhancement (fixed)

convenience conversion from symbolic to fraction field

Reported by: rws Owned by:
Priority: major Milestone: sage-6.5
Component: symbolics Keywords:
Cc: mmarco Merged in:
Authors: Ralf Stephan Reviewers: Miguel Marco
Report Upstream: N/A Work issues:
Branch: 753dacd (Commits) Commit:
Dependencies: Stopgaps:

Description

See http://ask.sagemath.org/question/25327/casting-symbolic-fractions-to-fraction-field-of-polynomial-ring/

Something like

sage: ex=(x+1)/(x-1); ex
(x + 1)/(x - 1)
sage: ex.numerator().polynomial(ZZ)/ex.denominator().polynomial(ZZ)
(x + 1)/(x - 1)
sage: type(_)
<type 'sage.rings.fraction_field_element.FractionFieldElement'>

made into an Expression method, perhaps named fraction(...) with the ring as argument.

Change History (9)

comment:1 Changed 6 years ago by rws

  • Branch set to u/rws/convenience_conversion_from_symbolic_to_fraction_field

comment:2 Changed 6 years ago by rws

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

New commits:

e36f54717539: fraction method of expression

comment:3 Changed 6 years ago by mmarco

  • Reviewers set to Miguel Marco

It looks good, although maybe some more doctest would be better. One with nontrivial numerator, one with several variables, using other rings, etc.

comment:4 Changed 6 years ago by mmarco

  • Cc mmarco added

comment:5 Changed 6 years ago by git

  • Commit changed from e36f547d47db20169a17488b0ac56e87aac0d988 to 753dacdc39299243f7e379a3c3f67d63f36a8c04

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

753dacd17539: more doctests

comment:6 Changed 6 years ago by rws

Done. Though I'm of the opinion that every computation path in the associated code needs only be tested once (so it's actually up to doctests in polynomial_element.__div__ to be exhaustive). But I understand it maybe a demonstration of function behaviour.

comment:7 Changed 6 years ago by mmarco

  • Status changed from needs_review to positive_review

comment:8 Changed 6 years ago by vbraun

  • Branch changed from u/rws/convenience_conversion_from_symbolic_to_fraction_field to 753dacdc39299243f7e379a3c3f67d63f36a8c04
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:9 Changed 6 years ago by rws

  • Commit 753dacdc39299243f7e379a3c3f67d63f36a8c04 deleted

Thanks for the review.

Note: See TracTickets for help on using tickets.