source: git/doc/usercard.tex @ d9267f

spielwiese
Last change on this file since d9267f was d9267f, checked in by Jens Schmidt <schmidt@…>, 25 years ago
* usercard.tex (Input and output): new section (Miscellany): new section * usercard.tex: fixes fixed git-svn-id: file:///usr/local/Singular/svn/trunk@1977 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 13.5 KB
Line 
1% $Id: usercard.tex,v 1.2 1998-05-25 09:49:02 schmidt Exp $
2
3%
4% usercard.tex - Singular user quick reference card.
5%
6
7\input singcard.tex
8
9\centerline{\hbf SINGULAR Quick Reference}
10
11\centerline{\srm {\ssc Singular} Version 1.2.0}
12
13\bigskip
14
15Do not forget to terminate all commands with a {\tt ;} (semicolon)!
16
17In particular if \Singular\ prints the continuation prompt {\tt .}
18(dot) instead of the regular command prompt {\tt >}, then it
19waits for a command to be terminated by a {\tt ;}.  If that does
20not help, try one or more {\tt "} or {\tt \char`}} to close an
21opened string or block.
22
23Comments start with {\tt //} and extend to end of line.
24
25\smallskip
26Some of the topics concerning interactive use are system dependent.
27
28\sec Starting SINGULAR(2.5cm)
29Singular&                       start \Singular\cr
30Singular {\it files} $\ldots$&  read {\it files\/} and prompt for further commands\cr
31Singular --help&                print help on command line options and exit\cr
32\endsec
33
34\sec Stopping SINGULAR()
35quit;&                          exit \Singular; also {\tt exit;} or {\tt \$}\cr
36\ctl c&                         interrupt \Singular\cr
37\endsec
38
39\sec Getting help()
40help;&                          enter online help system\cr
41help {\it topic\/};&            describe {\it topic\/}; also {\tt? {\it topic\/};}\cr
42\subsec{Inside the online help system:}
43\ctl h&                         get help on help system\cr
44q&                              exit from help system\cr
45n\rmslash p\rmslash u&          go to next/previous/upper node\cr
46m&                              pick menu item by name\cr
47l&                              go to last visited node/exit from help on help\cr
48SPC\rmslash DEL&                scroll forward/backward one page\cr
49\endsec
50
51\sec Commandline editing()
52\sectext
53Commandline editing is similar to that of, e.g., {\tt bash} or {\tt tcsh}:\cr
54BS\rmslash\ctl d&               remove character on the left/right of cursor\cr
55\ctl p\rmslash\ctl n&           get previous/next line from history\cr
56\ctl b\rmslash\ctl f&           move cursor left/right\cr
57\ctl a\rmslash\ctl e&           go to beginning/end of line\cr
58\ctl u\rmslash\ctl k&           delete to beginning/end of line\cr
59\endsec
60
61\sec Names and objects()
62\sectext
63\parskip=\verysmallskipamount
64All names(=identifiers) have to be declared.  A declaration has the syntax
65
66{\tt\quad {\it type\/} {\it name\/} \opt{= {\it expression\/}};}
67
68Names of type {\tt number}, {\tt poly}, {\tt ideal}, {\tt vector}, {\tt
69module}, {\tt matrix}, {\tt map}, and {\tt resolution} may be declared
70only inside a ring.  They are local to that ring.  The same holds for a {\tt
71list} if it contains an object of the above types.  All other types may be
72declared at any time.  They are globally visible.
73
74Names may consist of alphanumeric characters including {\tt \_}
75(underscore) and have to start with a letter.  Capital and small letters
76are distinguished.  Names may be followed by an integer expression in
77parentheses, resulting in so-called {\it indexed names}.
78
79The expression {\tt {\it name\/}({\it n}..{\it m\/})} is a shortcut for {\tt
80{\it name\/}({\it n\/}), $\ldots$, {\it name\/}({\it m\/})} which in particular
81is useful for declaring ring variables (\eg {\tt ring r = 0, x(1..3), dp;}).
82
83The special name {\tt \_} (underscore) may be used to refer to the value of the
84last expression printed.
85\cr
86\endsec
87
88\vfill
89\centerline{\srm \copyright 1998 \qquad Permissions on back}
90
91\eject
92
93\sec Ring declaration()
94\longentry ring {\it name\/} = {\it basefield}, ({\it ringvars}), {\it ordering\/};&
95                                \hyphenpenalty=50 \tolerance=200 declare ring
96                                {\it name\/} and make it the current base\-ring.
97                                {\it ringvars\/} has to be a list of names, the
98                                other items are described below.  Example:\par
99                                {\tt ring r = 32003, (x, y, z), dp;}\cr
100\longentry qring {\it name\/} = {\it ideal\/};&
101                                declare quotient ring {\it name\/} of the
102                                current base\-ring with respect to {\it
103                                ideal\/}{\it ideal\/} has to be a standard
104                                bases.  Make {\it name\/} the new basering.\cr
105\subsec{Available {\bit basefields\/}:}
1060&                              the rational numbers\cr
107\it p&                          the finite field $Z_p$ with {\it p\/}
108                                elements,\par
109                                $2 \le p \le 32003$ a prime\cr
110({\it p\/}\^{}{\it n}, {\it gen\/})&
111                                the finite field with $p^n$ elements, {\it p\/}
112                                a prime and\par $4 \le p^n \le 32671$. The name
113                                {\it gen\/} refers to some generator of the
114                                cyclic group of unities.\cr
115({\it p}, {\it alpha\/})&       algebraic extension of $Q$ or $Z_p$ ($p =
116                                0$ or as above) by {\it alpha}.  The minpoly
117                                $\mu_{\hbox{\tit alpha}}$ for {\it alpha\/} has
118                                to be specified with an assignment to {\tt
119                                minpoly} (\eg {\tt minpoly=a\^{}2+1;}, for
120                                $\hbox{\it alpha}=\hbox{\tt a}$).  {\it
121                                alpha\/} has to be a name.\cr
122({\it p}, $t_1$, $\ldots$)&     transcendental extension of $Q$ or $Z_p$
123                                ($p = 0$ or as above) by~$t_i$.  The $t_i$ have
124                                to be names.\cr
125real&                           the real numbers represented by floating point
126                                numbers\cr
127\endsec
128
129\sec Term orderings()
130\sectext
131An {\it ordering\/} as referred to in the ring declaration may either be
132a global, local, or matrix ordering or a list of these resulting in a
133pro\-duct ordering.  The list may include extra weight vectors and may be
134preceded or followed by a module ordering specification.\cr
135\subsec{Global orderings}
136lp&                             lexicographical ordering\cr
137dp&                             degree reverse lexicographical ordering\cr
138Dp&                             degree lexicographical ordering\cr
139wp($w_1$, $\ldots$)&            weighted reverse lexicographical ordering\cr
140Wp($w_1$, $\ldots$)&            weighted lexicographical ordering\cr
141&                               The $w_i$ have to be positive integers.\cr
142\subsec{Local orderings}
143ls&                             negative lexicographical ordering\cr
144ds&                             negative degree reverse lexicographical ordering\cr
145Ds&                             negative degree lexicographical ordering\cr
146ws($w_1$, $\ldots$)&            general weighted reverse lexicographical ordering\cr
147Ws($w_1$, $\ldots$)&            general weighted lexicographical ordering\cr
148&                               $w_1$ has to be a nonzero integer, every other
149                                $w_i$ may be any integer\cr
150\subsec{Matrix orderings}
151\longentry M($m_{11}$, $m_{12}$, $\ldots$, $m_{nn}$)&
152                                {\it m\/} has to be an invertible matrix with
153                                integer coeffi\-cients.  Coefficients have to be
154                                specified row-wise.\cr
155\subsec{Product orderings}
156\longentry($o_1$\opt{($k_1$)}, $o_2$\opt{($k_2$)}, $\ldots$, $o_n$\opt{($k_n$)})&
157                                the $o_i$ have to be any of the above orderings.
158                                {\tt lp}, {\tt dp}, {\tt Dp}, {\tt ls}, {\tt
159                                ds}, {\tt Ds} may be followed by an integer
160                                expression $k_i$ in parentheses specifying the
161                                number of variables $o_i$ refers to (\eg {\tt
162                                (lp(3), dp(2))}).\cr
163\subsec{Extra weight vector}
164a($w_1$, $\ldots$)&             any of the above degree orderings may be
165                                preceded by an extra weight vector\cr
166\noalign{\eject}
167\subsec{Module orderings}
168({\it c}, $o_1$, $\ldots$)&     sort by components first\cr
169($o_1$, $\ldots$, {\it c\/})&   sort by variables first\cr
170&                               $o_i$ may be any of the above orderings or an
171                                extra weight vector, {\it c\/} may be one of
172                                {\tt C} or {\tt c}:\cr
173C&                              sort generators in ascending order (\ie {\tt
174                                gen({\it i\/})} $<$ {\tt gen({\it j\/})} iff $i <
175                                j$)\cr
176c&                              sort generators in descending order\cr
177\endsec
178
179\sec Data types(1.5cm)
180\sectext
181Examples of ring-independent types:\cr
182\entryskip
183\longitem
184int i1 = 101; int i2 = 13 div 3;\cr
185\entryskip
186\longitem
187intvec iv = 13 div 3, -4, i1;\cr
188\entryskip
189\longentry
190intmat im[2][2] = 13 div 3, -4, i1;&
191                                a $2\times 2$ matrix.  Entries are filled
192                                row-wise, missing entries are set to zero, extra
193                                entries are ignored.  vector/matrix elements are
194                                accessed using the {\tt[$\ldots$]} operator,
195                                where the first element has index one (\eg {\tt
196                                iv[3]; im[1, 2];}).\cr
197\entryskip
198\longitem
199string s1 = "a quote \char"5C " and a backslash \char"5C \char"5C";\par
200string s2 = "con" + "catenation";\cr
201\entryskip
202\sectext
203Basering in the following is {\tt ring r = 0, (x, y, z, mu, nu), dp;}\cr
204\entryskip
205\longitem
206number n = 5/3;\cr
207\entryskip
208\longentry
209poly p(1) = 2xy2+3/4x3yz4;\par
210poly p(2) = (5/3)*mu\^{}2*nu\^{}3+n*yz2;&
211                                {\tt p(1)} equals $3/4x^3yz^4+2xy^2$.  Short
212                                format of mono\-mials is valid for one-character
213                                ring variables only.\cr
214\entryskip
215\longentry
216ideal i = p(1..2), x+y;&        note the use of indexed names\cr
217\entryskip
218\longentry
219vector v = [p(1), p(2), x+y];\par
220vector w = 2*p(1)*gen(6)+n*nu*gen(1);&
221                                vectors may be written in brackets ({\tt
222                                [$\ldots$]}) or expressed as linear
223                                combinations of the canonical generators {\tt
224                                gen({\it i\/})}\cr
225\entryskip
226\longitem
227module mo = v, w, x+y*gen(1);\cr
228\entryskip
229\longitem
230resolution r = sres(std(mo), 0);\cr
231\entryskip
232\longentry
233matrix ma[2][2] = 5/3, p(1), 101;&
234                                the rules for declaring, filling, and accessing
235                                integer matrices apply to types {\tt matrix}
236                                and {\tt vector}, too\cr
237\entryskip
238\longentry
239list l = iv, v, p(1..2), mo;&
240                                lists may collect objects of any type.  They are
241                                ring-dependent iff one of the entries is.\cr
242\entryskip
243\longentry
244def d = read("MPfile:r example.mp");&
245                                a name of type {\tt def} inherits the type of
246                                the object assigned first to it.  Useful if the
247                                actual type of an object is unknown.\cr
248\endsec
249
250\sec Monitoring and debugging tools()
251timer = 1;&                     print time used for commands to execute\cr
252\longentry int t = timer; {\it commandsequence}; timer-t;&
253                                print time used for {\it commandsequence} to
254                                execute\cr
255memory(1);&                     print number of bytes allocated from system\cr
256option(prot);&                  show algorithm protocol\cr
257option(mem);&                   show algorithm memory usage\cr
258\entryskip
259TRACE = 1;&                     print protocol on execution of procedures\cr
260listvar(all);&                  list all (user-)defined names\cr
261\longentry listvar({\it ringname});&
262                                list all names belonging to {\it ringname}\cr
263\endsec
264
265\eject
266
267\sec Options()
268option();&                      show current option settings\cr
269\longentry option($option_1$, no$option_2$, $\ldots$);&
270                                switch $option_1$ on and $option_2$ off, resp.\cr
271option(none);&                  reset all options to default values\cr
272\sectext
273Type {\tt help option;} for a list of all options.\cr
274\subsec{Monitoring}
275debugLib&                       show loading of procedures from libraries\cr
276mem&                            show algorithm memory usage\cr
277prot&                           show algorithm protocol\cr
278\subsec{Standard bases}
279fastHC&                         try to find highest corner as fast as possible\cr
280intStrategy&                    avoid divisions\cr
281morePairs&                      create additional pairs\cr
282notSugar&                       disable sugar strategy\cr
283redSB&                          compute reduced standard bases\cr
284redTail&                        reduce tails\cr
285sugarCrit&                      use sugar criteria\cr
286weightM&                        automatically compute weights\cr
287\subsec{Resolutions}
288minRes&                         do additional minimizing\cr
289notRegularity&                  disable regularity bound\cr
290\subsec{Miscellany}
291returnSB&                       let some functions return standard bases\cr
292\endsec
293
294\sec System variables()
295\sectext
296Type {\tt help System variables;} for a list of all system variables.\cr
297\subsec{Standard bases}
298degBound&                       stop if (weighted) total degree exceeds {\tt
299                                degBound}\cr
300multBound&                      stop if multiplicity gets smaller than {\tt
301                                multBound}\cr
302noether&                        cut off all monomials above the monomial {\tt
303                                noether}\cr
304\subsec{Miscellany}
305basering&                       the current basering\cr
306minpoly&                        minimal polynomial for algebraic extensions\cr
307short&                          do not print monomials in short format if zero\cr
308timer&                          on assignment of a non-zero value show time
309                                used for execution of executed commands.  On
310                                evaluation, return system time in seconds used
311                                by \Singular\ since start\cr
312TRACE&                          print information on procedures being executed
313                                if larger than one\cr
314\endsec
315
316\sec Input and output()
317< "{\it filename}";&            load and execute {\it filename}\cr
318\longentry write("{\it filename}", {\it expression\_list})&
319                                write {\it expression\_list} to ASCII file {\it
320                                filename}\cr
321\longentry read("{\it filename}");&
322                                read ASCII file {\it filename} and return
323                                content as a string.  See also example below.\cr
324\longentry
325dump("MPfile: {\it filename}");\par
326getdump("MPfile: {\it filename}");&
327                                dump current state of {\sc Singular} to {\it
328                                filename} and retrieve it, resp.\cr
329\entryskip
330\sectext
331An example how to write one single expression (in this case the
332ideal {\tt i}) to a file and read it back from there:
333
334{\tt
335write("i.save", i);\par
336execute("ideal i=" + read("i.save") + ";");
337}\cr
338\endsec
339
340\eject
341                               
342\sec Libraries()
343LIB "{\it library\/}";&         load {\it library}\cr
344help {\it library\/};&          show help on {\it library}\cr
345help all.lib;&                  show list of all libraries\cr
346\endsec
347
348\sec Mapping(1.5cm)
349\longentry map {\it name\/} = {\it ringname}, {\it ideal\/};&
350                                declare a map {\it name\/} from {\it ringname}
351                                to current basering.  The $i$'th ring variable
352                                from {\it ringname} is mapped to the $i$'th
353                                generator of {\it ideal}.\cr
354\longentry {\it mapname\/}({\it expression\/})&
355                                apply map {\it mapname\/} to {\it expression}\cr
356\entryskip
357\sectext
358Coefficients between rings with different basefields are mapped in the following
359way (non-canonical maps only):\strut
360\abovedisplayskip=0pt
361\belowdisplayskip=0pt
362$$
363\eqalign{Z_p \rightarrow Q&  :[i]_p \mapsto i \in [-p/2,p/2] \subset Z\cr
364         Z_p \rightarrow Z_q&:[i]_p \mapsto i \in [-p/2,p/2] \subset Z, i \mapsto [i]_q}
365$$
366\cr
367\noalign{\vskip -9pt} % dirty trick, gobbles the trailing \strut from \sectext
368\entryskip
369\longentry fetch({\it ringname}, {\it name\/})&
370                                map object {\it name\/} from ring {\it
371                                ringname\/} to current base\-ring.  The rings
372                                have to be ``almost'' identical.\cr
373\longentry imap({\it ringname}, {\it name\/})&
374                                map object {\it name\/} from subring {\it
375                                ringname\/} to current basering\cr
376\longentry subst({\it expression}, {\it ringvar}, {\it monomial\/})&
377                                substitute {\it ringvar\/} by {\it monomial\/}
378                                in {\it expression}\cr
379\endsec
380
381\sec Miscellany(1.5cm)
382\longentry ord({\it poly\/}\alt{\it vector\/})&
383                                return (weighted) degree of initial term\cr
384\longentry deg({\it poly\/}\alt{\it vector\/})&
385                                return maximal (weighted) degree of terms\cr
386\endsec
387
388\bye
Note: See TracBrowser for help on using the repository browser.