Opened 11 years ago

Closed 11 years ago

#7363 closed defect (fixed)

print symbolic fractions more naturally: print 2/(x+2) instead of 2 (1/(x+2))

Reported by: jason Owned by: burcin
Priority: minor Milestone: sage-4.3.3
Component: symbolics Keywords: pynac, symbolic, print
Cc: burcin Merged in: sage-4.3.3.alpha1
Authors: Burcin Erocal Reviewers: Karl-Dieter Crisman, Ross Kyprianou
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Attachments (1)

trac_7363-mul_coeff.patch (1.7 KB) - added by burcin 11 years ago.
add doctests

Download all attachments as: .zip

Change History (7)

comment:1 Changed 11 years ago by jason

  • Priority changed from major to minor

Changed 11 years ago by burcin

add doctests

comment:2 Changed 11 years ago by burcin

  • Authors set to Burcin Erocal
  • Keywords pynac added
  • Report Upstream set to N/A
  • Status changed from new to needs_work

Next pynac release will have a patch for this. attachment:trac_7363-mul_coeff.patch fixes some doctests and adds a couple more.

comment:3 Changed 11 years ago by burcin

  • Status changed from needs_work to needs_review

New pynac package available here:

http://sage.math.washington.edu/home/burcin/pynac/pynac-0.1.11.spkg

The package contains fixes for #7822, #6961, #7876, #7363, #6465 and #6559. Apart from this ticket, #7876 contains printing changes. Doctests should be run with the patch from that ticket applied as well.

comment:4 Changed 11 years ago by kcrisman

This seems to work well, but I do not know enough C++ to review http://pynac.sagemath.org/hg/rev/5ea74f619c01, unfortunately. Partial positive review?

comment:5 Changed 11 years ago by rossk

  • Keywords symbolic print added
  • Reviewers set to Karl-Dieter Crisman, Ross Kyprianou
  • Status changed from needs_review to positive_review

Im also not qualified to review the C++ code but the (representative) examples below indicate the code satisfies the objectives so Im giving it a positive review (which someone can reverse if they discover a counterexample)

# Note: division is left associative: 12/3/4 = (12/3)/4
sage: 12/3/4 
1

sage: var('x y z')
(x, y, z)

sage: 2/(x+1) # the motivating example
2/(x + 1)

sage: 1/(2*y)
1/2/y

sage: 1/(1/2*y)
2/y

sage: x/2/y
1/2*x/y

sage: .5*x/y
0.500000000000000*x/y

sage: .5/x/y
0.500000000000000/(x*y)

sage: 1/2/x/y
1/2/(x*y)

sage: 1/x/2
1/2/x

comment:6 Changed 11 years ago by mvngu

  • Merged in set to sage-4.3.3.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.