|
5.1.99 print
Syntax:
print ( expression )
print ( expression, "betti" )
print ( expression, format_string )
Type:
- none (for the first two calling sequences), resp.
string (for the last calling sequence)
Purpose:
- The first form prints the expression to the terminal and has no return
value. Use the format string
%p to print into a string (see
below).
The second form prints the graded Betti numbers from a matrix. See
the description of the format string "betti" below for more
details.
The last form returns the printed output as a string. The format
string determines which format to use to generate the string.
The following format strings are supported:
"betti"
- 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.). "%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");
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 [0] module, rk 2, 2 generator(s)
==> 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;
==> (0),(x,y,z),(dp(3),C),1,1
s=print(l,"%2s"); s;
==> (0),(x,y,z),(dp(3),C),
==> 1,1
==>
s=print(l,"%l"); s;
==> list("(0),(x,y,z),(dp(3),C)",intmat(intvec(1,1 ),1,2))
|
See
Type conversion and casting.
|