|
5.1.114 print
Syntax:
print ( expression )
print ( expression, "betti" )
print ( expression, format_string )
Type:
- string
Purpose:
- The first form prints the expression.
The second form prints the graded Betti numbers from a matrix.
The Betti numbers are printed in a matrix-like format where the entry
in row and column is the minimal number of generators in
degree
of the -th syzygy module of
(the 0th and 1st syzygy module of is and , resp.). The last form returns the printed output as a string depending on
the format string iwhich determines the format to use to generate the string.
The following format strings are supported:
"%s"
- returns
string( expression ) ,
"%2s"
- similar to
"%s" , except that newlines are inserted after every
comma and at the end,
"%l"
- similar to
"%s" , except that each object is embraced by its type
such that it can be directly used for "cutting and pasting",
"%2l"
- similar to
"%l" , except that newlines are inserted after every
comma and at the end,
"%;"
- returns the string equivalent to typing
expression;
"%t"
- returns the string equivalent to typing
type expression;
"%p"
- returns the string equivalent to typing
print(expression);
"%b"
- returns the string equivalent to typing
print(expression, "betti");
"betti"
- is not a format string.
Example:
| ring r=0,(x,y,z),dp;
module m=[1,y],[0,x+z];
m;
==> m[1]=y*gen(2)+gen(1)
==> m[2]=x*gen(2)+z*gen(2)
print(m); // the columns generate m
==> 1,0,
==> y,x+z
string s=print(m,"%s"); s;
==> y*gen(2)+gen(1),x*gen(2)+z*gen(2)
s=print(m,"%2s"); s;
==> y*gen(2)+gen(1),
==> x*gen(2)+z*gen(2)
==>
s=print(m,"%l"); s;
==> module(y*gen(2)+gen(1),x*gen(2)+z*gen(2))
s=print(m,"%;"); s;
==> m[1]=y*gen(2)+gen(1)
==> m[2]=x*gen(2)+z*gen(2)
==>
s=print(m,"%t"); s;
==> // m module , rk 2
==> m[1]=y*gen(2)+gen(1)
==> m[2]=x*gen(2)+z*gen(2)
s=print(m,"%p"); s;
==> 1,0,
==> y,x+z
intmat M=betti(mres(m,0));
print(M,"betti");
==> 0 1
==> ------------------
==> 0: 1 1
==> ------------------
==> total: 1 1
==>
list l=r,M;
s=print(l,"%s"); s;
==> (QQ),(x,y,z),(dp(3),C),1,1
s=print(l,"%2s"); s;
==> (QQ),(x,y,z),(dp(3),C),
==> 1,1
==>
s=print(l,"%l"); s;
==> list("(QQ),(x,y,z),(dp(3),C)",intmat(intvec(1,1 ),1,2))
|
See
Type conversion and casting;
betti;
dbprint;
fprintf;
printf;
short;
sprintf;
string type cast;
type.
|