Feature #1117
Better printing of negative coeffs
Description
Currently CoCoALib prints out polys wth negative rational coeffs in an ugly way:
/**/ x-(1/2)*y; x +(-1/2)*y
Improve printing so that we get -(
instead of +(-
/**/ x-(1/2)*y; x -(1/2)*y
Related issues
History
#1 Updated by John Abbott over 6 years ago
- Related to Bug #74: printing polynomials added
#2 Updated by John Abbott over 6 years ago
- Related to Feature #222: Printing polynomials - spaces between terms added
#3 Updated by John Abbott over 6 years ago
- Related to Design #432: Semantics of IsPrintedWithMinus added
#4 Updated by John Abbott over 6 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
JAA suggests that we handle integer and rational coeffs specially; all other coeffs are handled in a generic way.
Here are some examples:
/**/ use QQ[x,y]; /**/ x-(1/2)*y; --> currently prints as x +(-1/2)*y x-(1/2)*y /**/ x-(1/2); // better with or without brackets? x-1/2
NOTE: currently CoCoA does print the second poly as
x -1/2
; so no brackets, and special handling for the minus sign!
If coeff is not rational do not handle "negative" values specially:
/**/ use QQ(a)[x,y]; // not valid CoCoA syntax /**/ x + (-a+1)*y; x +(-a+1)*y
What about the following:
use QQ(a)[x,y]; /**/ x-a*y; x +(-a)*y
#5 Updated by John Abbott about 6 years ago
- Related to Design #1156: Printing for RingElem added
#6 Updated by John Abbott almost 6 years ago
- Target version changed from CoCoALib-0.99600 to CoCoALib-0.99650 November 2019
#7 Updated by John Abbott over 4 years ago
- Target version changed from CoCoALib-0.99650 November 2019 to CoCoALib-1.0