up previous next
StarPrint, StarSprint

print polynomial with *'s for multiplications

Syntax
StarPrint(F: RINGELEM)
StarPrintFold(F: RINGELEM, LineWidth: INT)
StarSprint(F: RINGELEM): STRING
StarSprintFold(F: RINGELEM, LineWidth: INT): STRING

Description
These functions print the polynomial F with asterisks added to denote multiplications. They may be useful when transfering polynomials or rational functions from CoCoA to other mathematical software (e.g. Gap, Maple, Macaulay, Singular,..). StarPrint inserts newline characters (only between terms) with the aim of avoiding lines longer than 70 characters; the second argument to StarPrintFold is for specifying a different width limit; a non positive value is treated as meaning no limit. The StarSprint functions print the value into a string.

Example
  Use R ::= QQ[x,y];
  F := x^3+2xy-y^2;
  StarPrint(F);
1*x^3 +2*x*y -1*y^2
-------------------------------
  StarPrintFold(F,1); -- this will print one term per line
1*x^3
 +2*x*y
 -1*y^2
-------------------------------
  D := OpenOFile("example");
  Print StarSprint(F) On D; -- this will print F into the file "example"
  Close(D);
-------------------------------

See Also