Project

General

Profile

Feature #1117

Better printing of negative coeffs

Added by John Abbott over 6 years ago. Updated over 4 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Category:
Improving
Target version:
Start date:
07 Nov 2017
Due date:
% Done:

10%

Estimated time:
Spent time:

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

Related to CoCoALib - Bug #74: printing polynomialsNew2011-12-22

Related to CoCoALib - Feature #222: Printing polynomials - spaces between termsIn Progress2012-08-08

Related to CoCoALib - Design #432: Semantics of IsPrintedWithMinusIn Progress2014-01-31

Related to CoCoALib - Design #1156: Printing for RingElemNew2018-02-12

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

#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

Also available in: Atom PDF