Macaulay 2 A system for computations in algebraic geometry and commutative algebra

advertisement
Macaulay 2
A system for computations in
algebraic geometry and commutative algebra
Daniel R. Grayson
Michael E. Stillman
University of Illinois at Urbana-Champaign
E-mail address: dan@math.uiuc.edu
URL: http://www.math.uiuc.edu/~dan
Cornell University
E-mail address: mike@math.cornell.edu
URL: http://www.math.cornell.edu/~mike
Contents
Part I. User’s Guide
25
Chapter 1. Preface
1.1. How to get this program
1.2. Resources required
1.3. Invoking the program
1.4. Getting started
1.5. Copyright and license
1.6. Acknowledgements
1.7. The authors
27
27
27
27
28
37
38
38
Chapter 2. Reading the Documentation
39
Chapter 3. Mathematical Overview
3.1. basic rings
3.2. polynomial rings
3.3. manipulating polynomials
3.4. polynomial rings with other monomial orderings
3.5. multi-graded polynomial rings
3.6. maps between rings
3.7. ideals
3.8. quotient rings
3.9. finite fields
3.10. fraction fields
3.11. tensor products of rings
3.12. exterior algebras
3.13. symmetric algebras
3.14. Weyl algebras
3.15. associative algebras
3.16. algebraic varieties
3.17. making matrices
3.18. making random matrices
3.19. making generic matrices
3.20. displaying matrices
3.21. manipulating matrices
3.22. diff and contract
3.23. free modules
3.24. making modules from matrices
3.25. manipulating modules
3.26. maps between modules
41
42
43
47
54
56
57
59
63
66
69
70
71
72
73
73
73
74
80
81
82
83
85
85
86
86
86
3
4
CONTENTS
3.27.
3.28.
3.29.
3.30.
3.31.
3.32.
3.33.
3.34.
3.35.
3.36.
3.37.
bases of parts of modules
coherent sheaves
free resolutions of modules
making chain complexes by hand
extracting information from chain complexes
manipulating chain complexes
maps between chain complexes
Groebner bases
computing Groebner bases
computing syzygies
computing resolutions
86
86
86
86
86
86
86
86
88
93
93
Chapter 4. Language and Programming Overview
4.1. valid names
4.2. assigning values
4.3. local variables in a file
4.4. viewing the symbols defined so far
4.5. subscripted variables
4.6. numbered variables
4.7. using functions
4.8. making functions
4.9. local variables in a function
4.10. making functions with a variable number of arguments
4.11. using functions with optional arguments
4.12. making new functions with optional arguments
4.13. strings
4.14. nets
4.15. lists
4.16. sequences
4.17. hash tables
4.18. loops
4.19. mapping over lists
4.20. mapping over hash tables
4.21. conditional execution
4.22. error handling
4.23. printing to the screen
4.24. reading files
4.25. getting input from the user
4.26. creating and writing files
4.27. two dimensional formatting
4.28. communicating with programs
4.29. using sockets
4.30. what a class is
4.31. installing methods
4.32. inheritance from parents
4.33. making new types
4.34. printing and formatting for new types
4.35. making a new method function
4.36. method functions with a variable number of arguments
95
96
96
97
98
99
100
100
101
103
104
106
107
107
109
111
113
115
117
118
120
122
122
122
123
125
126
126
129
131
131
132
133
133
133
133
133
CONTENTS
4.37. method functions with optional arguments
5
133
Chapter 5. Miscellaneous Topics
5.1. classes
5.2. operators
5.3. programming
5.4. executing other programs
5.5. debugging
5.6. system
5.7. help functions
5.8. syntax
5.9. replacements for commands and scripts from Macaulay
5.10. obsolete functions and symbols
135
135
136
138
138
138
139
140
140
142
149
Part II. Mathematical Vignettes
151
Chapter 6. Elementary uses of Groebner bases
153
Chapter 7. Canonical Embeddings of Plane Curves and Gonality
165
Chapter 8. Fano varieties
175
Chapter 9. Divisors
187
Part III. Reference Manual
201
Chapter 10. Ring
10.1. EngineRing
10.2. Field
10.3. ProductRing
10.4. Ring ** Ring
10.5. ring
10.6. Matrix ** Ring
10.7. Module ** Ring
10.8. Ring ^ ZZ
10.9. Ring ^ {...}
10.10. Ring _ String
10.11. Ring _ ZZ
10.12. Ring _ {...}
10.13. ZZ _ Ring
10.14. ideal Ring
10.15. map(Ring,Ring,{...})
10.16. matrix(Ring,{...})
10.17. monoid Ring
10.18. options Ring
10.19. random Ring
10.20. random(ZZ,Ring)
10.21. random({...},Ring)
10.22. sheaf Ring
203
205
218
219
219
219
219
220
220
221
221
222
222
223
223
223
225
226
226
226
227
227
227
Chapter 11. Ideal
229
6
CONTENTS
11.1.
11.2.
11.3.
11.4.
11.5.
11.6.
11.7.
11.8.
11.9.
Ideal * Ideal
Ideal + Ideal
Ideal : Ideal
Ideal ^ ZZ
ideal
Ideal / Ideal
Module / Ideal
module Ideal
resolution Ideal
Chapter 12. Matrix
12.1. ChainComplexMap _ ZZ
12.2. HH^ZZ ChainComplexMap
12.3. HH_ZZ ChainComplexMap
12.4. Matrix % Matrix
12.5. Matrix ** Matrix
12.6. Matrix ** Module
12.7. Matrix ++ Matrix
12.8. Matrix // Matrix
12.9. Matrix ^ [...]
12.10. Matrix ^ {...}
12.11. Matrix _ [...]
12.12. Matrix _ {...}
12.13. Matrix | Matrix
12.14. Matrix || Matrix
12.15. Module ^ [...]
12.16. Module ^ {...}
12.17. Module _ [...]
12.18. Module _ {...}
12.19. contract(Matrix,Matrix)
12.20. diff(Matrix,Matrix)
12.21. dual Matrix
12.22. flip(Module,Module)
12.23. generators GroebnerBasis
12.24. map Matrix
12.25. map Module
12.26. map(Module,Matrix)
12.27. map(Module,Module)
12.28. map(Module,Module,Function)
12.29. map(Module,Module,Matrix)
12.30. map(Module,Module,RingElement)
12.31. map(Module,Module,ZZ)
12.32. map(Module,Module,{...})
12.33. map(Module,Nothing,{...})
12.34. map(Module,RingElement)
12.35. map(Module,ZZ,Function)
12.36. map(Module,ZZ,{...})
12.37. matrix Matrix
12.38. matrix {...}
231
232
232
232
232
233
233
233
234
235
241
241
241
242
242
242
243
244
244
245
246
247
248
249
250
251
251
252
253
255
258
258
259
259
259
260
260
261
261
262
263
264
265
266
266
267
267
267
CONTENTS
12.39.
12.40.
12.41.
12.42.
12.43.
12.44.
12.45.
12.46.
12.47.
12.48.
12.49.
12.50.
12.51.
12.52.
mingens GroebnerBasis
random(Module,Module)
sum ChainComplexMap
syz GroebnerBasis
HH_Matrix Matrix
Matrix % RingElement
Matrix // RingElement
Matrix _ (...)
Matrix _ ZZ
chainComplex Matrix
diff Matrix
monomialIdeal Matrix
monomialIdeal(ZZ,Matrix)
resolution Matrix
7
269
269
269
270
271
271
271
272
272
272
272
273
273
273
Chapter 13. Module
13.1. ChainComplex _ ZZ
13.2. HH^ZZ ChainComplex
13.3. HH^ZZ CoherentSheaf
13.4. HH^ZZ Module
13.5. HH_ZZ ChainComplex
13.6. Module ** Module
13.7. Module + Module
13.8. Module ++ Module
13.9. Module / Module
13.10. dual Module
13.11. module CoherentSheaf
13.12. subquotient
13.13. sum ChainComplex
13.14. Hom(ChainComplex,Module)
13.15. Module == Module
13.16. Module [...]
13.17. Module _ ZZ
13.18. resolution Module
13.19. sheaf Module
13.20. sheaf(Module,Variety)
277
281
281
282
282
283
283
284
284
284
285
285
285
288
289
289
289
290
290
291
291
Chapter 14. RingMap
293
Chapter
15.1.
15.2.
15.3.
15. GroebnerBasis
forceGB
gb
stats GroebnerBasis
295
295
296
296
Chapter
16.1.
16.2.
16.3.
16.4.
16.5.
16. ChainComplex
ChainComplex ** ChainComplex
ChainComplex ** GradedModule
ChainComplex ++ ChainComplex
ChainComplex [...]
GradedModule ** ChainComplex
299
301
301
302
302
303
8
CONTENTS
16.6.
16.7.
16.8.
16.9.
16.10.
16.11.
16.12.
16.13.
16.14.
16.15.
16.16.
16.17.
16.18.
Chapter
17.1.
17.2.
17.3.
chainComplex (...)
chainComplex GradedModule
complete ChainComplex
dual ChainComplex
new ChainComplex
ChainComplex ** ChainComplexMap
ChainComplexMap ** ChainComplex
HH ChainComplex
components ChainComplex
length ChainComplex
map(ChainComplex,ChainComplex,Function)
max ChainComplex
min ChainComplex
17. Variety
AffineVariety
ProjectiveVariety
variety CoherentSheaf
Chapter 18. Function
18.1. OptionTable ==> Function
18.2. {...} ==> Function
18.3. Function Thing
18.4. Function \ VisibleList
18.5. VisibleList / Function
18.6. accumulate(Function,Thing,VisibleList)
18.7. accumulate(Function,VisibleList)
18.8. accumulate(VisibleList,Function)
18.9. accumulate(VisibleList,Thing,Function)
18.10. apply(BasicList,BasicList,Function)
18.11. apply(BasicList,Function)
18.12. apply(HashTable,Function)
18.13. apply(ZZ,Function)
18.14. fold(Function,Thing,VisibleList)
18.15. fold(Function,VisibleList)
18.16. fold(VisibleList,Function)
18.17. fold(VisibleList,Thing,Function)
18.18. options Function
18.19. product(ZZ,Function)
18.20. product({...},Function)
18.21. product({...},{...},Function)
18.22. scan(BasicList,Function)
18.23. scan(ZZ,Function)
18.24. scanPairs(HashTable,Function)
18.25. select(BasicList,Function)
18.26. select(HashTable,Function)
18.27. select(ZZ,BasicList,Function)
18.28. select(ZZ,HashTable,Function)
18.29. sum(ZZ,Function)
303
303
304
304
304
305
306
306
307
307
307
308
308
309
309
309
311
313
325
326
326
327
327
328
328
329
329
329
330
330
330
330
331
331
331
332
332
332
333
333
334
334
334
335
335
335
336
CONTENTS
18.30. sum({...},Function)
18.31. sum({...},{...},Function)
Chapter
19.1.
19.2.
19.3.
19. VisibleList
Array
List
Sequence
9
336
336
339
340
341
349
Chapter 20. File
20.1. File << Thing
20.2. String << Thing
357
357
358
Chapter 21. Thing
21.1. BasicList
21.2. Boolean
21.3. Database
21.4. Handle
21.5. HashTable
21.6. Net
21.7. Nothing
21.8. QQ
21.9. RR
21.10. Symbol
21.11. ZZ
359
361
403
411
412
413
453
476
477
479
481
486
Part IV. Developer’s Corner
497
Chapter
22.1.
22.2.
22.3.
499
499
504
504
22. engine
engine communication protocol
low level gb engine commands
high level gb engine commands
Chapter 23. internals
23.1. formatDocumentTag
23.2. setSpin
513
513
513
Part V. Appendix
515
Chapter 24. Miscellaneous documentation
24.1.
24.2. !
24.3. !=
24.4. #
24.5. # (...)
24.6. # Set
24.7. ##
24.8. #?
24.9. %
24.10. &
24.11. &&
517
532
533
533
534
534
534
534
535
535
535
536
10
CONTENTS
24.12.
24.13.
24.14.
24.15.
24.16.
24.17.
24.18.
24.19.
24.20.
24.21.
24.22.
24.23.
24.24.
24.25.
24.26.
24.27.
24.28.
24.29.
24.30.
24.31.
24.32.
24.33.
24.34.
24.35.
24.36.
24.37.
24.38.
24.39.
24.40.
24.41.
24.42.
24.43.
24.44.
24.45.
24.46.
24.47.
24.48.
24.49.
24.50.
24.51.
24.52.
24.53.
24.54.
24.55.
24.56.
24.57.
24.58.
24.59.
(...) # ZZ
(...) #? ZZ
*
**
+
++
,
–
->
.
..
.?
/
//
///
/^
:
:=
;
<
<<<
<< Thing
<=
=
=!=
==
===
==>
=>
>
>=
>>
?
@
@@
AfterEval
AfterNoPrint
AfterPrint
Algorithm
Ascending
Associative
BasisElementLimit
Bayer
BeforePrint
BinaryPowerMethod
ChangeMatrix
536
536
536
538
539
540
541
541
543
543
543
544
546
546
547
547
548
548
548
549
549
549
549
550
550
550
551
551
553
553
554
554
554
554
554
555
556
556
556
556
557
557
557
557
557
557
558
558
CONTENTS
24.60.
24.61.
24.62.
24.63.
24.64.
24.65.
24.66.
24.67.
24.68.
24.69.
24.70.
24.71.
24.72.
24.73.
24.74.
24.75.
24.76.
24.77.
24.78.
24.79.
24.80.
24.81.
24.82.
24.83.
24.84.
24.85.
24.86.
24.87.
24.88.
24.89.
24.90.
24.91.
24.92.
24.93.
24.94.
24.95.
24.96.
24.97.
24.98.
24.99.
24.100.
24.101.
24.102.
24.103.
24.104.
24.105.
24.106.
24.107.
CodimensionLimit
CompleteIntersection
ConversionFormat
ConvertInteger
ConvertToExpression
Degree
DegreeLimit
DegreeOrder
Descending
Documentation
DownArrow
Elimination
EliminationOrder
End
Engine
Ext
Factorization and characteristic sets library
Factory library
Fano
FindOne
Function \ {...}
GBtype
GC garbage collector
GF
GNU MP
GlobalAssignHook
GlobalReleaseHook
Grassmannian
HH
HardDegreeLimit
Hom
Homogeneous
Inhomogeneous
InverseMethod
Iterate
LengthLimit
Limit
Linear
LongPolynomial
Macaulay 2
MinimalGenerators
MinimalMatrix
Module : Module
Monomials
NewFromMethod
NewMethod
NewOfFromMethod
NewOfMethod
11
558
559
559
559
559
560
560
561
561
561
561
561
561
561
562
562
563
563
563
564
564
564
564
564
565
565
565
566
567
567
567
568
568
568
568
568
568
569
569
569
569
570
570
570
570
571
571
571
12
CONTENTS
24.108.
24.109.
24.110.
24.111.
24.112.
24.113.
24.114.
24.115.
24.116.
24.117.
24.118.
24.119.
24.120.
24.121.
24.122.
24.123.
24.124.
24.125.
24.126.
24.127.
24.128.
24.129.
24.130.
24.131.
24.132.
24.133.
24.134.
24.135.
24.136.
24.137.
24.138.
24.139.
24.140.
24.141.
24.142.
24.143.
24.144.
24.145.
24.146.
24.147.
24.148.
24.149.
24.150.
24.151.
24.152.
24.153.
24.154.
24.155.
NoPrint
NonLinear
OO
Options
Order
PairLimit
PairsRemaining
Primary
PrimitiveElement
Print
Proj
Projective
RightArrow
SEEALSO
Schur
SimplePowerMethod
SingleArgumentDispatch
Sort
SortStrategy
Spec
StopBeforeComputation
StopWithMinimalGenerators
Strategy
String | String
SubringLimit
Syzygies
SyzygyLimit
SyzygyMatrix
SyzygyRows
TEST
TOH
TeX
Tor
TotalPairs
TypicalValue
Unmixed
UseHilbertFunction
Variable
Verify
\
\\
^
^^
_
abs
accumulate
acos
addEndFunction
571
571
572
572
572
573
573
573
573
573
574
574
575
575
575
576
576
576
576
577
577
577
579
579
579
580
580
580
580
580
580
580
581
581
581
581
581
581
582
582
582
582
583
584
585
585
585
585
CONTENTS
24.156.
24.157.
24.158.
24.159.
24.160.
24.161.
24.162.
24.163.
24.164.
24.165.
24.166.
24.167.
24.168.
24.169.
24.170.
24.171.
24.172.
24.173.
24.174.
24.175.
24.176.
24.177.
24.178.
24.179.
24.180.
24.181.
24.182.
24.183.
24.184.
24.185.
24.186.
24.187.
24.188.
24.189.
24.190.
24.191.
24.192.
24.193.
24.194.
24.195.
24.196.
24.197.
24.198.
24.199.
24.200.
24.201.
24.202.
24.203.
addStartFunction
adjoint
adjoint1
adjust
alarm
all
ambient
ancestor
and
ann
annihilator
any
append
apply
applyKeys
applyPairs
applyTable
applyValues
apropos
argument
ascii
asin
assert
assign
atEndOfFile
atan
autoload
backtrace
baseName
baseRings
basictype
basis
benchmark
between
binary method
binomial
borel
briefDocumentation
browse
ceiling
chainComplex
char
characters
class
clearAll
clearEcho
clearOutput
close
13
586
586
586
586
586
587
587
588
588
588
588
588
588
589
589
590
590
591
591
592
592
592
592
592
593
593
593
593
594
594
594
594
596
596
596
597
597
598
598
598
598
599
599
599
599
599
600
600
14
CONTENTS
24.204.
24.205.
24.206.
24.207.
24.208.
24.209.
24.210.
24.211.
24.212.
24.213.
24.214.
24.215.
24.216.
24.217.
24.218.
24.219.
24.220.
24.221.
24.222.
24.223.
24.224.
24.225.
24.226.
24.227.
24.228.
24.229.
24.230.
24.231.
24.232.
24.233.
24.234.
24.235.
24.236.
24.237.
24.238.
24.239.
24.240.
24.241.
24.242.
24.243.
24.244.
24.245.
24.246.
24.247.
24.248.
24.249.
24.250.
24.251.
closeIn
closeOut
code
codim
coefficientRing
coefficients
cohomology
coimage
coker
cokernel
collectGarbage
columnate
combinatorial functions
combine
commandLine
compactMatrixForm
complement
complete
component example
components
compress
concatenate
cone
connectionCount
content
contract
copy
cos
cosh
cotangentSheaf
cover
currentDirectory
currentFile
dd
decompose
deepSplice
degree
degreeLength
degrees
degreesMonoid
degreesRing
delete
demark
denominator
depth
describe
det
diff
600
600
600
601
602
602
603
603
603
603
604
604
604
606
606
606
606
606
606
607
608
608
608
610
610
610
610
611
611
611
611
611
611
611
612
612
613
614
614
615
615
615
616
616
616
617
617
618
CONTENTS
24.252.
24.253.
24.254.
24.255.
24.256.
24.257.
24.258.
24.259.
24.260.
24.261.
24.262.
24.263.
24.264.
24.265.
24.266.
24.267.
24.268.
24.269.
24.270.
24.271.
24.272.
24.273.
24.274.
24.275.
24.276.
24.277.
24.278.
24.279.
24.280.
24.281.
24.282.
24.283.
24.284.
24.285.
24.286.
24.287.
24.288.
24.289.
24.290.
24.291.
24.292.
24.293.
24.294.
24.295.
24.296.
24.297.
24.298.
24.299.
difference
dim
directSum
divideByVariable
do
document
documentation
drop
dual
dumpdata
echoOff
echoOn
edit
editing Macaulay 2 code with emacs
else
emacs
end
endl
entries
environment
erase
error
errorDepth
euler
even
examine
examples
exec
exit
exp
exponents
extend
exteriorPower
factor
false
first
firstkey
fittingIdeal
flag
flatten
flip
floor
flush
fold
forceGB(..., ChangeMatrix => ...)
fork
format
fraction
15
618
618
619
620
621
621
621
622
622
622
622
622
622
623
624
624
627
627
627
628
628
628
628
629
629
629
629
629
630
630
630
630
631
631
633
633
633
633
633
634
634
634
634
634
635
635
635
635
16
CONTENTS
24.300.
24.301.
24.302.
24.303.
24.304.
24.305.
24.306.
24.307.
24.308.
24.309.
24.310.
24.311.
24.312.
24.313.
24.314.
24.315.
24.316.
24.317.
24.318.
24.319.
24.320.
24.321.
24.322.
24.323.
24.324.
24.325.
24.326.
24.327.
24.328.
24.329.
24.330.
24.331.
24.332.
24.333.
24.334.
24.335.
24.336.
24.337.
24.338.
24.339.
24.340.
24.341.
24.342.
24.343.
24.344.
24.345.
24.346.
24.347.
from
fromDual
functions
gb(..., ChangeMatrix => ...)
gb(..., DegreeLimit => ...)
gb(..., PairLimit => ...)
gb(..., StopBeforeComputation => ...)
gb(..., Strategy => ...)
gb(..., SyzygyLimit => ...)
gbTrace
gcDump
gcd
gcdCoefficients
genera
generatorExpressions
generatorSymbols
genericMatrix
genericSkewMatrix
genericSymmetricMatrix
gens
get
getChangeMatrix
getWWW
getc
getenv
global
globalAssignFunction
globalReleaseFunction
gradedModule
gradedModuleMap
graphIdeal
graphRing
group
hash
hashTable
hashing
height
help
hilbertFunction
hilbertSeries
homogenize
homology
homomorphism
hypertext
id
identity
if
ii
635
635
635
636
636
636
637
637
637
638
639
639
639
640
640
640
640
640
641
641
641
642
642
642
642
643
643
645
645
645
645
646
646
647
647
647
649
649
650
650
651
652
653
653
653
653
653
653
CONTENTS
24.348.
24.349.
24.350.
24.351.
24.352.
24.353.
24.354.
24.355.
24.356.
24.357.
24.358.
24.359.
24.360.
24.361.
24.362.
24.363.
24.364.
24.365.
24.366.
24.367.
24.368.
24.369.
24.370.
24.371.
24.372.
24.373.
24.374.
24.375.
24.376.
24.377.
24.378.
24.379.
24.380.
24.381.
24.382.
24.383.
24.384.
24.385.
24.386.
24.387.
24.388.
24.389.
24.390.
24.391.
24.392.
24.393.
24.394.
24.395.
image
incomparable
indeterminate
index
indexComponents
indices
inducedMap
inducedMap(..., Degree => ...)
infinity
initialization file
input
installMethod
instance
integrate
intersect
irreducibleCharacteristicSeries
isDirectSum
isInputFile
isListener
isOpenFile
isOutputFile
isPrimitive
isReady
isTable
jacobian
join
ker
kernel
kernel(..., SubringLimit => ...)
keys
kill
koszul
last
leadCoefficient
leadComponent
leadMonomial
leadTerm
length
lift
liftable
lineNumber
lines
listForm
listUserSymbols
load
loaddata
local
locate
17
654
654
654
654
655
655
655
655
656
656
656
656
657
657
657
657
657
658
658
658
658
658
659
659
659
660
661
661
661
661
661
662
662
662
662
662
663
664
664
664
665
665
665
665
666
666
666
667
18
CONTENTS
24.396.
24.397.
24.398.
24.399.
24.400.
24.401.
24.402.
24.403.
24.404.
24.405.
24.406.
24.407.
24.408.
24.409.
24.410.
24.411.
24.412.
24.413.
24.414.
24.415.
24.416.
24.417.
24.418.
24.419.
24.420.
24.421.
24.422.
24.423.
24.424.
24.425.
24.426.
24.427.
24.428.
24.429.
24.430.
24.431.
24.432.
24.433.
24.434.
24.435.
24.436.
24.437.
24.438.
24.439.
24.440.
24.441.
24.442.
24.443.
log
lookup
lookupCount
map
match
matrix
max
maxPosition
member
memoize
merge
mergePairs
method(..., Associative => ...)
method(..., TypicalValue => ...)
methods
min
minPosition
mingens
mingle
minors
minprimes
minus
mod
modifyRing
module
modules
modulo
modulus
monoid
monomialCurve
monomialIdeal
mutable
n
name
needs
netRows
new
newClass
newCoordinateSystem
newline
nextkey
not
not documented yet
notImplemented
null
nullhomotopy
number
numerator
667
667
668
668
669
669
669
669
670
670
671
671
671
672
672
673
673
673
673
674
674
674
674
675
675
675
675
675
675
676
677
677
677
677
678
678
678
679
680
680
680
680
680
680
681
681
684
684
CONTENTS
24.444.
24.445.
24.446.
24.447.
24.448.
24.449.
24.450.
24.451.
24.452.
24.453.
24.454.
24.455.
24.456.
24.457.
24.458.
24.459.
24.460.
24.461.
24.462.
24.463.
24.464.
24.465.
24.466.
24.467.
24.468.
24.469.
24.470.
24.471.
24.472.
24.473.
24.474.
24.475.
24.476.
24.477.
24.478.
24.479.
24.480.
24.481.
24.482.
24.483.
24.484.
24.485.
24.486.
24.487.
24.488.
24.489.
24.490.
24.491.
numeric
numgens
odd
of
on
oo
ooo
oooo
openDatabase
openDatabaseOut
openFiles
openIn
openInOut
openListener
openOut
or
order
override
pack
pad
pairs
parent
path
pathSeparator
pdim
pfaffians
phase
plus
poincare
poincareComputation
poincareN
pop
position
positions
power
prepend
presentation
print
print C.dd
printExamples
printString
processID
product
profile
profileSummary
projectiveHilbertPolynomial
promote
protect
19
684
684
685
685
685
685
686
686
686
686
686
686
686
687
687
687
688
688
688
688
689
689
689
690
690
690
690
690
691
692
692
692
692
693
693
693
693
694
694
694
694
695
695
695
695
696
696
696
20
CONTENTS
24.492.
24.493.
24.494.
24.495.
24.496.
24.497.
24.498.
24.499.
24.500.
24.501.
24.502.
24.503.
24.504.
24.505.
24.506.
24.507.
24.508.
24.509.
24.510.
24.511.
24.512.
24.513.
24.514.
24.515.
24.516.
24.517.
24.518.
24.519.
24.520.
24.521.
24.522.
24.523.
24.524.
24.525.
24.526.
24.527.
24.528.
24.529.
24.530.
24.531.
24.532.
24.533.
24.534.
24.535.
24.536.
24.537.
24.538.
24.539.
pruningMap
pseudoRemainder
pushForward
pushForward(..., StopBeforeComputation => ...)
pushForward(..., Strategy => ...)
pushForward1
pushForward1(..., DegreeLimit => ...)
pushForward1(..., MonomialOrder => ...)
pushForward1(..., PairLimit => ...)
pushForward1(..., StopBeforeComputation => ...)
pushForward1(..., Strategy => ...)
pushForward1(..., UseHilbertFunction => ...)
quit
quotient
quotient(..., Strategy => ...)
radical
rank
read
regularity
reloaded
remove
removeLowestDimension
reorganize
res
reshape
resolution
resolution(..., DegreeLimit => ...)
resolution(..., HardDegreeLimit => ...)
resolution(..., LengthLimit => ...)
resolution(..., PairLimit => ...)
resolution(..., SortStrategy => ...)
resolution(..., StopBeforeComputation => ...)
resolution(..., Strategy => ...)
resolution(..., SyzygyLimit => ...)
restart
returnCode
reverse
rsort
run
runEndFunctions
runStartFunctions
same
saturate
saturate(..., DegreeLimit => ...)
saturate(..., Strategy => ...)
scan
scanKeys
scanPairs
697
697
697
697
698
698
699
700
700
700
701
701
701
701
702
702
703
704
704
705
705
705
705
706
706
706
706
707
707
708
708
709
709
709
710
710
710
711
711
711
711
712
712
713
713
713
714
714
CONTENTS
24.540.
24.541.
24.542.
24.543.
24.544.
24.545.
24.546.
24.547.
24.548.
24.549.
24.550.
24.551.
24.552.
24.553.
24.554.
24.555.
24.556.
24.557.
24.558.
24.559.
24.560.
24.561.
24.562.
24.563.
24.564.
24.565.
24.566.
24.567.
24.568.
24.569.
24.570.
24.571.
24.572.
24.573.
24.574.
24.575.
24.576.
24.577.
24.578.
24.579.
24.580.
24.581.
24.582.
24.583.
24.584.
24.585.
24.586.
24.587.
scanValues
select
selectInSubring
sequence
set
setEcho
setrecursionlimit
shield
showStructure
showUserStructure
sin
singularLocus
sinh
size
sleep
someTerms
sort
sortColumns
sortColumns(..., DegreeOrder => ...)
sortColumns(..., MonomialOrder => ...)
source
specifying typical values
splice
sqrt
standardForm
stats
status
stderr
stdio
subclass
submatrix
subscript
substitute
substring
subtable
sum
super
superscript
symbol
symbol Documentation
symbol Resolution
symbol Symbols
symbol ann
symbol coker
symbol compactMatrixForm
symbol currentFile
symbol directSum
symbol frac
21
714
714
715
715
716
716
716
716
716
717
717
718
718
718
718
718
718
719
720
720
720
720
721
722
722
722
723
723
723
724
724
725
725
726
726
727
727
727
728
728
728
729
729
729
729
729
729
730
22
CONTENTS
24.588.
24.589.
24.590.
24.591.
24.592.
24.593.
24.594.
24.595.
24.596.
24.597.
24.598.
24.599.
24.600.
24.601.
24.602.
24.603.
24.604.
24.605.
24.606.
24.607.
24.608.
24.609.
24.610.
24.611.
24.612.
24.613.
24.614.
24.615.
24.616.
24.617.
24.618.
24.619.
24.620.
24.621.
24.622.
24.623.
24.624.
24.625.
24.626.
24.627.
24.628.
24.629.
24.630.
24.631.
24.632.
24.633.
24.634.
24.635.
symbol ker
symbol newline
symbol pathSeparator
symbol phase
symbol pi
symbol reloaded
symbol res
symbol typicalValues
symbolTable
symmetricAlgebra
symmetricPower
syz
syz(..., ChangeMatrix => ...)
syz(..., StopBeforeComputation => ...)
syz(..., Strategy => ...)
syzygyScheme
table
take
tan
tanh
target
tensor
tensorAssociativity
terms
then
time
times
timing
tmpname
toDual
toHandle
toList
toSequence
top
top level loop
top-method
topCoefficients
topicList
topics
trace
transnet
transpose
trim
true
truncate
try
typicalValues
ultimate
730
730
730
730
731
731
731
731
731
731
732
732
733
733
733
733
733
734
734
734
734
735
736
736
737
737
737
737
737
738
738
738
738
739
739
739
740
740
740
740
741
741
741
742
742
743
743
743
CONTENTS
24.636.
24.637.
24.638.
24.639.
24.640.
24.641.
24.642.
24.643.
24.644.
24.645.
24.646.
24.647.
24.648.
24.649.
24.650.
24.651.
24.652.
24.653.
24.654.
24.655.
24.656.
24.657.
unSingleton
unhex
uniform
use
userSymbols
values
variety
vars
vector
version
w3
wait
wedgeProduct
while
width
xor
youngest
{...} / Function
{}
|
||
˜
Bibliography
23
744
744
744
744
745
745
745
745
746
746
747
747
747
747
747
747
748
748
748
748
749
749
751
Part I
User’s Guide
Here are the basic concepts needed to use Macaulay 2 effectively.
Preface [I.1]
Reading the Documentation [I.2]
Mathematical Overview [I.3]
Language and Programming Overview [I.4]
Miscellaneous Topics [I.5]
CHAPTER 1
Preface
How to get this program [I.1.1]
Resources required [I.1.2]
Invoking the program [I.1.3]
Getting started [I.1.4]
Copyright and license [I.1.5]
Acknowledgements [I.1.6]
The authors [I.1.7]
1.1. How to get this program
The program is available over the web at the Macaulay 2 home page
http://www.math.uiuc.edu/Macaulay2
or by ftp to the host ftp.math.uiuc.edu with user name Macaulay2 and password
Macaulay2. There you will find the documentation, both in readable form and
available for downloading, the source code, ready for compiling on the machine of
your choice, and various precompiled versions, ready to run.
1.2. Resources required
You will need about 12 megabytes of disk space to install Macaulay 2, though
this may vary. It will need about 12 megabytes of RAM to run modest size problems,
and can benefit from any additional memory.
1.3. Invoking the program
On systems with a command line interface, the following commands can be
used to start the program. When the program starts up, the initialization file
[V.24.357], init.m2, will be loaded.
M2 – starts the program.
M2 file1 file2 ... – starts the program, reading and executing the specified
files.
These are the options that can also be provided on the command line.
-- – ignore previous arguments after reloading data
-e x – evaluates the expression x
-h – displays the usage message
-mpwprompt – MPW-style imput prompts
-n – print no input prompts
-q – suppresses loading of init file ’init.m2’
-s – stops execution if an error occurs
-silent – don’t print the startup banner
-tty – assume stdin is a tty
27
28
1. PREFACE
-x – special mode for running examples
The file M2 is actually a shell script which calls the executable file with appropriate arguments for loading the Macaulay 2 code previously compiled.
To terminate the program, one may type exit [V.24.280], quit [V.24.504], end
[V.24.268], or the end of file character.
1.4. Getting started
The best way to run Macaulay 2 is with emacs - for details on getting that
set up, see emacs [V.24.267]. (On MacOS systems, we include a shareware editor
called alpha for this purpose.) Learning emacs is worth the effort! Alternatively,
you may start Macaulay 2 with the command M2 in a shell window. On most
systems Macaulay 2 will start very quickly, but other parts of the program may
have to be loaded from the disk later, causing a slight delay.
Your first input prompt will be i1 = . In response to the prompt, type 2+2
and press return. The expression you entered will be evaluated – no punctuation
is required at the end of the line.
i1 : 2+2
o1 = 4
The answer is displayed to the right of the output label o1 =.
Here is some arithmetic with fractions.
i2 : 3/5 + 7/11
68
o2 = -55
o2 : QQ
Notice the additional line of output labelled with o2 :. Output lines labelled
with colons provide information about the type of output. In this case, the symbol
QQ [III.21.8] is our notation for the class of all rational numbers, and indicates
that the answer on the previous line is a rational number.
Multiplication is indicated with *.
i3 : 1*2*3*4
o3 = 24
Powers are obtained with ^ [V.24.149].
i4 : 2^200
o4 = 1606938044258990275541962092341162602522202993782792835 ...
Factorials are obtained with ! [V.24.2].
i5 : 40!
o5 = 815915283247897734345611269596115894272000000000
Because some answers can be very long, it is a good idea to run the program
in a window which does not wrap output lines, and allows the user to scroll left
horizontally to see the rest of the output. (See emacs [V.24.267].)
i6 : 100!
1.4. GETTING STARTED
29
o6 = 9332621544394415268169923885626670049071596826438162146 ...
Multiple expressions may be separated by semicolons.
i7 : 1;2;3*4
o9 = 12
A semicolon at the end of the line suppresses the printing of the value.
i10 : 4*5;
The output from the previous line can be obtained with oo [V.24.449], even if
a semicolon prevented it from being printed.
i11 : oo
o11 = 20
Lines before that can be obtained with ooo [V.24.450] and oooo [V.24.451].
Alternatively, the symbol labeling an output line can be used to retrieve the value,
as in the following example.
i12 : o5 + 1
o12 = 815915283247897734345611269596115894272000000001
To enter a string, use quotation marks.
i13 : "hi there"
o13 = hi there
o13 : String
A value can be assigned to a variable with = [V.24.37].
i14 : s = "hi there"
o14 = hi there
o14 : String
Strings may be concatenated horizontally with |, (see String | String [V.24.131]).
i15 : s | " - " | s
o15 = hi there - hi there
o15 : String
or vertically with ||, (see Net || Net [III.21.6.4]).
i16 : s || " - " || s
o16 = hi there
hi there
o16 : Net
A list of expressions can be formed with braces.
i17 : {1, 2, s}
o17 = {1, 2, hi there}
30
1. PREFACE
o17 : List
Lists behave like vectors.
i18 : 10*{1,2,3} + {1,1,1}
o18 = {11, 21, 31}
o18 : List
A function can be created with the arrow operator, -> [V.24.21] .
i19 : f = i -> i^3
o19 = f
o19 : Function
To evaluate a function, place its argument to the right of the function.
i20 : f 5
o20 = 125
Functions of more than one variable take a parenthesized sequence of arguments.
i21 : g = (x,y) -> x * y
o21 = g
o21 : Function
i22 : g(6,9)
o22 = 54
The function apply [V.24.169] can be used to apply a function to each element
of a list.
i23 : apply({1,2,3,4}, i -> i^2)
o23 = {1, 4, 9, 16}
o23 : List
i24 : apply({1,2,3,4}, f)
o24 = {1, 8, 27, 64}
o24 : List
The operator .. [V.24.23] may be used to generate sequences of consecutive
numbers.
i25 : apply(1 .. 4, f)
o25 = (1, 8, 27, 64)
o25 : Sequence
If the first argument to apply is an integer n then it stands for the list {0, 1,
..., n-1}.
1.4. GETTING STARTED
31
i26 : apply(5, f)
o26 = {0, 1, 8, 27, 64}
o26 : List
The function scan [V.24.537] is analogous to apply [V.24.169] except that no
value is returned. It may be used to implement loops in programs.
i27
(0,
(1,
(2,
(3,
(4,
: scan(5, i -> print (i, i^3))
0)
1)
8)
27)
64)
i28 : j=1; scan(10, i -> j = 2*j); j
o30 = 1024
Most computations with polynomials take place in rings that may be specified
in usual mathematical notation.
i31 : R = ZZ/5[x,y,z];
(We reserve single letter symbols such as Z for use as variables in rings, hence
we must use something like ZZ to stand for the ring of integers. It may remind you
of the ”blackboard bold” font of AMSTeX. If you prefer Z to ZZ, you may put Z=ZZ
in your initialization file [V.24.357].)
i32 : (x+y)^5
5
5
o32 = x + y
o32 : R
Rings and certain other types of things acquire the name of the global variable
they are assigned to.
i33 : R
o33 = R
o33 : PolynomialRing
To see the original description of a ring, use describe [V.24.249].
i34 : describe R
ZZ
o34 = -- [x, y, z]
5
o34 : Adjacent
A free module can be created as follows.
i35 : F = R^3
3
o35 = R
o35 : R - module, free
32
1. PREFACE
The i-th basis element of F can be obtained as F_i. In this example, the valid
values for i are 0, 1, and 2.
i36 : F_1
o36 = <1>
3
o36 : R
Using a list of indices instead will produce the homomorphism corresponding
to the basis vectors indicated.
i37 : F_{1,2}
o37 = {0} | 0 0 |
{0} | 1 0 |
{0} | 0 1 |
3
2
o37 : Matrix R <--- R
Repetitions are allowed.
i38 : F_{2,1,1}
o38 = {0} | 0 0 0 |
{0} | 0 1 1 |
{0} | 1 0 0 |
3
3
o38 : Matrix R <--- R
We can create a homomorphism between free modules with matrix [V.24.401]
by providing the list of rows of the matrix, each of which is in turn a list of ring
elements.
i39 : f = matrix {{x,y,z}}
o39 = {0} | x y z |
1
3
o39 : Matrix R <--- R
Use image [V.24.348] to get the image of f.
i40 : image f
o40 = image {0} | x y z |
1
o40 : R - module, submodule of R
We may use ideal [III.11.5] to produce the corresponding ideal.
i41 : ideal (x,y,z)
o41 = ideal (x, y, z)
o41 : Ideal of R
We may use kernel [V.24.375] to compute the kernel of f.
i42 : kernel f
1.4. GETTING STARTED
33
o42 = image {1} | 0 -y -z |
{1} | -z x 0 |
{1} | y 0 x |
3
o42 : R - module, submodule of R
The answer comes out as a module which is expressed as the image of a homomorphism whose matrix is displayed. In case the matrix itself is desired, it can be
obtained with generators [III.13.12.1].
i43 : generators oo
o43 = {1} | 0 -y -z |
{1} | -z x 0 |
{1} | y 0 x |
3
3
o43 : Matrix R <--- R
We may use poincare [V.24.472] to compute the Poincare polynomial.
i44 : poincare kernel f
3
2
o44 = - $T + 3$T
o44 : ZZ[ZZ^1]
We may use rank [V.24.508] to compute the rank.
i45 : rank kernel f
o45 = 2
A presentation for the kernel can be obtained with presentation [V.24.480].
i46 : presentation kernel f
o46 = {2} | x |
{2} | z |
{2} | -y |
3
1
o46 : Matrix R <--- R
We can produce the cokernel with cokernel [V.24.213]; no computation is
performed.
i47 : cokernel f
o47 = cokernel {0} | x y z |
1
o47 : R - module, quotient of R
The direct sum is formed with Module ++ Module [III.13.8].
i48 : N = kernel f ++ cokernel f
o48 = subquotient ({1} | 0 -y -z 0 |, {1} | 0 0 0 |)
{1} | -z x 0 0 | {1} | 0 0 0 |
{1} | y 0 x 0 | {1} | 0 0 0 |
34
1. PREFACE
{0} | 0
0
0
1 |
{0} | x y z |
4
o48 : R - module, subquotient of R
The answer is expressed in terms of the subquotient [III.13.12] function, which
produces subquotient modules. Each subquotient module is accompanied by its
matrix of generators and its matrix of relations. These matrices can be recovered
with generators [III.13.12.1] and relations [III.13.12.2].
i49 : generators N
o49 = {1}
{1}
{1}
{0}
|
|
|
|
0
-z
y
0
-y
x
0
0
-z
0
x
0
0
0
0
1
|
|
|
|
4
4
o49 : Matrix R <--- R
i50 : relations N
o50 = {1}
{1}
{1}
{0}
|
|
|
|
0
0
0
x
0
0
0
y
0
0
0
z
|
|
|
|
4
3
o50 : Matrix R <--- R
The function prune [III.13.12.3] can be used to convert a subquotient module
to a quotient module.
i51 : prune N
o51 = cokernel {2}
{2}
{2}
{0}
|
|
|
|
0
0
0
z
0
0
0
y
0
0
0
x
-y
z
x
0
|
|
|
|
4
o51 : R - module, quotient of R
We can use resolution [V.24.517] to compute a projective resolution of the
cokernel of f.
i52 : C = resolution cokernel f
1
3
3
1
o52 = R <-- R <-- R <-- R
0
1
2
3
o52 : ChainComplex
To see the differentials we examine ’C.dd’.
i53 : C.dd
1
o53 = -1 : 0 <----- R
0
: 0
1.4. GETTING STARTED
35
1
3
0 : R <----------------- R : 1
{0} | x y z |
3
3
1 : R <-------------------- R : 2
{1} | -y -z 0 |
{1} | x 0 -z |
{1} | 0 x y |
3
1
2 : R <-------------- R : 3
{2} | z |
{2} | -y |
{2} | x |
o53 : ChainComplexMap
We can verify that C is a complex by squaring the differential map.
i54 : C.dd^2 == 0
o54 = true
We can use betti [III.21.6.5] to see the degrees of the components of C.
i55 : betti C
o55 = total: 1 3 3 1
0: 1 3 3 1
o55 : Net
Let’s try a harder example. We can use vars [V.24.643] to create a sequence
of variables.
i56 : R = ZZ/101[a .. r];
We use genericMatrix [V.24.316] to make a 3 by 6 generic matrix whose
entries are drawn from the variables of the ring R.
i57 : g = genericMatrix(R,a,3,6)
o57 = {0} | a d g j m p |
{0} | b e h k n q |
{0} | c f i l o r |
3
6
o57 : Matrix R <--- R
Then we construct its cokernel with cokernel [V.24.213].
i58 : M = cokernel g
o58 = cokernel {0} | a d g j m p |
{0} | b e h k n q |
{0} | c f i l o r |
3
o58 : R - module, quotient of R
We may use resolution [V.24.517] to produce a projective resolution of it, and
time [V.24.613] to report the time required.
36
1. PREFACE
i59 : time C = resolution M
-- used 0.02 seconds
3
6
15
18
6
o59 = R <-- R <-- R
<-- R
<-- R
0
1
2
3
4
o59 : ChainComplex
As before, we may examine the degrees of its components, or display it.
i60 : betti C
o60 = total:
0:
1:
2:
3
3
.
.
6
6
.
.
15
.
.
15
18
.
.
18
6
.
.
6
o60 : Net
We can make a polynomial ring with 18 IndexedVariable [III.21.1.4]s.
i61 : S = ZZ/101[t_1 .. t_9, u_1 .. u_9];
We can use genericMatrix [V.24.316] to pack the variables into 3-by-3 matrices.
i62 : m = genericMatrix(S, t_1, 3, 3)
o62 = {0} | t_1 t_4 t_7 |
{0} | t_2 t_5 t_8 |
{0} | t_3 t_6 t_9 |
3
3
o62 : Matrix S <--- S
i63 : n = genericMatrix(S, u_1, 3, 3)
o63 = {0} | u_1 u_4 u_7 |
{0} | u_2 u_5 u_8 |
{0} | u_3 u_6 u_9 |
3
3
o63 : Matrix S <--- S
We may look at the matrix product.
i64 : m*n
o64 = {0} | t_1u_1+t_4u_2+t_7u_3 t_1u_4+t_4u_5+t_7u_6 t_1u_7 ...
{0} | t_2u_1+t_5u_2+t_8u_3 t_2u_4+t_5u_5+t_8u_6 t_2u_7 ...
{0} | t_3u_1+t_6u_2+t_9u_3 t_3u_4+t_6u_5+t_9u_6 t_3u_7 ...
3
3
o64 : Matrix S <--- S
Let’s produce the equations generated by the equations which assert that m
and n commute with each other. (See flatten [V.24.291].)
i65 : j = flatten(m*n - n*m)
o65 = {0} | t_4u_2+t_7u_3-t_2u_4-t_3u_7 t_2u_1-t_1u_2+t_5u_2 ...
1.5. COPYRIGHT AND LICENSE
37
1
9
o65 : Matrix S <--- S
Let’s compute a Groebner basis for the image of j with gb [III.15.2].
i66 : gb j
o66 = {0} | t_7u_3+t_8u_6-t_3u_7-t_6u_8 t_4u_3-t_3u_4-t_6u_5 ...
o66 : GroebnerBasis
The resulting Groebner basis contains a lot of information. We can get the
generators of the basis, and even though we call upon gb [III.15.2] again, the
computation will not be repeated.
i67 : generators gb j;
1
26
o67 : Matrix S <--- S
The semicolon prevents the matrix of generators from appearing on the screen,
but the class of the matrix appears – we see that there are 26 generators.
We can use betti [III.21.6.5] to see the degrees involved in the Groebner basis.
i68 : betti gb j
o68 = total:
0:
1:
2:
3:
4:
1 26
1 .
. 8
. 12
. 5
. 1
o68 : Net
1.5. Copyright and license
Macaulay 2, its object code and source code, and its documentation, are copyright by Daniel R. Grayson and Michael E. Stillman. We permit you to make copies
under the following conditions.
Provided you are a person (and not a corporate entity), you may make as
many copies of Macaulay 2 as you like for your personal non-commercial use. You
may install copies of Macaulay 2 on computers owned by Universities, Colleges,
High Schools, and other schools in such a way that students and staff of those
institutions may use it. You may modify and distribute the source code in the
Macaulay 2 language we provide you, but you must retain our copyright notices
and mark modified source code so others will know that it’s been modified. You
may print out the manual and make copies of it for your personal use.
If your intended use of Macaulay 2 is not covered by the license above, please
contact us so we can work something out. Notice that in the license above we have
not granted you permission to make copies of Macaulay 2 to be sold, distributed
on media which are sold, or distributed along with software which is sold. We have
not granted you permission to make derivative works, or to distribute them. If you
encounter a copy which appears not to conform to the terms of the license above,
we would like to hear about it.
Various libraries have been compiled into Macaulay 2.
38
1. PREFACE
Factory library [V.24.77]
Factorization and characteristic sets library [V.24.76]
GNU MP [V.24.84]
GC garbage collector [V.24.82]
1.6. Acknowledgements
We thank the National Science Foundation for generous funding since 1993 for
this project, Gert-Martin Greuel and Ruediger Stobbe for the incorporation of their
Factory library [V.24.77], Michael Messollen for the incorporation of his Factorization and characteristic sets library [V.24.76], and David Eisenbud, Wolfram
Decker and Sorin Popescu for early support, encouragement and suggestions. We
also acknowledge an intellectual debt to David Bayer, who, with Michael Stillman,
wrote Macaulay, a specialized computer algebra system for algebraic geometry and
the predecessor of this program.
1.7. The authors
The authors of Macaulay 2 and the bulk of this manual:
Daniel R. Grayson [I.1.7.1]
Michael E. Stillman [I.1.7.2]
Our co-author for the tutorials:
David Eisenbud [I.1.7.3]
To communicate with us about the program, use this email address: <Macaulay2@math.uiuc.edu>.
1.7.1. Daniel R. Grayson
Daniel R. Grayson <dan@math.uiuc.edu>.
Daniel Grayson received his PhD in Mathematics from MIT in 1976, taught
at Columbia from 1976 to 1981, and came to the University of Illinois at UrbanaChampaign in 1981, where he is a Professor. His mathematical research concerns
algebraic K-theory, but he has always been intrigued by computers. In 1986 he
joined with Stephen Wolfram and six other co-authors to write Mathematica which
in the years since its introduction in 1988 has become the pre-eminent system for
mathematics on the computer.
1.7.2. Michael E. Stillman
Michael E. Stillman <mike@math.cornell.edu>
Michael E. Stillman received his PhD in Mathematics from Harvard in 1983,
taught at University of Chicago 1983-85, was at Brandeis and then MIT 1985-87,
and then came to Cornell University. His mathematical research concerns computational algebraic geometry and algebraic geometry. He started writing syzygy
programs as an undergraduate at the University of Illinois, and from 1983 to 1992
with David Bayer he wrote Macaulay, a specialized computer algebra system for
algebraic geometry and the predecessor of this program.
1.7.3. David Eisenbud
David Eisenbud <de@msri.org>.
In this spot will go a brief biography of David Eisenbud.
CHAPTER 2
Reading the Documentation
The documentation is divided into the main parts, the User’s Guide [I] and
the Reference Manual [III]. The reference manual is organized mainly according
to the types of things, and reflects the particular way we’ve programmed the system.
For example, if you want to find out about matrices, then you might get there by
clicking first on Thing [III.21], then click on Type [III.21.5.4.11], and then on
Matrix [III.12]. The user’s guide is organized more according to mathematical
topics that might occur to an initial user, and might be a good place to look first,
except that it’s not completely written yet.
The documentation for Macaulay 2 is available in several formats. The directory Macaulay2/html contains the documentation in html form, suitable for
viewing with a web browser such as lynx or Netscape, and this is the best way
to view it. Each documentation page has a text box for entering a search string.
This will work if you view the documentation at our web site; it will work on your
local machine only if you or your system administrator has already installed htdig,
which is a free indexing package available at http://www.htdig.org/.
The directory Macaulay2/book contains the documentation in TeX form, which
can be printed with dvips or viewed on your screen with a dvi previewer such as
xdvi. There is also a searchable hyperlinked pdf version of the documentation
which can be viewed with Adobe’s Acrobat Reader or with xpdf.
Finally, all the documentation can be viewed within the program in text form
using help [V.24.337].
39
CHAPTER 3
Mathematical Overview
In this section we give a comprehensive overview of the main mathematical
features of Macaulay 2.
rings
basic rings [I.3.1]
polynomial rings [I.3.2]
manipulating polynomials [I.3.3]
polynomial rings with other monomial orderings [I.3.4]
multi-graded polynomial rings [I.3.5]
maps between rings [I.3.6]
ideals [I.3.7]
quotient rings [I.3.8]
finite fields [I.3.9]
fraction fields [I.3.10]
tensor products of rings [I.3.11]
exterior algebras [I.3.12]
symmetric algebras [I.3.13]
Weyl algebras [I.3.14]
associative algebras [I.3.15]
algebraic varieties [I.3.16]
matrices
making matrices [I.3.17]
making random matrices [I.3.18]
making generic matrices [I.3.19]
displaying matrices [I.3.20]
manipulating matrices [I.3.21]
diff and contract [I.3.22]
modules
free modules [I.3.23]
making modules from matrices [I.3.24]
manipulating modules [I.3.25]
maps between modules [I.3.26]
bases of parts of modules [I.3.27]
coherent sheaves [I.3.28]
chain complexes
free resolutions of modules [I.3.29]
making chain complexes by hand [I.3.30]
extracting information from chain complexes [I.3.31]
manipulating chain complexes [I.3.32]
maps between chain complexes [I.3.33]
41
42
3. MATHEMATICAL OVERVIEW
computations
Groebner bases [I.3.34]
computing Groebner bases [I.3.35]
computing syzygies [I.3.36]
computing resolutions [I.3.37]
3.1. basic rings
The following rings are initially present in every session with Macaulay 2.
ZZ [III.21.11] – the class of all integers
QQ [III.21.8] – the class of all rational numbers
RR [III.21.9] – the class of all real numbers
CC [III.21.1.1] – the class of all complex numbers
(The names of these rings are double letters so the corresponding symbols with
single letters can be used as variables in rings.) Entries of these rings are constructed
as follows, and the usual arithmetic operations apply.
i1 : 1234
o1 = 1234
i2 : 123/4
123
o2 = --4
o2 : QQ
i3 : 123.4
o3 = 123.4
o3 : RR
i4 : 123+4*ii
o4 = 123 + 4ii
o4 : CC
The usual arithmetic operations are available.
i5 : 4/5 + 2/3
22
o5 = -15
o5 : QQ
i6 : 10^20
o6 = 100000000000000000000
i7 : 3*5*7
o7 = 105
3.2. POLYNOMIAL RINGS
43
i8 : 5!
o8 = 120
An additional pair of division operations that produce integral quotients and
remainders is available.
i9 : 1234//100
o9 = 12
i10 : 1234%100
o10 = 34
3.2. polynomial rings
A polynomial ring can be created with the usual mathematical notation.
i1 : ZZ[x,y,z]
o1 = ZZ [x, y, z]
o1 : PolynomialRing
If you try to construct this ring again, you will get a different answer. We use
the strict comparison operator === [V.24.40] to demonstrate this.
i2 : ZZ[x,y,z]===ZZ[x,y,z]
o2 = false
Thus it is a good idea to assign a new ring to a variable for future reference.
i3 : R = QQ[a,b,c,d,e,f]
o3 = R
o3 : PolynomialRing
Notice that after assignment to a global variable, the ring knows its name, and
the name is used when printing the ring.
i4 : R
o4 = R
o4 : PolynomialRing
The original description of the ring can be recovered with describe [V.24.249].
i5 : describe R
o5 = QQ [a, b, c, d, e, f]
o5 : Adjacent
Subscript notation can be used to obtain the zero element and the unit element
of a ring, or indeed, to obtain any multiple of the unit.
i6 : 0_R
o6 = 0
44
3. MATHEMATICAL OVERVIEW
o6 : R
i7 : 1_R
o7 = 1
o7 : R
i8 : 11_R
o8 = 11
o8 : R
Subscript notation (the other way around) can be used to obtain the variables
(generators) from the ring. The first available index is 0.
i9 : R_0^10+R_1^3+R_2
10
3
o9 = a
+ b + c
o9 : R
It is also possible to obtain the variables in a ring from strings containing their
names.
i10 : R_"a"^10+R_"b"^3+R_"c"
10
3
o10 = a
+ b + c
o10 : R
The number of variables is provided by numgens [V.24.445].
i11 : numgens R
o11 = 6
i12 : apply(numgens R, i -> R_i^i)
2
3
4
5
o12 = {1, b, c , d , e , f }
o12 : List
i13 : sum(numgens R, i -> R_i^i)
5
4
3
2
o13 = f + e + d + c + b + 1
o13 : R
The index corresponding to a given variable can be obtained with index
[V.24.351].
i14 : index a, index f
o14 = (0, 5)
o14 : Sequence
3.2. POLYNOMIAL RINGS
45
The coefficient ring can be recovered with coefficientRing [V.24.208].
i15 : coefficientRing R
o15 = QQ
o15 : Field
-- the class of all rational numbers
An element of the coefficient ring can be promoted to the polynomial ring.
i16 : promote(11/2,R)
11
o16 = -2
o16 : R
Conversely, an element of the polynomial ring that is known to be a scalar can
be lifted back to the coefficient ring.
i17 : sc = (a-2)^2-a^2+4*a
o17 = 4
o17 : R
i18 : lift(sc,QQ)
o18 = 4
o18 : QQ
In programs, the function liftable [V.24.387] can be used to see whether this
is possible.
i19 : liftable(sc,QQ)
o19 = true
i20 : liftable(c^3,QQ)
o20 = false
A random homogeneous element can be obtained with random [V.24.216.1].
i21 : random(2,R)
5
2 2
7 2
9
1
2
8
...
o21 = -*a*b - -*b + a*c - -*c - -*b*d + -*c*d - 10d - -*a ...
2
3
4
5
3
9
...
o21 : R
We may construct polynomial rings over polynomial rings.
i22 : ZZ[a,b,c][d,e,f];
When displaying an element of an iterated polynomial ring, parentheses are
used to organize the coefficients recursively, which may themselves be polynomials.
i23 : (a+d+1)^2
46
3. MATHEMATICAL OVERVIEW
2
2
o23 = d + (2a + 2)d + (a + 2a + 1)
o23 : (ZZ [a, b, c])[d, e, f]
Variable names may be words.
i24 : QQ[rho,sigma,tau];
i25 : (rho - sigma)^2
2
2
o25 = rho - 2rho*sigma + sigma
o25 : QQ [rho, sigma, tau]
There are various other ways to specify the variables to be used in a polynomial
ring. A sequence of variables can be obtained as follows.
i26 : ZZ[b..k];
The single-letter variables can be obtained with vars [V.24.643].
i27 : vars (0..4)
o27 = (a, b, c, d, e)
o27 : Sequence
i28 : ZZ[vars (0..4),vars(26..30),vars 51]
o28 = ZZ [a, b, c, d, e, A, B, C, D, E, Z]
o28 : PolynomialRing
Subscripted variables can be used, provided the base for the subscripted variable
has not been used for something else.
i29 : ZZ[t,p_0,p_1,q_0,q_1];
Sequences of subscripted variables can be obtained.
i30 : ZZ[p_(0,0) .. p_(2,1),q_0..q_5]
o30 = ZZ [p
, p
, p
, p
, p
, p
, q , q , q , q ...
0,0
0,1
1,0
1,1
2,0
2,1
0
1
2
3 ...
o30 : PolynomialRing
i31 : (p_(0,0)+q_2-1)^2
2
2
o31 = p
+ 2p
q + q - 2p
- 2q + 1
0,0
0,0 2
2
0,0
2
o31 : ZZ [p
, p
, p
, p
, p
, p
, q , q , q , q ...
0,0
0,1
1,0
1,1
2,0
2,1
0
1
2
3 ...
The subscripts can be much more general, but care is required when using
symbols as subscripts, for the symbols may acquire values later that would interfere
with your original use of them as symbols. Thus you should protect symbols that
will be used in this way.
i32 : protect xx; protect yy; protect zz;
3.3. MANIPULATING POLYNOMIALS
47
i35 : ZZ[ee_[xx],ee_[yy],ee_[zz]]
o35 = ZZ [ee
, ee
, ee
]
[xx]
[yy]
[zz]
o35 : PolynomialRing
A basis of the subspace of ring elements of a given degree can be obtained in
matrix form with basis [V.24.187].
i36 : basis(2,R)
o36 = {0} | a2 ab ac ad ae af b2 bc bd be bf c2 cd ce cf d2
...
1
21
o36 : Matrix R <--- R
The Hilbert series of a polynomial ring can be obtained. Its power series expansion is the generating function for the dimensions of the degree n parts.
i37 : hilbertSeries R
1
o37 = ----------6
(- $T + 1)
o37 : Divide
We may use the option Degrees [III.10.1.3.2.3] to produce rings where the
generators have degrees other than 1.
i38 : S = ZZ/101[a,b,c,d,Degrees=>{1,2,3,4}]
o38 = S
o38 : PolynomialRing
i39 : random(5,S)
5
3
2
2
o39 = a - 45a b - 15a*b + 15a c - 2b*c - 10a*d
o39 : S
i40 : hilbertSeries S
1
o40 = ------------------------------------------2
3
4
(- $T + 1)(- $T + 1)(- $T + 1)(- $T + 1)
o40 : Divide
See also:
polynomial rings with other monomial orderings [I.3.4]
PolynomialRing [III.10.1.3] – the class of all ordered monoid rings
3.3. manipulating polynomials
Let’s set up some polynomials.
48
3. MATHEMATICAL OVERVIEW
i1 : R = ZZ/10007[a,b];
i2 : f = (2*a+3)^4 + 5
4
3
2
o2 = 16a + 96a + 216a + 216a + 86
o2 : R
i3 : g = (2*a+b+1)^3
3
2
2
3
2
2
o3 = 8a + 12a b + 6a*b + b + 12a + 12a*b + 3b + 6a + 3b ...
o3 : R
The number of terms in a polynomial is obtained with size [V.24.553].
i4 : size f, size g
o4 = (5, 10)
o4 : Sequence
The degree of a polynomial is obtained with degree [V.24.240].
i5 : degree f
o5 = {4}
o5 : List
i6 : degree g
o6 = {3}
o6 : List
(Notice that the degree is a list containing one integer, rather than an integer. The
degree is actually a vector of integers, represented as a list, with one component by
default.)
The list of terms of a polynomial is obtained with terms [V.24.611].
i7 : terms g
3
2
2
3
2
2
o7 = {8a , 12a b, 6a*b , b , 12a , 12a*b, 3b , 6a, 3b, 1}
o7 : List
We may combine that with select [V.24.541] to select terms satisfying certain
conditions. Here we select the terms of degree 2, subsequently summing them,
keeping in mind that the degree of a polynomial is always a list of integers.
i8 : select(terms g, i -> degree i == {2})
2
2
o8 = {12a , 12a*b, 3b }
o8 : List
i9 : sum oo
3.3. MANIPULATING POLYNOMIALS
49
2
2
o9 = 12a + 12a*b + 3b
o9 : R
A string representing the polynomial, suitable for entry into other programs,
can be obtained with toString [III.21.6.1.7].
i10 : toString f
o10 = 16*a^4+96*a^3+216*a^2+216*a+86
o10 : String
i11 : toString g
o11 = 8*a^3+12*a^2*b+6*a*b^2+b^3+12*a^2+12*a*b+3*b^2+6*a+3*b ...
o11 : String
The usual algebraic operations on polynomials are available, but there are
some special remarks to make about division. The result of division depends on
the ordering of monomials chosen when the ring is created, for division of f by g
proceeds by locating monomials in f divisible by the leading monomial of g, and
substituting for it the negation of the rest of g. The quotient is provided by the
expression f//g, and the remainder is obtained with f%g.
i12 : quot = f//g
o12 = 2a - 3b + 9
o12 : R
i13 : rem = f%g
2 2
3
4
2
2
2
o13 = 24a b + 16a*b + 3b - 96a b - 24a*b + 96a - 96a*b
...
...
o13 : R
i14 : f == quot * g + rem
o14 = true
Notice that as in the example above, comparison of polynomials is done with the
operator == [V.24.39].
Polynomials can be homogenized with respect to one of the variables in the
ring with homogenize [V.24.340].
i15 : homogenize(f,b)
4
3
2 2
3
4
o15 = 16a + 96a b + 216a b + 216a*b + 86b
o15 : R
Polynomials can be factored with factor [V.24.285].
i16 : S = factor f
2
50
3. MATHEMATICAL OVERVIEW
o16 = (a
+ 3a - 2301)(a - 402)(a + 405)(16)
o16 : Product
i17 : T = factor g
3
o17 = (a - 5003b - 5003) (8)
o17 : Product
The results above are represented as products of powers. (Exponents equal to 1
don’t appear in the display.) We can see the internal structure to a specified depth
(in this case, 2) with peek2 [III.21.6.9].
i18 : peek2(S,2)
2
o18 = Product{Power{a + 3a - 2301,1},Power{a - 402,1},Power ...
o18 : Net
i19 : peek2(T,2)
o19 = Product{Power{a - 5003b - 5003,3},Power{8,1}}
o19 : Net
The components of the expressions above (Products and Powers) are types of
lists, and the parts can be extracted with # [V.24.4].
i20 : T#0
3
o20 = (a - 5003b - 5003)
o20 : Power
i21 : T#0#0
o21 = a - 5003b - 5003
o21 : R
i22 : T#0#1
o22 = 3
The ring containing a ring element can be obtained with ring [III.10.5].
i23 : ring f
o23 = R
o23 : PolynomialRing
You can use this in a program to check whether two ring elements come from
the same ring.
i24 : ring f === ring g
o24 = true
3.3. MANIPULATING POLYNOMIALS
51
Notice that in the comparison above, the strict equality operator === [V.24.40]
is used.
The coefficient of a monomial in a polynomial can be obtained with _ [V.24.151].
i25 : f_1
o25 = 86
ZZ
o25 : ----10007
i26 : f_a
o26 = 216
ZZ
o26 : ----10007
i27 : g_(a*b)
o27 = 12
ZZ
o27 : ----10007
(Notice that the coefficients are elements of the coefficient ring.)
We may get parts of the leading term of a polynomial as follows.
i28 : leadTerm g
3
o28 = 8a
o28 : R
i29 : leadCoefficient g
o29 = 8
ZZ
o29 : ----10007
i30 : leadMonomial g
3
o30 = a
o30 : [a, b]
Notice that the lead monomial is an element of a monoid whose name is [a,b]. Its
exponents can be extracted with exponents [V.24.282].
i31 : exponents leadMonomial g
o31 = {3, 0}
o31 : List
52
3. MATHEMATICAL OVERVIEW
We can get all of the coefficients at once, assembled a one-rowed matrix, along
with a matrix containing the corresponding monomials.
i32 : coefficients f
o32 = {{0} | a4 a3 a2 a 1 |, {0} | 16 96 216 216 86 |}
o32 : List
i33 : coefficients g
o33 = {{0} | a3 a2b ab2 b3 a2 ab b2 a b 1 |, {0} | 8 12 6 1
...
o33 : List
A list of lists of exponents appearing in a polynomial can be obtained with
exponents [V.24.282].
i34 : exponents f
o34 = {{4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}
o34 : List
i35 : exponents g
o35 = {{3, 0}, {2, 1}, {1, 2}, {0, 3}, {2, 0}, {1, 1}, {0, 2 ...
o35 : List
The entire structure of a polynomial can be provided in an accessible form
based on lists with listForm [V.24.390].
i36 : listForm f
o36 = {({4, 0}, 16), ({3, 0}, 96), ({2, 0}, 216), ({1, 0}, 2 ...
o36 : List
i37 : S = listForm g
o37 = {({3, 0}, 8), ({2, 1}, 12), ({1, 2}, 6), ({0, 3}, 1),
...
o37 : List
The lists above are lists of pairs, where the first member of each pair is a list of
exponents in a monomial, and the second member is the corresponding coefficient.
Standard list operations can be used to manipulate the result.
i38 : S / print;
({3, 0}, 8)
({2, 1}, 12)
({1, 2}, 6)
({0, 3}, 1)
({2, 0}, 12)
({1, 1}, 12)
({0, 2}, 3)
({1, 0}, 6)
({0, 1}, 3)
({0, 0}, 1)
3.3. MANIPULATING POLYNOMIALS
53
The structure of a polynomial can also be provided in a form based on hash
tables with standardForm [V.24.564].
i39 : S = standardForm f
o39 = HashTable{HashTable{0
HashTable{0
HashTable{0
HashTable{0
HashTable{}
=>
=>
=>
=>
=>
1}
2}
3}
4}
86
=>
=>
=>
=>
216}
216
96
16
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
1}
1
1}
1}
2
2}
2}
1
3}
1}
2}
3}
1
=> 12}
o39 : HashTable
i40 : standardForm g
o40 = HashTable{HashTable{0
1
HashTable{0
HashTable{0
1
HashTable{0
HashTable{0
1
HashTable{0
HashTable{1
HashTable{1
HashTable{1
HashTable{}
=> 6
=> 6
=> 12
=> 12
=>
=>
=>
=>
8
3
3
1
o40 : HashTable
The hash tables above present the same information, except that only nonzero
exponents need to be provided. The information can be extracted with # [V.24.4].
i41 : S#(new HashTable from {0 => 2})
o41 = 216
ZZ
o41 : ----10007
Monomials (monoid elements) have an accessible form that is implicitly used
above.
i42 : listForm leadMonomial g
o42 = {3, 0}
o42 : List
i43 : standardForm leadMonomial g
o43 = HashTable{0 => 3}
o43 : HashTable
Comparison of polynomials is possible, and proceeds by simply examining the
lead monomials and comparing them.
i44 : f < g
54
3. MATHEMATICAL OVERVIEW
o44 = true
i45 : sort {b^2-1,a*b,a+1,a,b}
2
o45 = {b - 1, a*b, b, a, a + 1}
o45 : List
The comparison operator ? [V.24.46] returns a symbol indicating how two
polynomials, or rather, their lead monomials, stand with respect to each other in
the monomial ordering.
i46 : f ? g
o46 = <
o46 : Symbol
3.4. polynomial rings with other monomial orderings
We can make polynomial rings with various other orderings of the monomials
used in storing and displaying the polynomials. The choice of ordering can make a
difference in the time taken in various computations.
The material in this section will be completely redone soon.
The default is to use the graded reverse lexicographic ordering of monomials.
This means that terms of higher total degree come first; and for two terms of the
same degree, the term with the higher power of the last variable comes last; for
terms with the same power of the last variable, the exponent on the next to last
variable is consulted, and so on.
i1 : R=ZZ/101[a,b,c]
o1 = R
o1 : PolynomialRing
i2 : (a+b+c+1)^2
2
2
2
o2 = a + 2a*b + b + 2a*c + 2b*c + c + 2a + 2b + 2c + 1
o2 : R
Explicit comparison of monomials with respect to the chosen ordering is possible.
i3 : b^2 > a*c
o3 = true
The comparison operator ? [V.24.46] returns a symbol indicating the result
of the comparison: the convention is that the larger monomials are printed first
(leftmost).
i4 : b^2 ? a*c
o4 = >
o4 : Symbol
3.4. POLYNOMIAL RINGS WITH OTHER MONOMIAL ORDERINGS
55
The monomial ordering is also used when sorting lists with sort [V.24.556].
i5 : sort {1_R, a, a^2, b, b^2, a*b, a^3, b^3}
3
2
3
2
o5 = {b , b , a*b, b, a , a , a, 1}
o5 : List
The next ring uses MonomialOrder [III.10.1.3.2.1] to specify reverse lexicographic ordering. This means that the term with the higher power of the last
variable comes last; for terms with the same power of the last variable, the exponent on the next to last variable is consulted, and so on. Under this ordering the
monomials are not well ordered.
i6 : R=ZZ/101[x,y,z,MonomialOrder=>RevLex];
We currently get a monomial overflow if we try to compute anything in this
ring, sigh.
The next ring uses graded lexicographic ordering. This means that terms of
higher total degree come first; for two terms of the same degree, the term with the
higher power of the first variable comes first: for terms with the same power of the
first variable the power of the second variable is consulted, and so on.
i7 : R=ZZ/101[a,b,c,MonomialOrder=>GLex];
i8 : (a+b+c+1)^2
2
2
2
o8 = a + 2a*b + 2a*c + b + 2b*c + c + 2a + 2b + 2c + 1
o8 : R
(Notice how similar the result above is to the one obtained when graded reverse
lexicographic ordering is used.)
The next ring uses lexicographic ordering. This means that terms with the
highest power of the first variable come first: for two terms with the same power
of the first variable the power of the second variable is consulted, and so on.
i9 : R=ZZ/101[a,b,c,MonomialOrder=>Lex];
i10 : (a+b+c+1)^2
2
2
2
o10 = a + 2a*b + 2a*c + 2a + b + 2b*c + 2b + c + 2c + 1
o10 : R
The next ring uses an elimination order suitable for eliminating the first two
variables, a and b. In such an ordering we want all terms in which either of the
first two variables appears to come before all of those terms in which the first two
variables don’t appear. This particular ordering accomplishes this by consulting
first the graded reverse lexicographic ordering ignoring all variables but the first
two, and in case of a tie, consulting the graded reverse lexicographic ordering of
the entire monomials.
i11 : R=ZZ/101[a,b,c,MonomialOrder=>Eliminate 2];
i12 : (a+b+c+1)^2
56
3. MATHEMATICAL OVERVIEW
2
2
2
o12 = a + 2a*b + b + 2a*c + 2b*c + 2a + 2b + c + 2c + 1
o12 : R
The next ring uses the product ordering that segregates the first variable from
the next two. This means that terms come first that would come first in the graded
reverse lexicographic ordering when their parts involving the second two variables
are ignored, and in case of equality, the graded reverse lexicographic ordering of
their parts involving just the next two variables is consulted.
i13 : R=ZZ/101[a,b,c,MonomialOrder=>ProductOrder{1,2}];
i14 : (a+b+c+1)^2
2
2
2
o14 = a + 2a*b + 2a*c + 2a + b + 2b*c + c + 2b + 2c + 1
o14 : R
See MonomialOrder [III.10.1.3.2.1] for further details.
3.5. multi-graded polynomial rings
It is possible to set up a polynomial ring so that the degree of an element is
a vector of integers. For this, the option Degrees [III.10.1.3.2.3] is used, together
with a list of degrees for the variables in the ring. Each degree is itself a list of
integers. The degrees given must all be of the same length, and length zero is
allowed, to get an ungraded ring.
i1 : R = ZZ/101[a,b,c,Degrees=>{{1,2},{2,1},{1,0}}]
o1 = R
o1 : PolynomialRing
i2 : describe R
ZZ
o2 = --- [a, b, c, Degrees => {{1, 2}, {2, 1}, {1, 0}}]
101
o2 : Adjacent
At the moment there is a restriction on the degree vectors: the first entry must
be greater than zero. This restriction will be removed soon.
i3 : degree a
o3 = {1, 2}
o3 : List
i4 : degree b^2
o4 = {4, 2}
o4 : List
i5 : degree 0_R
3.6. MAPS BETWEEN RINGS
57
o5 = -infinity
o5 : InfiniteNumber
i6 : degree 1_R
o6 = {0, 0}
o6 : List
A random element of bi-degree {m,n} can be obtained with random [V.24.216.1].
i7 : random({15,15},R)
5 5
6 3 3
7
6
o7 = 39a b - 50a b c + 42a b*c
o7 : R
The function degree [V.24.240] applied to a polynomial will return the least
upper bound of the degrees of its monomials.
i8 : degree (a+b)
o8 = {2, 2}
o8 : List
We may recover the number of integers in each degree list for our ring as follows.
i9 : degreeLength R
o9 = 2
i10 : degreeLength ZZ
o10 = 0
3.6. maps between rings
The class of all ring homomorphisms is RingMap [III.14]. A ring homomorphism from a polynomial ring S to a ring R is obtained with map [V.24.399] by
providing a list of elements in R to which the generators (variables) of S should go,
as follows.
i1 : R = ZZ/101[a,b];
i2 : S = ZZ/101[x,y,z];
i3 : f = map(R,S,{a^2,a*b,b^2})
2
2
o3 = map(R,S,{a , a*b, b })
o3 : RingMap R <--- S
(Notice that the target of f is the first argument of map and the source of f is the
second argument.)
We can apply this ring map to elements of S in the usual way.
i4 : f(x+y+z)
58
3. MATHEMATICAL OVERVIEW
2
2
o4 = a + a*b + b
o4 : R
i5 : f S_2
2
o5 = b
o5 : R
Composition of ring maps is possible.
i6 : g = map(S,ZZ/101[t],{x+y+z})
ZZ
o6 = map(S,--- [t],{x + y + z})
101
ZZ
o6 : RingMap S <--- --- [t]
101
i7 : f * g
ZZ
2
2
o7 = map(R,--- [t],{a + a*b + b })
101
ZZ
o7 : RingMap R <--- --- [t]
101
The defining matrix of f can be recovered with the key matrix.
i8 : f.matrix
o8 = {0} | a2 ab b2 |
1
3
o8 : Matrix R <--- R
We can produce the kernel of f with kernel [V.24.375].
i9 : kernel f
2
o9 = ideal(y - x*z)
o9 : Ideal of S
We can produce the image of f with image [V.24.348]. It is computed as its
source ring modulo its kernel.
i10 : image f
S
o10 = -------2
y - x*z
o10 : QuotientRing
3.7. IDEALS
59
We can check whether the map is homogeneous with isHomogeneous [III.21.2.11].
i11 : isHomogeneous f
o11 = true
We can obtain the ring of the graph of f with graphRing [V.24.331].
i12 : graphRing f
ZZ
--- [a, b, x, y, z, Degrees => {{1}, {1}, {2}, {2}, {2 ...
101
o12 = ------------------------------------------------------ ...
2
2
(- a + x, - a*b + y, - b + z)
o12 : QuotientRing
We can obtain the ideal of the graph of f with graphIdeal [V.24.330], except
that currently the result is a matrix rather than an ideal, sigh.
i13 : graphIdeal f
2
2
o13 = ideal (- a + x, - a*b + y, - b + z)
ZZ
o13 : Ideal of --- [a, b, x, y, z, Degrees => {{1}, {1}, {2} ...
101
3.7. ideals
The ideal generated by a list of ring elements can be constructed with the
function ideal [III.11.5].
i1 : R = ZZ/101[a..d];
i2 : I = ideal (a^2*b-c^2, a*b^2-d^3, c^5-d)
2
2
2
3
5
o2 = ideal (a b - c , a*b - d , c - d)
o2 : Ideal of R
If you have a matrix, then ideal will produce the ideal generated by the entries
of the matrix.
i3 : f = matrix {{a^2,b^2},{c^2,d^2}}
o3 = {0} | a2 b2 |
{0} | c2 d2 |
2
2
o3 : Matrix R <--- R
i4 : J = ideal f
2
2
2
2
o4 = ideal (a , c , b , d )
o4 : Ideal of R
60
3. MATHEMATICAL OVERVIEW
An interesting class of ideals can be obtained as the defining ideals in projective space of monomial curves. The twisted cubic is the closure of the set of
points (1,t^1,t^2,t^3) in projective space. We use a list of the exponents and
monomialCurve [V.24.425] to get the ideal.
i5 : monomialCurve(R,{1,2,3})
2
o5 = ideal (b*c - a*d, b
2
- a*c, c
- b*d)
o5 : Ideal of R
The command substitute [V.24.572] can be used to transfer an ideal to another
ring. You may want to do this because another ring has a monomial ordering
more suitable for the computations you are about to do, or it may have additional
variables in it, one of which you wish to use for homogenization. Here is an example
of the latter. We make another ring with a new variable t in it, transfer the ideal,
and then homogenize the ideal.
i6 : S = ZZ/101[a..d,t];
i7 : substitute(I,S)
2
2
2
3
5
o7 = ideal (a b - c , a*b - d , c - d)
o7 : Ideal of S
i8 : homogenize(oo,t)
2
2
2
3
5
4
o8 = ideal (a b - c t, a*b - d , c - d*t )
o8 : Ideal of S
In this case, the substitution was done according to the names of the variables
in the two rings. There are more explicit ways to specify the substitution to be
performed. Here is one where we list the new values for all the variables.
i9 : T = ZZ/101[x,y,z,t];
i10 : substitute(I,{a=>x^10,b=>y^10,c=>z^10,d=>t^10})
20 10
20
10 20
30
50
10
o10 = ideal (x y
- z , x y
- t , z
- t )
o10 : Ideal of T
Now notice that the variable a appears to be an element of S. The creation of
the ring S supplanted the earlier value.
i11 : a
o11 = a
o11 : S
We restore the variables of R to visibility.
i12 : use R
3.7. IDEALS
61
o12 = R
o12 : PolynomialRing
To recover the generators of an ideal as a matrix, use generators [III.13.12.1].
i13 : generators J
o13 = {0} | a2 c2 b2 d2 |
1
4
o13 : Matrix R <--- R
Use the operator % to reduce a ring element with respect to a Groebner basis
of the ideal.
i14 : (1+a+a^3+a^4) % J
o14 = a + 1
o14 : R
Membership in the ideal may be tested by comparing the answer to 0 with ==.
i15 : (1+a+a^3+a^4) % J == 0
o15 = false
i16 : a^4 % J == 0
o16 = true
The usual algebraic operations on ideals are available.
i17 : I+J
2
2
2
3
5
2
2
2
2
o17 = ideal (a b - c , a*b - d , c - d, a , c , b , d )
o17 : Ideal of R
i18 : intersect(I,J)
2
2
2
3
5
2
2 5
2
o18 = ideal (- a b + c , - a*b + d , c d - d , a c - a d,
...
...
o18 : Ideal of R
i19 : I*J
4
2 2
2
2
4
2 3
2 2
2
2
o19 = ideal (a b - a c , a b*c - c , a b - b c , a b*d o19 : Ideal of R
i20 : J:I
2
2
2
o20 = ideal (d, a , b , c )
o20 : Ideal of R
i21 : saturate(J,I)
...
...
62
3. MATHEMATICAL OVERVIEW
o21 = ideal 1
o21 : Ideal of R
i22 : radical J
o22 = ideal (a, b, c, d)
o22 : Ideal of R
See also: intersect [V.24.362], Ideal : Ideal [III.11.3], saturate [V.24.534],
and radical [V.24.507].
We may ask whether one ideal is contained in another.
i23 : isSubset(I,J)
o23 = false
i24 : isSubset(I,I+J)
o24 = true
i25 : isSubset(I+J,J)
o25 = false
Once you have an ideal, then you may construct the quotient ring or the quotient module (there is a difference). Here is the quotient ring.
i26 : R/I
R
o26 = ----------------------------2
2
2
3
5
(a b - c , a*b - d , c - d)
o26 : QuotientRing
Here is the quotient module.
i27 : M = R^1/I
o27 = cokernel {0} | a2b-c2 ab2-d3 c5-d |
1
o27 : R - module, quotient of R
And if you want the module underlying I itself, you can get it with module
[V.24.420].
i28 : module I
o28 = image {0} | a2b-c2 ab2-d3 c5-d |
1
o28 : R - module, submodule of R
In general, when an ideal is used as an argument to a function that usually
would be given a module, we try to make an informed choice about whether the user
intends the ideal to be used as a module directly, or whether the quotient module is
more suitable. In homological functions such as Ext [V.24.75] and Tor [V.24.140]
3.8. QUOTIENT RINGS
63
the underlying module is used. Here are some examples where the quotient module
is used.
A free resolution of R^1/I can be obtained with resolution [V.24.517].
i29 : resolution I
1
3
3
1
o29 = R <-- R <-- R <-- R
0
1
2
3
o29 : ChainComplex
The Krull dimension or codimension of the support of the quotient module can
be obtained.
i30 : dim I
o30 = 1
i31 : dim J
o31 = 0
i32 : codim I
o32 = 3
(Beware that for a homogeneous ideal the dimension of its projective variety is one
less than the number provided by dim [V.24.253].)
If the dimension of the quotient module as a vector space is needed, use basis
[V.24.187] to get a matrix whose columns form a basis, and compute the dimension
from it.
i33 : basis (R^1/J)
o33 = {0} | 1 a ab abc abcd abd ac acd ad b bc bcd bd c cd d ...
o33 : Matrix
i34 : rank source oo
o34 = 16
(Here oo [V.24.449] refers to the result on the previous line.
For more information see Ideal [III.11].
3.8. quotient rings
The usual notation is used to form quotient rings. A Groebner basis is computed and used to reduce ring elements to normal form after arithmetic operations.
i1 : R = ZZ/11
o1 = R
o1 : QuotientRing
i2 : 6_R + 7_R
o2 = 2
64
3. MATHEMATICAL OVERVIEW
o2 : R
i3 : S = QQ[x,y,z]/(x^2-y, y^3-z)
o3 = S
o3 : QuotientRing
i4 : {1,x,x^2,x^3,x^4,x^5,x^6,x^7,x^8}
2
2
o4 = {1, x, y, x*y, y , x*y , z, x*z, y*z}
o4 : List
In the example above you might have wondered whether typing x would give
an element of S or an element of QQ[x,y,z]. Our convention is that typing x gives
an element of the last ring that has been assigned to a global variable. Here is
another example.
i5 : T = ZZ/101[r,s,t]
o5 = T
o5 : PolynomialRing
i6 : T/(r^3+s^3+t^3)
T
o6 = -----------3
3
3
r + s + t
o6 : QuotientRing
i7 : r^3+s^3+t^3
3
3
3
o7 = r + s + t
o7 : T
Notice that this time, the variables end up in the ring T, because we didn’t
assign the quotient ring to a global variable. The command use [V.24.639] would
install the variables for us, or we could assign the ring to a global variable.
i8 : U = ooo
o8 = U
o8 : QuotientRing
i9 : r^3+s^3+t^3
o9 = 0
o9 : U
The functions lift [V.24.386] and promote [V.24.490] can be used to transfer
elements between the polynomial ring and its quotient ring.
3.8. QUOTIENT RINGS
65
i10 : lift(U_"r",T)
o10 = r
o10 : T
i11 : promote(T_"r",U)
o11 = r
o11 : U
A random element of degree n can be obtained with random [V.24.216.1].
i12 : random(2,S)
2
5
8 2
o12 = y + -*x*z - -*z
2
9
o12 : S
In a program we can tell whether a ring is a quotient ring.
i13 : isQuotientRing ZZ
o13 = false
i14 : isQuotientRing S
o14 = true
We can recover the ring of which a given ring is a quotient.
i15 : ambient S
o15 = QQ [x, y, z]
o15 : PolynomialRing
We can also recover the coefficient ring, as we could for the original polynomial
ring.
i16 : coefficientRing S
o16 = QQ
o16 : Field
-- the class of all rational numbers
Here’s how we can tell whether the defining relations of a quotient ring were
homogeneous.
i17 : isHomogeneous S
o17 = false
i18 : isHomogeneous U
o18 = true
We can obtain the characteristic of a ring with char [V.24.197].
i19 : char (ZZ/11)
66
3. MATHEMATICAL OVERVIEW
o19 = 11
i20 : char S
o20 = 0
i21 : char U
o21 = 101
The presentation of the quotient ring can be obtained as a matrix with presentation [V.24.480].
i22 : presentation S
o22 = {0} | y3-1z x2-1y |
1
2
o22 : Matrix (QQ [x, y, z]) <--- (QQ [x, y, z])
If a quotient ring has redundant defining relations, a new ring can be made in
which these are eliminated with trim [V.24.630].
i23 : R = ZZ/101[x,y,z]/(x-y,y-z,z-x)
o23 = R
o23 : QuotientRing
i24 : trim R
ZZ
--- [x, y, z]
101
o24 = -------------(y - z, x - z)
o24 : QuotientRing
For more information see QuotientRing [III.10.1.4].
3.9. finite fields
The prime finite fields can be made easily as quotient rings of ZZ.
i1 : ZZ/101
ZZ
o1 = --101
o1 : QuotientRing
In general, to make a finite field with q elements, we use GF [V.24.83].
i2 : k = GF 81
o2 = k
o2 : GaloisField
The generator of the field can be obtained as usual.
3.9. FINITE FIELDS
67
i3 : k_0
o3 = $x
o3 : k
Notice that the name of the generator is displayed with a $ in it to indicate
that it is not accessible by typing. Of course, you could assign the generator to the
symbol of your choice, but it will still print the same way.
i4 : a = k_0
o4 = $x
o4 : k
i5 : a^20+1
30
o5 = $x
o5 : k
To specify a name for the generator when the field is created, use the Variable
[V.24.145] option.
i6 : F = GF(16, Variable => b)
o6 = F
o6 : GaloisField
i7 : b^20 + 1
10
o7 = b
o7 : F
i8 : random F
10
o8 = b
o8 : F
Finite fields can be used as base rings for polynomial rings.
i9 : R = F[x,y,z]
o9 = R
o9 : PolynomialRing
i10 : random(2,R)
13 2
11
11 2
10
5
2 2
o10 = b x + b x*y + b y + b x*z + b y*z + b z
o10 : R
68
3. MATHEMATICAL OVERVIEW
If you have a quotient ring that you know is a finite field, then you can convert
it to ring that is known by the system to be a finite field.
i11 : GF (ZZ/2[T]/(T^9+T+1), Variable => T)
o11 = GF(512)
o11 : GaloisField
You may also provide your own choice of primitive element. Internally, elements
of the finite field are stored as powers of the primitive element. First we assign our
quotient ring to a global variable to ensure that T gets set to a value in the quotient
ring, and then we call GF.
i12 : A = ZZ/2[T]/(T^9+T+1)
o12 = A
o12 : QuotientRing
i13 : k = GF (A, PrimitiveElement => T^3+1)
o13 = k
o13 : GaloisField
Notice that T is still recorded as an element of its quotient ring, rather than
this finite field.
i14 : T
o14 = T
o14 : A
Use promote [V.24.490] to see how the generator T appears as an element of
the finite field.
i15 : promote(T,k)
42
o15 = $x
o15 : k
Conversely, a given element of the finite field can be transferred back to the
quotient ring with lift [V.24.386].
i16 : lift(k_0, ring T)
3
o16 = T + 1
o16 : A
We can even lift it back to the polynomial ring.
i17 : lift(k_0, ambient ring T)
3
o17 = T + 1
ZZ
3.10. FRACTION FIELDS
69
o17 : -- [T]
2
For more information see GaloisField [III.10.1.2].
3.10. fraction fields
The fraction field of a ring (which must be an integral domain) is obtained with
the function frac [III.10.1.1.1].
i1 : frac ZZ
o1 = QQ
o1 : Field
--
the class of all rational numbers
i2 : R = ZZ/101[x,y]/(x^3 + 1 + y^3)
o2 = R
o2 : QuotientRing
i3 : frac R
o3 = frac R
o3 : FractionField
After defining a ring such as R, fractions in its fraction field can be obtained by
writing them explicitly.
i4 : x
o4 = x
o4 : R
i5 : 1/x
1
o5 = x
o5 : frac R
i6 : x/1
o6 = x
o6 : frac R
Alternatively, after applying the function use [V.24.639], or assigning the fraction ring to a global variable, the symbols you used become associated with the
corresponding elements of the fraction field.
i7 : use frac R
o7 = frac R
o7 : FractionField
70
3. MATHEMATICAL OVERVIEW
i8 : x
o8 = x
o8 : frac R
Fractions are reduced to the extent possible. This is done by computing the
syzygies between the numerator and denominator, and picking one of low degree.
i9 : f = (x-y)/(x^6-y^6)
-1
o9 = ------------2
2
x + x*y + y
o9 : frac R
i10 : (x^3 - y^3) * f
o10 = - x + y
o10 : frac R
The parts of a fraction may be extracted.
i11 : numerator f
o11 = -1
o11 : R
i12 : denominator f
2
2
o12 = x + x*y + y
o12 : R
Alternatively, the functions lift [V.24.386] and liftable [V.24.387] can be used.
i13 : liftable(1/f,R)
o13 = true
i14 : liftable(f,R)
o14 = false
i15 : lift(1/f,R)
2
2
o15 = - x - x*y - y
o15 : R
For more information see FractionField [III.10.1.1].
3.11. tensor products of rings
The operator ** [V.24.15] or the function tensor [V.24.609] can be used to
construct tensor products of rings.
3.12. EXTERIOR ALGEBRAS
71
i1 : ZZ/101[x,y]/(x^2-y^2) ** ZZ/101[a,b]/(a^3+b^3)
ZZ
--- [x, y, a, b]
101
o1 = -----------------2
2
3
3
(x - y , a + b )
o1 : QuotientRing
Other monomial orderings can be specified.
i2 : T = tensor(ZZ/101[x,y], ZZ/101[a,b], MonomialOrder => E ...
o2 = T
o2 : PolynomialRing
The options to tensor can be discovered with options [III.21.5.5.1].
i3 : options tensor
o3 = OptionTable{Degrees =>
}
Inverses => false
MonomialOrder => GRevLex
MonomialSize => 8
NewMonomialOrder =>
SkewCommutative => false
VariableBaseName =>
VariableOrder =>
Variables =>
Weights => {}
WeylAlgebra => {}
o3 : OptionTable
3.12. exterior algebras
Create an exterior algebra with explicit generators by creating a polynomial
ring with the option SkewCommutative [III.10.1.3.2.8].
i1 : R = ZZ/101[x,y,z, SkewCommutative => true]
o1 = R
o1 : PolynomialRing
i2 : y*x
o2 = -x*y
o2 : R
i3 : (x+y+z)^2
o3 = 0
o3 : R
i4 : basis R
72
3. MATHEMATICAL OVERVIEW
o4 = {0} | 1 x xy xyz xz y yz z |
1
8
o4 : Matrix R <--- R
i5 : basis(2,R)
o5 = {0} | xy xz yz |
1
3
o5 : Matrix R <--- R
At the moment, there is no way to construct an exterior algebra from a free
module, but you can take quotient rings of exterior algebras.
3.13. symmetric algebras
Polynomial rings are symmetric algebras with explicit generators, and we have
already seen how to construct them. But if you have a module, then its symmetric
algebra can be constructed with symmetricAlgebra [V.24.597].
i1 : R = QQ[a..d];
i2 : S = symmetricAlgebra R^3
o2 = S
o2 : PolynomialRing
i3 : describe S
o3 = QQ [$x , $x , $x , a, b, c, d]
0
1
2
o3 : Adjacent
The dollar signs used in displaying the names of the variables indicate that the
names were invented for us, and are not available by typing them, but you can get
them in the usual way by indexing.
i4 : S_0+S_4
o4 = $x + b
0
o4 : S
i5 : S_"$x_0"
o5 = $x
0
o5 : S
To specify the names of the variables when creating the ring, use the Variables
[III.10.1.3.2.9] option.
i6 : S = symmetricAlgebra(R^3, Variables => {t,u,v})
o6 = S
3.16. ALGEBRAIC VARIETIES
73
o6 : PolynomialRing
We can construct the symmetric algebra of a module that isn’t necessarily free.
i7 : symmetricAlgebra(R^1/(R_0,R_1^3), Variables => {t})
QQ [t, a, b, c, d]
o7 = -----------------3
(t*a, t*b )
o7 : QuotientRing
3.14. Weyl algebras
A Weyl algebra is the non-commutative algebra of algebraic differential operators on a polynomial ring. To each variable x corresponds the operator dx that
differentiates with respect to that variable. The evident commutation relation takes
the form dx*x == x*dx + 1.
We can give any names we like to the variables in a Weyl algebra, provided
we specify the correspondence between the variables and the derivatives, with the
WeylAlgebra [III.10.1.3.2.6] option, as follows.
i1 : R = ZZ/101[x,dx,t,WeylAlgebra => {x=>dx}]
o1 = R
o1 : PolynomialRing
i2 : dx*x
o2 = x*dx + 1
o2 : R
i3 : dx*x^5
5
4
o3 = x dx + 5x
o3 : R
3.15. associative algebras
Eventually we will implement associative algebras, not necessarily commutative.
3.16. algebraic varieties
We may use Spec [V.24.127] to create an affine scheme (or algebraic variety)
with a specified coordinate ring and ring [III.10.5] to recover the ring.
i1 : R = ZZ/2[x,y,z]
o1 = R
o1 : PolynomialRing
74
3. MATHEMATICAL OVERVIEW
i2 : X = Spec R
o2 = Spec R
o2 : AffineVariety
i3 : ring X
o3 = R
o3 : PolynomialRing
i4 : dim X
o4 = 3
The variety X is a 3-dimensional affine space.
We may form products.
i5 : X * X
ZZ
o5 = Spec(-- [x, y, z, x, y, z])
2
o5 : AffineVariety
i6 : dim oo
o6 = 6
We may use Proj [V.24.118] to create a projective scheme (or algebraic variety)
with a specified homogeneous coordinate ring.
i7 : Y = Proj R
o7 = Proj R
o7 : ProjectiveVariety
i8 : ring Y
o8 = R
o8 : PolynomialRing
i9 : dim Y
o9 = 2
The most important reason for introducing the notion of algebraic variety into
a computer algebra system is to support the notion of coherent sheaf. See coherent
sheaves [I.3.28] for information about that.
For more details about varieties, see Variety [III.17].
3.17. making matrices
The simplest way to make a matrix is to give a doubly nested list of ring
elements to the matrix [V.24.401] command.
i1 : R = ZZ/101[x,y,z];
3.17. MAKING MATRICES
75
i2 : f = matrix {{x,0,y*z},{0,y^2,x^2}}
o2 = {0} | x 0 yz |
{0} | 0 y2 x2 |
2
3
o2 : Matrix R <--- R
One way to construct a doubly nested list of ring elements is with the table
[V.24.604] command.
i3 : table(3,3,(i,j) -> R_i^j)
2
2
2
o3 = {{1, x, x }, {1, y, y }, {1, z, z }}
o3 : List
i4 : p = matrix oo
o4 = {0} | 1 x x2 |
{0} | 1 y y2 |
{0} | 1 z z2 |
3
3
o4 : Matrix R <--- R
i5 : q = matrix table(3,3,(i,j) -> R_j^i)
o5 = {0} | 1 1 1 |
{0} | x y z |
{0} | x2 y2 z2 |
3
3
o5 : Matrix R <--- R
The usual arithmetic operations among matrices are available, including direct
sum (++ [V.24.17]) and tensor product (** [V.24.15]). Scalars are converted to
scalar matrices when necessary.
i6 : x*p
o6 = {0} | x x2 x3 |
{0} | x xy xy2 |
{0} | x xz xz2 |
3
3
o6 : Matrix R <--- R
i7 : 11-p
o7 = {0} | 10 -x
-x2
|
{0} | -1 -y+11 -y2
|
{0} | -1 -z
-z2+11 |
3
3
o7 : Matrix R <--- R
i8 : p*q
76
3. MATHEMATICAL OVERVIEW
o8 = {0} | x4+x2+1
x2y2+xy+1 x2z2+xz+1 |
{0} | x2y2+xy+1 y4+y2+1
y2z2+yz+1 |
{0} | x2z2+xz+1 y2z2+yz+1 z4+z2+1
|
3
3
o8 : Matrix R <--- R
i9 : p++q
o9 = {0}
{0}
{0}
{0}
{0}
{0}
|
|
|
|
|
|
1
1
1
0
0
0
x
y
z
0
0
0
x2
y2
z2
0
0
0
0
0
0
1
x
x2
0
0
0
1
y
y2
0
0
0
1
z
z2
|
|
|
|
|
|
6
6
o9 : Matrix R <--- R
i10 : r = p++x
o10 = {0}
{0}
{0}
{0}
|
|
|
|
1
1
1
0
x
y
z
0
x2
y2
z2
0
0
0
0
x
|
|
|
|
4
4
o10 : Matrix R <--- R
i11 : x ++ y ++ z ++ x*y*z
o11 = {0}
{0}
{0}
{0}
|
|
|
|
x
0
0
0
0
y
0
0
0
0
z
0
0
0
0
xyz
|
|
|
|
4
4
o11 : Matrix R <--- R
i12 : p**p
o12 = {0}
{0}
{0}
{0}
{0}
{0}
{0}
{0}
{0}
|
|
|
|
|
|
|
|
|
1
1
1
1
1
1
1
1
1
x
y
z
x
y
z
x
y
z
x2
y2
z2
x2
y2
z2
x2
y2
z2
x
x
x
y
y
y
z
z
z
x2
xy
xz
xy
y2
yz
xz
yz
z2
x3
xy2
xz2
x2y
y3
yz2
x2z
y2z
z3
x2
x2
x2
y2
y2
y2
z2
z2
z2
x3
x2y
x2z
xy2
y3
y2z
xz2
yz2
z3
x4
x2y2
x2z2
x2y2
y4
y2z2
x2z2
y2z2
z4
|
|
|
|
|
|
|
|
|
9
9
o12 : Matrix R <--- R
The components of a direct sum can be recovered later.
i13 : components r
o13 = {{0} | 1 x x2 |, {0} | x |}
{0} | 1 y y2 |
{0} | 1 z z2 |
3.17. MAKING MATRICES
77
o13 : List
There are commands for horizontal and vertical concatenation of matrices, and
again, scalars are converted to scalar matrices when necessary.
i14 : p|q
o14 = {0} | 1 x x2 1 1 1 |
{0} | 1 y y2 x y z |
{0} | 1 z z2 x2 y2 z2 |
3
6
o14 : Matrix R <--- R
i15 : p||q
o15 = {0}
{0}
{0}
{0}
{0}
{0}
|
|
|
|
|
|
1
1
1
1
x
x2
x
y
z
1
y
y2
x2
y2
z2
1
z
z2
|
|
|
|
|
|
6
3
o15 : Matrix R <--- R
i16 : p|1
o16 = {0} | 1 x x2 1 0 0 |
{0} | 1 y y2 0 1 0 |
{0} | 1 z z2 0 0 1 |
3
6
o16 : Matrix R <--- R
i17 : x^3||p
o17 = {0}
{1}
{2}
{0}
{0}
{0}
|
|
|
|
|
|
x3
0
0
1
1
1
0
x3
0
x
y
z
0
0
x3
x2
y2
z2
|
|
|
|
|
|
6
3
o17 : Matrix R <--- R
An identity matrix can be obtained with id [V.24.344] as the identity map on
a free module.
i18 : id_(R^3)
o18 = {0} | 1 0 0 |
{0} | 0 1 0 |
{0} | 0 0 1 |
3
3
o18 : Matrix R <--- R
A matrix is regarded as a homomorphism between two free modules, its source
[V.24.560] and target [V.24.608].
78
3. MATHEMATICAL OVERVIEW
i19 : M = target f
2
o19 = R
o19 : R - module, free
i20 : N = source f
3
o20 = R
o20 : R - module, free
Free modules are actually graded free modules, with the same sort of grading
that the ring comes with. The degrees of the basis vectors of the target are always
zero.
i21 : degree M_0
o21 = {0}
o21 : List
i22 : degree M_1
o22 = {0}
o22 : List
If possible, the degrees of the basis vectors of the source are set so that the map
f turns out to a homogeneous map of degree zero. This opportunism is important
because certain algorithms will run faster on homogeneous maps.
i23 : degree N_0
o23 = {1}
o23 : List
i24 : degree N_1
o24 = {2}
o24 : List
i25 : degree N_2
o25 = {2}
o25 : List
i26 : isHomogeneous f
o26 = true
A list of the degrees of all the basis vectors can be obtained with degrees
[V.24.242].
i27 : degrees N
3.17. MAKING MATRICES
79
o27 = {{1}, {2}, {2}}
o27 : List
It may happen that the matrix can not be made homogeneous. In that case,
the degree of a basis vector is currently set to the degree of the largest monomial
occurring in the corresponding column of the matrix. In a future version of the
program it might be more sensible to set the degrees of the basis vectors all to zero.
i28 : g = matrix {{x,0,y*z},{y^2,x^2,0}}
o28 = {0} | x 0 yz |
{0} | y2 x2 0 |
2
3
o28 : Matrix R <--- R
i29 : isHomogeneous g
o29 = false
i30 : degrees source g
o30 = {{2}, {2}, {2}}
o30 : List
Suppose we multiply a homogeneous polynomial by a homogeneous matrix.
The result ought to be homogeneous, but how can we arrange that? Scalar multiplication should not change the source or target of a map! Instead, we introduce
one final complication: each matrix records a degree of its own, which is normally
zero, and is used when deciding whether the matrix is homogeneous.
i31 : degree matrix {{x^10}}
o31 = {0}
o31 : List
i32 : degree f
o32 = {0}
o32 : List
Multiplying a matrix by a homogeneous polynomial adds the degree of the
polynomial to the degree of the map.
i33 : h = x^10 * f
o33 = {0} | x11 0
x10yz |
{0} | 0
x10y2 x12
|
2
3
o33 : Matrix R <--- R
i34 : degree h
o34 = {10}
o34 : List
80
3. MATHEMATICAL OVERVIEW
i35 : degrees source h
o35 = {{1}, {2}, {2}}
o35 : List
i36 : isHomogeneous h
o36 = true
If you don’t like this, you have an alternative. The degree of a tensor product of
two matrices is the sum of the degrees, and its source module is the tensor product
of the source modules.
i37 : h = x^10 ** f
o37 = {0} | x11 0
x10yz |
{0} | 0
x10y2 x12
|
2
3
o37 : Matrix R <--- R
i38 : degree h
o38 = {0}
o38 : List
i39 : degrees source h
o39 = {{11}, {12}, {12}}
o39 : List
i40 : isHomogeneous h
o40 = true
For more information about matrices, see Matrix [III.12].
3.18. making random matrices
The random [V.24.216.1] command can be used in various ways to make random matrices. We could assemble random polynomials into a doubly nested list
and use matrix [V.24.401] to enter them into a matrix.
i1 : R = ZZ/101[x,y,z];
i2 : matrix table(3,3,(i,j)->random(2,R))
o2 = {0} | 42x2-50xy+9y2+39xz-15yz-22z2
50x2+45xy-39y2-29x ...
{0} | -32x2+31xy-38y2-32xz+31yz+24z2 -42x2-50xy+15y2-41 ...
{0} | -9x2+32xy+4y2-4xz-2yz+24z2
x2-45xy-15y2+15xz- ...
3
3
o2 : Matrix R <--- R
i3 : matrix table(3,3,(i,j)->random(i-j,R))
o3 = {0} | -49
0
0
|
3.19. MAKING GENERIC MATRICES
81
{0} | -41x+35y-15z
8
0 |
{0} | 20x2-13xy-44y2+16xz-46yz+50z2 -33x+33y+z 31 |
3
3
o3 : Matrix R <--- R
As usual, the degrees of the basis elements of the source and target of the map are
determined from the polynomials’ degrees. Alternatively, one could generate a free
module with the appropriate degrees and use random [V.24.216.1] to insert random
matrix entries of the appropriate degree so as to make the matrix homogeneous.
i4 : random(R^3,R^{1,0,-1,-2})
o4 = {0} | 0 -1 20x-2y+46z 15x2+21y2+5xz+43yz+15z2
|
{0} | 0 12 38x+4y+34z 32x2-50xy-48y2-15xz+33yz-38z2 |
{0} | 0 -15 -40x-2z
-13x2-29xy-6y2+50xz-28yz+37z2 |
3
4
o4 : Matrix R <--- R
i5 : random(R^{1,0,-1},R^{1,0,-1})
o5 = {-1} | -33 -19x+7y+35z -18x2+22xy+21y2-36xz+27yz-28z2 |
{0} | 0
-8
8x-19y+40z
|
{1} | 0
0
4
|
3
3
o5 : Matrix R <--- R
3.19. making generic matrices
Here a few commands for making various sorts of generic matrices. A generic
matrix is one whose entries are independent variables from the ring, subject to
certain relations.
We begin by making a ring with enough variables to accomodate all the examples.
i1 : R = ZZ/101[a..z];
We can make a general generic matrix with genericMatrix [V.24.316]. We
specify the ring, the starting variable and the dimensions.
i2 : genericMatrix(R,c,3,5)
o2 = {0} | c f i l o |
{0} | d g j m p |
{0} | e h k n q |
3
5
o2 : Matrix R <--- R
We can also make a skew symmetric matrix with genericSkewMatrix [V.24.317]
or a symmetric matrix with genericSymmetricMatrix [V.24.318].
i3 : R = ZZ/101[a..i];
i4 : genericSkewMatrix(R,c,3)
o4 = {0} | 0 c
{0} | -c 0
d |
e |
82
3. MATHEMATICAL OVERVIEW
{0} | -d -e 0 |
3
3
o4 : Matrix R <--- R
i5 : gs = genericSymmetricMatrix(R,a,3)
o5 = {0} | a b c |
{0} | b d e |
{0} | c e f |
3
3
o5 : Matrix R <--- R
Suppose we need a random symmetric matrix of linear forms in three variables.
We can use random [V.24.216.1] and substitute [V.24.572] to obtain it from the
generic symmetric matrix gs above.
i6 : S = ZZ/101[x,y,z];
i7 : rn = random(S^1, S^{9:-1})
o7 = {0} | 42x-50y+39z 9x-15y-22z 50x+45y-29z -39x+30y+19z - ...
1
9
o7 : Matrix S <--- S
i8 : substitute(gs, rn)
o8 = {0} | 42x-50y+39z 9x-15y-22z
50x+45y-29z |
{0} | 9x-15y-22z -39x+30y+19z -38x+2y-4z |
{0} | 50x+45y-29z -38x+2y-4z
-36x-16y-6z |
3
3
o8 : Matrix S <--- S
3.20. displaying matrices
Normally matrices are displayed in compact notation that originated with
Macaulay.
i1 : R = ZZ/101[x,y];
i2 : f = random(R^1,R^{2:-2})
o2 = {0} | 42x2-50xy+39y2 9x2-15xy-22y2 |
1
2
o2 : Matrix R <--- R
Setting the global flag compactMatrixForm [V.24.219] to false [V.24.286]
will modify that behavior so that matrices are displayed more clearly and less
compactly.
i3 : compactMatrixForm = false
o3 = false
i4 : f
|
2
2
2
2 |
3.21. MANIPULATING MATRICES
o4 = | 42x
- 50x*y + 39y
9x
- 15x*y - 22y
83
|
1
2
o4 : Matrix R <--- R
We may use toString [III.21.6.1.7] to produce a string, useful as input into
other programs, or into Macaulay 2 at another time.
i5 : toString f
o5 = matrix {{42*x^2-50*x*y+39*y^2, 9*x^2-15*x*y-22*y^2}}
o5 : String
The function toExternalString [III.21.6.1.6] tries harder: it gives complete
information about the source, target, and degree of the map.
i6 : toExternalString f
o6 = map(R^{{0}}, R^{{-2}, {-2}}, {{42*x^2-50*x*y+39*y^2, 9* ...
o6 : String
3.21. manipulating matrices
In previous sections we have learned various ways to make matrices. Now we
discuss methods for manipulating matrices.
The principal way to extract a submatrix of a matrix is with submatrix
[V.24.570].
i1 : R = ZZ/101[a .. o];
i2 : p = genericMatrix(R, a, 3, 5)
o2 = {0} | a d g j m |
{0} | b e h k n |
{0} | c f i l o |
3
5
o2 : Matrix R <--- R
i3 : submatrix(p,{1,2},{3,4})
o3 = {0} | k n |
{0} | l o |
2
2
o3 : Matrix R <--- R
A subset of columns can be extracted with _ [V.24.151] and a subset of the
rows can be extracted with ^ [V.24.149].
i4 : p^{1,2}
o4 = {0} | b e h k n |
{0} | c f i l o |
2
5
o4 : Matrix R <--- R
i5 : p_{3,4}
84
3. MATHEMATICAL OVERVIEW
o5 = {0} | j m |
{0} | k n |
{0} | l o |
3
2
o5 : Matrix R <--- R
Since ^ [V.24.149] and _ [V.24.151] have the same parsing precedence, and
associate to the left by default, these operations can be combined without adding
parentheses, giving a slower form of submatrix [V.24.570].
i6 : p^{1,2}_{3,4}
o6 = {0} | k n |
{0} | l o |
2
2
o6 : Matrix R <--- R
i7 : p_{3,4}^{1,2}
o7 = {0} | k n |
{0} | l o |
2
2
o7 : Matrix R <--- R
We can transpose [V.24.629] a matrix.
i8 : transpose p
o8 = {-1}
{-1}
{-1}
{-1}
{-1}
|
|
|
|
|
a
d
g
j
m
b
e
h
k
n
c
f
i
l
o
|
|
|
|
|
5
3
o8 : Matrix R <--- R
We can test whether a matrix, regarded as a linear transformation, is injective
or surfective.
i9 : isSurjective p
o9 = false
i10 : isInjective p
o10 = false
i11 : isInjective transpose p
o11 = true
We can use diff [V.24.251] to differentiate a matrix with respect to a variable
and contract [V.24.229] to contract.
i12 : q = matrix {{a^2,b^2,c^2},{a*b,b*c,a*c}}
o12 = {0} | a2 b2 c2 |
{0} | ab bc ac |
3.23. FREE MODULES
85
2
3
o12 : Matrix R <--- R
i13 : diff(a,q)
o13 = {0} | 2a 0 0 |
{0} | b 0 c |
2
3
o13 : Matrix R <--- R
i14 : contract(a,q)
o14 = {0} | a 0 0 |
{0} | b 0 c |
2
3
o14 : Matrix R <--- R
These operations have a meaning when the first argument is itself a polynomial, or
even a matrix of polynomials.
i15 : r = matrix{{1,a,a^2,a^3}}
o15 = {0} | 1 a a2 a3 |
1
4
o15 : Matrix R <--- R
i16 : diff(transpose r,r)
o16 = {0}
{1}
{2}
{3}
|
|
|
|
1
0
0
0
a
1
0
0
a2
2a
2
0
a3
3a2
6a
6
|
|
|
|
4
4
o16 : Matrix R <--- R
i17 : contract(transpose r,r)
o17 = {0}
{1}
{2}
{3}
|
|
|
|
1
0
0
0
a
1
0
0
a2
a
1
0
a3
a2
a
1
|
|
|
|
4
4
o17 : Matrix R <--- R
For more information about matrices, see Matrix [III.12].
3.22. diff and contract
This node has not been written yet.
3.23. free modules
This node has not been written yet.
86
3. MATHEMATICAL OVERVIEW
3.24. making modules from matrices
This node has not been written yet.
3.25. manipulating modules
This node has not been written yet.
3.26. maps between modules
This node has not been written yet.
3.27. bases of parts of modules
This node has not been written yet.
3.28. coherent sheaves
This node has not been written yet.
3.29. free resolutions of modules
This node has not been written yet.
3.30. making chain complexes by hand
This node has not been written yet.
3.31. extracting information from chain complexes
This node has not been written yet.
3.32. manipulating chain complexes
This node has not been written yet.
3.33. maps between chain complexes
This node has not been written yet.
3.34. Groebner bases
Computations in a quotient ring R/I of a polynomial ring R can be done with
the aid of a Groebner basis for the ideal I. One must begin by choosing a way to
order the monomials of R, so that each polynomial has a designated leading term.
A Groebner basis is then a generating set for I whose leading terms generate the
ideal of leading terms of all the elements of I. See polynomial rings with other
monomial orderings [I.3.4] for information about setting up the ordering of the
monomials.
Many routines in Macaulay 2 will compute and use Groebner bases silently,
so ordinarily the user will not have to explicitly compute them. Recomputation is
avoided, in that if a Groebner basis has already been partially computed, then it will
be used whenever possible. Occasionally, the user will need to exercise closer control
over the computations, and may need to compute the Groebner bases directly.
To demonstrate, we set up a polynomial ring. (The default ordering used here
of the monomials is the graded reverse lexicographic ordering.)
3.34. GROEBNER BASES
87
i1 : R = ZZ/101[a..d];
i2 : I = ideal (a^2*b-c^2, a*b^2-d^3, c^5-d)
2
2
2
3
5
o2 = ideal (a b - c , a*b - d , c - d)
o2 : Ideal of R
The Groebner basis can be obtained with gb [III.15.2].
i3 : gb I
o3 = {0} | ab2-d3 a2b-c2 ad3-bc2 c5-d d6-b3c2 |
o3 : GroebnerBasis
The result obtained above is an object of class GroebnerBasis [III.15] that
encapsulates the basis, the state of the computation, in case it’s incomplete, and
several associated matrices.
The basis can be assembled into a matrix with generators [III.13.12.1], or its
abbreviation, gens [V.24.319].
i4 : transpose generators gb I
o4 = {-3}
{-3}
{-4}
{-5}
{-6}
|
|
|
|
|
ab2-d3
a2b-c2
ad3-bc2
c5-d
d6-b3c2
|
|
|
|
|
5
1
o4 : Matrix R <--- R
We transposed the matrix above, simply because column vectors of polynomials
tend to fit on the page more easily than row vectors.
Here is another example, which illustrates the use of another monomial ordering
convenient for the elimination of variables.
i5 : A = ZZ/101[t];
i6 : f = t^3 + t^2 + 1;
i7 : g = t^4 - t;
We wish to find a polynomial relation among f and g, so we set up a new ring
with a monomial ordering tailored for the elimination of its first variable. (See
Eliminate [III.10.1.3.2.1.5]).
i8 : B = ZZ/101[t,F,G,MonomialOrder => Eliminate 1];
i9 : I = ideal(F - (t^3 + t^2 + 1), G - (t^4 - t))
3
2
4
o9 = ideal (- t - t + F - 1, - t + t + G)
o9 : Ideal of B
i10 : transpose gens gb I
o10 = {-4} | F4-7F3-2F2G-4FG2-G3+18F2+3FG+6G2-21F-G+9 |
88
3. MATHEMATICAL OVERVIEW
{-3}
{-3}
{-3}
{-2}
|
|
|
|
tG2-tF+6tG+5t-F3+3F2+3FG+3G2+G-2
tFG+tF-4tG-3t+F2-FG-G2-4F-G+3
tF2-4tF+tG+5t-F2-FG+3F+3G-2
t2+tF-2t-F-G+1
|
|
|
|
5
1
o10 : Matrix B <--- B
The entry in the matrix above not involving t is the desired relation.
Computations in a quotient module M/N can be done with the aid of a Groebner
basis for the submodule N.
i11 : clearAll
i12 : R = ZZ/101[a..f];
i13 : N = image matrix {{a,b,c},{d,e,f}}
o13 = image {0} | a b c |
{0} | d e f |
2
o13 : R - module, submodule of R
i14 : gb N
o14 = {0} | a b c 0
0
0
|
{0} | d e f bd-ae cd-af ce-bf |
o14 : GroebnerBasis
Notice the appearance of the 2 by 2 minors.
Groebner bases can be computed in various types of rings: polynomial rings
over fields, skew-commutative-polynomial rings, Weyl algebras, and quotient rings
of any such rings. Groebner bases in rings over the integers can be computed for
homogeneous ideals. In the future Groebner bases will be provided for nonhomogeneous ideals in rings over the integers, in polynomial rings over polynomial rings,
and in general noncommutative algebras.
3.35. computing Groebner bases
In this section we give some more detail about how to control the computation
of Groebner bases.
We may stop the computation of a homogeneous Groebner basis after S-polynomials
up to a certain degree have been handled with the DegreeLimit [V.24.66] option.
(This is meaningful only in homogeneous situations.) Certains statistics about the
suspended computation can be displayed with stats [V.24.565].
i1 : R = ZZ/101[x,y,z,w];
i2 : I = ideal(x*y-z^2,y^2-w^2)
2
2
2
o2 = ideal (x*y - z , y - w )
o2 : Ideal of R
i3 : g2 = gb(I,DegreeLimit => 2)
3.35. COMPUTING GROEBNER BASES
89
o3 = {0} | xy-z2 y2-w2 |
o3 : GroebnerBasis
i4 : stats g2
# pairs computed = 2
o4 =
o4 : String
i5 : g3 = gb(I,DegreeLimit => 3)
o5 = {0} | xy-z2 y2-w2 yz2-xw2 |
o5 : GroebnerBasis
i6 : stats g3
# pairs computed = 3
o6 =
o6 : String
The computation advanced further with the higher degree limit.
The second computation advances the state of the Groebner basis object started
by the first, and the two results are exactly the same Groebner basis object.
i7 : g2
o7 = {0} | xy-z2 y2-w2 yz2-xw2 |
o7 : GroebnerBasis
i8 : g2 === g3
o8 = true
The option PairLimit [V.24.113] can be used to stop after a certain number of
S-polynomials have been reduced. After being reduced, the S-polynomial is added
to the basis, or a syzygy has been found.
i9 : I = ideal(x*y-z^2,y^2-w^2)
2
2
2
o9 = ideal (x*y - z , y - w )
o9 : Ideal of R
i10 : gb(I,PairLimit => 2)
o10 = {0} | xy-z2 y2-w2 |
o10 : GroebnerBasis
i11 : gb(I,PairLimit => 3)
o11 = {0} | xy-z2 y2-w2 yz2-xw2 |
o11 : GroebnerBasis
90
3. MATHEMATICAL OVERVIEW
The option BasisElementLimit [V.24.55] can be used to stop after a certain
number of basis elements have been found.
i12 : I = ideal(x*y-z^2,y^2-w^2)
2
2
2
o12 = ideal (x*y - z , y - w )
o12 : Ideal of R
i13 : gb(I,BasisElementLimit => 2)
o13 = {0} | xy-z2 y2-w2 |
o13 : GroebnerBasis
i14 : gb(I,BasisElementLimit => 3)
o14 = {0} | xy-z2 y2-w2 yz2-xw2 |
o14 : GroebnerBasis
The option CodimensionLimit [V.24.60] can be used to stop after the apparent codimension, as gauged by the leading terms of the basis elements found so far,
reaches a certain number.
The option SubringLimit [V.24.132] can be used to stop after a certain number of basis elements in a subring have been found. The subring is determined
by the monomial ordering in use. For Eliminate n the subring consists of those
polynomials not involving any of the first n variables. For Lex the subring consists
of those polynomials not involving the first variable. For ProductOrder {m,n,p}
the subring consists of those polynomials not involving the first m variables.
Here is an example where we are satisfied to find one relation from which the
variable t has been eliminated.
i15 : R = ZZ/101[t,F,G,MonomialOrder => Eliminate 1];
i16 : I = ideal(F - (t^3 + t^2 + 1), G - (t^4 - t))
3
2
4
o16 = ideal (- t - t + F - 1, - t + t + G)
o16 : Ideal of R
i17 : transpose gens gb (I, SubringLimit => 1)
o17 = {-4}
{-3}
{-3}
{-3}
{-2}
|
|
|
|
|
F4-7F3-2F2G-4FG2-G3+18F2+3FG+6G2-21F-G+9
tG2-tF+6tG+5t-F3+3F2+3FG+3G2+G-2
tFG+tF-4tG-3t+F2-FG-G2-4F-G+3
tF2-4tF+tG+5t-F2-FG+3F+3G-2
t2+tF-2t-F-G+1
|
|
|
|
|
5
1
o17 : Matrix R <--- R
Sometimes a Groebner basis computation can seem to last forever. An ongoing
visual display of its progress can be obtained with gbTrace [V.24.309].
i18 : gbTrace 3
3.35. COMPUTING GROEBNER BASES
91
o18 = 0
i19 : I = ideal(x*y-z^2,y^2-w^2)
2
2
2
o19 = ideal (x*y - z , y - w )
ZZ
o19 : Ideal of --- [x, y, z, w]
101
i20 : gb I
{2}(0)gg{3}(1)m{4}(2)mo{5}(1)o
o20 = {0} | xy-z2 y2-w2 yz2-xw2 z4-x2w2 |
o20 : GroebnerBasis
Here is what the tracing symbols indicate.
{2}
ready to reduce S-polynomials of degree 2
(0)
there are 0 more S-polynomials (the basis is empty
g
the generator yx-z2 has been added to the basis
g
the generator y2-w2 has been added to the basis
{3}
ready to reduce S-polynomials of degree 3
(1)
there is 1 more S-polynomial
m
the reduced S-polynomial yz2-xw2 has been added to
{4}
ready to reduce S-polynomials of degree 4
(2)
there are 2 more S-polynomials
m
the reduced S-polynomial z4-x2w2 has been added to
o
an S-polynomial reduced to zero and has been disca
{5}
ready to reduce S-polynomials of degree 5
(1)
there is 1 more S-polynomial
o
an S-polynomial reduced to zero and has been disca
Let’s turn off the tracing.
...
...
...
...
...
i21 : gbTrace 0
o21 = 3
Each of the operations dealing with Groebner bases may be interrupted or
stopped (by typing CTRL-C). The computation is continued by re-issuing the same
command. Alternatively, the command can be issued with the option StopBeforeComputation
=> true. It will stop immediately, and return a Groebner basis object that can be
inspected with stats [V.24.565], gens [V.24.319] or syz [V.24.599]. The computation can be continued later.
The function forceGB [III.15.1] can be used to create a Groebner basis object
with a specified Groebner basis. No computation is performed to check whether
the specified basis is a Groebner basis.
If the Poincare polynomial (or Hilbert function) for a homogeneous submodule
M is known, you can speed up the computation of a Groebner basis by informing
the system. This is done by storing the Poincare polynomial in M.poincare.
As an example, we compute the Groebner basis of a random ideal, which is
almost certainly a complete intersection, in which case we know the Hilbert function
already.
i22 : R = ZZ/101[a..e];
i23 : T = (degreesRing R)_0
92
3. MATHEMATICAL OVERVIEW
o23 = $T
o23 : ZZ[ZZ^1]
i24 : f = random(R^1,R^{-3,-3,-5,-6});
1
4
o24 : Matrix R <--- R
i25 : time betti gb f
-- used 2.48 seconds
o25 = total:
0:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
1 53
1 .
. .
. 2
. 1
. 2
. 3
. 5
. 5
. 8
. 9
. 8
. 6
. 3
. 1
o25 : Net
The matrix was randomly chosen, and we’d like to use the same one again, but
this time with a hint about the Hilbert function, so first we must erase the memory
of the Groebner basis computed above.
i26 : remove(f,{false,0})
Now we provide the hint and compute the Groebner basis anew.
i27 : (cokernel f).poincare = (1-T^3)*(1-T^3)*(1-T^5)*(1-T^6 ...
17
14
12
9
8
5
3
o27 = $T
- 2$T
- $T
+ 2$T + 2$T - $T - 2$T + 1
o27 : ZZ[ZZ^1]
i28 : time betti gb f
-- used 0.91 seconds
o28 = total:
0:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
1 53
1 .
. .
. 2
. 1
. 2
. 3
. 5
. 5
. 8
. 9
. 8
. 6
3.37. COMPUTING RESOLUTIONS
12: .
13: .
3
1
o28 : Net
The computation turns out to be substantially faster.
3.36. computing syzygies
This node has not been written yet.
3.37. computing resolutions
This node has not been written yet.
93
CHAPTER 4
Language and Programming Overview
In this section we give a comprehensive overview of the user language and the
main programming features of Macaulay 2.
variables and symbols
valid names [I.4.1]
assigning values [I.4.2]
local variables in a file [I.4.3]
viewing the symbols defined so far [I.4.4]
subscripted variables [I.4.5]
numbered variables [I.4.6]
overview of functions
using functions [I.4.7]
making functions [I.4.8]
local variables in a function [I.4.9]
making functions with a variable number of arguments [I.4.10]
using functions with optional arguments [I.4.11]
making new functions with optional arguments [I.4.12]
basic types
strings [I.4.13]
nets [I.4.14]
lists [I.4.15]
sequences [I.4.16]
hash tables [I.4.17]
control structures
loops [I.4.18]
mapping over lists [I.4.19]
mapping over hash tables [I.4.20]
conditional execution [I.4.21]
error handling [I.4.22]
input and output
printing to the screen [I.4.23]
reading files [I.4.24]
getting input from the user [I.4.25]
creating and writing files [I.4.26]
two dimensional formatting [I.4.27]
communicating with programs [I.4.28]
using sockets [I.4.29]
interfacing with the system
classes and types
what a class is [I.4.30]
95
96
4. LANGUAGE AND PROGRAMMING OVERVIEW
installing methods [I.4.31]
inheritance from parents [I.4.32]
making new types [I.4.33]
printing and formatting for new types [I.4.34]
method functions
making a new method function [I.4.35]
method functions with a variable number of arguments
[I.4.36]
method functions with optional arguments [I.4.37]
4.1. valid names
Valid names for symbols may be constructed using letters, digits, and the apostrophe, and should not begin with a digit.
i1 : x
o1 = x
o1 : Symbol
i2 : q0r55
o2 = q0r55
o2 : Symbol
i3 : f’
o3 = f’
o3 : Symbol
Some symbols have preassigned meanings and values. For example, symbols
consisting of the letter o followed by a number are used to store output values.
i4 : o2
o4 = q0r55
o4 : Symbol
Other symbols refer to functions built in to Macaulay 2 that provide much of
its functionality, as we will learn.
The class of all symbols is Symbol [III.21.10].
4.2. assigning values
Use an equal sign to assign values to variables.
i1 : x
o1 = x
o1 : Symbol
i2 : x = "abcde"
o2 = abcde
4.3. LOCAL VARIABLES IN A FILE
97
o2 : String
i3 : x
o3 = abcde
o3 : String
Before assignment, any reference to a variable provides the symbol with that
name. After assignment, the assigned value is provided. The variable created is
global, in the sense that any code placed elsewhere that contains a reference to a
variable called x will refer to the one we just set.
4.3. local variables in a file
There is a way to construct variables that can be used within a given source
file, and are invisible to code placed in other files. We use := [V.24.30] for this.
Assume the code below is placed in a file, and that the file is loaded with the load
[V.24.392] command.
i1 : ff := 5
o1 = 5
i2 : ff
o2 = 5
The variable above is a local one. Its value is not available to code in other
files.
Assume the code above is entered directly by the user into Macaulay 2. Then
the variable is still a local one and is not available to code previously loaded or to
functions previously defined, but it will be available to code loaded subsequently.
We illustrate this below with the variable jj.
i3 : hh = () -> jj
o3 = hh
o3 : Function
i4 : hh()
o4 = jj
o4 : Symbol
i5 : jj = 444
o5 = 444
i6 : hh()
o6 = 444
i7 : jj := 555
o7 = 555
98
4. LANGUAGE AND PROGRAMMING OVERVIEW
i8 : hh()
o8 = 444
i9 : jj
o9 = 555
4.4. viewing the symbols defined so far
After using Macaulay 2 for a while, you may have stored data in several variables. The system also stores output values for you in output variables. You may
wish to free the memory space occupied by that data, or you may simply wish to
remind yourself where you stored a previously computed value.
We may use the command listUserSymbols [V.24.391] to obtain a list of the
user’s symbols encountered so far.
i1 : ff = 20:4; hh = true; kk
o3 = kk
o3 : Symbol
i4 : listUserSymbols
o4 = ff:
o1:
hh:
o2:
kk:
o3:
Sequence
Sequence
Boolean
Boolean
Symbol
Symbol
o4 : Net
The symbols are listed in chronological order, and the type of value stored
under it is displayed.
We can clear the output symbols with clearOutput [V.24.202].
i5 : clearOutput
i6 : listUserSymbols
o6 = ff:
o1:
hh:
o2:
kk:
Sequence
Sequence
Boolean
Boolean
Symbol
o6 : Net
We can clear all the symbols with clearAll [V.24.200].
i7 : clearAll
i8 : listUserSymbols
o8 = ff:
o1:
hh:
o2:
Symbol
Symbol
Symbol
Symbol
4.5. SUBSCRIPTED VARIABLES
99
kk: Symbol
o8 : Net
4.5. subscripted variables
It is common in mathematics to use subscripted variables. We use the underscore to represent subscripts. If we haven’t assigned a value to x we may simply
start using it as a subscripted variable. The subscripts can be anything.
i1 : x
o1 = x
o1 : Symbol
i2 : x_4
o2 = x
4
o2 : IndexedVariable
i3 : x_(2,3)
o3 = x
2,3
o3 : IndexedVariable
The .. [V.24.23] operator knows what to do with subscripted variables.
i4 : x_10 .. x_20
o4 = (x , x , x , x , x , x , x , x , x , x , x )
10
11
12
13
14
15
16
17
18
19
20
o4 : Sequence
i5 : x_(1,1) .. x_(2,3)
o5 = (x
, x
, x
, x
, x
, x
)
1,1
1,2
1,3
2,1
2,2
2,3
o5 : Sequence
Values can be assigned to these variables with # [V.24.4].
i6 : x#10 = 555;
i7 : x_10
o7 = 555
Be careful not to assign a value to x itself if you wish to continue using it as a
subscripted variable.
See also:
IndexedVariable [III.21.1.4] – the class of all indexed variables
IndexedVariableTable [III.21.5.4.5] – the class of indexed variable tables
100
4. LANGUAGE AND PROGRAMMING OVERVIEW
4.6. numbered variables
One way to get many variables suitable for use as indeterminates in a polynomial ring is with the function vars [V.24.643]. It converts a list or sequence of
integers into symbols. It prefers to hand out symbols whose name consists of a
single letter, but there are only 52 such symbols, so it also uses symbols such as
x55 and X44.
i1 : vars (0 .. 9,40,100,-100)
o1 = (a, b, c, d, e, f, g, h, i, j, O, x48, X100)
o1 : Sequence
These variables can be used to make polynomial rings.
i2 : ZZ[vars(0 .. 10)]
o2 = ZZ [a, b, c, d, e, f, g, h, i, j, k]
o2 : PolynomialRing
4.7. using functions
There are many functions in Macaulay 2 that do various things. You can get a
brief indication of what a function does by typing its name.
i1 : sin
o1 = sin
o1 : Function
-- sine function
In this case, we see that the function sin [V.24.550] takes a single argument x.
We apply a function to its argument by typing them in adjacent positions. It is
possible but not necessary to place parentheses around the argument.
i2 : sin 1.2
o2 = 0.932039
o2 : RR
i3 : sin(1.2)
o3 = 0.932039
o3 : RR
i4 : sin(1.0+0.2)
o4 = 0.932039
o4 : RR
In parsing the operator ^ [V.24.149] takes precedence over adjacency, so the
function is applied after the power is computed in the following code. This may
not be what you expect.
4.8. MAKING FUNCTIONS
101
i5 : print(10 + 1)^2
121
Some functions take more than one argument, and the arguments are separated
by a comma, and then parentheses are needed.
i6 : append
o6 = append
o6 : Function
--
add to the end of a list
i7 : append({a,b,c},d)
o7 = {a, b, c, d}
o7 : List
Some functions take a variable number of arguments.
i8 : join
o8 = join
o8 : Function
i9 : join({a,b},{c,d},{e,f},{g,h,i})
o9 = {a, b, c, d, e, f, g, h, i}
o9 : List
Functions, like anything else, can be assigned to variables. You may do this to
provide handy private abbreviations.
i10 : ap = append;
i11 : ap({a,b,c},d)
o11 = {a, b, c, d}
o11 : List
4.8. making functions
The operator -> [V.24.21] is used to make new functions. On its left we provide
the names of the parameters to the function, and to the right we provide the body
of the function, an expression involving those parameters whose value is to be
computed when the function is applied. Let’s illustrate this by makint a function
for squaring numbers and calling it sq.
i1 : sq = i -> i^2
o1 = sq
o1 : Function
i2 : sq 10
102
4. LANGUAGE AND PROGRAMMING OVERVIEW
o2 = 100
i3 : sq(5+5)
o3 = 100
When the function is evaluated, the argument is evaluated and assigned temporarily as the value of the parameter i. In the example above, i was assigned the
value 10, and then the body of the function was evaluated, yielding 100.
Here is how we make a function with more than one argument.
i4 : tm = (i,j) -> i*j
o4 = tm
o4 : Function
i5 : tm(5,7)
o5 = 35
Functions can be used without assigning them to variables.
i6 : (i -> i^2) 7
o6 = 49
Another way to make new functions is to compose two old ones with the operator @@ [V.24.48].
i7 : sincos = sin @@ cos
o7 = sincos
o7 : Function
i8 : sincos 2.2
o8 = -0.555115
o8 : RR
i9 : sin(cos(2.2))
o9 = -0.555115
o9 : RR
Code that implements composition of functions is easy to write, because functions can create new functions and return them. We illustrate this by writing a
function called compose that will compose two functions, just as the operator @@
[V.24.48] did above.
i10 : compose = (f,g) -> x -> f(g(x))
o10 = compose
o10 : Function
i11 : sincos = compose(sin,cos)
4.9. LOCAL VARIABLES IN A FUNCTION
103
o11 = sincos
o11 : Function
i12 : cossin = compose(cos,sin)
o12 = cossin
o12 : Function
i13 : sincos 2.2
o13 = -0.555115
o13 : RR
i14 : cossin 2.2
o14 = 0.690587
o14 : RR
We created two composite functions in the example above to illustrate an important point. The parameters f and g acquire values when sincos is created, and
they acquire different values when cossin is created. These two sets of values do
not interfere with each other, and the memory they occupy will be retained as long
as they are needed. Indeed, the body of both functions is x -> f(g(x)), and the
only difference between them is the values assigned to the parameters f and g.
The class of all functions is Function [III.18].
4.9. local variables in a function
A local variable in a function is one that is not visible to code in other locations.
Correct use of local variables is important, for data stored in global variables will
stay around forever, needlessly occupying valuable memory space. For recursive
functions especially, it is important to use local variables so that one invocation of
the function doesn’t interfere with another.
The simplest way to create a local variable in a function is with the assignment
operator := [V.24.30]. The expression X := Y means that the value of Y will be
assigned to a newly created local variable whose name is X. Once X has been created,
new values can be assigned to it with expressions like X = Z.
i1 : i = 22;
i2 : f = () -> (i := 0; while i<9 do (<< i << " "; i=i+1); < ...
o2 = f
o2 : Function
i3 : f()
0 1 2 3 4 5 6 7 8
i4 : i
o4 = 22
104
4. LANGUAGE AND PROGRAMMING OVERVIEW
In the example above, we see that the function f does its work with a local
variable i that is unrelated to the global variable i introduced on the first line.
In the next example, we show that the local variables in two invocations of
a function don’t interfere with each other. We write a function f that returns a
newly created counting function. The counting function simply returns the number
of times it has been called.
i5 : f = () -> (i := 0; () -> i = i+1)
o5 = f
o5 : Function
Let’s use f to create counting functions and show that they operate independently.
i6 : p = f()
o6 = p
o6 : Function
i7 : q = f()
o7 = q
o7 : Function
i8 : p(),p(),p(),p(),q(),p(),p(),q(),p(),p()
o8 = (1, 2, 3, 4, 1, 5, 6, 2, 7, 8)
o8 : Sequence
4.10. making functions with a variable number of arguments
It is easy to write a function with a variable number of arguments. Define the
function with just one parameter, with no parentheses around it. If the function is
called with several arguments, the value of the single parameter will be a sequence
containing the several arguments; if the function is called with one argument, the
value of the parameter will be that single argument.
i1 : f = x -> {class x, if class x === Sequence then #x};
i2 : f()
o2 = {Sequence, 0}
o2 : List
i3 : f(3)
o3 = {ZZ, }
o3 : List
i4 : f(3,4)
o4 = {Sequence, 2}
4.10. MAKING FUNCTIONS WITH A VARIABLE NUMBER OF ARGUMENTS
105
o4 : List
i5 : f(3,4,5)
o5 = {Sequence, 3}
o5 : List
We could use the function sequence [V.24.543] to bring the case where there
is just one argument into line with the others. It will enclose anything that is not
a sequence in a sequence of length one.
i6 : f = x -> (
x = sequence x;
{class x, #x});
i7 : f()
o7 = {Sequence, 0}
o7 : List
i8 : f(3)
o8 = {Sequence, 1}
o8 : List
i9 : f(3,4)
o9 = {Sequence, 2}
o9 : List
i10 : f(3,4,5)
o10 = {Sequence, 3}
o10 : List
As an aside, we reveal that there is a way to define a function of one argument
that will signal an error if it’s given more than one argument: put parentheses
around the single parameter in the definition of the function. As a side effect it can
be used to extract the single element from a singleton sequence.
i11 : ((x) -> x) 3
o11 = 3
i12 : singleton 3
o12 = singleton 3
o12 : Sequence
i13 : ((x) -> x) oo
o13 = 3
106
4. LANGUAGE AND PROGRAMMING OVERVIEW
4.11. using functions with optional arguments
Some functions accept optional arguments. Each of these optional arguments
has a name. For example, one of the optional arguments for gb [III.15.2] is named
DegreeLimit [V.24.66]; it can be used to specify that the computation should
stop after a certain degree has been reached. Values for optional arguments are
specified by providing additional arguments of the form B=>v where B is the name
of the optional argument, and v is the value provided for it.
i1 : R = ZZ/101[x,y,z,w];
i2 : gb ideal(x*y-z^2,y^2-w^2)
o2 = {0} | y2-w2 xy-z2 yz2-xw2 z4-x2w2 |
o2 : GroebnerBasis
i3 : gb(ideal(x*y-z^2,y^2-w^2),DegreeLimit => 2)
o3 = {0} | y2-w2 xy-z2 |
o3 : GroebnerBasis
The names and default values of the optional arguments for a function can be
obtained with options [III.21.5.5.1], as follows.
i4 : o = options res
o4 = OptionTable{Algorithm =>
}
DegreeLimit =>
HardDegreeLimit => {}
LengthLimit => infinity
PairLimit => infinity
SortStrategy => 0
StopBeforeComputation => false
SyzygyLimit => infinity
o4 : OptionTable
The value returned is a type of hash table, and can be used to obtain particular
default values.
i5 : o.SortStrategy
o5 = 0
The entry DegreeLimit => 2 is called an option. Internally it is represented
as a type of list of length 2.
i6 : DegreeLimit => 2
o6 = DegreeLimit => 2
o6 : Option
i7 : peek oo
o7 = Option{DegreeLimit,2}
o7 : Net
4.13. STRINGS
107
4.12. making new functions with optional arguments
Let’s consider an example where we wish to construct a linear function of x
called f, with the slope and y-intercept of the graph being optional arguments of
f. We use the ==> [V.24.41] operator to attach the default values to our function,
coded in a special way.
i1 : opts = {Slope => 1, Intercept => 1}
o1 = {Slope => 1, Intercept => 1}
o1 : List
i2 : f = opts ==> o -> x -> x * o.Slope + o.Intercept
o2 = f
o2 : Function
i3 : f 5
o3 = 6
i4 : f(5, Slope => 100)
o4 = 501
i5 : f(5, Slope => 100, Intercept => 1000)
o5 = 1500
In the example the function body is the code x * opts.Slope + opts.Intercept.
When it is evaluated, a hash table is assigned to opts; its keys are the names of the
optional arguments, and the values are the corresponding current values, obtained
either from the default values specified in the definition of f, or from the options
specified at the time f is called.
In the example above, the inner function has just one argument, x, but handling
multiple arguments is just as easy. Here is an example with two arguments.
i6 : f = {a => 1000} ==> o -> (x,y) -> x * o.a + y;
i7 : f(3,7)
o7 = 3007
i8 : f(5,11,a=>10^20)
o8 = 500000000000000000011
4.13. strings
A string is a sequence of characters. Strings can be manipulated in various
ways to produce printed output. One enters a string by surrounding a sequence of
characters with quotation marks.
i1 : "abcdefghij"
o1 = abcdefghij
108
4. LANGUAGE AND PROGRAMMING OVERVIEW
o1 : String
Strings may contain newline characters.
i2 : "abcde
fghij"
o2 = abcde
fghij
o2 : String
Strings, like anything else, can be assigned to variables.
i3 : x = "abcdefghij"
o3 = abcdefghij
o3 : String
There are escape sequences that make it possible to enter special characters:
\n
newline
\f
form feed
\r
return
\\
\
\"
"
\t
tab
\xxx
ascii character with octal value xxx
i4 : y = "abc\101\102\n\tstu"
o4 = abcAB
stu
o4 : String
We can use peek [III.21.6.8] to see what characters are in the string.
i5 : peek y
o5 = "abcAB\n\tstu"
o5 : String
Another way to enter special characters into strings is to use /// [V.24.27] as
the string delimiter.
i6 : ///a \ n = "c"///
o6 = a \ n = "c"
o6 : String
The function ascii [V.24.176] converts strings to lists of ascii character code,
and back again.
i7 : ascii y
o7 = {97, 98, 99, 65, 66, 10, 9, 115, 116, 117}
o7 : List
i8 : ascii oo
4.14. NETS
109
o8 = abcAB
stu
o8 : String
We may use the operator | [V.24.655] to concatenate strings.
i9 : x|x|x
o9 = abcdefghijabcdefghijabcdefghij
o9 : String
The operator # [V.24.4] computes the length of a string.
i10 : #x
o10 = 10
We may also use the operator # [V.24.4] to extract single characters from a
string. Warning: we number the characters starting with 0.
i11 : x#5
o11 = f
o11 : String
The function substring [V.24.573] will extract portions of a string for us.
i12 : substring(x,5)
o12 = fghij
o12 : String
i13 : substring(x,5,2)
o13 = fg
o13 : String
The class of all strings is String [III.21.6.1].
4.14. nets
A net is a rectangular two-dimensional array of characters, together with an
imaginary horizontal baseline that allows nets to be assembled easily into lines of
text. A string is regarded as a net with one row.
Nets are used extensively for such things as formatting polynomials for display
on ascii terminals. Use net [III.21.6.7] to obtain such nets directly.
i1 : R = ZZ[x,y];
i2 : (x+y)^2
2
2
o2 = x + 2x*y + y
o2 : R
i3 : n = net oo
110
4. LANGUAGE AND PROGRAMMING OVERVIEW
2
2
o3 = x + 2x*y + y
o3 : Net
The net n above looks exactly the same as the original polynomial - that’s
because a polynomial is printed by printing its net. But the net n is no longer usable
as a polynomial; it’s just an array of characters. We may use peek [III.21.6.8] to
clarify the extent of a net.
i4 : peek n
+--------------+
| 2
2|
o4 = |x + 2x*y + y |
+--------------+
o4 : Net
One way to create nets directly is with the operator ||, which concatenates
strings or nets vertically.
i5 : x = "a" || "bb" || "ccc"
o5 = a
bb
ccc
o5 : Net
We may use the operator ^ [V.24.149] to raise or lower a net with respect to
its baseline. Look carefully to see how the baseline has moved - it is aligned with
the equal sign.
i6 : x^2
a
bb
o6 = ccc
o6 : Net
Nets may appear in lists, and elsewhere.
i7 : {x,x^1,x^2}
a
a
bb
o7 = {a , bb , ccc}
bb
ccc
ccc
o7 : List
Nets and strings can be concatenated horizontally with the operator | [V.24.655].
i8 : x^2 | "-------" | x
a
bb
o8 = ccc-------a
bb
ccc
4.15. LISTS
111
o8 : Net
Each net has a width, a depth, and a height. The width is the number of
characters in each row. The depth is the number of rows below the baseline, and
the height is the number of rows above the baseline. The depth and the height can
be negative.
i9 : width x, height x, depth x
o9 = (3, 1, 2)
o9 : Sequence
We may extract the rows of a net as strings with netRows [V.24.431].
i10 : netRows x
o10 = {a, bb, ccc}
o10 : List
i11 : peek oo
o11 = {"a","bb","ccc"}
o11 : Net
The class of all nets is Net [III.21.6].
4.15. lists
A list is a handy way to store a series of things. We create one by separating
the elements of the series by commas and surrounding the series with braces.
i1 : x = {a,b,c,d,e}
o1 = {a, b, c, d, e}
o1 : List
We retrieve the length of a list with the operator # [V.24.4].
i2 : #x
o2 = 5
We use it also to obtain a particular element. The elements are nubered consecutively starting with 0.
i3 : x#2
o3 = c
o3 : Symbol
The elements of a list are stored in consecutive memory locations, so the operation above is fast.
The functions first [V.24.287] and last [V.24.380] retrieve the first and last
elements of a list.
i4 : first x, last x
112
4. LANGUAGE AND PROGRAMMING OVERVIEW
o4 = (a, e)
o4 : Sequence
Omitting an element of a list causes the symbol null [V.24.440] to be inserted
in its place.
i5 : g = {3,4,,5}
o5 = {3, 4, , 5}
o5 : List
i6 : peek g
o6 = {3,4,null,5}
o6 : Net
Lists can be used as vectors, provided their elements are the sorts of things
that can be added and mutliplied.
i7 : 10000*{3,4,5} + {1,2,3}
o7 = {30001, 40002, 50003}
o7 : List
If the elements of a list are themselves lists, we say that we have a nested list.
i8 : y = {{a,b,c},{d,{e,f}}}
o8 = {{a, b, c}, {d, {e, f}}}
o8 : List
i9 : #y
o9 = 2
One level of nesting may be eliminated with flatten [V.24.291].
i10 : flatten y
o10 = {a, b, c, d, {e, f}}
o10 : List
A table is a list whose elements are lists all of the same length. The inner lists
are regarded as rows when the table is displayed as a two-dimensional array with
MatrixExpression [III.21.1.3.10].
i11 : z = {{a,1},{b,2},{c,3}}
o11 = {{a, 1}, {b, 2}, {c, 3}}
o11 : List
i12 : isTable z
o12 = true
i13 : MatrixExpression z
4.16. SEQUENCES
o13 = | a
|
| b
|
| c
113
1 |
|
2 |
|
3 |
o13 : MatrixExpression
Various other functions for manipulating lists include {...} | {...} [III.19.2.7],
append [V.24.168], between [V.24.189], delete [V.24.245], drop [V.24.259], join
[V.24.373], mingle [V.24.414], pack [V.24.462], prepend [V.24.479], reverse [V.24.528],
rsort [V.24.529], sort [V.24.556], take [V.24.605], and unique [III.19.2.4].
The class of all lists is List [III.19.2], and the class of all basic lists, useful for
deriving news types of list that do not inherit methods for treating lists as vectors,
is BasicList [III.21.1].
4.16. sequences
A sequence is like a list, except that parentheses are used instead of braces to
create them and to print them. Sequences are implemented in a more efficient way
than lists, since a sequence is created every time a function is called with more than
one argument. Another difference is that new types of list can be created by the
user, but not new types of sequence.
i1 : x = (a,b,c,d,e)
o1 = (a, b, c, d, e)
o1 : Sequence
It is a bit harder to create a sequence of length 1, since no comma would be
involved, and parentheses are also used for simple grouping of algebraic expressions.
i2 : (a)
o2 = a
o2 : Symbol
We provide the function singleton [III.19.3.1], which can be used to create a
sequence of length 1. Its name appears when a sequence of length 1 is displayed.
i3 : singleton a
o3 = singleton a
o3 : Sequence
Most of the functions that apply to lists also work with sequences. We give
just one example.
i4 : append(x,f)
o4 = (a, b, c, d, e, f)
o4 : Sequence
The operator .. [V.24.23] can be used to create sequences of numbers, sequences
of subscripted variables, or sequences of those particular symbols that are known
to vars [V.24.643], and so on.
114
4. LANGUAGE AND PROGRAMMING OVERVIEW
i5 : -3 .. 3
o5 = (-3, -2, -1, 0, 1, 2, 3)
o5 : Sequence
i6 : y_1 .. y_10
o6 = (y , y , y , y , y , y , y , y , y , y )
1
2
3
4
5
6
7
8
9
10
o6 : Sequence
i7 : a .. p
o7 = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
o7 : Sequence
i8 : (1,1) .. (2,3)
o8 = ((1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3))
o8 : Sequence
i9 : {a,1} .. {c,2}
o9 = ({a, 1}, {a, 2}, {b, 1}, {b, 2}, {c, 1}, {c, 2})
o9 : Sequence
The operator ZZ : Thing [III.21.11.9] can be used to create sequences by
replicating something a certain number of times.
i10 : 12:a
o10 = (a, a, a, a, a, a, a, a, a, a, a, a)
o10 : Sequence
Notice what happens when we try to construct a list using .. [V.24.23] or :
[V.24.29].
i11 : z = {3 .. 6, 9, 3:12}
o11 = {(3, 4, 5, 6), 9, (12, 12, 12)}
o11 : List
The result above is a list of length 3 some of whose elements are sequences.
This may be a problem if the user intended to produce the list {3, 4, 5, 6, 9,
12, 12, 12}. The function splice [V.24.562] can be used to flatten out one level
of nesting - think of it as removing those pairs of parentheses that are one level in.
i12 : splice z
o12 = {3, 4, 5, 6, 9, 12, 12, 12}
o12 : List
4.17. HASH TABLES
115
The difference between splice [V.24.562] and flatten [V.24.291] is that flatten
[V.24.291] removes pairs of braces.
The functions toList [V.24.619] and toSequence [V.24.620] are provided for
converting between lists to sequences.
i13 : toList x
o13 = {a, b, c, d, e}
o13 : List
i14 : toSequence oo
o14 = (a, b, c, d, e)
o14 : Sequence
Other functions for dealing especially with sequences include sequence [V.24.543]
and deepSplice [V.24.239]. The class of all sequences is Sequence [III.19.3].
4.17. hash tables
A hash table is a data structure that can implement a function whose domain
is a finite set. An element of the domain is called a key. The hash table stores the
key-value pairs in such a way that when presented with a key, the corresponding
value can be quickly recovered.
A dictionary could be implemented as a hash table: the keys would be the
words in the language, and the values could be the definitions of the words.
A phone book could also be implemented as a hash table: the keys would be
the names of the subscribers, and the values could be the corresponding phone
numbers. (We exclude the possibility of two subscribers with the same name.)
As an example we implement a phone book.
i1 : book = new HashTable from {
"Joe" => "344-5567",
"Sarah" => "567-4223",
"John" => "322-1456"}
o1 = HashTable{Joe => 344-5567 }
John => 322-1456
Sarah => 567-4223
o1 : HashTable
We use the operator # [V.24.4] to obtain values from the phone book.
i2 : book#"Sarah"
o2 = 567-4223
o2 : String
The operator #? [V.24.8] can be used to tell us whether a given key has an
entry in the hash table.
i3 : book#?"Mary"
o3 = false
116
4. LANGUAGE AND PROGRAMMING OVERVIEW
We have implemented the notion of set via hash tables in which every value is
the number 1.
i4 : x = set {a,b,c,r,t}
o4 = Set {c, r, t, a, b}
o4 : Set
i5 : peek x
o5 = Set{a
b
c
r
t
=>
=>
=>
=>
=>
1}
1
1
1
1
o5 : Net
i6 : x#?a
o6 = true
i7 : x#?4
o7 = false
There is a type of hash table that is mutable, i.e., a hash table whose entries can be changed. They are changed with assignment statements of the form
x#key=value.
i8 : x = new MutableHashTable;
i9 : x#"Joe" = "344-5567";
i10 : x#3 = {a,b,c};
i11 : x#{1,2} = 44;
i12 : x#3
o12 = {a, b, c}
o12 : List
i13 : x#?4
o13 = false
When a mutable hash table is printed, its contents are not displayed. This
prevents infinite loops in printing routines.
i14 : x
o14 = MutableHashTable{...}
o14 : MutableHashTable
Use peek [III.21.6.8] to see the contents of a mutable hash table.
i15 : peek x
4.18. LOOPS
117
o15 = MutableHashTable{3 => {a, b, c} }
Joe => 344-5567
{1, 2} => 44
o15 : Net
A variant of # [V.24.4] is . [V.24.22]. It takes only global symbols as keys,
and ignores their values.
i16 : p=4;
i17 : x.p = 444;
i18 : x.p
o18 = 444
i19 : x#?4
o19 = false
Other functions for manipulating hash tables include browse [V.24.194], copy
[V.24.230], hashTable [V.24.334], keys [V.24.377], mutable [V.24.427], pairs
[V.24.464], remove [V.24.512], and values [V.24.641].
For details of the mechanism underlying hash tables, see hashing [V.24.335].
The class of all hash tables is HashTable [III.21.5], and the class of all mutable
hash tables is MutableHashTable [III.21.5.4].
4.18. loops
An expression of the form while X do Y operates by evaluating X repeatedly.
Each time the value of X is true, Y is evaluated and its value is discarded. When
finally the value of X is false the special value null is returned as the value of the
while expression.
i1 : i = 0;
i2 : while i < 20 do (<< " " << i; i = i + 1); << endl;
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
In the example above, X is the predicate i < 20 and Y is the code (<< " "
<< i; i = i + 1). Notice the use of the semicolon within Y to separates two
expressions.
The semicolon can also be used with the predicate X to do other things before
the test is performed. This works because the value of an expression of the form
(A;B;C;D;E) is obtained by evaluating each of the parts, and providing the value
of the last part (in this case, E), as the value of the whole expression. Thus, if the
value of E is always true or false, the expression (A;B;C;D;E) can be used as the
predicate X. We illustrate this in the following example.
i4 : i = 0;
i5 : while (<< " " << i; i < 20) do i = i+1; << endl
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
o6 = stdio
o6 : File
118
4. LANGUAGE AND PROGRAMMING OVERVIEW
As a further indication of the power of this construction, consider an expression
of the following form.
while (A; not B) and (C; not D) do (E; F)
It is the Macaulay 2 equivalent of C code that looks like this:
while (TRUE) { A; if (B) break; C; if (D) break; E; F; ...
4.19. mapping over lists
In programming, loops that operate on consecutive elements of a list are common, so we offer various ways to apply functions to each of the elements of a list,
along with various ways to treat the returned values.
The most basic operation is provided by scan [V.24.537], which applies a function consecutively to each element of a list, discarding the values returned.
i1 : scan({a,b,c}, print)
a
b
c
By contrast, apply [V.24.169] will produced a list containing the values returned.
i2 : apply({1,2,3,4}, i -> i^2)
o2 = {1, 4, 9, 16}
o2 : List
This operation is so common that we offer two shorthand notations for it, one
with the function on the right and one with the function on the left.
i3 : {1,2,3,4} / (i -> i^2)
o3 = {1, 4, 9, 16}
o3 : List
i4 : (i -> i^2) \ {1,2,3,4}
o4 = {1, 4, 9, 16}
o4 : List
The associativity of these operators during parsing is set up so the following
code works as one would wish.
i5 : {1,2,3,4} / (i -> i^2) / (j -> 1000*j)
o5 = {1000, 4000, 9000, 16000}
o5 : List
i6 : (j -> 1000*j) \ (i -> i^2) \ {1,2,3,4}
o6 = {1000, 4000, 9000, 16000}
o6 : List
i7 : (j -> 1000*j) @@ (i -> i^2) \ {1,2,3,4}
o7 = {1000, 4000, 9000, 16000}
4.19. MAPPING OVER LISTS
119
o7 : List
The function apply [V.24.169] can also be used with two lists of the same
length, in which case it will apply the function consecutively to corresponding
elements of the two lists.
i8 : apply({1,2,3}, {7,8,9}, (i,j) -> 1000*i+j)
o8 = {1007, 2008, 3009}
o8 : List
The function table [V.24.604] can be used to create a table (doubly nested list)
from two lists and a function of two arguments. It applies the function consecutively
to an element from the first list and an element from the second list.
i9 : table({1,2,3},{7,8},(i,j) -> 1000*i+j)
o9 = {{1007, 1008}, {2007, 2008}, {3007, 3008}}
o9 : List
The function applyTable [V.24.172] can be used to apply a function to each
element of a doubly nested list (table). Occasionally matrices are represented as a
table, so this is a useful facility.
i10 : applyTable( {{1,2,3},{4,5}}, i -> i^2)
o10 = {{1, 4, 9}, {16, 25}}
o10 : List
We may use select [V.24.541] to select those elements from a list that satisfy
some condition. In the next example, we use the function even [V.24.276] to select
the even numbers from a list.
i11 : select({1,2,3,4,5,6,7,8,9,10}, even)
o11 = {2, 4, 6, 8, 10}
o11 : List
An optional first argument to select [V.24.541] allows us to specify the maximum number of elements selected.
i12 : select(2,{1,2,3,4,5,6,7,8,9,10}, even)
o12 = {2, 4}
o12 : List
We may use any [V.24.167] to tell whether there is at least one element of a
list satisfying a condition, and all [V.24.161] to tell whether all elements satisfy it.
i13 : any({1,2,3,4,5,6,7,8,9,10}, even)
o13 = true
i14 : all({1,2,3,4,5,6,7,8,9,10}, even)
o14 = false
120
4. LANGUAGE AND PROGRAMMING OVERVIEW
We can use position [V.24.476] to tell us the position of the first element in a
list satisfying a condition.
i15 : position({1,3,5,7,8,9,11,13,15,16},even)
o15 = 4
The functions fold [V.24.295] and accumulate [V.24.153] provide various ways
to apply a function of two arguments to the elements of a list. One of the arguments
is the next element from the list, and the other argument is the value returned by
the previous application of the function. As an example, suppose we want to convert
the list {7,3,5,4,2} of digits into the corresponding number 73542. The formula
(((7*10+3)*10+5)*10+4)+2 is a fast way to do it that doesn’t involve computing
high powers of 10 separately. We can do this with fold [V.24.295] and the following
code.
i16 : fold((i,j) -> i*10+j, {7,3,5,4,2})
o16 = 73542
It is possible to give an additional argument to fold [V.24.295] so that lists of
length 0 can be handled correctly.
4.20. mapping over hash tables
Each entry in a hash table consists of a key and a value. We provide three ways
to map functions over a hash table, depending on whether the function is to receive
a value and return a new value, to receive a key and return a new key, or to receive
a key-value pair and return a new key-value pair. The corresponding functions,
applyValues [V.24.173], applyKeys [V.24.170], and applyPairs [V.24.171] are
illustrated in the next example.
i1 : x = new HashTable from {a=>1, b=>2}
o1 = HashTable{a => 1}
b => 2
o1 : HashTable
i2 : applyValues(x, value -> 1000*value)
o2 = HashTable{a => 1000}
b => 2000
o2 : HashTable
i3 : applyKeys(x, key -> {key})
o3 = HashTable{{a} => 1}
{b} => 2
o3 : HashTable
i4 : applyPairs(x, (key,value) -> (value,key))
o4 = HashTable{1 => a}
2 => b
o4 : HashTable
4.20. MAPPING OVER HASH TABLES
121
The functions, scanValues [V.24.540], scanKeys [V.24.538], and scanPairs
[V.24.539] are similar, but the values returned are discarded instead of being assembled into a new hash table.
i5 : x = new HashTable from {a=>1, b=>2}
o5 = HashTable{a => 1}
b => 2
o5 : HashTable
i6 : scanValues(x, print)
1
2
i7 : scanKeys(x, print)
a
b
i8 : scanPairs(x, print)
(a, 1)
(b, 2)
The function merge [V.24.406] can be used to merge two hash tables. The
result is a hash table whose keys are those occuring in one of the two incoming
hash tables. We must provide a function of two arguments that is used to combine
the values when a key occurs in both hash tables.
i9 : y = new HashTable from {b=>200, c=>300}
o9 = HashTable{b => 200}
c => 300
o9 : HashTable
i10 : merge(x, y, plus)
o10 = HashTable{a => 1 }
b => 202
c => 300
o10 : HashTable
The function combine [V.24.217] can be used to combine two hash tables x
and y into a new hash table. Three functions must be provided. The first one
produces new keys from a key of x and a key of y. The second one produces a new
values from a value of x and a value of y. The third one is used to combine values
when two new keys turn out to be the same.
i11 : combine(x,y,identity,times,plus)
o11 = HashTable{(a,
(a,
(b,
(b,
o11 : HashTable
b)
c)
b)
c)
=>
=>
=>
=>
200}
300
400
600
122
4. LANGUAGE AND PROGRAMMING OVERVIEW
4.21. conditional execution
The basic way to control the execution of code is with the if [V.24.346] expression. Such an expression typically has the form if X then Y else Z and is
evaluated as follows. First X is evaluated. If the result is true, then the value of Y
is provided, and if the result is false, then the value of Z is provided. An error is
signalled if the value of X is anything but true or false.
i1 : (-4 .. 4) /
(i -> if i < 0 then "neg"
else if i == 0 then "zer"
else "pos")
o1 = (neg, neg, neg, neg, zer, pos, pos, pos, pos)
o1 : Sequence
The else clause may be omitted from an if expression. In that case, if value of
the predicate X is false, then null is provided as the value of the if expression.
i2 : (-4 .. 4) /
(i -> if i < 0 then "neg"
else if i == 0 then "zer")
o2 = (neg, neg, neg, neg, zer, , , , )
o2 : Sequence
There are a variety of predicate functions (such as <, used above) that yield
true or false and can be used as the predicate in an if expression. For a list, see
Boolean [III.21.2]. Boolean results may be combined with not [V.24.437], and
[V.24.164], and or [V.24.459].
4.22. error handling
When an error occurs in your program, an error message will appear that gives
the name of the file, the line number, and the column number of the code that
provoked the error.
You may use the function error [V.24.273] in your programs to signal errors.
Your error message will appear on the screen and execution will be stopped.
The function try [V.24.633] can be used to catch an error before execution is
stopped and to continue or to try something else.
4.23. printing to the screen
Use the operator << [V.24.34] to print something to the screen.
i1 : << 2^100
1267650600228229401496703205376
o1 = stdio
o1 : File
Notice that the value returned is the standard input output file stdio [V.24.568].
We can also use << [V.24.34] as a binary operator to print explicitly to this file,
and the output will appear on the screen.
i2 : stdio << 2^100
1267650600228229401496703205376
4.24. READING FILES
123
o2 = stdio
o2 : File
The associativity of the operator << [V.24.34] during parsing is arranged so
that the following code will work in a useful way.
i3 : << "The answer is " << 2^100 << ".";
The answer is 1267650600228229401496703205376.
Printing works fine with nets, too.
i4 : << "The answer is " << "aaa"||"bb"||"c" << ".";
The answer is aaa.
bb
c
In the presence of nets, which are used whenever you print something that is
formatted two-dimensionally, the only correct way to terminate a line is with endl
[V.24.269], even though a string called newline [V.24.435] is available to you.
i5 : R = ZZ[x,y];
i6 : f = (x+y+1)^2; g = (x-y+1)^2
2
2
o7 = x - 2x*y + y + 2x - 2y + 1
o7 : R
i8 : << "f = " << f << endl << "g = " << g << endl;
2
2
f = x + 2x*y + y + 2x + 2y + 1
2
2
g = x - 2x*y + y + 2x - 2y + 1
Output is saved in a buffer until the end of the line is encountered. If nets are
not involved, you may use flush [V.24.294] to force the output to appear on the
screen before the end of the line is encountered. This may be useful in displaying
some tiny indication of computational progress to the user.
i9 : scan(0 .. 20, i -> << "." << flush)
.....................
4.24. reading files
Sometimes a file will contain a single expression whose value you wish to have
access to. For example, it might be a polynomial produced by another program.
The function get [V.24.320] can be used to obtain the entire contents of a file as a
single string. We illustrate this here with a file whose name is expression.
i1 : get "expression"
o1 = z^6+3*x*z^4+6*y*z^4+3*x^2*z^2+12*x*y*z^2+12*y^2*z^2+x^3 ...
o1 : String
This isn’t quite what you want, because a string containing a description of a
polynomial is not the same as a polynomial. We may use value [III.21.1.3.1] to
evaluate the string and produce the corresponding polynomial, after first setting
up a polynomial ring to contain it.
124
4. LANGUAGE AND PROGRAMMING OVERVIEW
i2 : R = ZZ/101[x,y,z]
o2 = R
o2 : PolynomialRing
i3 : f = value get "expression"
6
4
4
2 2
2
2 2
3
...
o3 = z + 3x*z + 6y*z + 3x z + 12x*y*z + 12y z + x + 6 ...
o3 : R
i4 : factor f
2
3
o4 = (z + x + 2y) (1)
o4 : Product
Often a file will contain code written in the Macaulay 2 language. We have a
file called sample with two lines of code.
i5 : << get "sample";
sample = 2^100
print sample
To load and execute that code, use load [V.24.392].
i6 : load "sample"
1267650600228229401496703205376
The command needs [V.24.430] can be used to load a file only if it hasn’t
already been loaded.
i7 : needs "sample"
For debugging or dipslay purposes, it is sometimes useful to be able to simulate
entering the lines of a file one by one, so they appear on the screen along with
prompts and output lines. We use input [V.24.358] for this.
i8 : input "sample"
i9 : sample = 2^100
o9 = 1267650600228229401496703205376
i10 : print sample
1267650600228229401496703205376
i11 :
There are other ways to manipulate the contents of a file with multiple lines.
First, let’s use peek [III.21.6.8] to observe the extent of this string returned by get
[V.24.320].
i12 : peek get "sample"
o12 = "sample = 2^100\nprint sample\n"
o12 : String
4.25. GETTING INPUT FROM THE USER
125
The resulting string has newlines in it; we can use lines [V.24.389] to break it
apart into a list of strings, with one row in each string.
i13 : lines get "sample"
o13 = {sample = 2^100, print sample}
o13 : List
We may use peek [III.21.6.8] to observe the extent of these strings.
i14 : peek lines get "sample"
o14 = {"sample = 2^100","print sample"}
o14 : Net
We could even use stack [III.21.6.10] to assemble the lines of the file into a net.
i15 : stack lines get "sample"
o15 = sample = 2^100
print sample
o15 : Net
4.25. getting input from the user
The function read [V.24.509] can be used to prompt the user and obtain a line
of input as a string. In response to the prompt, the user enters sample and press
return.
i1 : filename = read "file name : "
file name : sample
o1 = sample
o1 : String
Let’s use peek [III.21.6.8] to verify that this string contains no newline characters.
i2 : peek filename
o2 = "sample"
o2 : String
If necessary, we may use value [III.21.1.3.1] to evaluate the string provided by
the user. In this example, we enter (x+y)^2 in response to the prompt.
i3 : R = ZZ[x,y];
i4 : s = read "polynomial : "
polynomial : (x+y)^2
o4 = (x+y)^2
o4 : String
i5 : value s
126
4. LANGUAGE AND PROGRAMMING OVERVIEW
2
2
o5 = x + 2x*y + y
o5 : R
4.26. creating and writing files
We can print to a file in essentially the same way we print to the screen. In the
simplest case, we create the entire file with one command; we give the file name
as the initial left hand operand of << [V.24.34], and we close the file with close
[V.24.203]. Files must be closed before they can be used for something else.
i1 : "testfile" << 2^100 << endl << close
o1 = testfile
o1 : File
i2 : value get "testfile"
o2 = 1267650600228229401496703205376
More complicated files may require printing to the file multiple times. One way
to handle this is to assign the open file created the first time we use << [V.24.34] to
a variable, so we can use it for subsequent print operations and for closing the file.
i3 : f = "testfile" << ""
o3 = testfile
o3 : File
i4 : f << "hi" << endl
o4 = testfile
o4 : File
i5 : f << "ho" << endl
o5 = testfile
o5 : File
i6 : f << close
o6 = testfile
o6 : File
i7 : << get "testfile";
hi
ho
4.27. two dimensional formatting
We have seen that nets [I.4.14] are potentially useful for two dimesional formatting of output to an ascii terminal with limited graphical ability. We present
4.27. TWO DIMENSIONAL FORMATTING
127
now a few more hints about putting this idea into practice. Nets are used extensively in Macaulay 2 for formatting, for example, for formatting of polynomials and
matrices.
i1 : R = ZZ/101[x,y,z];
i2 : f = random(R^1,R^{5:-3})
o2 = {0} | 42x3-50x2y+9xy2+50y3+39x2z-15xyz+45y2z-22xz2-29yz ...
1
5
o2 : Matrix R <--- R
Output of routines such as betti [III.21.6.5] and net [III.21.6.7] that return nets
can be easily incorporated into more complex displays using standard operations
on nets (see Net [III.21.6]).
i3 : C = resolution cokernel f
1
5
9
5
o3 = R <-- R <-- R <-- R
0
1
2
3
o3 : ChainComplex
i4 : be = betti C
o4 = total:
0:
1:
2:
3:
1
1
.
.
.
5
.
.
5
.
9
.
.
.
9
5
.
.
.
5
o4 : Net
i5 : "Betti numbers of " | net C | " are " | be^2
1
5
9
o5 = Betti numbers of R
<-- R
<-- R
0
1
2
5
<-- R are
3
total:
0:
1:
2:
3:
1
1
.
.
.
5
.
.
5
.
...
...
...
...
...
o5 : Net
You could even learn how to display algebraic expressions with nets.
i6 : "x" | "2"^1
2
o6 = x
o6 : Net
There is an easier way to display algebraic expressions, using a type of thing
called an Expression [III.21.1.3]. It allows you to set up things that print out as
powers, sums, products, matrices, and so on. There are various types of expression,
such as Power [III.21.1.3.13], Sum [III.21.1.3.4.3], Divide [III.21.1.3.6], Minus
[III.21.1.3.11], and Product [III.21.1.3.4.2] that we can use for this.
128
4. LANGUAGE AND PROGRAMMING OVERVIEW
i7 : Divide(Minus a,b)
-a
o7 = -b
o7 : Divide
i8 : Power(Sum(3,4,5),7)
7
o8 = (3 + 4 + 5)
o8 : Power
i9 : Sum(1,2, Minus 3, 4,5)
o9 = 1 + 2 - 3 + 4 + 5
o9 : Sum
Actually, the formation of such expressions is contagious, in the sense that
the basic algebraic operations will construct expressions for you if one of their two
operands is already an expression.
i10 : Minus a / b
-a
o10 = -b
o10 : Divide
i11 : (Sum(3,4,5))^7
7
o11 = (3 + 4 + 5)
o11 : Power
i12 : 1 + 2 + Minus 3 + 4 + 5
o12 = 3 - 3 + 4 + 5
o12 : Sum
In the last example above, 1 + 2 was evaluated first, so it yielded 3 but after
that the contagion set in.
The function expression [III.21.1.3.20] can be used to prepare things such as
polynomials for formatting using the mechanism introduced above.
i13 : g = (x+y)^2
2
2
o13 = x + 2x*y + y
o13 : R
i14 : e = expression g
2
2
4.28. COMMUNICATING WITH PROGRAMS
o14 = x
129
+ 2x*y + y
o14 : Sum
i15 : peek e
2
2
o15 = Sum{x ,2x*y,y }
o15 : Net
In the example above, we see that peek [III.21.6.8] extracts only one level of
the structure. We may use peek2 [III.21.6.9] to display the structure of e to depth
2.
i16 : peek2(e,2)
o16 = Sum{Power{x,2},Product{2,x,y},Power{y,2}}
o16 : Net
Other types of Expression [III.21.1.3] that can be used for formatting nested
lists as two dimensional arrays are MatrixExpression [III.21.1.3.10] and Table
[III.21.1.3.19].
i17 : Table{{1,2,3},{a,bb,ccc}}
o17 =
1
2
3
a
bb
ccc
o17 : Table
i18 : MatrixExpression{{1,2,3},{a,bb,ccc}}
o18 = | 1
|
| a
2
3
|
|
ccc |
bb
o18 : MatrixExpression
i19 : Table{{"Example 1","Example 2"},
{Table{{1,2},{3,4}},Table{{11,22},{3,444}}}}
o19 =
Example 1
Example 2
1
2
11
22
3
4
3
444
o19 : Table
4.28. communicating with programs
The most naive way to interact with another program is simply to run it, let
it communicate directly with the user, and wait for it to finish. This is done with
the run [V.24.530] command.
i1 : run "uname -a"
Linux rhenium 2.2.14 #21 Mon Jan 31 17:41:33 CST 2000 i686 u ...
130
4. LANGUAGE AND PROGRAMMING OVERVIEW
o1 = 0
More often, one wants to write Macaulay 2 code to obtain and manipulate the
output from the other program. If the program requires no input data from us,
as in the example above, then we can use get [V.24.320] with a file name whose
first character is an exclamation point; the rest of the file name will be taken as
the command to run. In this example, we also peek at the string to see whether it
includes a newline character.
i2 : peek get "!uname -a"
o2 = "Linux rhenium 2.2.14 #21 Mon Jan 31 17:41:33 CST 2000
...
o2 : String
Bidirectional communication with a program is also possible. We use openInOut [V.24.456] to create a file that serves as a bidirectional connection to a program. That file is called an input output file. In this example we open a connection
to the unix utility egrep and use it to locate the symbol names in Macaulay2 that
begin with in.
i3 : f = openInOut "!egrep ’^in’"
o3 = !egrep ’^in’
o3 : File
i4 : scan(keys symbolTable(), key -> f << key << endl)
i5 : f << closeOut
o5 = !egrep ’^in’
o5 : File
i6 : stack sort lines read f
o6 = incomparable
indeterminate
index
indexComponents
indices
inducedMap
inducesWellDefinedMap
infinity
input
installMethod
instance
integrate
intersect
o6 : Net
i7 : close f
o7 = !egrep ’^in’
o7 : File
4.30. WHAT A CLASS IS
131
With this form of bidirectional communication there is always a danger of
blocking, because the buffers associated with the communication channels (pipes)
typically hold only 4096 bytes. In this example we succeeded because the entire
output from egrep was smaller than 4096 bytes. In general, one should be careful
to arrange things so that the two programs take turns using the communication
channel, so that when one is writing data, the other is reading it.
A useful function in this connection is isReady [V.24.370], which will tell you
whether an input file has any input available for reading, or whether it has arrived
at the end. We illustrate it in the following example by simulating a computation
that takes 5 seconds to complete, printing one dot per second while waiting.
i8 : f = openIn "!sleep 5; echo -n the answer is 4"
o8 = !sleep 5; echo -n the answer is 4
o8 : File
i9 : isReady f
o9 = false
i10 : while not isReady f do (sleep 1; << "." << flush)
.....
i11 : read f
o11 = the answer is 4
o11 : String
i12 : isReady f
o12 = true
i13 : atEndOfFile f
o13 = true
i14 : close f
o14 = !sleep 5; echo -n the answer is 4
o14 : File
We also allow for bidirectional communication through sockets over the internet. See openInOut [V.24.456] and openListener [V.24.457], or the next section.
Another useful function is wait [V.24.647], which can be used to wait for input
to be available from any of a list of input files.
4.29. using sockets
This node has not been written yet.
4.30. what a class is
This node has not been written yet.
132
4. LANGUAGE AND PROGRAMMING OVERVIEW
4.31. installing methods
The method to be used for computing an expression such as -x depends on
the type of x. For example, the method for negating a polynomial differs from
the method for negating an integer modulo 111. Each method is a function of one
variable, and is stored in the class of x under a key which is referred to as the
name of the method. For some built-in methods the method name is a symbol, but
for methods created with method [I.4.31.1], the method name is the same as the
function used for calling it up.
Let’s assume that X is the class of x. The way to install a method for the
negation of an instance x of X is with a statement of the following form.
- X := x ->( ... )
Here ( ... ) represents the body of the function, consisting of suitable code for
the operation at hand.
The method installed by the code above is automatically inherited by subclass
[V.24.569]es of X. Here is a brief description of the way this works. Suppose X is
the parent [V.24.465] of P. When an expression -p is to be evaluated, where the
class of p is P, then the method for -P is applied, unless there isn’t one, in which
case the method for -X is applied, and so on, all the way up the chain of parents
to the topmost ancestor of everything, which is called Thing [III.21].
As an extreme example of inheritance, code like
- Thing := x -> ...
will install a method for negating anything, which will take effect as a last resort
whenever a more specifically defined method isn’t found.
The user may introduce new methods as well as new method names. So it is
important to understand how methods are installed and consulted.
Applying a method named C to a thing x whose class is X means that
(lookup(C,X)) x
is evaluated. In other words, C is used as a key to obtain a function from X (or
its parent, grandparent, and so on), and the function is applied to x. See lookup
[V.24.397].
Installing a method named C for the class X is done with code such as
C X := (x) -> ( ... )
where ( ... ) represents suitable code for the operation at hand.
Here is the routine for making new methods.
method [I.4.31.1] – make a new method function
See also:
binary method [V.24.190]
classes [I.5.1]
lookup [V.24.397] – look up methods
4.31.1. method
f = method() – creates a method function
The code above creates a method function which takes up to three arguments,
looking up the appropriate method according to the classes of the arguments, with
inheritance. To install a method for two arguments, (x,y), of classes X and Y, use
code like this:
f(X,Y) := (x,y) -> ...
where ’...’ represents the body of the function you wish to install. The syntax for
one or three arguments is analogous. For a single argument x of class X, one could
also write:
f X := (x) -> ...
4.37. METHOD FUNCTIONS WITH OPTIONAL ARGUMENTS
133
the effect of which happens to be the same as that of
X#f := (x) -> ...
See also:
Options [V.24.111] – specify optional arguments for a method
methods [V.24.410] – list methods
The function method is a member of the class Function [III.18].
Optional arguments :
method(..., Associative => ...) [V.24.408] – allows associative methods
to be created
method(..., Options => ...)
method(..., SingleArgumentDispatch => ...)
method(..., TypicalValue => ...) [V.24.409] – specify return value type
4.32. inheritance from parents
This node has not been written yet.
4.33. making new types
This node has not been written yet.
4.34. printing and formatting for new types
This node has not been written yet.
4.35. making a new method function
This node has not been written yet.
4.36. method functions with a variable number of arguments
This node has not been written yet.
4.37. method functions with optional arguments
This node has not been written yet.
CHAPTER 5
Miscellaneous Topics
Some of these topics will have to be merged with sections above.
classes [I.5.1]
operators [I.5.2]
programming [I.5.3]
executing other programs [I.5.4]
debugging [I.5.5]
system [I.5.6]
help functions [I.5.7]
syntax [I.5.8]
replacements for commands and scripts from Macaulay [I.5.9]
obsolete functions and symbols [I.5.10]
5.1. classes
Every thing x belongs to a class X – a hash table that indicates in a weak sort
of way what type of thing x is. We may also say that x is an instance [V.24.360]
of X. The mathematical notion of a set X and an element x of X can be modeled this
way. The class of x can be obtained with the function class [V.24.199].
Every thing X also has a parent P, which indicates a larger class to which
every instance x of X belongs. We also say that X is a subclass [V.24.569] of P.
For example, the mathematical notion of a module P and a submodule X may be
modelled this way. The parent of x can be obtained with the function parent
[V.24.465].
i1 : parent 2
o1 = Nothing
o1 : Type
--
the empty class
i2 : parent parent 2
o2 = Thing
o2 : Type
--
the class of all things
i3 : class 2
o3 = ZZ
135
136
5. MISCELLANEOUS TOPICS
o3 : Ring
--
the class of all integers
i4 : parent class 2
o4 = Thing
o4 : Type
--
the class of all things
i5 : class class 2
o5 = Ring
o5 : Type
--
the class of all rings
i6 : parent class class 2
o6 = Type
o6 : Type
-- class of all types
The classes and parents provide a uniform way for operations on things to locate
the appropriate functions needed to perform them. Please see binary method
[V.24.190] now for a brief discussion.
For more details, see one of the topics below.
newClass [V.24.433] – copy an object, changing the class
new [V.24.432] – new objects of various types
ancestor [V.24.163] – whether one type is an ancestor of another
instance [V.24.360] – whether something has a certain type
For related topics, see one of the following.
uniform [V.24.638] – test whether elements of a list are of the same class
Thing [III.21] – the class of all things
Nothing [III.21.7] – the empty class
Type [III.21.5.4.11] – class of all types
MutableList [III.21.1.9] – the class of all mutable lists
MutableHashTable [III.21.5.4] – the class of all mutable hash tables
SelfInitializingType [III.21.5.4.11.4] – the class of all self initializing
types
5.2. operators
Here is a list of unary and binary operators in the language. Many of them can
have methods installed for handling arguments of specific types.
[V.24.1] – function application
, [V.24.18] – separates elements of lists or sequences
; [V.24.31] – statement separator
= [V.24.37] – assignment
<- [V.24.33] – assignment with left hand side evaluated
:= [V.24.30] – assignment of method or new local variable
5.2. OPERATORS
== [V.24.39] – equal
!= [V.24.3] – not equal
=== [V.24.40] – strictly equal
=!= [V.24.38] – strictly not equal
< [V.24.32] – less than
<= [V.24.36] – less than or equal
=> [V.24.42] – option
> [V.24.43] – greater than
>= [V.24.44] – greater than or equal
? [V.24.46] – comparison
or [V.24.459] – or
and [V.24.164] – and
not [V.24.437] – negation
.. [V.24.23] – sequence builder
+ [V.24.16] – addition
- [V.24.19] – subtraction
* [V.24.14] – multiplication
/ [V.24.25] – division, or applying a function to elements of a list
// [V.24.26] – quotient
\\ [V.24.148] – left quotient
% [V.24.9] – remainder
^ [V.24.149] – power
/^ [V.24.28] – divided power
! [V.24.2] – factorial
++ [V.24.17] – direct sum
** [V.24.15] – tensor product
<< [V.24.34] – file output, bit shifting
>> [V.24.45] – bit shifting
_ [V.24.151] – subscripting
. [V.24.22] – hash table access or assignment
.? [V.24.24] – test for hash table access
# [V.24.4] – hash table access; length of a list, sequence or hash table
#? [V.24.8] – test for hash table access
| [V.24.655] – horizontal concatenation of strings or matrices
|| [V.24.656] – vertical concatentation of strings or matrices
& [V.24.10] – bit-wise and
: [V.24.29] – ideal quotient, repetitions
\ [V.24.147] – applying a function to elements of a list
==> [V.24.41] – attaching options to a function
@@ [V.24.48] – composing functions
@ [V.24.47] –
&& [V.24.11] –
^^ [V.24.150] –
˜ [V.24.657] –
137
138
5. MISCELLANEOUS TOPICS
5.3. programming
5.4. executing other programs
The run [V.24.530] command can be used to execute another program, after
which control will return to Macaulay 2.
To pass the contents of a string as input to a program or command, open an
output file with openOut [V.24.458] whose name is the character ’ !’ followed by
the command, write the data to the resulting file, and then close the file. The
output is displayed on the screen.
If you want to collect the output from a command in a string, use get [V.24.320]
with a file name consisting of the character ’ !’ followed by the command.
5.5. debugging
Here are some debugging tools.
assert [V.24.178] – assert something is true
backtrace [V.24.183] – trace back through evaluations after an error
benchmark [V.24.188] – accurate timing of execution
browse [V.24.194] – browse the contents of an object
code [V.24.206] – display source code
currentFile [V.24.236]
edit [V.24.264] – edit source code
error [V.24.273] – deliver error message
errorDepth [V.24.274] – set the error printing depth
examine [V.24.277] – examine internal information about functions or
symbols
flag [V.24.290] – flag a symbol
frame [III.21.1.9.1] – the frame of a function
listUserSymbols [V.24.391] – display the user’s symbols
locate [V.24.395] – locate source code
methods [V.24.410] – list methods
on [V.24.448] – trace a function each time it’s run
peek [III.21.6.8] – examine contents of an object
peek2 [III.21.6.9] – examine contents of an object
profile [V.24.487] – profile a function
shield [V.24.547] – shield evaluation from interrupts
showStructure [V.24.548] – show relationship between types
showUserStructure [V.24.549] – show relationship between types defined
by user
try [V.24.633] – catch an error
userSymbols [V.24.640] – a list of the user’s symbols
These functions are for debugging the kernel interpreter itself, and are not
intended for users.
buckets [I.5.5.1] – list the buckets in a hash table
seeParsing [I.5.5.2] – print syntax table
5.5.1. buckets
buckets x – returns a list of the buckets used internally in an hash table x.
Each bucket is represented as a list of key/value pairs.
5.6. SYSTEM
139
The function buckets is a member of the class Function [III.18].
5.5.2. seeParsing
seeParsing() – print the syntax table which governs parsing precedence.
The function seeParsing is a member of the class Function [III.18].
5.6. system
Loading files:
autoload [V.24.182] – arrange for a function to be loaded automatically
initialization file [V.24.357]
input [V.24.358] – read Macaulay 2 commands and echo
load [V.24.392] – read Macaulay 2 commands
needs [V.24.430] – read Macaulay 2 commands if necessary
Echoing characters:
clearEcho [V.24.201] – turn off echoing
setEcho [V.24.545] – turn on echoing
Dumping and restoring the state of the system:
dumpdata [V.24.261] – dump state of the system to a file
loaddata [V.24.393] – load state of the system from a file
reloaded [V.24.511]
restart [V.24.526] – restart Macaulay 2
addStartFunction [V.24.156] – add a startup function
addEndFunction [V.24.155] – add an ending function
Interface to the operating system:
top level loop [V.24.622]
alarm [V.24.160] – set an alarm
currentDirectory [V.24.235] – current working directory
exec [V.24.279] – execute another program
exit [V.24.280] – exit the program
fork [V.24.297] – fork the process
getenv [V.24.324] – get value of environment variable
processID [V.24.485] – the process identifier
path [V.24.466] – list of directories to look in
pathSeparator [V.24.467]
quit [V.24.504] – quit the program
run [V.24.530] – run an external command
sleep [V.24.554] – sleep for a while
time [V.24.613] – time a computation
timing [V.24.615] – time a computation
tmpname [V.24.616] – make a temporary file name
wait [V.24.647] – wait for child process
Variables with information about the state of the current process:
commandLine [V.24.218] – the command line arguments
environment [V.24.271] – the environment variables
version [V.24.645] – information about this version of the program
Miscellaneous commands:
getWWW [V.24.322] – get a web page
Dealing with the garbage collector:
140
5. MISCELLANEOUS TOPICS
collectGarbage [V.24.214] – collect the garbage in memory
gcDump [V.24.310] – the status of the memory allocator
5.7. help functions
Online Macaulay 2 documentation is stored in hypertext [V.24.343] form.
Functions for accessing the documentation:
apropos [V.24.174] – symbols matching a pattern
briefDocumentation [V.24.193] – get brief documentation
documentation [V.24.258] – get documentation, unformatted
examples [V.24.278] – list the examples in documentation
help [V.24.337] – get help
topicList [V.24.625] – list of help topics
topics [V.24.626] – display available help topics
How to write documentation yourself:
document [V.24.257] – install documentation
hypertext [V.24.343]
Output formatting routines:
html [III.21.6.1.1] – convert hypertext to html format
mathML [III.21.6.1.2] – convert to MathML format
tex [III.21.6.1.3] – convert to TeX
text [III.21.6.1.5] – convert hypertext to text
Some internals:
Documentation [V.24.69]
phase [V.24.470]
See also:
Reading the Documentation [I.2]
5.8. syntax
A newline ends a statement if it can, otherwise it acts like any white space.
i1 : 2+
3+
4
o1 = 9
Parsing is determined by a triple of numbers attached to each token. The
following table (produced by seeParsing [I.5.5.2]), displays each of these numbers.
i2 : seeParsing()
word
<WORDS>
!
#
%
&
(
)
*
+
precedence scope strength
62
62
68
66
58
44
62
4
58
50
62
60
68
66
58
44
4
0
58
50
62
62
68
60
58
44
70
0
58
50
5.8. SYNTAX
,
.
/
:
;
<
=
>
?
@
[
\\
]
^
_
{
|
}
~
else
!=
##
#?
=!=
&&
**
++
->
..
.?
//
/^
and
:=
<<<
<=
==
=>
>=
>>
@@
===
==>
--newline-local
symbol
\\\\
^^
do
if
of
or
||
timing
shield
then
try
time
global
10
50
66
58
36
8
30
16
30
30
60
54
58
4
66
66
62
40
4
46
14
30
60
66
30
34
52
50
16
48
66
58
66
26
16
16
20
30
30
16
30
22
64
30
16
8
62
62
56
42
14
62
18
24
32
62
62
14
62
62
62
10
50
66
58
34
8
30
14
30
30
58
4
56
0
66
66
4
40
0
46
14
30
58
66
30
34
52
50
14
48
66
58
66
26
14
14
20
30
30
14
30
20
64
30
14
8
14
14
54
42
14
14
18
24
32
14
14
14
14
14
14
10
50
66
58
36
8
30
16
30
30
60
70
58
0
66
66
70
40
0
46
14
30
60
66
30
34
52
50
16
48
66
58
66
26
16
16
20
30
30
16
30
22
64
30
16
8
14
14
56
42
14
14
18
24
32
14
14
14
14
14
14
141
142
5. MISCELLANEOUS TOPICS
while
62
14
14
new
62
18
18
not
28
28
28
from
18
18
18
Here is the way these numbers work. The parser maintains a number which
we will call the current parsing level, or simply, the level. The parser builds up an
expression until it encounters an input token whose precedence is less than or equal
to the current level. The tokens preceding the offending token are bundled into an
expression appropriately and incorporated into the containing expression.
When an operator or token is encountered, its scope serves as the level for
parsing the subsequent expression, unless the current level is higher, in which case
it is used.
Consider a binary operator such as *. The relationship between its scope and
its precedence turns out to determine whether a*b*c is parsed as (a*b)*c or as
a*(b*c). When the parser encounters the second *, the current parsing level is
equal to the scope of the first *. If the scope is less than the precedence, then the
second * becomes part of the right hand operand of the first *, and the expression
is parsed as a*(b*c). Otherwise, the expression is parsed as (a*b)*c.
For unary operators, the strength is used instead of the scope to reset the
current level. The reason for having both numbers is that some operators can be
either unary or binary, depending on the context. A good example is # [V.24.4]
which binds as tightly as . [V.24.22] when used as an infix operator, and binds as
loosely as adjacency or function application when used as a prefix operator.
To handle expressions like b c d, where there are no tokens present which can
serve as a binary multiplication operator, after parsing b, the level will be set to 1
less than the precedence of an identifier, so that b c d will be parsed as b (c d).
The exclamation point is allowed as a unary operator either to the right or
to the left of its operand. The other unary operators occur to the left of their
operands.
Three operators are treated specially, in that the empty expression is allowed
to the right of them. These are newline, comma, and semicolon.
5.9. replacements for commands and scripts from Macaulay
Macaulay 2 aims to provide all of the functionality of Macaulay, but the names
of the functions are not the same, and there are other differences. One major
difference is the introduction of the notion of module, whereas in Macaulay, the
pervasive concept was the matrix.
Here is a list of old Macaulay functions, together with pointers to functions in
Macaulay 2 that might be used to replace them.
Macaulay commands:
. – not available
ac – such destructive changes are not allowed
add – + [V.24.16]
ar – not documented yet [V.24.438]
args – not documented yet [V.24.438]
betti – betti [III.21.6.5]
binoms – not documented yet [V.24.438]
cache_mem – not documented yet [V.24.438]
calc – not documented yet [V.24.438]
5.9. REPLACEMENTS FOR COMMANDS AND SCRIPTS FROM MACAULAY
143
cat – not documented yet [V.24.438]
cdir – not documented yet [V.24.438]
ce – not documented yet [V.24.438]
characteristic – char [V.24.197]
chcalc – not documented yet [V.24.438]
codim – codim [V.24.207]
coef – not documented yet [V.24.438]
col_degree – not documented yet [V.24.438]
col_degs – not documented yet [V.24.438]
commands – not documented yet [V.24.438]
compress – compress [V.24.224]
concat – | [V.24.655],|| [V.24.656]
continue – not documented yet [V.24.438]
contract – contract [V.24.229]
copy – not documented yet [V.24.438]
degree – degree [V.24.240]
determinants – minors [V.24.415]
diag – The command diag m n is equivalent to the Macaulay2 expression
n = map((ring m)^(numgens source m), source m,(i,j) -> if
i === j then m_(0,i) else 0)
diag – not documented yet [V.24.438]
diff – diff [V.24.251]
dshift – not documented yet [V.24.438]
dsum – ++ [V.24.17]
echo – not documented yet [V.24.438]
edit – not documented yet [V.24.438]
edit_map – not documented yet [V.24.438]
elim – selectInSubring [V.24.542]
endmon – not documented yet [V.24.438]
ev – substitute [V.24.572],RingMap [III.14]
exit – quit [V.24.504]
fetch – substitute [V.24.572]
flatten – flatten [V.24.291]
forcestd – forceGB [III.15.1]
help – help [V.24.337]
help_file – not documented yet [V.24.438]
hilb – hilbertSeries [V.24.339],hilbertPolynomial [III.21.5.6.3],hilbertFunction
[V.24.338],poincare [V.24.472]
hilb_numer – hilbertSeries [V.24.339]
homog – homogenize [V.24.340]
hulb – not documented yet [V.24.438]
ideal – ideal [III.11.5], matrix [V.24.401]
iden – id [V.24.344]
if – if [V.24.346]
imap – map [V.24.399]
in – leadTerm [V.24.384]
incoef – not documented yet [V.24.438]
144
5. MISCELLANEOUS TOPICS
incr_set – not documented yet [V.24.438]
inpart – not documented yet [V.24.438]
int – not documented yet [V.24.438]
intersect – intersect [V.24.362]
is_zero – == [V.24.39]
jacob – jacobian [V.24.372]
jump – not documented yet [V.24.438]
k-basis – basis [V.24.187]
k_basis – basis [V.24.187]
keep – not documented yet [V.24.438]
kill – not documented yet [V.24.438]
koszul – koszul [V.24.379]
lift – // [V.24.26]
lift_std – gb [III.15.2]
listvars – listUserSymbols [V.24.391]
mat – matrix [V.24.401]
max – max [V.24.402]
mc – not documented yet [V.24.438]
min – min [V.24.411]
modulo – modulo [V.24.422]
monitor – emacs [V.24.267]
monitoring – not documented yet [V.24.438]
monoms – not documented yet [V.24.438]
monprimes – not documented yet [V.24.438]
mr – not documented yet [V.24.438]
mult – * [V.24.14]
ncols – use numgens source m
nres – resolution [V.24.517]
nrows – use numgens target m
numinfo – not documented yet [V.24.438]
nvars – use numgens R
outer – ** [V.24.15]
path – path [V.24.466]
pc – not documented yet [V.24.438]
pfaff – pfaffians [V.24.469]
pmap – not documented yet [V.24.438]
poly – not documented yet [V.24.438]
power – ^ [V.24.149]
pr – not documented yet [V.24.438]
pres <C:complex> – Use C.dd or print C.dd [V.24.482]
present_ring – not documented yet [V.24.438]
pring – not documented yet [V.24.438]
prmat – print [V.24.481] or toString [III.21.6.1.7]
putchange – not documented yet [V.24.438]
putmat – not documented yet [V.24.438]
putstd – not documented yet [V.24.438]
5.9. REPLACEMENTS FOR COMMANDS AND SCRIPTS FROM MACAULAY
145
qring <I:ideal> <result A:ring> – In Macaulay2, if I is an ideal, then A
= (ring I)/I is equivalent, except that in Macaulay2, a Groebner
basis of I is computed for you, if it is needed
quit – quit [V.24.504]
quotient – not documented yet [V.24.438]
random – not documented yet [V.24.438]
reduce – not documented yet [V.24.438]
res – not documented yet [V.24.438]
reset – restart [V.24.526]
ring – not documented yet [V.24.438]
ring-from-rows – not documented yet [V.24.438]
ring_from_cols – not documented yet [V.24.438]
ring_from_rows – not documented yet [V.24.438]
ring_sum – not documented yet [V.24.438]
rmap – not documented yet [V.24.438]
row_degree – not documented yet [V.24.438]
row_degs – not documented yet [V.24.438]
sat – saturate [V.24.534]
set – not documented yet [V.24.438]
set_value – not documented yet [V.24.438]
setcoldegs – not documented yet [V.24.438]
setdegs – not documented yet [V.24.438]
setring – use [V.24.639]
shout – not documented yet [V.24.438]
size – not documented yet [V.24.438]
smult – * [V.24.14]
space – engineMemory [IV.22.3.15]
spairs – not documented yet [V.24.438]
spare – not documented yet [V.24.438]
sparse – not documented yet [V.24.438]
std – not documented yet [V.24.438]
std_minimal – not documented yet [V.24.438]
stdpart – not documented yet [V.24.438]
submat – submatrix [V.24.570]
subtract – - [V.24.19]
syz – syz [V.24.599],kernel [V.24.375]
tensor <matrix M> <matrix N> <result matrix M.N> – cokernel M **
cokernel N
trace – trace [V.24.627]
transpose – transpose [V.24.629]
truncate – truncate [V.24.632]
type – not documented yet [V.24.438]
version – version [V.24.645]
wedge – minors [V.24.415],exteriorPower [V.24.284]
Macaulay scripts from ’scriptsde’:
<adj_of_cat – not documented yet [V.24.438]
<adjoin_fractions – not documented yet [V.24.438]
<adjoint – not documented yet [V.24.438]
146
5. MISCELLANEOUS TOPICS
<analytic_spread – not documented yet [V.24.438]
<annihilated – not documented yet [V.24.438]
<annihilator – ann [V.24.165]
<annihilator1 – ann [V.24.165]
<annihilator2 – ann [V.24.165]
<binomial – binomial [V.24.191]
<ceiling – not documented yet [V.24.438]
<changelog – not documented yet [V.24.438]
<codim – not documented yet [V.24.438]
<cohomology – not documented yet [V.24.438]
<cohomology1 – not documented yet [V.24.438]
<column_vector – not documented yet [V.24.438]
<complement – not documented yet [V.24.438]
<copyring – not documented yet [V.24.438]
<cotan – not documented yet [V.24.438]
<cotan_bihom – not documented yet [V.24.438]
<curve_on_cubic – not documented yet [V.24.438]
<diagonal_submodule – not documented yet [V.24.438]
<diff – not documented yet [V.24.438]
<double_dual – not documented yet [V.24.438]
<double_dual1 – not documented yet [V.24.438]
<dual_variety – not documented yet [V.24.438]
<empty_array – not documented yet [V.24.438]
<equality – not documented yet [V.24.438]
<ext – not documented yet [V.24.438]
<ext(-,r) – not documented yet [V.24.438]
<extend_ring – not documented yet [V.24.438]
<from_bigraded – not documented yet [V.24.438]
<from_div_powers – not documented yet [V.24.438]
<generic_mat – genericMatrix [V.24.316]
<getvars – not documented yet [V.24.438]
<hom – not documented yet [V.24.438]
<hom_and_map – not documented yet [V.24.438]
<hom_is_0 – not documented yet [V.24.438]
<homology – not documented yet [V.24.438]
<i_in_j – not documented yet [V.24.438]
<ideal – not documented yet [V.24.438]
<idempotent – not documented yet [V.24.438]
<idencoldegs – not documented yet [V.24.438]
<idenrowdegs – not documented yet [V.24.438]
<interchange – not documented yet [V.24.438]
<interchange_permutation – not documented yet [V.24.438]
<inverse – not documented yet [V.24.438]
<is_zero – not documented yet [V.24.438]
<k3carpet – not documented yet [V.24.438]
<kernel – not documented yet [V.24.438]
<kernel_and_map – not documented yet [V.24.438]
<kosz_hom1 – not documented yet [V.24.438]
5.9. REPLACEMENTS FOR COMMANDS AND SCRIPTS FROM MACAULAY
<kosz_hom2 – not documented yet [V.24.438]
<l_i_in_j – not documented yet [V.24.438]
<l_intersect – not documented yet [V.24.438]
<l_res – not documented yet [V.24.438]
<lex_seg_ideal – not documented yet [V.24.438]
<macaulayrep – not documented yet [V.24.438]
<map_from_col – not documented yet [V.24.438]
<minpres – not documented yet [V.24.438]
<module_iso – not documented yet [V.24.438]
<monomial_curve – not documented yet [V.24.438]
<mult_ideals – not documented yet [V.24.438]
<nbyn_commuting – not documented yet [V.24.438]
<normal_sheaf – not documented yet [V.24.438]
<nres – not documented yet [V.24.438]
<nzd – not documented yet [V.24.438]
<orbit_equations – not documented yet [V.24.438]
<permutation – not documented yet [V.24.438]
<perp – not documented yet [V.24.438]
<points – not documented yet [V.24.438]
<powers – not documented yet [V.24.438]
<project_from_product – not documented yet [V.24.438]
<projective_plane – not documented yet [V.24.438]
<prune – prune [III.13.12.3]
<prune_and_map – not documented yet [V.24.438]
<push_forward – pushForward [V.24.494]
<push_forward1 – pushForward1 [V.24.497]
<quotient1 – quotient [V.24.505]
<radical – radical [V.24.507]
<random_element – not documented yet [V.24.438]
<random_int – not documented yet [V.24.438]
<random_map – not documented yet [V.24.438]
<random_mat – not documented yet [V.24.438]
<rank_prob – not documented yet [V.24.438]
<rat_nor_curve – not documented yet [V.24.438]
<rat_nor_osc_locus – not documented yet [V.24.438]
<rational_surface – not documented yet [V.24.438]
<rational_surface1 – not documented yet [V.24.438]
<reduce_syzygy_1 – not documented yet [V.24.438]
<regular_sequence – not documented yet [V.24.438]
<regular_sequence1 – not documented yet [V.24.438]
<regularity – regularity [V.24.510]
<remove_low_dim – not documented yet [V.24.438]
<remove_low_dim_id – not documented yet [V.24.438]
<remove_lowest_dim – not documented yet [V.24.438]
<representatives – not documented yet [V.24.438]
<representatives_old – not documented yet [V.24.438]
<res – resolution [V.24.517]
<res_and_dim – resolution [V.24.517],pdim [V.24.468]
147
148
5. MISCELLANEOUS TOPICS
<ring – not documented yet [V.24.438]
<sagbi – not documented yet [V.24.438]
<sagbi_step – not documented yet [V.24.438]
<sat – saturate [V.24.534]
<sat1 – saturate [V.24.534]
<scroll – not documented yet [V.24.438]
<select – not documented yet [V.24.438]
<shout_list – not documented yet [V.24.438]
<sort_by_degree – not documented yet [V.24.438]
<stack – matrix [V.24.401],map [V.24.399]
<submat_by_degs – not documented yet [V.24.438]
<subring – kernel [V.24.375]
<sym – not documented yet [V.24.438]
<sym_cokernel – not documented yet [V.24.438]
<template_for_scripts – not documented yet [V.24.438]
<to_div_powers – not documented yet [V.24.438]
<tor – Tor [V.24.140]
<unmixed_radical – radical [V.24.507]
<unmixed_radical1 – radical [V.24.507]
<unmixed_radical2 – radical [V.24.507]
<wedge_cokernel – not documented yet [V.24.438]
<x_to_last – newCoordinateSystem [V.24.434]
<zeromat – not documented yet [V.24.438]
Macaulay scripts from ’scriptsmj’:
<2BYN – not documented yet [V.24.438]
<add_matrix_to_array – not documented yet [V.24.438]
<check_complex – not documented yet [V.24.438]
<check_exact – not documented yet [V.24.438]
<comp_to_array – not documented yet [V.24.438]
<eagon_northcott – not documented yet [V.24.438]
<extract_matrix – not documented yet [V.24.438]
<homology_of_array – not documented yet [V.24.438]
<jordan0 – not documented yet [V.24.438]
<koszul_complex – not documented yet [V.24.438]
<lift – not documented yet [V.24.438]
<lift_arrays – not documented yet [V.24.438]
<mc – not documented yet [V.24.438]
<nilpotent0 – not documented yet [V.24.438]
<pres – not documented yet [V.24.438]
<smult_complex – not documented yet [V.24.438]
<splice_resns – not documented yet [V.24.438]
Macaulay scripts from ’scriptsms’:
<block_map – not documented yet [V.24.438]
<blowup – not documented yet [V.24.438]
<blowup0 – not documented yet [V.24.438]
<generic_skew_mat – genericSkewMatrix [V.24.317]
<generic_sym_mat – genericSymmetricMatrix [V.24.318]
<hilb_fcn – not documented yet [V.24.438]
5.10. OBSOLETE FUNCTIONS AND SYMBOLS
<inhomog_std – not documented yet [V.24.438]
<l_dual0 – not documented yet [V.24.438]
<l_from_dual – fromDual [V.24.301]
<l_homog0 – not documented yet [V.24.438]
<l_min0 – not documented yet [V.24.438]
<l_minimal – not documented yet [V.24.438]
<l_minimal0 – not documented yet [V.24.438]
<l_tangentcone – not documented yet [V.24.438]
<l_to_dual – toDual [V.24.617]
<line_bundle_image – not documented yet [V.24.438]
<normal_cone – not documented yet [V.24.438]
<proj_bundle – not documented yet [V.24.438]
<rmap – not documented yet [V.24.438]
<symmetric_algebra – not documented yet [V.24.438]
5.10. obsolete functions and symbols
149
Part II
Mathematical Vignettes
In this section we present some tutorials which aim to introduce the user to
some mathematical ways of using Macaulay 2. The tutorials are relatively independent of each other, and each one introduces the use of some features of Macaulay 2
in a slow and leisurely way, assuming the reader is already familiar with the mathematical concepts involved. David Eisenbud [I.1.7.3] joins us as a co-author of
these tutorials.
Elementary uses of Groebner bases [II.6]
Canonical Embeddings of Plane Curves and Gonality [II.7]
Fano varieties [II.8]
Divisors [II.9]
CHAPTER 6
Elementary uses of Groebner bases
In this tutorial we introduce a number of basic operations using Groebner bases,
and at the same time become familiar with a range of useful Macaulay2 constructs.
The sections are:
A. First steps; example with a monomial curve
B. Random regular sequences
C. Division with remainder
D. Elimination theory
E. Quotients and saturation A. First Steps; example with a monomial
curve
To compute the Groebner basis of an ideal (x2 y, xy 2 + x3 ) in the polynomial
ring in four variables we proceed as follows:
Our favorite field
i1 : KK = ZZ/31991
o1 = KK
o1 : QuotientRing
The polynomial ring
i2 : R = KK[x,y,z,w]
o2 = R
o2 : PolynomialRing
and the ideal
i3 : I = ideal(x^2*y,x*y^2+x^3)
2
3
2
o3 = ideal (x y, x + x*y )
o3 : Ideal of R
now the punch line:
i4 : J = gens gb I
o4 = {0} | x3+xy2 x2y xy3 |
1
3
o4 : Matrix R <--- R
From this we can for example compute the codimension, dimension, degree,
and the whole Hilbert function and polynomial. This will be more fun if we work
with an example having some meaning. We choose to work with the ideal defining
153
154
6. ELEMENTARY USES OF GROEBNER BASES
the rational quartic curve in P3 given parametrically in an affine representation by
t 7→ (t, t3 , t4 ).
(The reader who doesn’t understand this terminology may ignore it for the moment,
and treat the ideal given below as a gift from the gods... .) We obtain the ideal by
first making the polynomial ring in 4 variables (the homogeneous coordinate ring
of P3 )
i5 : R = KK[a..d]
o5 = R
o5 : PolynomialRing
and then using a function monomialCurve, which we shall treat for now as a
black box
i6 : I = monomialCurve(R,{1,3,4})
3
o6 = ideal (b*c - a*d, b
2
2
2
3
2
- a c, a*c - b d, c - b*d )
o6 : Ideal of R
From Macaulay’s point of view, I is an ideal, and the codimension of its support
is 2, while its dimension is 2:
i7 : codim I
o7 = 2
i8 : dim I
o8 = 2
This is the codimension of R/I in R and the dimension of R/I. We could work
with the module R/I as well. Precision requires writing R1 instead of R (R is a
ring, and R1 is the free module of rank 1 over it)
i9 : codim (R^1/(I*R^1))
o9 = 2
We could also extract the generators of I (as a matrix) and take the cokernel
to get the same thing:
i10 : M = coker gens I
o10 = cokernel {0} | bc-ad b3-a2c ac2-b2d c3-bd2 |
1
o10 : R - module, quotient of R
i11 : codim M
o11 = 2
i12 : dim M
o12 = 2
And similarly for the degree:
6. ELEMENTARY USES OF GROEBNER BASES
155
i13 : degree I
o13 = 4
i14 : degree M
o14 = 4
As one might expect, the degree of the quartic is 4 !
The Hilbert polynomial is obtained by
i15 : hilbertPolynomial M
o15 = - 3*P + 4*P
0
1
o15 : ProjectiveHilbertPolynomial
The term Pi represents the Hilbert polynomial of projective i-space. This
formula tells us that the Hilbert polynomial of M is H(m) = 4(m + 1) −3 = 4m + 1.
Thus the degree is four, the dimension of the projective variety which is the support
of M is 1 (and so the affine dimension is 2), and that the (arithmetic) genus is 0 (1
minus the constant term, for curves).
The Hilbert series of M (the generating function for the dimensions of the
graded pieces of M ) is
i16 : hilbertSeries M
3
2
- $T + 2$T + 2$T + 1
o16 = ---------------------2
(- $T + 1)
o16 : Divide
The indeterminate in this expression is $T.
Another way to get information about the module M is to see its free resolution
i17 : Mres = res M
1
4
4
1
o17 = R <-- R <-- R <-- R
0
1
2
3
o17 : ChainComplex
To get more precise information about Mres, we could do
i18 : betti Mres
o18 = total:
0:
1:
2:
1
1
.
.
4
.
1
3
4
.
.
4
1
.
.
1
o18 : Net
The display is chosen for compactness: the first line gives the total betti numbers, the same information given when we type the resolution. The remaining lines
156
6. ELEMENTARY USES OF GROEBNER BASES
express the degrees of each of the generators of the free modules in the resolution.
The jth column after the colons gives the degrees of generators of the jth module(counting from 0); an n in the jth column in the row headed by “d:” means that
the jth free module has n generators of degree n + j. Thus for example in our case,
the generator of the third (last) free module in the resolution has degree 3 + 2 = 5.
B. Random regular sequences
An interesting and illustrative open problem is to understand the initial ideal
(and the Groebner basis) of a “generic” regular sequence. To study a very simple
case we take a matrix of 2 random forms in a polynomial ring in 3 variables:
i19 : R = KK[x,y,z]
o19 = R
o19 : PolynomialRing
i20 : F = random(R^1, R^{-2,-3})
o20 = {0} | -8514x2+5827xy-9613y2+7886xz+5702yz+11835z2 -157 ...
1
2
o20 : Matrix R <--- R
makes F into a 1 × 2 matrix whose elements have degrees 2, 3 (that is, F is a
random map to the free module R1 , which has its one generator in the (default)
degree, 0, from the free module with generators in the listed degrees, {2, 3}). We
now can compute
i21 : GB = gens gb F
o21 = {0} | x2-14140xy+5100y2+12053xz+14443yz+7878z2 xy2-658 ...
1
3
o21 : Matrix R <--- R
i22 : LT = leadTerm gens gb F
o22 = {0} | x2 xy2 y4 |
1
3
o22 : Matrix R <--- R
i23 : betti LT
o23 = total:
0:
1:
2:
3:
1
1
.
.
.
3
.
1
1
1
o23 : Net
shows that there are Groebner basis elements of degrees 2,3, and 4. This result
is dependent on the monomial order in the ring R; for example we could take the
lexicographic order
i24 : R = KK[x,y,z, MonomialOrder => Lex]
o24 = R
6. ELEMENTARY USES OF GROEBNER BASES
157
o24 : PolynomialRing
(see help MonomialOrder for other possibilities). We get
i25 : F = random(R^1, R^{-2,-3})
o25 = {0} | -9394x2+8312xy+12075xz-3147y2-11542yz+3907z2 -13 ...
1
2
o25 : Matrix R <--- R
i26 : GB = gens gb F
o26 = {0} | x2+2417xy+2168xz+13360y2-639yz+14449z2 xy2+198xy ...
1
5
o26 : Matrix R <--- R
i27 : LT = leadTerm gens gb F
o27 = {0} | x2 xy2 xyz2 xz4 y6 |
1
5
o27 : Matrix R <--- R
i28 : betti LT
o28 = total:
0:
1:
2:
3:
4:
5:
1
1
.
.
.
.
.
5
.
1
1
1
1
1
o28 : Net
and there are Groebner basis elements of degrees 2, 3, 4, 5, 6. C. Division
With Remainder
A major application of Groebner bases is to decide whether an element is in a
given ideal, and whether two elements reduce to the same thing modulo an ideal.
For example, everyone knows that the trace of a nilpotent matrix is 0. We can
produce an ideal I that defines the variety X of nilpotent 3 × 3 matrices by taking
the cube of a generic matrix and setting the entries equal to zero. Here’s how:
i29 : R = KK[a..i]
o29 = R
o29 : PolynomialRing
i30 : M = genericMatrix(R,a,3,3)
o30 = {0} | a d g |
{0} | b e h |
{0} | c f i |
3
3
o30 : Matrix R <--- R
158
6. ELEMENTARY USES OF GROEBNER BASES
i31 : N = M^3
o31 = {0} | a3+2abd+bde+2acg+bfg+cdh+cgi
a2d+bd2+ade+ ...
{0} | a2b+b2d+abe+be2+bcg+ach+ceh+bfh+chi abd+2bde+e3+ ...
{0} | a2c+bcd+abf+bef+c2g+cfh+aci+bfi+ci2 acd+cde+bdf+ ...
3
3
o31 : Matrix R <--- R
i32 : I = flatten N
o32 = {0} | a3+2abd+bde+2acg+bfg+cdh+cgi a2b+b2d+abe+be2+bcg ...
1
9
o32 : Matrix R <--- R
(actually this produces a 1 x 9 matrix of of forms, not the ideal: J = ideal I;
the matrix will be more useful to us). But the trace is not in I! This is obvious
from the fact that the trace has degree 1, but the polynomials in I are of degree 3.
We could also check by division with remainder:
i33 : Tr = trace M
o33 = a + e + i
o33 : R
i34 : Tr //I
-- the quotient, which is 0
o34 = 0
9
1
o34 : Matrix R <--- R
i35 : Tr % I
-- the remainder, which is Tr again
o35 = a + e + i
o35 : R
(Here Tr is an element of R, not a matrix. We could do the same thing with a
1 × 1 matrix with Tr as its element.) This is of course because the entries of I do
NOT generate the ideal of all forms vanishing on X – this we may find with J =
radical ideal I, (but this takes a while: see the documentation for radical on a
faster way to find this) which shows that the radical is generated by the trace, the
determinant, and the sum of the principal 2 × 2 minors, that is, by the coefficients
of the characteristic polynomial. In particular, we can try the powers of the radical:
i36 : Tr^2 % I
2
2
2
o36 = a + 2a*e + e + 2a*i + 2e*i + i
o36 : R
i37 : Tr^3 % I
2
2
3
...
o37 = 3a e + 3b*d*e + 3a*e + 3e + 3b*f*g + 3c*d*h + 6e*f*h ...
6. ELEMENTARY USES OF GROEBNER BASES
159
o37 : R
i38 : Tr^4 % I
2 2
2
3
4
o38 = 6a e + 6b*d*e + 6a*e + 6e + 6b*e*f*g + 6c*d*e*h -
...
...
o38 : R
i39 : Tr^5 % I
2 2
2
3
4
2
...
o39 = 30a e i + 30b*d*e i + 30a*e i + 30e i + 30c*e g*i + 30 ...
o39 : R
i40 : Tr^6 % I
2 2 2
2 2
3 2
4 2
2
2 ...
o40 = 90a e i + 90b*d*e i + 90a*e i + 90e i + 90c*e g*i ...
o40 : R
i41 : Tr^7 % I
o41 = 0
o41 : R
The seventh power is the first one in the ideal! (Bernard Mourrain has worked
out a formula for which power in general.) In this case
i42 : Tr^6 // I
o42 = {3}
{3}
{3}
{3}
{3}
{3}
{3}
{3}
{3}
|
|
|
|
|
|
|
|
|
a3+18abd+6a2e-15988bde+15ae2+4e3+15994bfg+15994c
9ade+9de2-15991afg-15982efg+27adi-9dei
9deh+15991fgh+18agi+18egi-9dhi
-36a2b+15955abe+15982be2-15973ach-15991ceh-18bfh
16a3+15a2e+15994bde+6ae2+e3+15994bfg+15994cdh+36
18abg-15982beg-36a2h+18bdh-54aeh-15982cgh-15901b
36a2c+18ace+18abf+15991bef+15991cfh+99aci+18cei+
-9cde+36a2f+36aef-9e2f+15991cfg-27cdi+216afi-27e
-38a3-54abd-30a2e-24bde-30ae2-8e3-36acg-18ceg+3b
...
...
...
...
...
...
...
...
...
9
1
o42 : Matrix R <--- R
is not 0. It is a matrix that makes the following true:
i43 : Tr^6 == I * (Tr^6 // I) + (Tr^6 % I)
o43 = true
D. Elimination Theory
Consider the problem of projecting the “twisted cubic”, a curve in P3 defined
by the three 2 × 2 minors of a certain 2 × 3 matrix into the plane. Such problems
can be solved in a very simple and direct way using Groebner bases. The technique
lends itself to many extensions, and in its developed form can be used to find the
closure of the image of any map of affine varieties.
160
6. ELEMENTARY USES OF GROEBNER BASES
In this section we shall first give a simple direct treatment of the problem above,
and then show how to use Macaulay2’s general tool to solve the problem. We first
clear the earlier meaning of x to make it into a subscripted variable
i44 : erase global x
o44 = x
o44 : Symbol
and then set
i45 : R = KK[x_0..x_3]
o45 = R
o45 : PolynomialRing
the homogeneous coordinate ring of P3 and
i46 : M = map(R^2, 3, (i,j)->x_(i+j))
o46 = {0} | x_0 x_1 x_2 |
{0} | x_1 x_2 x_3 |
2
3
o46 : Matrix R <--- R
i47 : I = gens minors(2,M)
o47 = {0} | -x_1^2+x_0x_2 -x_1x_2+x_0x_3 -x_2^2+x_1x_3 |
1
3
o47 : Matrix R <--- R
a matrix whose image is the ideal of the twisted cubic. As projection center we
take the point defined by
i48 : pideal = ideal(x_0+x_3, x_1, x_2)
o48 = ideal (x + x , x , x )
0
3
1
2
o48 : Ideal of R
To find the image we must intersect the ideal I with the subring generated by
the generators of pideal. We make a change of variable so that these generators
become the last three variables in the ring; that is, we write the ring as KK[y0 ..y3 ]
where
y0 = x0 , y1 = x1 , y2 = x2 , y3 = x0 + x3
and thus x3 = y3 − y0 , etc. We want the new ring to have an “elimination order”
for the first variable.
i49 : erase global y
o49 = y
o49 : Symbol
i50 : S = KK[y_0..y_3,MonomialOrder=> Eliminate 1]
6. ELEMENTARY USES OF GROEBNER BASES
161
o50 = S
o50 : PolynomialRing
Here is one way to make the substitution
i51 : I1 = substitute(I, matrix{{y_0,y_1,y_2,y_3-y_0}})
o51 = {0} | y_0y_2-y_1^2 -y_0^2+y_0y_3-y_1y_2 -y_0y_1-y_2^2+ ...
1
3
o51 : Matrix S <--- S
The elimination of 1 variable from the matrix of Groebner basis elements proceeds as follows:
i52 : J = selectInSubring(1,gens gb I1)
o52 = {0} | y_1^3+y_2^3-y_1y_2y_3 |
1
1
o52 : Matrix S <--- S
and gives (a matrix with element) the cubic equation of a rational curve with
one double point in the plane. However, we are still in a ring with 4 variables, so
if we really want a plane curve (and not the cone over one) we must move to yet
another ring:
i53 : S1 = KK[y_1..y_3]
o53 = S1
o53 : PolynomialRing
i54 : J1 = substitute(J, S1)
o54 = {0} | y_1^3+y_2^3-y_1y_2y_3 |
1
1
o54 : Matrix S1 <--- S1
This time we didn’t have to give so much detail to the substitute command
because of the coincidence of the names of the variables.
Having shown the primitive method, we now show a much more flexible and
transparent one: we set up a ring map from the polynomial ring in 3 variables
(representing the plane) to R/I, taking the variables y to the three linear forms
that define the projection center. Then we just take the kernel of this map! (“Under
the hood”, Macaulay2 is doing a more refined version of the same computation as
before.) Here is the ring map
i55 : Rbar = R/(ideal I)
o55 = Rbar
o55 : QuotientRing
i56 : f = map(Rbar, S1,
matrix(Rbar,{{x_0+x_3, x_1,x_2}})
)
o56 = map(Rbar,S1,{x
+ x , x , x })
162
6. ELEMENTARY USES OF GROEBNER BASES
0
3
1
2
o56 : RingMap Rbar <--- S1
and the desired ideal
i57 : J1 = ker f
3
3
o57 = ideal(y - y y y + y )
2
1 2 3
3
o57 : Ideal of S1
E. Quotients and saturation
Another typical application of Groebner bases and syzygies is to the computation of ideal quotients and saturations. Again we give an easy example that we can
treat directly, and then introduce the tool used in Macaulay2 to treat the general
case.
If I and J are ideals in a ring R, we define (I : J), the ideal quotient, by
(I : J) = {f ∈ R | f J ⊂ I}.
In our first examples we consider the case where J is generated by a single
element g. This arises in practice, for example, in the problem of homogenizing an
ideal. Suppose we consider the affine space curve parametrized by t 7→ (t, t2 , t3 ).
The ideal of polynomials vanishing on the curve is easily seen to be (b − a2 , c − a3 )
(where we have taken a, b, c as the coordinates of affine space). To find the projective
closure of the curve in P3 , we must homogenize these equations with respect to
a new variable d, getting dc − a2 , d2 c − a3 . But these forms do NOT define the
projective closure! In general, homogenizing the generators of the ideal I of an
affine variety one gets an ideal I1 that defines the projective closure UP TO a
component supported on the hyperplane at infinity (the hyperplane d = 0). To
see the ideal of the closure we must remove any such components, for example
by replacing I1 by the union I2 of all the ideals (I1 : dn ), where n ranges over
positive integers. This is not so hard as it seems: First of all, we can successively
compute the increasing sequence of ideals (I1 : d), (I1 : d2 ), . . . until we get two
that are the same; all succeeding ones will be equal, so we have found the union.
A second method involves a special property of the reverse lex order, and is much
more efficient in this case. We shall illustrate both. First we set up the example
above:
i58 : R = KK[a,b,c,d]
o58 = R
o58 : PolynomialRing
i59 : I1 = ideal(d*c-a^2, d^2*c-a^3)
2
3
2
o59 = ideal (- a + c*d, - a + c*d )
o59 : Ideal of R
6. ELEMENTARY USES OF GROEBNER BASES
163
How to compute the ideal quotient: If I is generated by f1 , . . . , fn , we see that
s ∈ (I : g) iff there are ring elements ri such that
n
X
ri fi + sg = 0.
i=1
Thus it suffices to compute the kernel (syzygies) of the 1 × (n + 1) matrix
(f1 , ..., fn , g)
and collect the coefficients of g, that is, the entries of the last row of a matrix
representing the kernel. Thus in our case we may compute (I1 : d) by concatenating
the matrix for I1 with the single variable d
i60 : I1aug = (gens I1) | matrix{{d}}
o60 = {0} | -a2+cd -a3+cd2 d |
1
3
o60 : Matrix R <--- R
i61 : augrelations = gens ker I1aug
o61 = {2} | d
-a
|
{3} | 0
1
|
{1} | a2-cd ac-cd |
3
2
o61 : Matrix R <--- R
There are 3 rows (numbered 0,1,2 !) and 2 columns, so to extract the last row
we may do
i62 : I21 = submatrix(augrelations, {2}, {0,1})
o62 = {1} | a2-cd ac-cd |
1
2
o62 : Matrix R <--- R
But this is not an “ideal” properly speaking: first of all, it is a matrix, not an
ideal, and second of all its target is not R1 but R(−1), the free module of rank 1
with generator in degree 1. We can fix both of these problems by
i63 : I21 = ideal I21
2
o63 = ideal (a - c*d, a*c - c*d)
o63 : Ideal of R
This is larger than the original ideal, having two quadratic generators instead
of a quadric and a cubic, so we continue. Instead of doing the same computation
again, we introduce the built-in command
i64 : I22 = I21 : d
2
2
o64 = ideal (a - c*d, a*c - c*d, c - c*d)
o64 : Ideal of R
164
6. ELEMENTARY USES OF GROEBNER BASES
which is again larger than I21, having three quadratic generators. Repeating,
i65 : I23 = I22 : d
2
2
o65 = ideal (a - c*d, a*c - c*d, c - c*d)
o65 : Ideal of R
we get another ideal with three quadratic generators. It must be the same as
I21, but the generators are written differently because of the route taken to get it,
so (being suspicious) we might check with
i66 : (gens I23) % (gens I22)
o66 = 0
1
3
o66 : Matrix R <--- R
which returns 0, showing that I23 is contained in (gives remainder 0 when
divided by) I22. Thus the homogeneous ideal I2 of the projective closure is equal
to I23 (this is the homogeneous ideal of the twisted cubic, already encountered
above).
A more perspicuous way of approaching the computation of the union of the
(I : dn ), which is called the saturation of I with respect to d, and written (I : d∞ ),
is first to compute a reverse lex Groebner basis.
i67 : gens gb I1
o67 = {0} | a2-cd acd-cd2 c2d2-cd3 |
1
3
o67 : Matrix R <--- R
This yields (a2-cd, acd-cd2, c2d2-cd3), meaning
(a2 − cd, acd − cd2 , c2 d2 − cd3 ).
We see that the second generator is divisible by d, and the third is divisible by d2 .
General theory says that we get the right answer simply by making these divisions,
that is, the saturation is
(a2 − cd, ac − cd, c2 − cd),
as previously computed. The same thing can be accomplished in one line by
i68 : I2 = divideByVariable(gens gb I1,d)
o68 = {0} | a2-cd ac-cd c2-cd |
1
3
o68 : Matrix R <--- R
This saturation may be found directly in Macaulay2:
i69 : saturate(I1, d)
2
2
o69 = ideal (a - c*d, a*c - c*d, c - c*d)
o69 : Ideal of R
CHAPTER 7
Canonical Embeddings of Plane Curves and
Gonality
MATHEMATICAL BACKGROUND
The gonality of a curve is defined to be the smallest degree of a morphism from
the curve to the projective line P1 . It is known that a curve C of genus g admits
a map to P1 of degree at most [(g + 3)/2]. Further, if C is d-gonal, then in its
canonical embedding C lies on a rational normal scroll of dimension d − 1, and the
free resolution of the homogeneous coordinate ring of the scroll is a subcomplex of
the free resolution of the homogeneous coordinate ring of C. Thus for example the
2-linear part of that resolution has length at least g − d, and “Green’s Conjecture”
states that if one computes Clifford index instead of gonality, a slight refinement,
then equality holds. For example, Green’s conjecture predicts that the resolution
of the homogeneous coordinate ring of a general curve of genus 7 and gonality 4 is:
-total: 1 10 25 25 10 1
-0: 1 . . . . .
-1: . 10 16 9 . .
-2: . . 9 16 10 .
-3: . . . . . 1
(Green’s conjecture has actually been proven by Frank Schreyer in this case; in
any case the result that the two-linear part is AT LEAST as long as predicted in
Green’s conjecture is easy.)
If a curve can be represented as a plane curve of degree e with an ordinary
multiple point (that is, the branches have distinct tangents) of multiplicity m, then
projection from the point defines a map to P1 of degree e − m. In this example
we will illustrate the “principle” that this is often the gonality of the curve by
computing the canonical embedding and its resolution. To compute the canonical
embedding, we will use “adjunction”: the canonical series of a plane curve C of
degree e with only ordinary multiple points of degrees mi as singularities is obtained
as the linear series cut out by plane curves D of degree e − 3 passing through the
nodes with multiplicities mi − 1; at a tacnode of multiplicity 2 the condition is that
D passes through the singular point and is tangent to the tangent line of C at that
point.
We will make these computations for three types of plane sextic curves (of
genus seven):
C1 will have 3 ordinary nodes;
C2 will have one ordinary triple point;
C3 will have one tacnode and one ordinary node. Computation
We take C1 to be a curve of degree 6 having 3 ordinary double points:
i1 : R = ZZ/31991[a,b,c] -- the coordinate ring of P^2
o1 = R
165
166
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
o1 : PolynomialRing
We define the ideals of the points. We could write
i2 : ipoint1 = ideal matrix({{a,b}})
o2 = ideal (a, b)
o2 : Ideal of R
but the following shortcut is faster!
i3 : ipoint1 = ideal(a,b)
o3 = ideal (a, b)
o3 : Ideal of R
i4 : ipoint2 = ideal(a,c)
o4 = ideal (a, c)
o4 : Ideal of R
i5 : ipoint3 = ideal(b,c)
o5 = ideal (b, c)
o5 : Ideal of R
For a curve to be double at the 3 points, its equation must lie in the ideal
i6 : icurves1 = intersect(
ipoint1^2,
ipoint2^2,
ipoint3^2
)
2 2
2 2
2 2
o6 = ideal (a*b*c, a b , a c , b c )
o6 : Ideal of R
The matrix with the generators of icurves1 as its entries is obtained by
i7 : Icurves1 = gens icurves1
o7 = {0} | abc a2b2 a2c2 b2c2 |
1
4
o7 : Matrix R <--- R
We find the equation F1 of a general curve of degree 6 with these double points
by composing a random matrix of forms having the correct degree with the matrix
of generators of icurves1.
i8 : F1 = Icurves1 * random(source Icurves1, R^{-6})
o8 = {0} | 1548a4b2+10647a3b3-3147a2b4-8514a4bc-3567a3b2c+90 ...
1
1
o8 : Matrix R <--- R
i9 : betti F1
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
o9 = total:
0:
1:
2:
3:
4:
5:
1
1
.
.
.
.
.
167
1
.
.
.
.
.
1
o9 : Net
We now look for the equation F2 of C2, a curve with an ordinary triple point
at point1. It must lie in the cube of the ideal ipoint1.
i10 : Icurves2 = gens (ipoint1^3)
o10 = {0} | a3 a2b ab2 b3 |
1
4
o10 : Matrix R <--- R
i11 : F2 = Icurves2 * random(source Icurves2, R^{-6})
o11 = {0} | -4710a6+745a5b+14748a4b2+10410a3b3+5240a2b4+4785 ...
1
1
o11 : Matrix R <--- R
i12 : betti F2
o12 = total:
0:
1:
2:
3:
4:
5:
1
1
.
.
.
.
.
1
.
.
.
.
.
1
o12 : Net
Finally, the equation of a curve with a tacnode at a = b = 0 having tangent
line a − b = 0 there must lie in the ideal
i13 : i = ideal((a-b)^2) + (ipoint1^4)
2
2
4
3
2 2
3
4
o13 = ideal (a - 2a*b + b , a , a b, a b , a*b , b )
o13 : Ideal of R
and adding a node at point3 we get
i14 : icurves3 = intersect(i, ipoint3^2)
2 2
3
4
3
4
4
2
o14 = ideal (a b - 6a*b + 4b , a*b + 7997b , b , a b*c -
...
...
o14 : Ideal of R
i15 : Icurves3 = gens icurves3
o15 = {0} | a2b2-6ab3+4b4 ab3+7997b4 b4 a2bc-2ab2c+b3c a2c2- ...
168
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
1
5
o15 : Matrix R <--- R
so
i16 : F3 = Icurves3 * random(source Icurves3, R^{-6})
o16 = {0} | -1064a4b2-3102a3b3+4225a2b4+1779ab5+13458b6+1342 ...
1
1
o16 : Matrix R <--- R
i17 : betti F3
o17 = total:
0:
1:
2:
3:
4:
5:
1
1
.
.
.
.
.
1
.
.
.
.
.
1
o17 : Net
It is evident from the discussion above that C1 and C3 have gonality ≤ 5 (indeed,
every curve of genus 7 has gonality ≤ 5) and that C2 has gonality ≤ 4. We can
establish lower bounds for the gonalities by looking at the canonical embeddings.
The canonical series of C1 is cut out by
i18 : can1 = basis(3, intersect(
ipoint1,ipoint2,ipoint3)
)
o18 = {2} | a b c 0 0 0 0 |
{2} | 0 0 0 a c 0 0 |
{2} | 0 0 0 0 0 b c |
o18 : Matrix
Some explanation regarding the basis command is needed here. can1 is a
matrix whose target is the ideal of the intersection of these three points:
i19 : target can1
o19 = image {0} | ab ac bc |
1
o19 : R - module, submodule of R
and whose source is a free module over the coefficient ring:
i20 : source can1
7
o20 = R
o20 : R - module, free
For our purposes, there are two problems with this. The first is that we want
a map where both the source and target have the base ring R. This can be accomplished by tensoring with R:
i21 : can1 = can1 ** R
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
169
o21 = {2} | a b c 0 0 0 0 |
{2} | 0 0 0 a c 0 0 |
{2} | 0 0 0 0 0 b c |
o21 : Matrix
The second problem is that the image of a basis element is not obviously in the
ideal: it is represented in terms of the generators of I. This can be alleviated by
applying super: this takes a homomorphism f : M → N , where N is a submodule
of a quotient module F/I, and returns the homomorphism f : M → F/I.
i22 : can1 = super can1
o22 = {0} | a2b ab2 abc a2c ac2 b2c bc2 |
1
7
o22 : Matrix R <--- R
similarly, for C2 and C3:
i23 : can2 = basis(3, ipoint1^2)
o23 = {2} | a b c 0 0 0 0 |
{2} | 0 0 0 b c 0 0 |
{2} | 0 0 0 0 0 b c |
o23 : Matrix
i24 : can2 = super (can2 ** R)
o24 = {0} | a3 a2b a2c ab2 abc b3 b2c |
1
7
o24 : Matrix R <--- R
i25 : can3 = basis(3, intersect(
ideal(a-b) + ipoint1^2,
ipoint3)
)
o25 = {2} | a b c 0 0 0 0 |
{2} | 0 0 0 b c 0 0 |
{2} | 0 0 0 0 0 a c |
o25 : Matrix
i26 : can3 = super (can3 ** R)
o26 = {0} | a2b ab2 abc b3 b2c a2c-abc ac2-bc2 |
1
7
o26 : Matrix R <--- R
These should all give embeddings of the curves in P6 , so we expect them to be
linear series of vector space dimension 7. Here’s how to check:
i27 : betti
can1
o27 = total: 1 7
0: 1 .
1: . .
170
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
2: . 7
o27 : Net
i28 : betti
can2
o28 = total:
0:
1:
2:
1
1
.
.
7
.
.
7
o28 : Net
i29 : betti
can3
o29 = total:
0:
1:
2:
1
1
.
.
7
.
.
7
o29 : Net
To compute the homogeneous coordinate rings of the canonical curves, we must
find the algebraic relations among the generators of cani modulo Fi.
The coordinate ring of P6
i30 : S = (coefficientRing R)[x_0..x_6]
o30 = S
o30 : PolynomialRing
Find the canonical ideal IC1 of C1, that is, the kernel of the map S → R/(F 1)
defined by the canonical series.
i31 : T1 = R/ideal F1
o31 = T1
o31 : QuotientRing
i32 : f1 = map(T1,S,substitute(can1, T1))
2
2
2
2
2
2
o32 = map(T1,S,{a b, a*b , a*b*c, a c, a*c , b c, b*c })
o32 : RingMap T1 <--- S
i33 : IC1 = mingens ker f1
o33 = {0} | x_0^2-3899x_0x_1-1056x_1^2+15990x_0x_3-9736x_1x_ ...
1
10
o33 : Matrix S <--- S
and similarly for C2, C3
i34 : T2 = R/ideal F2
o34 = T2
o34 : QuotientRing
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
171
i35 : f2 = map(T2,S,substitute(can2, T2))
3
2
2
2
3
2
o35 = map(T2,S,{a , a b, a c, a*b , a*b*c, b , b c})
o35 : RingMap T2 <--- S
i36 : IC2 = mingens ker f2
o36 = {0} | x_1^2-x_0x_3 x_1x_2-x_0x_4 x_1x_3-x_0x_5 x_2x_3- ...
1
14
o36 : Matrix S <--- S
i37 : T3 = R/ideal F3
o37 = T3
o37 : QuotientRing
i38 : f3 = map(T3,S,substitute(can3, T3))
2
2
3
2
2
2 ...
o38 = map(T3,S,{a b, a*b , a*b*c, b , b c, a c - a*b*c, a*c ...
o38 : RingMap T3 <--- S
i39 : IC3 = mingens ker f3
o39 = {0} | x_0^2+8602x_0x_1-13985x_0x_3+2554x_1x_3-8732x_3^ ...
1
10
o39 : Matrix S <--- S
We now find the 2-linear part of the free resolution of IC1 and its betti numbers.
i40 : IC1res = res(coker IC1)
1
10
25
25
10
1
o40 = S <-- S
<-- S
<-- S
<-- S
<-- S
0
1
2
3
4
5
o40 : ChainComplex
i41 : betti
IC1res
o41 = total:
0:
1:
2:
3:
1
1
.
.
.
10
.
10
.
.
25
.
16
9
.
25
.
9
16
.
10
.
.
10
.
1
.
.
.
1
o41 : Net
From this computation, and the easy implication of Green’s conjecture explained above, we see that the gonality of C1 is exactly 4, the gonality of the linear
series obtained by projection from any one of the three double points. We now do
the same for IC2 and IC3:
i42 : IC2res = res(coker IC2)
172
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
1
14
35
35
14
1
o42 = S <-- S
<-- S
<-- S
<-- S
<-- S
0
1
2
3
4
5
o42 : ChainComplex
i43 : betti
IC2res
o43 = total:
0:
1:
2:
3:
4:
1
1
.
.
.
.
14
.
10
4
.
.
35
.
20
15
.
.
35
.
15
20
.
.
14
.
4
10
.
.
1
.
.
.
1
.
o43 : Net
i44 : IC3res = res(coker IC3)
1
10
25
25
10
1
o44 = S <-- S
<-- S
<-- S
<-- S
<-- S
0
1
2
3
4
5
o44 : ChainComplex
i45 : betti
IC3res
o45 = total:
0:
1:
2:
3:
1
1
.
.
.
10
.
10
.
.
25
.
16
9
.
25
.
9
16
.
10
.
.
10
.
1
.
.
.
1
o45 : Net
and we find that in the tacnodal case the gonality is still 4, while in the triple
point case the gonality is 3. Note that we could have made the computation faster,
as in the following example. In these cases the resolution is so fast that the speedup
is not noticeable, but in larger cases it would be worthwhile. First clear the info
computed in IC1
i46 : IC1 = matrix entries IC1
o46 = {0} | x_0^2-3899x_0x_1-1056x_1^2+15990x_0x_3-9736x_1x_ ...
1
10
o46 : Matrix S <--- S
Now redo the resolution, this time bounding the degree to which the computation is carried.
i47 : IC1res = res(coker IC1, DegreeLimit => {1})
1
10
25
25
10
1
o47 = S <-- S
<-- S
<-- S
<-- S
<-- S
0
1
2
3
4
5
7. CANONICAL EMBEDDINGS OF PLANE CURVES AND GONALITY
173
o47 : ChainComplex
i48 : betti IC1res
o48 = total:
0:
1:
2:
3:
1
1
.
.
.
10
.
10
.
.
25
.
16
9
.
25
.
9
16
.
10
.
.
10
.
1
.
.
.
1
o48 : Net
Instead of computing the canonical model of C1 directly, we could have treated
the structure sheaf of C1 as a sheaf on the projective plane, and compute its pushForward under the map to P6 given by can1 (the image of the plane under this
map is a Del Pezzo surface on which the canonical curve lies.) This is done as
follows:
i49 : ff1 = map(R,S,can1)
2
2
2
2
2
2
o49 = map(R,S,{a b, a*b , a*b*c, a c, a*c , b c, b*c })
o49 : RingMap R <--- S
i50 : trim ideal pushForward1(ff1,coker F1)
2
2
...
o50 = ideal (x - 3899x x - 1056x + 15990x x - 9736x x - ...
0
0 1
1
0 3
1 3
...
o50 : Ideal of S
CHAPTER 8
Fano varieties
Given a variety X in projective r-space Pr , the Fano scheme F anok (X) is the
natural parameter space for the linear k-planes lying on X. In this tutorial we
explore the methods for computing it. The tutorial is in three parts
A. The twenty-seven lines
B. General methods
C. Surfaces of degree 4 in P5
In section A, we treat by hand the Fano variety of lines on a nonsingular cubic
surface in P3 , and find that there are indeed 27 lines lying on the surface.
In section B, we explain a general purpose function, written to compute Fano
schemes.
There are (up to linear transformations) just 3 nondegenerate smooth surfaces
of degree 4 in P5 : the Veronese embedding of P2 and the rational normal scrolls
S(1, 3) and S(2, 2). Can they be distinguished by their Fano varieties of lines? To
find out, read section C ! A. Lines on the nonsingular cubic in P3
First make the homogeneous coordinate ring of the ambient projective 3-space
i1 : R = ZZ/32003[a,b,c,d]
o1 = R
o1 : PolynomialRing
and the ideal of a nonsingular cubic
i2 : X = ideal(a^3+b^3+c^3+d^3)
3
3
3
3
o2 = ideal(a + b + c + d )
o2 : Ideal of R
We make a parametrized indeterminate line in our projective space, adding
parameters s, t for the line and two points p0 ..p3 and q0 ..q3 representing the points
0 and infinity on the line.
i3 : KK = coefficientRing R
o3 = KK
o3 : QuotientRing
i4 : S = KK [s,t,p_0..p_3,q_0..q_3]
o4 = S
o4 : PolynomialRing
175
176
8. FANO VARIETIES
Then we make a map F from R to the new ring sending the variables to the
coordinates of the general point on the line
i5 : F = map(S,R,
s*matrix{{p_0..p_3}} +
t*matrix{{q_0..q_3}}
)
o5 = map(S,R,{s*p + t*q , s*p + t*q , s*p + t*q , s*p +
0
0
1
1
2
2
3
...
...
o5 : RingMap S <--- R
We now apply F to the ideal of X
i6 : FX = F X
3 3
3 3
3 3
3 3
2
2
2
2 ...
o6 = ideal(s p + s p + s p + s p + 3s t*p q + 3s*t p q ...
0
1
2
3
0 0
0 0 ...
o6 : Ideal of S
and the condition we want becomes the condition that FX vanishes identically
in s, t. The following line produces the coefficients:
i7 : cFX = (coefficients({0,1},gens FX))_1
o7 = {0} | p_0^3+p_1^3+p_2^3+p_3^3 3p_0^2q_0+3p_1^2q_1+3p_2^ ...
1
4
o7 : Matrix S <--- S
The interface to the coefficients routine is a bit baroque, and might change
in the future. For now, the {0, 1} says to find the coefficients of each column of the
matrix, with respect to the first two variables. The routine returns a list of two
matrices, the second one being the one we need (index 1, since all indices start at
0 in Macaulay2)
We can get rid of some of the variables of S, to ease the computation:
i8 : S1 = KK[p_0..p_3,q_0..q_3]
o8 = S1
o8 : PolynomialRing
i9 : cFX = substitute(cFX, S1)
o9 = {0} | p_0^3+p_1^3+p_2^3+p_3^3 3p_0^2q_0+3p_1^2q_1+3p_2^ ...
1
4
o9 : Matrix S1 <--- S1
The ring we want is the quotient
i10 : S1bar = S1/ideal cFX
o10 = S1bar
o10 : QuotientRing
8. FANO VARIETIES
177
Now we want to move to the Grassmannian, so we take a new polynomial ring
in 6 variables that will correspond to the minors of the matrix with rows p0 ..p3 and
q0 ..q3 ,
i11 : GR = coefficientRing R[x_0..x_5]
o11 = GR
o11 : PolynomialRing
We define a map sending the xi to the minors, regarded as elements of S1bar
i12 : M = substitute(
exteriorPower(2, matrix{{p_0..p_3},{q_0..q_3}}),
S1bar)
o12 = {0} | -p_1q_0+p_0q_1 -p_2q_0+p_0q_2 -p_2q_1+p_1q_2 -p_ ...
1
6
o12 : Matrix S1bar <--- S1bar
i13 : gr = map (S1bar, GR, M)
o13 = map(S1bar,GR,{- p q + p q , - p q + p q , - p q + p ...
1 0
0 1
2 0
0 2
2 1
...
o13 : RingMap S1bar <--- GR
i14 : fano = trim ker gr
3
3
3
2
2
o14 = ideal (x x - x x + x x , x - x - x , x x - x x ,
2 3
1 4
0 5
0
2
4
0 1
4 5
...
...
...
o14 : Ideal of GR
trim replaces the given set of generators with a minimal set of generators. We
get an ideal representing points:
i15 : codim fano
o15 = 5
and the number of these points – the number of the corresponding lines - is 27:
i16 : degree fano
o16 = 27
It is interesting to note that the ideal of the Fano scheme that we have produced
is NOT saturated, as the number (25) of cubics it contains is less than 56−27 = 29:
i17 : betti fano
o17 = generators: total:
0:
1:
2:
1 20
1 .
. 1
. 19
o17 : Net
Possible next steps in this computation would be to compute the Jacobian ideal
of Fano to show that we really got 27 distinct lines, etc. B. General methods
178
8. FANO VARIETIES
The first step in writing a program is to decide what the program should do,
and it is just as well to write the documentation at this point .
First, Fano and Grassmannian are commands in Macaulay 2, so are a protected
symbol. We remove its current meaning by
i18 : erase symbol Fano
o18 = Fano
o18 : Symbol
i19 : erase symbol Grassmannian
o19 = Grassmannian
o19 : Symbol
The documentation has the following form:
i20 : document { Fano,
TT "Fano(k,X,GR) or Fano(k,X)", " -- computes ...
the ideal of a Fano scheme in the Grassmannian ...
PARA,
"Given an ideal X representing a projective va ...
in P^r, a positive integer k<r, and optionally ...
ring GR with (exactly) r+1 choose k+1 variable ...
representing the ambient space of the Grassman ...
k-planes in P^r, this routine returns the idea ...
GR of the Fano scheme that parametrizes the k- ...
lying on X. If the optional third argument is ...
present, the routine fabricates its own local ...
and returns an ideal over it."
}
If we take the variety that is the whole of Pr , we get the Grassmannian. It is
useful to be able to make the ring representing the ambient space of the Grassmannian beforehand by hand, so the ideals of several Fano varieties can be compared.
But often we won’t need this. Thus we make the function capable of accepting this
ambient ring as an argument, or of fending for itself if no ambient ring is given.
i21 : document{symbol Grassmannian,
TT "Grassmannian(k,r,R) or
Grassmannian(k,r)",
"-- Given natural numbers k <= r,
and optionally a ring R with at least binomial ...
variables, the routine defines the ideal of th ...
Grassmannian of projective k-planes in P^r, us ...
the first binomial(r+1,k+1) variables of R.
If R is not given, the routine makes and uses
ZZ/31991[vars(0..binomial(r+1,k+1)-1]."
}
In order to make Fano handle an optional number of arguments, we make it a
method instead of a function, as follows
i22 : Fano = method()
o22 = Fano
o22 : Function
8. FANO VARIETIES
Here is the code for the first case, with comments interspersed:
i23 : Fano(ZZ,Ideal,Ring) := (k,X,GR) -> (
-- Get info about the base ring of X:
-- The coefficient ring (to make new rings of
-- the same characteristic, for example)
-- and the number of variables
KK:=coefficientRing ring X;
r := (numgens ring X) - 1;
-- Next make private variables for our
-- intermediate rings, to avoid interfering
-- with something outside:
t:=symbol t;
p:=symbol p;
-- And rings
S1 := KK[t_0..t_k];
S2 := KK[p_0..p_(k*r+k+r)];
S := tensor(S1,S2);
-- Over S we have a generic point of a generic
-- line, represented by a row vector, which
-- we use to define a map from the base ring
-- of X
F := map(S,ring X,
genericMatrix(S,S_0,1,k+1)*
genericMatrix(S,S_(k+1),k+1,r+1)
);
-- We now apply F to the ideal of X
FX := F X;
-- and the condition we want becomes the condition
-- that FX vanishes identically in the t_i.
-- The following line produces the matrix of
-- coefficients of the monomials in the
-- variables labelled 0..k:
cFX := (coefficients
(toList(0..k),gens FX))_1;
-- We can get rid of the variables t_i
-- to ease the computation:
cFX = substitute(cFX, S2);
-- The ring we want is the quotient
S2bar := S2/ideal cFX;
-- Now we want to move to the Grassmannian,
-- represented by the ring GR
-- We define a map sending the variables of GR
-- to the minors of the generic matrix in the
-- p_i regarded as elements of S1bar
gr := map(S2bar,GR,
exteriorPower(k+1,
genericMatrix(S2bar,S2bar_0,k+1,r+1)
)
);
-- and the defining ideal of the Fano variety is
ker gr
)
o23 = --Function[stdio:51:100]-o23 : Function
The second case reduces to the first:
i24 : Fano(ZZ, Ideal) := (k,X) -> (
179
180
8. FANO VARIETIES
KK:=coefficientRing ring X;
r := (numgens ring X) - 1;
-- We can specify a private ring with binomial(r+1,k ...
-- variables as follows
GR := KK[Variables => binomial(r+1,k+1)];
-- the work is done by
Fano(k,X,GR)
)
o24 = --Function[stdio:102:109]-o24 : Function
With the 0 ideal we get the Grassmannian of projective k-planes in Pr :
i25 : Grassmannian = method()
o25 = Grassmannian
o25 : Function
i26 : Grassmannian(ZZ,ZZ,Ring) := (k,r,R) ->(
KK := coefficientRing R;
RPr := KK[Variables => r+1];
Pr := ideal(0_RPr);
Fano(k,Pr)
)
o26 = --Function[stdio:112:116]-o26 : Function
i27 : Grassmannian(ZZ,ZZ) := (r,k) -> (
R := ZZ/31991[
vars(0..(binomial(r+1,k+1)-1))
];
Grassmannian(k,r,R)
)
o27 = --Function[stdio:118:122]-o27 : Function
As a first example we can try the Fano of lines on the nonsingular quadric in
P3
i28 : KK = ZZ/31991
o28 = KK
o28 : QuotientRing
i29 : R = KK[a,b,c,d]
o29 = R
o29 : PolynomialRing
i30 : X = ideal(a*b-c*d)
o30 = ideal(a*b - c*d)
8. FANO VARIETIES
181
o30 : Ideal of R
i31 : I = Fano(1,X)
2
2
...
o31 = ideal ($x $x , $x $x , $x - $x , $x $x + 15995$x $x ...
1 3
2 4
0
5
1 4
0 5 ...
o31 : Ideal of KK [$x , $x , $x , $x , $x , $x ]
0
1
2
3
4
5
we investigate by checking its dimension and degree
i32 : dim I
o32 = 2
The answer “2” means that I is the ideal of a curve in P5 , the ambient space
of the Grassmannian of lines.
i33 : degree I
o33 = 4
The answer is 4. In fact, the ideal I represents the union of two conics. C.
Surfaces of degree 4 in P5
We now turn to the three surfaces of degree 4 in P5 , and make their ideals:
The ring of P5
i34 : KK = ZZ/31991
o34 = KK
o34 : QuotientRing
i35 : P5 = KK[a..f]
o35 = P5
o35 : PolynomialRing
It happens that the ideals of all three surfaces are generated by minors of
suitable matrices:
The Veronese embedding of P2 :
i36 : MVero = genericSymmetricMatrix(P5,a,3)
o36 = {0} | a b c |
{0} | b d e |
{0} | c e f |
3
3
o36 : Matrix P5 <--- P5
i37 : Vero = minors(2,MVero)
2
...
o37 = ideal (- b + a*d, - b*c + a*e, - c*d + b*e, - b*c + a ...
o37 : Ideal of P5
182
8. FANO VARIETIES
The other scrolls are defined by the minors of matrices that are made from
“catalecticant” blocks, that is, from matrices such as
b c d e
c d e f
which are manufactured by
i38 : catalecticant = (R,v,m,n) ->
map(R^m,n,(i,j)-> R_(i+j+v))
o38 = catalecticant
o38 : Function
for example
i39 : catalecticant(P5,1,2,4)
o39 = {0} | b c d e |
{0} | c d e f |
2
4
o39 : Matrix P5 <--- P5
produces the example above. The rational normal scroll S13, which is the union
of lines joining a line with the corresponding points of a twisted cubic in a disjoint
subspace of P5
i40 : M13 = catalecticant(P5,0,2,1) |
catalecticant(P5,2,2,3)
o40 = {0} | a c d e |
{0} | b d e f |
2
4
o40 : Matrix P5 <--- P5
i41 : S13 = minors(2,M13)
2
...
o41 = ideal (- b*c + a*d, - b*d + a*e, - d + c*e, - b*e + a ...
o41 : Ideal of P5
Finally, the rational normal scroll S22, which is made by a similar construction
starting with two conics in P5
i42 : M22 = catalecticant(P5,0,2,2) |
catalecticant(P5,3,2,2)
o42 = {0} | a b d e |
{0} | b c e f |
2
4
o42 : Matrix P5 <--- P5
i43 : S22 = minors(2, M22)
2
...
o43 = ideal (- b + a*c, - b*d + a*e, - c*d + b*e, - b*e + a ...
o43 : Ideal of P5
8. FANO VARIETIES
183
It is interesting to note that the numerical invariants of these surfaces are very
hard to distinguish. In particular, the graded betti numbers
i44 : Verores = res coker gens Vero
1
6
8
3
o44 = P5 <-- P5 <-- P5 <-- P5
0
1
2
3
o44 : ChainComplex
i45 : S22res = res coker gens S22
1
6
8
3
o45 = P5 <-- P5 <-- P5 <-- P5
0
1
2
3
o45 : ChainComplex
i46 : S13res = res coker gens S13
1
6
8
3
o46 = P5 <-- P5 <-- P5 <-- P5
0
1
2
3
o46 : ChainComplex
i47 : betti Verores
o47 = total:
0:
1:
2:
1
1
.
.
6
.
6
.
8
.
8
.
3
.
3
.
o47 : Net
i48 : betti S22res
o48 = total: 1 6 8 3
0: 1 . . .
1: . 6 8 3
o48 : Net
i49 : betti S13res
o49 = total: 1 6 8 3
0: 1 . . .
1: . 6 8 3
o49 : Net
coincide, so the three cannot be distinguished on the basis of these or on the
basis of the (weaker) invariants the Hilbert series or Hilbert polynomials. But the
Fano varieties are more obviously different:
We compute the Fano varieties of lines on each of our surfaces.
i50 : FVero = Fano(1, Vero)
184
8. FANO VARIETIES
2
...
o50 = ideal ($x , $x $x , $x $x , $x $x , $x $x , $x $x , $x ...
3
0 6
0 8
3 6
0 9
3 9
...
o50 : Ideal of KK [$x , $x , $x , $x , $x , $x , $x , $x , $ ...
0
1
2
3
4
5
6
7
...
i51 : betti gens FVero
o51 = total: 1 120
0: 1
.
1: . 120
o51 : Net
The ideal contains all 120 quadrics, and represents the empty set: The Veronese
surface contains no lines!
i52 : FS13 = Fano(1, S13)
...
o52 = ideal ($x $x , $x $x , $x $x , $x $x , $x $x , $x $x , ...
0 2
1 5
0 4
1 8
1 9
0 7 ...
o52 : Ideal of KK [$x , $x , $x , $x , $x , $x , $x , $x , $ ...
0
1
2
3
4
5
6
7
...
It turns out that the dimension (1) and degree (4) of these varieties coincide! Moreover, since the ideals are not saturated, one cannot directly compare
the Hilbert series or free resolutions (of course one could first compute a saturation). But there is the arithmetic genus, that is, 1 − H(0), where H is the Hilbert
polynomial.
i53 : hilbertPolynomial coker gens FS13
o53 = - 2*P + 4*P
0
1
o53 : ProjectiveHilbertPolynomial
The output, 4P1 − 2P0 , means “four times the Hilbert polynomial of the
projective line minus 2”; that is, the polynomial is H(d) = 4d + 2; so arithmetic
genus is −1.
i54 : FS22 = Fano(1, S22)
2
...
o54 = ideal ($x , $x $x , $x $x , $x $x , $x $x , $x $x
...
1
3 9
3 13
0 10
1 10
0 12 ...
o54 : Ideal of KK [$x , $x , $x , $x , $x , $x , $x , $x , $ ...
0
1
2
3
4
5
6
7
...
i55 : hilbertPolynomial coker gens FS22
o55 = - 3*P + 4*P
0
1
o55 : ProjectiveHilbertPolynomial
8. FANO VARIETIES
185
The output, 4P1 − 3P0 , means H(d) = 4d + 1, arithmetic genus −1. In
fact, the Fano variety of S22 consists of a projective line, embedded as a smooth
rational quartic; while the Fano variety of S13 consists of a smooth rational quartic
(corresponding to the rulings of the surface S13 and an isolated point, corresponding
to the section of negative self-intersection on the surface).
CHAPTER 9
Divisors
In this tutorial we describe one way to represent divisors on a smooth projective subvariety X of Pr , and show methods for computing the group operations,
computing the vector space of sections, and determining whether two divisors are
linearly equivalent. We also construct the canonical divisor on X.
We consider smooth varieties only, although most of this can be extended to
normal varieties. Cartier and Weil divisors on normal varieties might be the subject
of a further tutorial.
Other possible future topics would be: intersection numbers, determining whether
a divisor is very ample, and finding the base point locus of the divisor class.
The simplest case is when the homogeneous coordinate ring SX of X satisfies
the S2 condition of Serre: We say that a domain R is S2 if every proper nonzero
principal ideal has pure codimension 1 (all associated primes of the ideal are of
codimension 1).
In this tutorial, we consider the case when this holds (e.g. this holds for complete intersections). In a further tutorial, we will make the necessary extensions to
handle the non S2 -case.
An example that we will use throughout is the plane cubic curve E, whose
homogenoeus coordinate ring is SE:
i1 : KK = ZZ/31991
o1 = KK
o1 : QuotientRing
i2 : SE = KK[x,y,z]/(y^2*z - x*(x-z)*(x+3*z))
o2 = SE
o2 : QuotientRing
The sections in this tutorial are
A. Representation of divisors
B. Group operations on divisors
C. Global Sections
D. Linear Equivalence
E. The canonical divisor A. Representation of divisors
Let X be a smooth irreducible variety. A (Weil) divisor on X is an integral
linear combination of irreducible subvarieties of X of codimension 1. The divisor
is called effective if all the coefficients are non-negative. To any ideal I in the
homogeneous coordinate ring SX of X we associate the effective divisor that is the
187
188
9. DIVISORS
sum of the pure codimension 1 components of I, each taken with the multiplicity
it has in the primary decomposition of I.
Let D = E −F be a divisor, where E and F are effective. Because X is normal,
there is a unique homogeneous ideal I in SX such that V (I) = E, and I is either
(1), or has pure codimension one. Similarly, there is a unique such ideal J with
V (J) = F . Our plan is to represent the divisor D by the pair of ideals (I, J).
This representation is not unique. If (I, J) and (I 0 , J 0 ) are two pairs of ideals
(such that each ideal is either (1) or has pure codimension one), then (I, J) and
(I 0 , J 0 ) represent the same divisor iff
sat(IJ 0 ) = sat(I 0 J),
where sat(K) is the saturation of K (the largest ideal L such that a power of the
irrelevant ideal times L is in K) Write (I, J) ≡ (I 0 , J 0 ) if sat(IJ 0 ) = sat(I 0 J).
This correspondence defines a bijection between Div(X) and {(I, J) | I, J are
homogeneous ideals in SX either trivial, or pure codim one}/ ≡.
As we will often have to saturate ideals of codimension 1, we give here the
most efficient method we know, which has the additional advantage of throwing
away all components not of codimension 1. That is, we define purify1S2(I), a
function that takes an arbitary ideal I in a ring satisfying S2 , and returns the ideal
which is the intersection of the codimension 1 primary components of I. In the
next divisor tutorial (not yet written), we will write a routine purify1(I) which
does not require the ring to be S2 .
i3 : purify1S2 = I -> (
-- Assuming ring I is S2, and I is not 0, returns t
-- pure codimension 1 part of I.
-- Find a nonzero element of I:
M := compress gens I;
-- Explanation: gens I is
-- the matrix of generators of I; compress
-- removes the entries that are 0
-- and := makes M a local variable.
if numgens source M == 0 then error "Ideal is zero!
f := ideal(M_(0,0));
-- f is the ideal generated by the first entry.
-- Since ring I is S2, the ideal f is
-- pure codimension 1. Thus
f:(f:I)
-- is the pure codimension 1 part. (The last
-- expression given in a function is the returned
-- value. The symbol ; is the statement separator
-- (by definition!) we cannot put a ; after the las
)
o3 = purify1S2
o3 : Function
For example, in the ring
i4 : R = ZZ/5[a,b]
o4 = R
o4 : PolynomialRing
we have
...
...
...
...
9. DIVISORS
189
i5 : purify1S2(ideal(a^2,a*b))
o5 = ideal a
o5 : Ideal of R
Throughout this tutorial, we will treat divisors as equivalence classes of pairs,
and our operations will operate on pairs. So let’s define a divisor type in Macaulay2.
The following declaration provides a new data type, the Divisor.
i6 : Divisor = new Type of List
o6 = Divisor
o6 : Type
Let’s write a routine to create a divisor, from either a single ideal, or a pair of
ideals. (This routine should check that its arguments are pure codimension one, or
trivial, and in the same ring, but we will ignore that).
Defining divisor to be a method allows us to define different versions of this
routine which take different arguments.
i7 : divisor = method()
o7 = divisor
o7 : Function
The following allows us to define an object of class Divisor from a pair of
ideals.
i8 : divisor(Ideal,Ideal) := (I,J) ->
new Divisor from {purify1S2 I,purify1S2 J}
o8 = --Function[stdio:27:28]-o8 : Function
The following routine defines an (effective) divisor from a single ideal.
i9 : divisor Ideal := (I) -> divisor(I, ideal(1_(ring I)))
o9 = --Function[stdio:29:29]-o9 : Function
The divisors of some rational points on the elliptic curve E include
i10 : P = divisor ideal(x,z)
o10 = {ideal (x, z), ideal 1}
o10 : Divisor
i11 : R = divisor ideal(x,y)
o11 = {ideal (x, y), ideal 1}
o11 : Divisor
i12 : R1 = divisor ideal(x-z,y)
190
9. DIVISORS
o12 = {ideal (x - z, y), ideal 1}
o12 : Divisor
i13 : R2 = divisor ideal(x+3*z,y)
o13 = {ideal (x + 3z, y), ideal 1}
o13 : Divisor
i14 : Q1 = divisor ideal(y-6*z, x-3*z)
o14 = {ideal (x - 3z, y - 6z), ideal 1}
o14 : Divisor
Testing equality of divisors is often made simpler by having a “normal form”
for divisors. The normal form of a divisor D is E − F where E and F are both
effective and have disjoint support. It is easy to see that the normal form of (I, J)
is (I : J, J : I).
In the following code, the expressions D#0 and D#1 refer to the first and second ideals in the list representing D. (D#0 is the first because Macaulay2 counts
everything starting from 0.)
i15 : normalForm = method()
o15 = normalForm
o15 : Function
Two pairs (I, J), (I 0 , J 0 ) define the same divisor exactly when their normal
forms are equal. The following code establishes a method for testing the equality
of divisors. The last line tests the two equalities of ideals that are necessary.
i16 : normalForm Divisor := (D) ->
new Divisor from {D#0 : D#1, D#1 : D#0}
o16 = --Function[stdio:36:37]-o16 : Function
We shall later show that with R1 and R2 as above, the divisor (R1 + R2) - R1
is represented by
i17 : Divisor == Divisor := (D,E) -> (
D1 := normalForm D;
E1 := normalForm E;
D1#0 == E1#0 and D1#1 == E1#1
)
o17 = --Function[stdio:38:41]-o17 : Function
so that the normal form of D is R2:
i18 : D = divisor(ideal(y, x^2+2*x*z-3*z^2), ideal(x-z, y))
2
2
o18 = {ideal (y, x + 2x*z - 3z ), ideal (x - z, y)}
o18 : Divisor
9. DIVISORS
191
and we can directly test equality by
i19 : normalForm D
o19 = {ideal (x + 3z, y), ideal 1}
o19 : Divisor
B. Group operations on divisors
To add divisors we multiply the corresponding ideals and then saturate. This
may be coded as follows (the products are saturated in the divisor routine):
i20 : D == R2
o20 = true
Negation is even simpler, since all we need do is exchange the two ideals. We
don’t use the divisor routine, since our ideals are already saturated.
i21 : Divisor + Divisor := (D,E) -> divisor(D#0 * E#0, D#1 * ...
Let’s also include functions to compute differences and to multiply by integers.
i22 : - Divisor := (D) -> new Divisor from {D#1, D#0}
o22 = --Function[stdio:47:47]-o22 : Function
i23 : Divisor - Divisor := (D,E) -> D + (-E);
Some arithmetic of divisors on our elliptic curve
i24 : ZZ Divisor := ZZ * Divisor := (n,D) -> divisor((D#0)^n ...
i25 : 2P
2
o25 = {ideal (z, x ), ideal 1}
o25 : Divisor
Notice that 3P is the hyperplane section z = 0, which is the equation of the
flex line to the cubic at the point P .
i26 : 3P
o26 = {ideal z, ideal 1}
o26 : Divisor
i27 : D = P-R1
o27 = {ideal (x, z), ideal (x - z, y)}
o27 : Divisor
C. Global Sections
Since we have assumed X smooth, Weil divisors can all be represented by
Cartier divisors, that is, by sections of an invertible sheaf. If D = (I, J) is a
divisor, and sheaf (I) denotes the sheaf of OX -modules corresponding to I, then
we put
OX (D) = sheaf (I)−1 ⊗ sheaf (J).
192
9. DIVISORS
We define L(D) to be the space of global sections of the sheaf OX (D). Note
that a global section is the same as a sheaf homomorphism OX → OX (D). If we
write D = E − F , where E and F are effective, then global sections of OX (E − F )
can be identified with homomorphisms OX (−E) → OX (−F ).
If we write D = (I, J), then L(D) and Hom(I, J) can be identified with subsets
of the field of fractions of SX . Since SX satisfies S2 , these sets are equal. The
following proposition allows us to compute Hom(I, J):
Proposition. Suppose X is a smooth projective variety whose homogeneous
coordinate ring SX is S2 . If D is the divisor (I, J) and f is any non-zero element
of I, then L(D) is the degree zero part of
sat((f ∗ J) : I)
.
f
Proposition. If s = g/f is section of the divisor D = (I, J) as above, then
the zero scheme of s is defined by the ideal
sat(f I : g) : J.
Consider the divisor 2P on our curve E:
i28 : D2 = 2P - 2R1
2
2
o28 = {ideal (z, x ), ideal (x - z, y )}
o28 : Divisor
In this case, I = (x2 , z), and J = (1). Compute the vector space of sections
L(2P ):
i29 : D = 2P
2
o29 = {ideal (z, x ), ideal 1}
o29 : Divisor
i30 : I = D#0
2
o30 = ideal (z, x )
o30 : Ideal of SE
i31 : J = D#1
o31 = ideal 1
o31 : Ideal of SE
The degree 0 part in the proposition is the degree d part of sat((f J) : I),
divided by f , where d = deg f .
We can use the command basis to obtain a vector space basis of a module or
ideal in a given degree and thus compute the global sections (For an explanation
of this use of the basis routine, see the tutorial on canonical embeddings of plane
curves and gonality)
i32 : f = z
9. DIVISORS
193
o32 = z
o32 : SE
i33 : LD = basis(degree f, purify1S2((f*J) : I))
o33 = {1} | 1 0 |
{1} | 0 1 |
o33 : Matrix
so the vector space L(2P ) is generated by 1 = z/z, and x/z. Since J = (1),
the zero locus of the section (z + x)/z is defined by the ideal
i34 : LD = super (LD ** (ring target LD))
o34 = {0} | x z |
1
2
o34 : Matrix SE <--- SE
and its degree is:
i35 : imI = purify1S2(((z+x)*I) : z)
2
o35 = ideal (x + z, y
2
- 4z )
o35 : Ideal of SE
Let’s now package this into a routine globalSections which takes an argument
D of class Divisor, and computes a basis of L(D), represented as fractions with a
common denominator. The output is a row vector of the numerators, followed by
the denominator.
i36 : degree imI
o36 = 2
i37 : globalSections = method()
o37 = globalSections
o37 : Function
Another important task is to find the ideal of zeros of a section s = f /g of a
divisor D.
i38 : globalSections Divisor := (D) -> (
-- First let’s grab the parts (I,J) of D.
I := D#0;
J := D#1;
-- Let ’f’ be the first element of the
-- matrix of generators of the ideal I.
f := (gens I)_(0,0);
-- Now compute the basis of global sections
-- just as above
LD := basis(degree f, purify1S2((f*J) : I));
LD = super (LD ** (ring target LD));
-- Return both this vector space and the denominat ...
{LD, f});
194
9. DIVISORS
Let’s find the image of the elliptic curve E under the linear system 4P . To do
this we define a ring homomorphism from the global sections with the command
map. Its kernel defines the image of E.
i39 : sectionIdeal = (f,g,D) -> (
I := D#0;
J := D#1;
purify1S2((f*I):g) : J
);
i40 : D = 4P
2
o40 = {ideal (x*z, z ), ideal 1}
o40 : Divisor
i41 : L = globalSections D
o41 = {{0} | x2 xy xz y2 |, x*z}
o41 : List
i42 : phi = map(SE, ZZ/31991[a..d], L#0)
2
2
o42 = map(SE,KK [a, b, c, d],{x , x*y, x*z, y })
o42 : RingMap SE <--- KK [a, b, c, d]
The image in P3 is a complete intersection of two quadrics: the elliptic normal
curve in P3 .
For a less obvious example, consider the divisor 4P − R, which is not effective.
Since it has degree 3 as a divisor on an elliptic curve, the Riemann Roch theorem
tells us that it is equivalent to an effective divisor; in fact that it has three sections.
We can check this as follows:
i43 : ker phi
2
2
2
o43 = ideal (a + 2a*c - 3c - c*d, b - a*d)
o43 : Ideal of KK [a, b, c, d]
i44 : D = 4P - R
2
o44 = {ideal (x*z, z ), ideal (x, y)}
o44 : Divisor
i45 : L = globalSections D
o45 = {{0} | x2 xy y2+3xz |, x*z}
o45 : List
i46 : II = sectionIdeal(y*z+x*z+x^2, z^2, D)
2
2
2
...
9. DIVISORS
o46 = ideal (x
+ x*z + y*z, x*y + y
195
+ 4x*z + y*z, y
+ 3x* ...
o46 : Ideal of SE
D. Linear Equivalence
Testing whether two divisors E and F are linearly equivalent boils down to
testing whether D = E − F is principal and thus linearly equivalent to 0.
One method to determine whether D is principal is to compute the global
sections of D. A divisor D is principal iff L(D) has dimension one, and the zero
locus of its generator is the empty set.
For example, on the elliptic curve E, consider P − R:
i47 : degree II
o47 = 3
P − R has no global sections, so it is not equivalent to 0. Now consider 2P − 2R
i48 : globalSections (P-R)
o48 = {0, x}
o48 : List
i49 : D = 2 P - 2 R
2
2
o49 = {ideal (z, x ), ideal (x, y )}
o49 : Divisor
Since the divisor D = 2P − 2R has degree 0 and has a section, D is linearly
equivalent to 0. The result shows that the rational function x/z has divisor 2P −2R.
To check that a divisor of unknown degree is equivalent to 0, we attempt to
find a section and show it does not vanish anywhere. We include this in the routine
below.
Remember that in this tutorial we are assuming that SX is S2 and that X
is smooth. These computations are easily modified in the non-S2 case. See the
corresponding tutorial, once it is written!
i50 : LB = globalSections D
o50 = {{0} | x |, z}
o50 : List
We get the same answers as before:
i51 : linearlyEquivalent = (D,E) -> (
F := normalForm(D-E);
LB := globalSections F;
L := LB#0;
-- L is the matrix of numerators. Thus numgens sou ...
-- is the dimension of the space of global section ...
if numgens source L != 1
then false
else (
R := ring L;
V := sectionIdeal(L_(0,0), LB#1, F);
if V == ideal(1_R)
196
9. DIVISORS
then (L_(0,0))/(LB#1)
else false)
);
i52 : linearlyEquivalent(P,R)
o52 = false
We now look at the group law on the cubic: We take the point P to be 0; we can
then identify the natural group of divisor classes of degree 0 with the set of points
on the curve. With this identification, the group law ++ on points of the curve is
defined by: R + +S = the unique point T for which the divisor (R − P ) + (S − P ) is
linearly equivalent to (T − P ). i.e. R + +S := unique effective divisor in R + S − P .
What we need to do is: given a divisor R + S − P , find an effective divisor
equivalent to it.
i53 : linearlyEquivalent(2P,2R)
x
o53 = z
o53 : frac SE
i54 : effective = (D) -> (
LB := globalSections D;
L := LB#0; -- the matrix of numerators
if numgens source L == 0
then error(toString D + " is not effective")
else divisor sectionIdeal(L_(0,0), LB#1, D));
i55 : effective(2R-P)
o55 = {ideal (x, z), ideal 1}
o55 : Divisor
i56 : addition = (R,S) -> effective(R + S - P);
Some points are in the torsion subgroup:
i57 : addition(R1,R2)
o57 = {ideal (x, y), ideal 1}
o57 : Divisor
i58 : Q2 = addition(Q1, Q1)
o58 = {ideal (x - z, y), ideal 1}
o58 : Divisor
i59 : Q3 = addition(Q2, Q1)
o59 = {ideal (x - 3z, y + 6z), ideal 1}
o59 : Divisor
i60 : Q4 = addition(Q3, Q1)
9. DIVISORS
197
o60 = {ideal (x, z), ideal 1}
o60 : Divisor
So the point Q1 = (3, 6, 1) is a point of order 4 in the group.
Exercise: Write a routine that computes n times a point in this group law. E.
The canonical divisor
The most important divisor class on a variety is the canonical class. For example, consider the twisted cubic curve whose ideal is the ideal of 2 × 2 minors of the
“catalecticant” matrix
i61 : Q4a = addition(Q2,Q2)
o61 = {ideal (x, z), ideal 1}
o61 : Divisor
i62 : S = ZZ/31991[a,b,c,d];
i63 : catalect = map(S^2, 3, (i,j)->S_(i+j))
o63 = {0} | a b c |
{0} | b c d |
2
3
o63 : Matrix S <--- S
i64 : IC = minors(2, catalect)
2
2
o64 = ideal (- b + a*c, - b*c + a*d, - c + b*d)
o64 : Ideal of S
As a graded module, the canonical class is given as KX = Extc (SX , S(−r −1)),
where c = codimX, X ⊂ Pr , and S = k[x0 , . . . , xr ] is the polynomial ring.
i65 : SX = S/IC
o65 = SX
o65 : QuotientRing
i66 : KX = Ext^2(coker gens IC,S^{-4})
o66 = cokernel {1} | -b -c -d |
{1} | a b c |
2
o66 : S - module, quotient of S
i67 : canpres = substitute(presentation(KX), SX)
o67 = {1} | -b -c -d |
{1} | a b c |
2
3
o67 : Matrix SX <--- SX
Thus we need a routine that takes a rank 1 torsion free module over a domain
and finds an ideal isomorphic to it. We wish to compute homomorphisms from the
198
9. DIVISORS
canonical module into SX , and take the divisor whose first ideal is the image of
a homomorphism of non-negative degree, and whose second ideal is an arbitrary
nonzero element of SX whose degree is equal to the degree of the homomorphism.
First we find a homomorphism of lowest degree:
i68 : betti canpres
o68 = total: 2 3
1: 2 3
o68 : Net
The degree is
i69 : I1 = transpose (syz transpose canpres)_{0}
o69 = {0} | a b |
1
2
o69 : Matrix SX <--- SX
We need to balance the degree dg with a power of the first nonzero generator
of the ring. This is done in the following packaged version.
i70 : dg = (degrees (target I1))_0_0
o70 = 0
We start from a module over the ring SX:
i71 : divisorFromModule = M -> (
-- given a module M, returns the divisor of the imag ...
-- of a nonzero homomorphism to R, suitably twisted.
-- first get the presentation of M
I1 = transpose(
(syz transpose presentation M)_{0});
-- The degree is
d := (degrees (target I1))_0_0;
-- We need to balance the degree d with a power
-- of the first nonzero generator of the ring.
var1 := (compress vars ring M)_{0};
-- Now fix up the degrees.
if d==0 then candiv = divisor(ideal I1)
else if d>0 then
candiv =
divisor(
ideal (I1**dual(target I1)),
ideal var1^d
)
else
candiv =
divisor(
ideal(
var1^(-d)**I1**dual target I1
))
);
i72 : M = coker canpres
o72 = cokernel {1} | -b -c -d |
{1} | a b c |
9. DIVISORS
199
2
o72 : SX - module, quotient of SX
Some tests:
i73 : divisorFromModule(M)
o73 = {ideal (a, b), ideal 1}
o73 : Divisor
i74 : use SX
o74 = SX
o74 : QuotientRing
i75 : divisorFromModule(image matrix{{d^2}})
2
o75 = {ideal 1, ideal a }
o75 : Divisor
Here is the canonical divisor routine in packaged form:
i76 : divisorFromModule(SX^{1})
o76 = {ideal a, ideal 1}
o76 : Divisor
i77 : canonicalDivisor= SX ->(
-- Given a ring SX, computes a canonical divisor for ...
I := ideal presentation SX;
S := ring I;
embcodim := codim I;
M := Ext^embcodim(coker gens I,S^{-numgens S});
M = coker substitute(presentation M, SX);
divisorFromModule(M)
);
There are other ways of computing the canonical class. Perhaps we have already
written a tutorial on this subject.
Part III
Reference Manual
This section is intended to offer detailed documentation on every aspect of the
system of interest to users. We organize the software and therefore the documentation primarily according to the types of objects, and secondarily according to the
functions available for dealing with objects of a given type. For example, if you
want to know how to get a projective resolution of an ideal, you should first find
either the section dealing with ideals or the section dealing with chain complexes.
More briefly, look first for the noun and then for the verb.
In line with that advice, we list here some types of things with particular
mathematical interest.
Ring [III.10] – the class of all rings
Ideal [III.11] – the class of all ideals
Matrix [III.12] – the class of all matrices
Module [III.13] – the class of all modules
RingMap [III.14] – the class of all ring maps
GroebnerBasis [III.15] – the class of all Groebner bases
ChainComplex [III.16] – the class of all chain complexes
Variety [III.17] – the class of all algebraic varieties
Some types of things of interest to the programmer and user.
Function [III.18] – the class of all functions
VisibleList [III.19] – class of all visible lists
File [III.20] – the class of all files
We’ve mentioned that our software is organized according to the types of things
there are. The types form a hierarchy; for example, a polynomial ring is a type of
ring, and an affine variety is a type of variety. At the top of the hierarchy sits Thing
[III.21]; everything is a thing, and every type is a type of thing. The documentation
is organized here as a view of the hierarchy from the top down, so you can find
everything (eventually) in the following section, its subsections, or the sections it
refers to.
Thing [III.21] – the class of all things
CHAPTER 10
Ring
A ring is a set together with operations +, -, * and elements 0, 1 satisfying the
usual rules. In this system, it is also understood to be a ZZ-algebra, which means
that the operations where one argument is an integer are also provided.
The type Ring is a member of the class Type [III.21.5.4.11]. Each object of
class Ring is called a ring. Each ring is also a member of class Type [III.21.5.4.11].
Types of Ring :
EngineRing [III.10.1] – the class of rings handled by the engine
Field [III.10.2] – the class of all fields
ProductRing [III.10.3] – the class of all product rings
Making a ring :
Ring ** Ring [III.10.4] – tensor product
ambient GaloisField
ambient QuotientRing
ambient Ring
coefficientRing GaloisField
coefficientRing PolynomialRing
coefficientRing Ring
modifyRing Ring
ring [III.10.5] – get the associated ring
tensor(Ring,Ring)
trim Ring
Methods for using a ring :
AffineVariety ** Ring
Ext(ZZ,Ideal,Ring)
Ext(ZZ,Matrix,Ring)
Ext(ZZ,Module,Ring)
Ext(ZZ,Ring,Ideal)
Ext(ZZ,Ring,Module)
Ext(ZZ,Ring,Ring)
Fano(ZZ,Ideal,Ring)
GF Ring [III.10.1.2.1] – make a finite field from a ring
Grassmannian(ZZ,ZZ,Ring)
Hom(Ideal,Ring)
Hom(Module,Ring)
Hom(Ring,Ideal)
Hom(Ring,Module)
Ideal * Ring
Ideal == Ring
Matrix ** Ring [III.10.6] – tensor product
203
204
10. RING
Module ** Ring [III.10.7] – tensor product
Proj Ring
ProjectiveVariety ** Ring
Ring * Ideal
Ring * Ring
Ring / (...)
Ring / Ideal [III.10.1.4.1] – quotient ring
Ring / Module
Ring / RingElement
Ring / ZZ
Ring / {...}
Ring == Ideal
Ring OrderedMonoid [III.10.1.3.1] – make a polynomial ring
Ring [...] [III.10.1.3.2] – the standard way to make a polynomial ring
Ring ^ ZZ [III.10.8] – make a free module
Ring ^ {...} [III.10.9] – make a free module
Ring _ String [III.10.10] – get a variable by name
Ring _ ZZ [III.10.11] – get a variable by number
Ring _ {...} [III.10.12] – make a monomial from a list of exponents
Spec Ring
ZZ _ Ring [III.10.13]
basis Ring
basis(ZZ,Ring)
basis({...},Ring)
char Ring
degreeLength Ring
dim Ring
euler Ring
frac Ring
genera Ring
generators Ring
group Ring
hilbertFunction(ZZ,Ring)
hilbertFunction({...},Ring)
hilbertPolynomial Ring
ideal Ring [III.10.14] – get the ideal used to form a quotient ring
isAffineRing Ring
isCommutative Ring
isField Ring
isHomogeneous Ring
isQuotientOf(QuotientRing,Ring)
isQuotientOf(Ring,Ring)
isQuotientRing Ring
isRing Ring
jacobian Ring
lift(Ideal,Ring)
lift(Matrix,Ring)
lift(QQ,Ring)
10.1. ENGINERING
205
lift(RingElement,Ring)
lift(ZZ,Ring)
liftable(QQ,Ring)
liftable(RingElement,Ring)
liftable(ZZ,Ring)
map(Ring,Matrix)
map(Ring,Ring)
map(Ring,Ring,Matrix)
map(Ring,Ring,{...}) [III.10.15] – make a ring map
matrix(Ring,{...}) [III.10.16] – make a matrix
monoid Ring [III.10.17] – get the monoid from a monoid ring
new EngineRing from Ring
new Module from Ring
numgens Ring
options Ring [III.10.18] – get values used for optional arguments
poincare Ring
promote(MonoidElement,Ring)
promote(QQ,Ring)
promote(RingElement,Ring)
promote(ZZ,Ring)
random Ring [III.10.19] – random element of a ring
random(ZZ,Ring) [III.10.20] – a random ring element of a given degree
random({...},Ring) [III.10.21] – a random ring element of a given degree
sheaf Ring [III.10.22] – make the structure sheaf
singularLocus Ring
substitute(Ideal,Ring)
substitute(Matrix,Ring)
substitute(Module,Ring)
substitute(RingElement,Ring)
substitute(Vector,Ring)
use Ring
vars Ring
Fixed objects of class Ring :
ZZ [III.21.11] – the class of all integers
10.1. EngineRing
The engine [IV.22] handles most of the types of rings in the system.
The command new Engine from x is not meant for general users, and provides the developers with a way to create top-level rings corresponding to rings
implemented in the engine. Here x may be:
commands for the engine, as a string, or a sequence or list of strings, which
cause a ring to be placed on the top of the engine’s stack.
a ring, in which case another top-level ring is formed as an interface to the
same underlying engine ring.
the handle of on engine ring
The type EngineRing is a member of the class Type [III.21.5.4.11]. Each
object of class EngineRing is called an engine ring. Each engine ring is also a
member of class Ring [III.10].
206
10. RING
Types of EngineRing :
FractionField [III.10.1.1] – the class of all fraction fields
GaloisField [III.10.1.2] – the class of all Galois fields
PolynomialRing [III.10.1.3] – the class of all ordered monoid rings
QuotientRing [III.10.1.4] – the class of all quotient rings
SchurRing [III.10.1.5] – the class of all Schur rings
Methods for using an engine ring :
EngineRing / Ideal
EngineRing _ ZZ
ZZ _ EngineRing
frac EngineRing
generators EngineRing
net EngineRing
new EngineRing from (...)
new EngineRing from Handle
new EngineRing from Ring
new EngineRing from String
new EngineRing from {...}
numgens EngineRing
promote(ZZ,EngineRing)
toString EngineRing
10.1.1. FractionField
The type FractionField is a member of the class Type [III.21.5.4.11]. Each
object of class FractionField is called a fraction field. Each fraction field is also a
member of class EngineRing [III.10.1].
Making a fraction field :
frac [III.10.1.1.1] – construct a fraction field
Methods for using a fraction field :
coefficientRing FractionField
degreeLength FractionField
frac FractionField
isField FractionField
isHomogeneous FractionField
net FractionField
numgens FractionField
toString FractionField
10.1.1.1. frac
frac R – construct the fraction field of the ring R.
If R has no name yet, then the names for its symbols will be usurped as names
for the corresponding elements of R.
i1 : F = frac (ZZ/101[x,y])
o1 = F
o1 : FractionField
i2 : 1/x + 1/y + 1/2
10.1. ENGINERING
207
- 50x*y + x + y
o2 = --------------x*y
o2 : F
Results of division with / [V.24.25] will be in the fraction field, and the fraction
field will be created if necessary.
i3 : R = ZZ[x,y]
o3 = R
o3 : PolynomialRing
i4 : x/y
x
o4 = y
o4 : frac R
The function frac is a member of the class Function [III.18].
Class of returned value: FractionField [III.10.1.1] – the class of all fraction
fieldsWays to use frac :
frac EngineRing
frac FractionField
frac Ring
10.1.2. GaloisField
The type GaloisField is a member of the class Type [III.21.5.4.11]. Each
object of class GaloisField is called a Galois field. Each Galois field is also a member
of class EngineRing [III.10.1].
Making a Galois field :
GF Ring [III.10.1.2.1] – make a finite field from a ring
GF ZZ [III.10.1.2.2] – make a finite field of a given order
GF(ZZ,ZZ) [III.10.1.2.3] – make a finite field of a given prime power order
Methods for using a Galois field :
ambient GaloisField
coefficientRing GaloisField
dim GaloisField
isField GaloisField
random GaloisField
10.1.2.1. GF Ring
GF R – make a Galois field from a quotient ring R which happens to be isomorphic to a finite field.
i1 : k = GF(ZZ/2[t]/(t^3+t+1))
o1 = k
o1 : GaloisField
208
10. RING
i2 : t+t^2
4
o2 = t
o2 : k
Synopsis of use:
Operator: GF [V.24.83]
Class of argument 1: Ring [III.10]
Class of typical returned value: GaloisField [III.10.1.2]
Optional arguments :
GF(..., PrimitiveElement => ...)
GF(..., Variable => ...)
10.1.2.2. GF ZZ
GF(q) – make a Galois field with q elements, where q is a power of a prime.
i1 : k = GF(8)
o1 = k
o1 : GaloisField
i2 : x = k_0
o2 = $x
o2 : k
i3 : x+x^2
4
o3 = $x
o3 : k
Synopsis of use:
Operator: GF [V.24.83]
Class of argument 1: ZZ [III.21.11]
Class of typical returned value: GaloisField [III.10.1.2]
Optional arguments :
GF(..., PrimitiveElement => ...)
GF(..., Variable => ...)
Code:
-- ../m2/galois.m2:64-68
GF(ZZ) := GaloisField => options -> (q) -> (
factors := factor q;
if #factors =!= 1 or factors#0#0 === -1
then error "expected a power of a prime";
GF(factors#0#0,factors#0#1,options))
10.1.2.3. GF(ZZ,ZZ)
GF(p,n) – make a Galois field with p^n elements, where p is a prime.
i1 : k = GF(2,3,Variable=>x)
10.1. ENGINERING
209
o1 = k
o1 : GaloisField
i2 : x+x^2
4
o2 = x
o2 : k
Synopsis of use:
Operator: GF [V.24.83]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: GaloisField [III.10.1.2]
Optional arguments :
GF(..., PrimitiveElement => ...)
GF(..., Variable => ...)
10.1.3. PolynomialRing
Every element of a polynomial ring is also a RingElement [III.21.5.4.9].
See also:
polynomial rings [I.3.2]
The type PolynomialRing is a member of the class Type [III.21.5.4.11]. Each
object of class PolynomialRing is called a polynomial ring. Each polynomial ring
is also a member of class EngineRing [III.10.1].
Making a polynomial ring :
Ring OrderedMonoid [III.10.1.3.1] – make a polynomial ring
Ring [...] [III.10.1.3.2] – the standard way to make a polynomial ring
degreesRing PolynomialRing
degreesRing ZZ
Methods for using a polynomial ring :
PolynomialRing ** PolynomialRing
PolynomialRing ** QuotientRing
PolynomialRing _ {...}
QuotientRing ** PolynomialRing
ambient PolynomialRing
char PolynomialRing
codim PolynomialRing
coefficientRing PolynomialRing
degreeLength PolynomialRing
dim PolynomialRing
expression PolynomialRing
generators PolynomialRing
hilbertSeries PolynomialRing
isAffineRing PolynomialRing
isHomogeneous PolynomialRing
isPolynomialRing PolynomialRing
net PolynomialRing
210
10. RING
newCoordinateSystem(PolynomialRing,Matrix)
numgens PolynomialRing
options PolynomialRing
presentation PolynomialRing
presentation(PolynomialRing,PolynomialRing)
presentation(PolynomialRing,QuotientRing)
presentation(QuotientRing,PolynomialRing)
tensor(PolynomialRing,PolynomialRing)
tensor(PolynomialRing,QuotientRing)
tensor(QuotientRing,PolynomialRing)
toExternalString PolynomialRing
toString PolynomialRing
10.1.3.1. Ring OrderedMonoid
R M – produces the monoid ring from a ring R and an ordered monoid M.
See also:
polynomial rings [I.3.2]
Synopsis of use:
Operator: [V.24.1]
Class of argument 1: Ring [III.10]
Class of argument 2: OrderedMonoid [III.21.5.4.11.3.1]
Class of typical returned value: PolynomialRing [III.10.1.3]
10.1.3.2. Ring [...]
R[...] – produces the monoid ring from a ring R and the ordered monoid
specified by [...].
This is the customary way to make a polynomial ring.
Optional arguments (placed inside the array):
MonomialOrder [III.10.1.3.2.1] – monomial ordering
MonomialSize [III.10.1.3.2.2] – specify maximum exponent size
Degrees [III.10.1.3.2.3] – specify the degrees
Weights [III.10.1.3.2.4] – specify monomial ordering by weights
Inverses [III.10.1.3.2.5] – specify whether generators are invertible
WeylAlgebra [III.10.1.3.2.6] – make a Weyl algebra
VariableBaseName [III.10.1.3.2.7] – base name for variables
SkewCommutative [III.10.1.3.2.8] – make a skewcommutative (alternating) ring
Variables [III.10.1.3.2.9] – specify the variable names
VariableOrder [III.10.1.3.2.10]
See also:
polynomial rings [I.3.2]
Synopsis of use:
Operator: [V.24.1]
Class of argument 1: Ring [III.10]
Class of argument 2: Array [III.19.1]
Class of typical returned value: PolynomialRing [III.10.1.3]
Code:
-- ../m2/orderedmonoidrings.m2:312
10.1. ENGINERING
211
Ring Array := PolynomialRing => (R,variables) -> use R monoi ...
10.1.3.2.1. MonomialOrder
MonomialOrder – a key used with monoids to indicate a monomial ordering
other than the default (graded reverse lexicographic)
Permissible values:
GRevLex [III.10.1.3.2.1.1] – reverse lexicographic ordering
GLex [III.10.1.3.2.1.2] – graded lexicographic ordering
Lex [III.10.1.3.2.1.3] – lexicographic ordering
RevLex [III.10.1.3.2.1.4] – reverse lexicographic ordering
Eliminate [III.10.1.3.2.1.5] – elimination ordering
ProductOrder [III.10.1.3.2.1.6] – product ordering
Eventually, more general monomial orders will be allowed.
See also:
polynomial rings with other monomial orderings [I.3.4]
Weights [III.10.1.3.2.4] – specify monomial ordering by weights
The symbol MonomialOrder is a member of the class Symbol [III.21.10].
Functions with optional argument named MonomialOrder :
graphIdeal(..., MonomialOrder => ...)
graphRing(..., MonomialOrder => ...)
modifyRing(..., MonomialOrder => ...)
pushForward(..., MonomialOrder => ...)
pushForward1(..., MonomialOrder => ...) [V.24.499] – specify the
elimination order to use in pushForward1
sortColumns(..., MonomialOrder => ...) [V.24.559] – specify Ascending or Descending sort order
symmetricAlgebra(..., MonomialOrder => ...)
tensor(..., MonomialOrder => ...)
10.1.3.2.1.1. GRevLex
GRevLex – a symbol used as an optional argument of MonomialOrder [III.10.1.3.2.1]
in monoids handled by the engine [IV.22] to indicate that the monomial order is
the graded reverse lexicographic order.
Caveat: If the number of degree vectors is greater than one, this is currently
only graded using the first degree vector. This will eventually change.
The symbol GRevLex is a member of the class Symbol [III.21.10].
10.1.3.2.1.2. GLex
GLex – a symbol used as an optional argument of MonomialOrder [III.10.1.3.2.1]
in monoids handled by the engine [IV.22] to indicate that the monomial order is
the graded lexicographic order.
Caveat: If the number of degree vectors is greater than one, this is currently
only graded using the first degree vector. This will eventually change.
The symbol GLex is a member of the class Symbol [III.21.10].
212
10. RING
10.1.3.2.1.3. Lex
Lex – a symbol used as an optional argument of MonomialOrder [III.10.1.3.2.1]
in monoids handled by the engine [IV.22] to indicate that the monomial order is
the (non-graded) lexicographic order.
The symbol Lex is a member of the class Symbol [III.21.10].
10.1.3.2.1.4. RevLex
RevLex – a symbol used as an optional argument of MonomialOrder [III.10.1.3.2.1]
in monoids handled by the engine [IV.22] to indicate that the monomial order is
the reverse lexicographic order.
The symbol RevLex is a member of the class Symbol [III.21.10].
10.1.3.2.1.5. Eliminate
Eliminate n – an optional argument of MonomialOrder [III.10.1.3.2.1] in
monoids handled by the engine [IV.22] to indicate that the monomial order is the
elimination order eliminating the first n variables, refined by the graded reverse
lexicographic order.
Caveat: If the number of degree vectors is greater than one, this is currently
only graded using the first degree vector. This will eventually change.
The self initializing type Eliminate is a member of the class SelfInitializingType [III.21.5.4.11.4]. Each object of class Eliminate is also a member of class
BasicList [III.21.1].
Methods for using an object of class Eliminate :
expression Eliminate
new Eliminate from ZZ
10.1.3.2.1.6. ProductOrder
ProductOrder{n1, ..., nr} – an optional argument of MonomialOrder [III.10.1.3.2.1]
in monoids handled by the engine [IV.22] to indicate that the monomial order is
the product of r graded reverse lex orders, each with n1, n2, ..., nr variables.
Caveat: If the number of degree vectors is greater than one, the grading in each
block only uses the first degree vector. This will eventually change.
The self initializing type ProductOrder is a member of the class SelfInitializingType [III.21.5.4.11.4]. Each object of class ProductOrder is also a member
of class BasicList [III.21.1].
10.1.3.2.2. MonomialSize
MonomialSize => n – an option which determines the maximum exponent size.
Used as an option to monoid [V.24.424], or when a polynomial ring is created.
Setting ’MonomialSize=>n’ specifies that monomial exponents may be as large as
2^n - 1. The default value is 8, allowing for exponents up to 255.
See monoid [V.24.424] for details.
The symbol MonomialSize is a member of the class Symbol [III.21.10].
Functions with optional argument named MonomialSize :
graphIdeal(..., MonomialSize => ...)
graphRing(..., MonomialSize => ...)
modifyRing(..., MonomialSize => ...)
10.1. ENGINERING
213
symmetricAlgebra(..., MonomialSize => ...)
tensor(..., MonomialSize => ...)
10.1.3.2.3. Degrees
Degrees – an option which specifies the degrees of the generators.
Used as an option to monoid [V.24.424], or when a polynomial ring is created.
See monoid [V.24.424] for details.
The symbol Degrees is a member of the class Symbol [III.21.10].
Functions with optional argument named Degrees :
graphIdeal(..., Degrees => ...)
graphRing(..., Degrees => ...)
modifyRing(..., Degrees => ...)
symmetricAlgebra(..., Degrees => ...)
tensor(..., Degrees => ...)
10.1.3.2.4. Weights
Weights => {...} – a keyword for an option used in specifying monomial
orderings.
This feature is currently under development.
The symbol Weights is a member of the class Symbol [III.21.10].
Functions with optional argument named Weights :
graphIdeal(..., Weights => ...)
graphRing(..., Weights => ...)
modifyRing(..., Weights => ...)
symmetricAlgebra(..., Weights => ...)
tensor(..., Weights => ...)
10.1.3.2.5. Inverses
Inverses – an option used in creating a monoid which tells whether negative
exponents will be allowed, making the monoid into a group.
See also:
monoid [V.24.424] – make a monoid
The symbol Inverses is a member of the class Symbol [III.21.10].
Functions with optional argument named Inverses :
graphIdeal(..., Inverses => ...)
graphRing(..., Inverses => ...)
modifyRing(..., Inverses => ...)
symmetricAlgebra(..., Inverses => ...)
tensor(..., Inverses => ...)
10.1.3.2.6. WeylAlgebra
WeylAlgebra – an option used when creating a polynomial ring to specify that
a Weyl algebra is to be produced.
A Weyl algebra is an algebra in which some of the variables behave as derivatives with respect to the other variables.
i1 : R = ZZ/101[x,dx,y,dy,WeylAlgebra => {x=>dx, y=>dy}];
214
10. RING
The list {x=>dx, y=>dy} indicates that the variable dx is to play the role of
the derivative with respect to x, and that y is to play the role of the derivative with
respect to y.
i2 : dx*x
o2 = x*dx + 1
o2 : R
i3 : dx*x^10
10
9
o3 = x dx + 10x
o3 : R
i4 : dx*y^10
10
o4 = dx*y
o4 : R
The symbol WeylAlgebra is a member of the class Symbol [III.21.10].
Functions with optional argument named WeylAlgebra :
graphIdeal(..., WeylAlgebra => ...)
graphRing(..., WeylAlgebra => ...)
modifyRing(..., WeylAlgebra => ...)
symmetricAlgebra(..., WeylAlgebra => ...)
tensor(..., WeylAlgebra => ...)
10.1.3.2.7. VariableBaseName
VariableBaseName => x – an optional argument used when creating monoids
or rings to specify that the variables should be x_0, ..., x_n.
The symbol VariableBaseName is a member of the class Symbol [III.21.10].
Functions with optional argument named VariableBaseName :
graphIdeal(..., VariableBaseName => ...)
graphRing(..., VariableBaseName => ...)
modifyRing(..., VariableBaseName => ...)
symmetricAlgebra(..., VariableBaseName => ...)
tensor(..., VariableBaseName => ...)
10.1.3.2.8. SkewCommutative
SkewCommutative – name for an optional argument for monoids that specifies
that monoid rings created from them will be skewcommutative.
The default value is false.
i1 : R = ZZ[x,y,SkewCommutative=>true]
o1 = R
o1 : PolynomialRing
i2 : x*y
10.1. ENGINERING
215
o2 = x*y
o2 : R
i3 : y*x
o3 = -x*y
o3 : R
The symbol SkewCommutative is a member of the class Symbol [III.21.10].
Functions with optional argument named SkewCommutative :
graphIdeal(..., SkewCommutative => ...)
graphRing(..., SkewCommutative => ...)
modifyRing(..., SkewCommutative => ...)
symmetricAlgebra(..., SkewCommutative => ...)
tensor(..., SkewCommutative => ...)
10.1.3.2.9. Variables
Variables – a key used with monoids to indicate the list of variable names, or
the number of variables.
This option is useful for those situations when one doesn’t care about the names
of the variables in a ring or monoid, or when one is creating a tensor product ring,
symmetric algebra, or other ring, and one wants control over the names of the ring
variables.
The symbol Variables is a member of the class Symbol [III.21.10].
Functions with optional argument named Variables :
graphIdeal(..., Variables => ...)
graphRing(..., Variables => ...)
modifyRing(..., Variables => ...)
symmetricAlgebra(..., Variables => ...)
tensor(..., Variables => ...)
10.1.3.2.10. VariableOrder
VariableOrder – an option used when creating a monoid.
Not implemented yet.
See also:
monoid [V.24.424] – make a monoid
The symbol VariableOrder is a member of the class Symbol [III.21.10].
Functions with optional argument named VariableOrder :
graphIdeal(..., VariableOrder => ...)
graphRing(..., VariableOrder => ...)
modifyRing(..., VariableOrder => ...)
symmetricAlgebra(..., VariableOrder => ...)
tensor(..., VariableOrder => ...)
10.1.4. QuotientRing
The type QuotientRing is a member of the class Type [III.21.5.4.11]. Each
object of class QuotientRing is called a quotient ring. Each quotient ring is also a
member of class EngineRing [III.10.1].
216
10. RING
Making a quotient ring :
Ring / (...)
Ring / Ideal [III.10.1.4.1] – quotient ring
Ring / Module
Ring / RingElement
Ring / {...}
graphRing RingMap
image RingMap
singularLocus Ideal
singularLocus Ring
symmetricAlgebra Module
Methods for using a quotient ring :
PolynomialRing ** QuotientRing
QuotientRing ** PolynomialRing
QuotientRing ** QuotientRing
QuotientRing _ String
ambient QuotientRing
char QuotientRing
codim QuotientRing
coefficientRing QuotientRing
degreeLength QuotientRing
degreesRing QuotientRing
dim QuotientRing
expression QuotientRing
generators QuotientRing
hilbertSeries QuotientRing
ideal QuotientRing
isAffineRing QuotientRing
isField QuotientRing
isHomogeneous QuotientRing
isQuotientOf(QuotientRing,Ring)
isQuotientRing QuotientRing
monoid QuotientRing
net QuotientRing
numgens QuotientRing
options QuotientRing
presentation QuotientRing
presentation(PolynomialRing,QuotientRing)
presentation(QuotientRing,PolynomialRing)
presentation(QuotientRing,QuotientRing)
random QuotientRing
tensor(PolynomialRing,QuotientRing)
tensor(QuotientRing,PolynomialRing)
tensor(QuotientRing,QuotientRing)
toString QuotientRing
trim QuotientRing
vars QuotientRing
10.1. ENGINERING
217
10.1.4.1. Ring / Ideal
R/I – form a quotient ring.
Here I may be: an element of R; a sequence of elements of R; or a submodule
of R^1.
The names of the variables are assigned values in the new quotient ring by
automatically running use R, unless R has a name, or one of the rings R is a
quotient ring of has a name.
Quotient rings are bulky objects, because they contain a Groebner basis for
their ideals, so only quotients of ZZ are remembered forever. Typically the ring
created by R/I will be a brand new ring, and its elements will be incompatible with
the elements of previously created quotient rings for the same ideal.
i1 : ZZ/2 === ZZ/(4,6)
o1 = true
i2 : R = ZZ/101[t]
o2 = R
o2 : PolynomialRing
i3 : R/t === R/t
o3 = false
See also:
QuotientRing [III.10.1.4] – the class of all quotient rings
use [V.24.639] – install defaults
Synopsis of use:
Operator: / [V.24.25]
Class of argument 1: Ring [III.10]
Class of argument 2: Ideal [III.11]
Class of typical returned value: QuotientRing [III.10.1.4]
Code:
-- ../m2/quotring.m2:136-142
Ring / Ideal := QuotientRing => (R,I) -> if I == 0 then R el ...
if R === ZZZ then ZZZquotient(R,I)
else if R === ZZ then ZZquotient(R,I)
else (
error "can’t form quotient of this ring"
)
)
10.1.5. SchurRing
A Schur ring is the representation ring for the general linear group of n by n
matrices, and one can be constructed with Schur [V.24.122].
i1 : R = Schur 4
o1 = R
o1 : SchurRing
218
10. RING
The element corresponding to the Young diagram {3,2,1} is obtained as follows.
i2 : R_{3,2,1}
o2 = {3, 2, 1}
o2 : R
The dimension of the underlying virtual representation can be obtained with
dim [V.24.253].
i3 : dim R_{3,2,1}
o3 = 64
Multiplication in the ring comes from tensor product of representations.
i4 : R_{3,2,1} * R_{1,1}
o4 = 0
o4 : R
See also:
_ [V.24.151]
SchurRing [III.10.1.5] – the class of all Schur rings
List [III.19.2] – class of all lists – {...}
The type SchurRing is a member of the class Type [III.21.5.4.11]. Each object
of class SchurRing is called a Schur ring. Each Schur ring is also a member of class
EngineRing [III.10.1].
Making a Schur ring :
Schur ZZ
Methods for using a Schur ring :
SchurRing _ {...} [III.10.1.5.1] – make an element of a Schur ring
toString SchurRing
10.1.5.1. SchurRing _ {...}
S_v – produce the element of the Schur ring S corresponding to the Young
diagram whose rows have lengths as in the list v.
The row lengths should be in decreasing order.
See also:
SchurRing [III.10.1.5] – the class of all Schur rings
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: SchurRing [III.10.1.5]
Class of argument 2: List [III.19.2]
Next more general method: Ring _ {...} [III.10.12] – make a monomial
from a list of exponents
10.2. Field
Use isField [III.21.2.9] to determine whether a given ring is a field, since some
rings that are fields, for implementation reasons, cannot be instances of Field
[III.10.2].
10.6. MATRIX ** RING
219
i1 : isField (ZZ/101)
o1 = true
The type Field is a member of the class Type [III.21.5.4.11]. Each object of
class Field is called a field. Each field is also a member of class Ring [III.10].
Fixed objects of class Field :
CC [III.21.1.1] – the class of all complex numbers
QQ [III.21.8] – the class of all rational numbers
RR [III.21.9] – the class of all real numbers
10.3. ProductRing
If R and S are rings, then R * S denotes their product ring. If r and s are
elements of R and S respectively, then an element of the product is provided by
new R*S from {r,s}
This has to be rethought!
The type ProductRing is a member of the class Type [III.21.5.4.11]. Each
object of class ProductRing is called a product ring. Each product ring is also a
member of class Ring [III.10].
Making a product ring :
Ring * Ring
Methods for using a product ring :
net ProductRing
toString ProductRing
10.4. Ring ** Ring
For complete documentation, see tensor [V.24.609].
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Ring [III.10]
Class of argument 2: Ring [III.10]
Class of typical returned value: Ring [III.10]
10.5. ring
The function ring is a member of the class Function [III.18].
Class of returned value: Ring [III.10] – the class of all ringsWays to use ring :
ring ChainComplexMap
ring CoherentSheaf [III.21.5.4.2.12] – get the coordinate ring under a
sheaf
ring Ideal
ring Matrix
ring Thing
ring Type
ring Variety
ring Vector
10.6. Matrix ** Ring
f ** R – form the tensor product of a module map f with a ring R.
The ring of f should be a base ring of R. The degree of the map is preserved.
220
10. RING
i1 : R = ZZ[a..c];
i2 : S = R/(a+b+c);
i3 : f = vars R
o3 = {0} | a b c |
1
3
o3 : Matrix R <--- R
i4 : f ** S
o4 = {0} | -1b-1c b c |
1
3
o4 : Matrix S <--- S
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Matrix [III.12]
Class of argument 2: Ring [III.10]
Class of typical returned value: Matrix [III.12]
10.7. Module ** Ring
M ** R – form the tensor product of a module M with a ring R.
The ring of M should be a base ring of R.
i1 : R = ZZ/101[x,y];
i2 : M = coker vars R
o2 = cokernel {0} | x y |
1
o2 : R - module, quotient of R
i3 : M ** R[t]
o3 = cokernel {0} | x y |
1
o3 : R [t] - module, quotient of (R [t])
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Module [III.13]
Class of argument 2: Ring [III.10]
Class of typical returned value: Module [III.13]
10.8. Ring ^ ZZ
R^n – produce a free module of rank n over the ring R
See also:
^ [V.24.149] – a binary operator, usually used for exponents
isFreeModule [III.21.2.10] – whether something a free module
Ring ^ {...} [III.10.9] – make a free module
10.10. RING _ STRING
221
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Ring [III.10]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Module [III.13]
10.9. Ring ^ {...}
R^{i,j, k, ...} – produce a free module over R whose generators have degrees -i, -j, -k, ...
The degrees i, j, ... may themselves be multi-degrees, represented as lists of
integers. The operator : [V.24.29] may be used to indicate repetitions.
i1 : R = ZZ/101[x,y,z];
i2 : F = R^{1,4:2,3,3:4}
9
o2 = R
o2 : R - module, free
i3 : degrees F
o3 = {{-1}, {-2}, {-2}, {-2}, {-2}, {-3}, {-4}, {-4}, {-4}}
o3 : List
See also:
degrees [V.24.242] – get degrees of basis elements
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Ring [III.10]
Class of argument 2: List [III.19.2]
Class of typical returned value: Module [III.13]
10.10. Ring _ String
R_"x" – produce the variable of the polynomial ring R whose name is x.
i1 : R = ZZ[x,y,z];
i2 : R_"x"
o2 = x
o2 : R
Eventually we will implement this for monoids, too.
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Ring [III.10]
Class of argument 2: String [III.21.6.1]
Class of typical returned value: RingElement [III.21.5.4.9]
Code:
-- ../m2/enginering.m2:642
Ring _ String := RingElement => (x,s) -> x#s
222
10. RING
10.11. Ring _ ZZ
R_i – produce the i-th generator of a ring R.
The indexing of generators is based on 0, so R_0 would be the first one, and so
on.
i1 : R = ZZ[a..d]
o1 = R
o1 : PolynomialRing
i2 : R_2
o2 = c
o2 : R
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Ring [III.10]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: RingElement [III.21.5.4.9]
Code:
-- ../m2/enginering.m2:188-192
Ring _ ZZ := RingElement => (R,i) -> (
if R.?generators
then R.generators#i
else error "ring has no generators"
)
10.12. Ring _ {...}
R_w – produce the monomial of the ring R by using the integers in the list w as
exponents of the variables.
i1 : R = ZZ[a..d]
o1 = R
o1 : PolynomialRing
i2 : R_{1,2,3,4}
2 3 4
o2 = a*b c d
o2 : R
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Ring [III.10]
Class of argument 2: List [III.19.2]
Class of typical returned value: RingElement [III.21.5.4.9]
Code:
-- ../m2/orderedmonoidrings.m2:320
Ring _ List := RingElement => (R,w) -> product(#w, i -> (R_i ...
10.15. MAP(RING,RING,{...})
223
10.13. ZZ _ Ring
1_R – provides the unit element of the ring R.
0_R – provides the zero element of the ring R.
n_R – promotes the integer n to the ring R.
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Ring [III.10]
Class of typical returned value: RingElement [III.21.5.4.9]
Code:
-- ../m2/enginering.m2:649-653
ZZ _ Ring := RingElement => (i,R) -> (
if i === 1 then R#1
else if i === 0 then R#0
else i * R#1
)
10.14. ideal Ring
ideal R – for a quotient ring R=A/I, returns I
Synopsis of use:
Operator: ideal [III.11.5]
Class of argument 1: Ring [III.10]
Class of typical returned value: Ideal [III.11]
Code:
-- ../m2/matrix1.m2:540
ideal Ring := R -> ideal 0_R
10.15. map(Ring,Ring,{...})
map(R,S,m) – sets up a ring homomorphism from S to R which sends the i-th
variable of S to the i-th element of the list m. Alternatively, m may be a 1 by n
matrix over R, where n is the number of variables in the polynomial ring S; or it
may be a square matrix over the common coefficient ring of the two rings, in which
case it is used as the matrix of a linear change of coordinates.
i1 : R = ZZ/101[a,b];
i2 : m = symmetricPower(3, vars R)
o2 = {0} | a3 a2b ab2 b3 |
1
4
o2 : Matrix R <--- R
i3 : rank source m
o3 = 4
i4 : S = ZZ/101[s_1 .. s_oo]
o4 = S
o4 : PolynomialRing
i5 : f = map(R,S,m)
224
10. RING
3
2
2
3
o5 = map(R,S,{a , a b, a*b , b })
o5 : RingMap R <--- S
i6 : f s_2
2
o6 = a b
o6 : R
i7 : f vars S
o7 = {0} | a3 a2b ab2 b3 |
1
4
o7 : Matrix R <--- R
i8 : kernel f
2
2
o8 = ideal (s - s s , s s - s s , s - s s )
3
2 4
2 3
1 4
2
1 3
o8 : Ideal of S
i9 : generators oo
o9 = {0} | s_3^2-s_2s_4 s_2s_3-s_1s_4 s_2^2-s_1s_3 |
1
3
o9 : Matrix S <--- S
i10 : f oo
o10 = 0
1
3
o10 : Matrix R <--- R
i11 : U = ZZ/101[t,u,v]
o11 = U
o11 : PolynomialRing
i12 : g = map(S,U,{s_1+s_2, s_2 + s_3, s_3+s_4})
o12 = map(S,U,{s + s , s + s , s + s })
1
2
2
3
3
4
o12 : RingMap S <--- U
i13 : f * g
3
2
2
2
2
3
o13 = map(R,U,{a + a b, a b + a*b , a*b + b })
o13 : RingMap R <--- U
10.16. MATRIX(RING,{...})
225
i14 : kernel oo
2
o14 = ideal(u - t*v)
o14 : Ideal of U
i15 : f g generators oo
o15 = 0
1
1
o15 : Matrix R <--- R
The class of all ring maps is RingMap [III.14].
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Ring [III.10]
Class of argument 2: Ring [III.10]
Class of argument 3: List [III.19.2]
Class of typical returned value: RingMap [III.14]
Optional arguments :
map(..., Degree => ...)
10.16. matrix(Ring,{...})
matrix(R,v) – create a matrix over R from a doubly-nested list of ring elements
or matrices.
This is essentially the same as matrix {...} [III.12.38] together with the specification of the ring.
i1 : R = ZZ/101[a..f]
o1 = R
o1 : PolynomialRing
i2 : matrix(R, {{a,b,0},{d,0,f}})
o2 = {0} | a b 0 |
{0} | d 0 f |
2
3
o2 : Matrix R <--- R
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: matrix [V.24.401]
Class of argument 1: Ring [III.10]
Class of argument 2: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Optional arguments :
matrix(..., Degree => ...)
Code:
226
10. RING
-- ../m2/matrix1.m2:3-5
matrix(Ring,List) := Matrix => options -> (R,m) -> (
if not isTable m then error "expected a table";
map(R^#m,,m,options))
10.17. monoid Ring
monoid R – yields the underlying monoid of polynomial ring or monoid ring.
i1 : R = QQ[x,y]
o1 = R
o1 : PolynomialRing
i2 : monoid R
o2 = [x, y]
o2 : GeneralOrderedMonoid
Synopsis of use:
Operator: monoid [V.24.424]
Class of argument 1: Ring [III.10]
Class of typical returned value: Monoid [III.21.5.4.11.3]
Code:
-- ../m2/ofcm.m2:391
monoid Ring := Monoid => R -> R.monoid
10.18. options Ring
options R – returns the options used when the polynomial ring R was created.
Synopsis of use:
Operator: options [III.21.5.5.1]
Class of argument 1: Ring [III.10]
Class of typical returned value: OptionTable [III.21.5.5]
Code:
-- ../m2/methods.m2:223
options
Ring := x -> null
10.19. random Ring
random R – yields a random element of the ring R.
Currently implemented only for rings of the form ZZ/n.
Synopsis of use:
Operator: random [V.24.216.1]
Class of argument 1: Ring [III.10]
Class of typical returned value: RingElement [III.21.5.4.9]
Code:
-- ../m2/enginering.m2:644-647
random Ring := RingElement => (R) -> (
if R.?random then R.random()
else error "no method found for item of class Ring"
)
10.22. SHEAF RING
227
10.20. random(ZZ,Ring)
random(n,R) – yields a random homogeneous element of degree n in the ring
R.
Synopsis of use:
Operator: random [V.24.216.1]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Ring [III.10]
Class of typical returned value: RingElement [III.21.5.4.9]
Code:
-- ../m2/genmat.m2:51
random(ZZ,Ring) := RingElement => (n,R) -> random({n},R)
10.21. random({...},Ring)
random(n,R) – yields a random homogeneous element of degree n in the ring
R, where n is a list of integers.
Synopsis of use:
Operator: random [V.24.216.1]
Class of argument 1: List [III.19.2]
Class of argument 2: Ring [III.10]
Class of typical returned value: RingElement [III.21.5.4.9]
10.22. sheaf Ring
sheaf R – produce the structure sheaf on the projective variety Proj R.
Synopsis of use:
Operator: sheaf [III.21.5.4.2.8]
Class of argument 1: Ring [III.10]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:44
Ring ~ := sheaf Ring := CoherentSheaf => (R) -> sheaf R^1
CHAPTER 11
Ideal
The justification for considering an ideal I as different from a submodule M of
R^1 is that some methods are different. For example, M^3 is a direct sum, whereas
I^3 is still an ideal.
The type Ideal is a member of the class Type [III.21.5.4.11]. Each object
of class Ideal is called an ideal. Each ideal is also a member of class MutableHashTable [III.21.5.4].
Making an ideal :
Fano(ZZ,Ideal)
Fano(ZZ,Ideal,Ring)
Grassmannian(ZZ,ZZ)
Grassmannian(ZZ,ZZ,Ring)
Ideal * Ideal [III.11.1] – product of ideals
Ideal * Ring
Ideal + Ideal [III.11.2] – sum of ideals
Ideal : Ideal [III.11.3] – ideal quotient for
Ideal : RingElement
Ideal ^ ZZ [III.11.4] – power of an ideal
Module : Module
Ring * Ideal
RingElement * Ideal
RingMap Ideal
annihilator CoherentSheaf
annihilator Ideal
annihilator Module
annihilator RingElement
content Matrix
content RingElement
fittingIdeal(ZZ,Module)
graphIdeal RingMap
homogenize(Ideal,RingElement)
ideal [III.11.5] – make an ideal
ideal (...)
ideal Matrix
ideal Module
ideal RingElement
ideal {...}
kernel RingMap
lift(Ideal,Ring)
quotient(Ideal,Ideal)
229
230
11. IDEAL
quotient(Ideal,RingElement)
quotient(Module,Module)
radical Ideal
removeLowestDimension Ideal
saturate Ideal
saturate(Ideal,Ideal)
saturate(Ideal,RingElement)
substitute(Ideal,Matrix)
substitute(Ideal,Ring)
substitute(Ideal,{...})
top Ideal
trim Ideal
truncate(ZZ,Ideal)
truncate({...},Ideal)
Methods for using an ideal :
EngineRing / Ideal
Ext(ZZ,Ideal,Ideal)
Ext(ZZ,Ideal,Module)
Ext(ZZ,Ideal,Ring)
Ext(ZZ,Matrix,Ideal)
Ext(ZZ,Module,Ideal)
Ext(ZZ,Ring,Ideal)
Hom(Ideal,Ideal)
Hom(Ideal,Module)
Hom(Ideal,Ring)
Hom(Module,Ideal)
Hom(Ring,Ideal)
Ideal * Module
Ideal / Ideal [III.11.6] – quotient module
Ideal == Ideal
Ideal == Module
Ideal == Ring
Ideal == ZZ
Ideal _ ZZ
Matrix % Ideal
Module / Ideal [III.11.7] – quotient module by an ideal
Module : Ideal
Module == Ideal
Ring / Ideal [III.10.1.4.1] – quotient ring
Ring == Ideal
RingElement % Ideal
ZZ % Ideal
ZZ * Ideal
ZZ == Ideal
basis Ideal
basis(ZZ,Ideal)
basis({...},Ideal)
betti Ideal
11.1. IDEAL * IDEAL
231
codim Ideal
decompose Ideal
degree Ideal
dim Ideal
euler Ideal
expression Ideal
gb Ideal
genera Ideal
generators Ideal
hilbertFunction(ZZ,Ideal)
hilbertFunction({...},Ideal)
hilbertPolynomial Ideal
hilbertSeries Ideal
irreducibleCharacteristicSeries Ideal
isHomogeneous Ideal
isSubset(Ideal,Ideal)
isSubset(Ideal,Module)
isSubset(Module,Ideal)
jacobian Ideal
leadTerm Ideal
leadTerm(ZZ,Ideal)
lift(Ideal,ZZ)
map Ideal
map(Ideal,Ideal)
mingens Ideal
module Ideal [III.11.8] – turn an ideal into a module
net Ideal
numgens Ideal
poincare Ideal
quotient(Module,Ideal)
resolution Ideal [III.11.9] – make a projective resolution
ring Ideal
saturate(Module,Ideal)
singularLocus Ideal
substitute(Ideal,Option)
toString Ideal
11.1. Ideal * Ideal
I * J – the product of two ideals.
Synopsis of use:
Operator: * [V.24.14]
Class of argument 1: Ideal [III.11]
Class of argument 2: Ideal [III.11]
Class of typical returned value: Ideal [III.11]
Code:
-- ../m2/matrix1.m2:465
Ideal * Ideal := Ideal => (I,J) -> ideal flatten (generators ...
232
11. IDEAL
11.2. Ideal + Ideal
I + J – the sum of two ideals.
Synopsis of use:
Operator: + [V.24.16]
Class of argument 1: Ideal [III.11]
Class of argument 2: Ideal [III.11]
Class of typical returned value: Ideal [III.11]
Code:
-- ../m2/matrix1.m2:469
Ideal + Ideal := Ideal => (I,J) -> ideal (generators I | gen ...
11.3. Ideal : Ideal
I:J – computes the ideal quotient.
The notation I:J is equivalent to quotient(I,J), although with the latter
form, optional arguments can be provided. See quotient [V.24.505] for further
details.
Synopsis of use:
Operator: : [V.24.29]
Class of argument 1: Ideal [III.11]
Class of argument 2: Ideal [III.11]
Class of typical returned value: Ideal [III.11]
Code:
-- ../m2/colon.m2:174
Ideal : Ideal := Ideal => (I,J) -> quotient(I,J)
11.4. Ideal ^ ZZ
I^n – the n-th power of an ideal I.
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Ideal [III.11]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Ideal [III.11]
Code:
-- ../m2/matrix1.m2:464
Ideal ^ ZZ := Ideal => (I,n) -> ideal symmetricPower(n,gener ...
11.5. ideal
ideal v – produces the ideal spanned by a list or sequence of ring elements.
i1 : ZZ[a..i]
o1 = ZZ [a, b, c, d, e, f, g, h, i]
o1 : PolynomialRing
i2 : ideal (c..h)
o2 = ideal (c, d, e, f, g, h)
o2 : Ideal of ZZ [a, b, c, d, e, f, g, h, i]
11.8. MODULE IDEAL
233
The function ideal is a member of the class Function [III.18].
Class of returned value: Ideal [III.11] – the class of all idealsWays to use ideal
:
ideal (...)
ideal Matrix
ideal Module
ideal QQ
ideal QuotientRing
ideal Ring [III.10.14] – get the ideal used to form a quotient ring
ideal RingElement
ideal Variety
ideal ZZ
ideal {...}
11.6. Ideal / Ideal
I/J – produces the quotient module (I+J)/J, where I and J are ideals in a
ring.
See also:
Module [III.13] – the class of all modules
Synopsis of use:
Operator: / [V.24.25]
Class of argument 1: Ideal [III.11]
Class of argument 2: Ideal [III.11]
Class of typical returned value: Module [III.13]
Code:
-- ../m2/matrix1.m2:456
Ideal / Ideal := Module => (I,J) -> module I / module J
11.7. Module / Ideal
M/I – computes the quotient module M/IM, where M is a module and I is an
ideal.
The module and ideal should belong to the same ring.
Synopsis of use:
Operator: / [V.24.25]
Class of argument 1: Module [III.13]
Class of argument 2: Ideal [III.11]
Class of typical returned value: Module [III.13]
Code:
-- ../m2/matrix1.m2:457
Module / Ideal := Module => (M,J) -> M / (J * M)
11.8. module Ideal
module I – produce the submodule of R^1 corresponding to an ideal I in a ring
R.
Synopsis of use:
Operator: module [V.24.420]
Class of argument 1: Ideal [III.11]
Class of typical returned value: Module [III.13]
Code:
234
11. IDEAL
-- ../m2/matrix1.m2:514
module Ideal := Module => I -> image I.generators
11.9. resolution Ideal
resolution I – produces a projective resolution of the module R/I if I is an
ideal in the ring R.
Synopsis of use:
Operator: resolution [V.24.517]
Class of argument 1: Ideal [III.11]
Class of typical returned value: ChainComplex [III.16]
Optional arguments :
resolution(..., DegreeLimit => ...) [V.24.518] – compute only up
to this degree
resolution(..., HardDegreeLimit => ...) [V.24.519] – compute only
up to this degree
resolution(..., LengthLimit => ...) [V.24.520] – stop when the resolution reaches this length
resolution(..., PairLimit => ...) [V.24.521] – stop when this number
of pairs are handled
resolution(..., SortStrategy => ...) [V.24.522] – specify a strategy
for sorting S-pairs
resolution(..., StopBeforeComputation => ...) [V.24.523] – whether
to stop the computation immediately
resolution(..., Strategy => ...) [V.24.524] – specify a computational
strategy
resolution(..., SyzygyLimit => ...) [V.24.525] – stop when this
number of syzygies are obtained
Code:
-- ../m2/res.m2:172-176
resolution Ideal := ChainComplex => options -> (I) -> resolu ...
if I.?quotient
then I.quotient
else I.quotient = (ring I)^1/I,
options)
CHAPTER 12
Matrix
These are the matrices for which Groebner basis operations are available from
the engine [IV.22].
A matrix is a map from a graded module to a graded module, see Module
[III.13]. The degree of the map is not necessarily 0, and may be obtained with
degree [V.24.240].
Multiplication of matrices corresponds to composition of maps, and when f
and g are maps so that the target Q of g equals the source P of f, the product f*g is
defined, its source is the source of g, and its target is the target of f. The degree of
f*g is the sum of the degrees of f and of g. The product is also defined when P !=
Q, provided only that P and Q are free modules of the same rank. If the degrees of
P differ from the corresponding degrees of Q by the same degree d, then the degree
of f*g is adjusted by d so it will have a good chance to be homogeneous, and the
target and source of f*g are as before.
If h is a matrix then h_j is the j-th column of the matrix, and h_j_i is the
entry in row i, column j. The notation h_(i,j) can be used as an abbreviation
for h_j_i, allowing row and column indices to be written in the customary order.
If m and n are matrices, a is a ring element, and i is an integer, then m+n, m-n,
-m, m*n, a*m, and i*m denote the usual matrix arithmetic. Use m == n, and m ==
0 to check equality of matrices.
See also compactMatrixForm [V.24.219], which governs printing matrices.
The type Matrix is a member of the class Type [III.21.5.4.11]. Each object of
class Matrix is called a matrix. Each matrix is also a member of class ModuleMap
[III.21.5.4.6].
Making a matrix :
- Matrix
ChainComplexMap _ ZZ [III.12.1] – get component
Ext(ZZ,Matrix,Module)
Ext(ZZ,Module,Matrix)
GradedModuleMap _ ZZ
HH^ZZ ChainComplexMap [III.12.2] – cohomology of a chain complex
map
HH_ZZ ChainComplexMap [III.12.3] – homology of a chain complex
map
Hom(Matrix,Module)
Hom(Module,Matrix)
Matrix % GroebnerBasis
Matrix % Ideal
Matrix % Matrix [III.12.4] – find the normal form modulo the image of
a map
235
236
12. MATRIX
Matrix % Module
Matrix * Matrix
Matrix ** Matrix [III.12.5] – tensor product of matrices
Matrix ** Module [III.12.6] – tensor product
Matrix ** Ring [III.10.6] – tensor product
Matrix + Matrix
Matrix ++ Matrix [III.12.7] – direct sum of maps
Matrix ++ RingElement
Matrix - Matrix
Matrix // GroebnerBasis
Matrix // Matrix [III.12.8] – factor a map through another
Matrix ^ ZZ
Matrix ^ [...] [III.12.9] – select some rows of blocks
Matrix ^ {...} [III.12.10] – select some rows of a matrix
Matrix _ [...] [III.12.11] – select some columns of blocks
Matrix _ {...} [III.12.12] – get some columns from a matrix
Matrix | Matrix [III.12.13] – join matrices horizontally
Matrix || Matrix [III.12.14] – join matrices vertically
Module ** Matrix
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Module ^ {...} [III.12.16] – projection map from a free module
Module _ [...] [III.12.17] – get inclusion map into direct sum
Module _ {...} [III.12.18] – map from free module to some generators
RingElement ++ Matrix
RingElement ++ RingElement
RingElement // GroebnerBasis
RingElement | RingElement
RingElement || RingElement
RingMap Matrix
basis Ideal
basis Module
basis Ring
basis(ZZ,Ideal)
basis(ZZ,Module)
basis(ZZ,Ring)
basis({...},Ideal)
basis({...},Module)
basis({...},Ring)
borel Matrix
complement Matrix
compress Matrix
contract’(Matrix,Matrix)
contract(Matrix,Matrix) [III.12.19] – contract one matrix by another
cover Matrix
diff(Matrix,Matrix) [III.12.20] – differentiate
divideByVariable(Matrix,RingElement)
divideByVariable(Matrix,RingElement,ZZ)
12. MATRIX
237
dual Matrix [III.12.21] – dual of a map
exteriorPower(ZZ,Matrix)
flatten Matrix
flip(Module,Module) [III.12.22] – matrix of commutativity of tensor
product
generators GroebnerBasis [III.12.23] – – the Groebner basis matrix
generators Ideal
generators Module
generators(ZZ,Resolution)
getChangeMatrix GroebnerBasis
getChangeMatrix(ZZ,Resolution)
homogenize(Matrix,RingElement)
homogenize(Matrix,RingElement,{...})
homomorphism Matrix
inducedMap(Module,Module)
inducedMap(Module,Module,Matrix)
jacobian Ideal
jacobian Matrix
jacobian Ring
koszul(ZZ,Matrix)
leadTerm Ideal
leadTerm Matrix
leadTerm(ZZ,Ideal)
leadTerm(ZZ,Matrix)
leadTerm(ZZ,ZZ,Resolution)
lift(Matrix,Ring)
map Ideal
map Matrix [III.12.24] – make a map
map Module [III.12.25] – make a map
map(Ideal,Ideal)
map(Module,Matrix) [III.12.26] – make a map
map(Module,Module) [III.12.27] – make a map
map(Module,Module,Function) [III.12.28] – make a map
map(Module,Module,Matrix) [III.12.29] – make a map
map(Module,Module,RingElement) [III.12.30] – make a map
map(Module,Module,ZZ) [III.12.31] – make a map
map(Module,Module,{...}) [III.12.32] – make a map
map(Module,Nothing,Matrix)
map(Module,Nothing,{...}) [III.12.33] – make a map
map(Module,RingElement) [III.12.34] – make a map
map(Module,ZZ)
map(Module,ZZ,Function) [III.12.35] – make a map
map(Module,ZZ,{...}) [III.12.36] – make a map
matrix Matrix [III.12.37] – make a matrix
matrix {...} [III.12.38] – make a matrix
matrix(Ring,{...}) [III.10.16] – make a matrix
mingens GroebnerBasis [III.12.39] – – a matrix whose columns are minimal generators of the submodule
238
12. MATRIX
mingens Ideal
mingens Module
mingens(ZZ,Resolution)
minors(ZZ,Matrix)
modulo(Matrix,Matrix)
pfaffians(ZZ,Matrix)
presentation Module
presentation QuotientRing
prune Matrix
random(Module,Module) [III.12.40] – make a random module map
relations Module
selectInSubring(ZZ,Matrix)
submatrix(Matrix,(...),(...))
submatrix(Matrix,(...),{...})
submatrix(Matrix,{...})
submatrix(Matrix,{...},(...))
submatrix(Matrix,{...},{...})
substitute(Matrix,Matrix)
substitute(Matrix,Ring)
substitute(Matrix,ZZ)
substitute(Matrix,{...})
sum ChainComplexMap [III.12.41] – direct sum of the components of
a chain map
super Matrix
symmetricPower(ZZ,Matrix)
syz GroebnerBasis [III.12.42] – – a matrix whose columns are the syzygies on the columns of the original matrix
syz Matrix
tensorAssociativity(Module,Module,Module)
transpose Matrix
vars Ring
wedgeProduct(ZZ,ZZ,Module)
Methods for using a matrix :
Ext(ZZ,Matrix,Ideal)
Ext(ZZ,Matrix,Ring)
HH_Matrix Matrix [III.12.43] – kernel modulo image
Matrix % RingElement [III.12.44] – reduce the columns modulo of a
ring element
Matrix * Vector
Matrix * ZZ
Matrix ** RingElement
Matrix + RingElement
Matrix + ZZ
Matrix ++ ZZ
Matrix - RingElement
Matrix - ZZ
Matrix // RingElement [III.12.45] – factor a map through a multiplication map
12. MATRIX
Matrix // ZZ
Matrix == Matrix
Matrix == RingElement
Matrix == ZZ
Matrix _ (...) [III.12.46] – get an entry
Matrix _ ZZ [III.12.47] – get a column from a matrix
Matrix | RingElement
Matrix | ZZ
Matrix || RingElement
Matrix || ZZ
RingElement % Matrix
RingElement * Matrix
RingElement ** Matrix
RingElement + Matrix
RingElement - Matrix
RingElement // Matrix
RingElement == Matrix
RingElement | Matrix
RingElement || Matrix
ZZ * Matrix
ZZ + Matrix
ZZ ++ Matrix
ZZ - Matrix
ZZ // Matrix
ZZ == Matrix
ZZ | Matrix
ZZ || Matrix
betti Matrix
chainComplex Matrix [III.12.48] – make a small chain complex
coefficients Matrix
coefficients({...},Matrix)
coimage Matrix
cokernel Matrix
components Matrix
content Matrix
contract(Matrix,RingElement)
contract(Matrix,Vector)
contract(RingElement,Matrix)
contract(Vector,Matrix)
degree Matrix
det Matrix
diff Matrix [III.12.49] – differentiate a matrix
diff(Matrix,RingElement)
diff(Matrix,Vector)
diff(RingElement,Matrix)
diff(Vector,Matrix)
entries Matrix
expression Matrix
239
240
12. MATRIX
extend(ChainComplex,ChainComplex,Matrix)
forceGB Matrix
gb Matrix
ideal Matrix
image Matrix
inducedMap(Module,Nothing,Matrix)
inducedMap(Nothing,Module,Matrix)
inducedMap(Nothing,Nothing,Matrix)
inducesWellDefinedMap(Module,Module,Matrix)
inducesWellDefinedMap(Module,Nothing,Matrix)
inducesWellDefinedMap(Nothing,Module,Matrix)
inducesWellDefinedMap(Nothing,Nothing,Matrix)
isHomogeneous Matrix
isInjective Matrix
isIsomorphism Matrix
isSurjective Matrix
isWellDefined Matrix
kernel Matrix
lift(Matrix,ZZ)
map(Ring,Matrix)
map(Ring,Ring,Matrix)
modulo(Matrix,Nothing)
modulo(Nothing,Matrix)
monomialIdeal Matrix [III.12.50] – make a monomial ideal
monomialIdeal(ZZ,Matrix) [III.12.51] – make a monomial ideal
net Matrix
newCoordinateSystem(PolynomialRing,Matrix)
precedence Matrix
promote(Matrix,QQ)
promote(Matrix,ZZ)
rank Matrix
resolution Matrix [III.12.52] – make a projective resolution
ring Matrix
sortColumns Matrix
submatrix(Matrix,Nothing,{...})
submatrix(Matrix,{...},Nothing)
subquotient(Matrix,Matrix)
subquotient(Matrix,Nothing)
subquotient(Nothing,Matrix)
substitute(Ideal,Matrix)
substitute(Matrix,Option)
substitute(Module,Matrix)
substitute(RingElement,Matrix)
substitute(Vector,Matrix)
toExternalString Matrix
toString Matrix
topCoefficients Matrix
trace Matrix
12.3. HH_ZZ CHAINCOMPLEXMAP
241
12.1. ChainComplexMap _ ZZ
p_i – for a map p : C -> D of chain complexes of degree d, provides the
component p_i : C_i -> D_(i+d).
See also:
ChainComplexMap [III.21.5.4.1] – the class of all maps between chain
complexes
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: ChainComplexMap [III.21.5.4.1]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Matrix [III.12]
12.2. HH^ZZ ChainComplexMap
HH^i f – provides the map on the i-th cohomology module by a map f of chain
complexes.
See also:
cohomology [V.24.210] – general cohomology functor
HH [V.24.88] – general homology and cohomology functor
Synopsis of use:
Operator: cohomology [V.24.210]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ChainComplexMap [III.21.5.4.1]
Class of typical returned value: Matrix [III.12]
Optional arguments :
cohomology(..., Degree => ...)
Code:
-- ../m2/chaincomplexes.m2:426
cohomology(ZZ,ChainComplexMap) := Matrix => opts -> (i,f) -> ...
12.3. HH_ZZ ChainComplexMap
HH_i f – provides the map on the i-th homology module by a map f of chain
complexes.
See also:
homology [V.24.341] – general homology functor
HH [V.24.88] – general homology and cohomology functor
Synopsis of use:
Operator: homology [V.24.341]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ChainComplexMap [III.21.5.4.1]
Class of typical returned value: Matrix [III.12]
Optional arguments :
Code:
-- ../m2/chaincomplexes.m2:423-425
homology(ZZ,ChainComplexMap) := Matrix => opts -> (i,f) -> (
inducedMap(homology(i+degree f,target f), homology(i,so ...
)
242
12. MATRIX
12.4. Matrix % Matrix
f % g – yields the reduction of the columns of the matrix f modulo a Groebner
basis of the matrix g.
Synopsis of use:
Operator: % [V.24.9]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix2.m2:89-95
Matrix % Matrix := Matrix => (n,m) -> (
R := ring n;
if R =!= ring m then error "expected matrices over the ...
if not isFreeModule source n or not isFreeModule source ...
or not isFreeModule target n or not isFreeModule target ...
then error "expected maps between free modules";
n % gb m)
12.5. Matrix ** Matrix
f ** g – computes the tensor product of two matrices.
See also:
Matrix [III.12] – the class of all matrices
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
12.6. Matrix ** Module
f ** N – tensor product of a matrix f and a module N.
This is the same as tensoring f with the identity map of N.
When N is a free module of rank 1 the net effect of the operation is to shift the
degrees of f.
i1 : R = ZZ/101[t]
o1 = R
o1 : PolynomialRing
i2 : f = matrix {{t}}
o2 = {0} | t |
1
1
o2 : Matrix R <--- R
i3 : degrees source f
o3 = {{1}}
o3 : List
i4 : degrees source (f ** R^{-3})
12.7. MATRIX ++ MATRIX
243
o4 = {{4}}
o4 : List
See also:
Matrix [III.12] – the class of all matrices
Module [III.13] – the class of all modules
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Matrix [III.12]
Class of argument 2: Module [III.13]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/modules2.m2:52-59
Matrix ** Module := Matrix => (f,M) -> (
P := youngest(f,M);
key := (f,M,symbol **);
if P#?key then P#key
else f**M = (
f ** id_M
)
)
12.7. Matrix ++ Matrix
f++g – computes the direct sum of two maps between modules.
If an argument is a ring element or integer, it is promoted to a one by one
matrix.
i1 : R = ZZ/101[a..c];
i2 : vars R ++ transpose vars R
o2 = {0}
{-1}
{-1}
{-1}
|
|
|
|
a
0
0
0
b
0
0
0
c
0
0
0
0
a
b
c
|
|
|
|
4
4
o2 : Matrix R <--- R
i3 : oo^[1]
o3 = {-1} | 0 0 0 a |
{-1} | 0 0 0 b |
{-1} | 0 0 0 c |
3
4
o3 : Matrix R <--- R
i4 : a++b++c
o4 = {0} | a 0 0 |
{0} | 0 b 0 |
{0} | 0 0 c |
3
3
o4 : Matrix R <--- R
244
12. MATRIX
Selecting rows or columns of blocks:
Matrix ^ [...] [III.12.9] – select some rows of blocks
Matrix _ [...] [III.12.11] – select some columns of blocks
See also:
directSum [V.24.254] – direct sum of modules or maps
Matrix | Matrix [III.12.13] – join matrices horizontally
Matrix || Matrix [III.12.14] – join matrices vertically
Synopsis of use:
Operator: ++ [V.24.17]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
12.8. Matrix // Matrix
f//g – yields a matrix h from matrices f and g such that f - g*h is the
reduction of f modulo a Groebner basis for the image of g.
If the remainder f - g*h is zero, then the quotient f//g satisfies the equation
f = g * (f//g).
See also:
Matrix % Matrix [III.12.4] – find the normal form modulo the image of
a map
Synopsis of use:
Operator: // [V.24.26]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
12.9. Matrix ^ [...]
f^[i,j,k] – extract some rows of blocks from a matrix f.
The target of f should be a direct sum, and the result is obtained by composition
with the projection onto the sum of the components numbered i, j, k. Free
modules are regarded as direct sums.
i1 : f = map(ZZ^2 ++ ZZ^2, ZZ^2, {{1,2},{3,4},{5,6},{7,8}})
o1 = |
|
|
|
1
3
5
7
2
4
6
8
|
|
|
|
4
2
o1 : Matrix ZZ <--- ZZ
i2 : f^[0]
o2 = | 1 2 |
| 3 4 |
2
2
o2 : Matrix ZZ <--- ZZ
i3 : f^[1]
12.10. MATRIX ^ {...}
245
o3 = | 5 6 |
| 7 8 |
2
2
o3 : Matrix ZZ <--- ZZ
i4 : f^[1,0]
o4 = |
|
|
|
5
7
1
3
6
8
2
4
|
|
|
|
4
2
o4 : Matrix ZZ <--- ZZ
See also:
submatrix [V.24.570] – select part of a matrix
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Matrix _ [...] [III.12.11] – select some columns of blocks
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Matrix [III.12]
Class of argument 2: Array [III.19.1]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix1.m2:596
Matrix ^ Array := Matrix => (f,v) -> (target f)^v * f
12.10. Matrix ^ {...}
f^{i,j,k,...} – produce the submatrix of a matrix f consisting of rows numbered i, j, k, ... .
Repetitions of the indices are allowed.
If the list of row indices is a permutation of 0 .. n-1, where n is the number of
rows, then the result is the corresponding permutation of the rows of f.
i1 : R = ZZ/101[a..f]
o1 = R
o1 : PolynomialRing
i2 : p = matrix {{a,b,c},{d,e,f}}
o2 = {0} | a b c |
{0} | d e f |
2
3
o2 : Matrix R <--- R
i3 : p^{1}
o3 = {0} | d e f |
1
3
246
12. MATRIX
o3 : Matrix R
<--- R
i4 : p^{1,0}
o4 = {0} | d e f |
{0} | a b c |
2
3
o4 : Matrix R <--- R
See also:
^ [V.24.149] – a binary operator, usually used for exponents
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Matrix [III.12]
Class of argument 2: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix.m2:399-403
Matrix ^ List := Matrix => (f,v) -> (
v = splice v;
listZ v;
submatrix(f,v,)
)
12.11. Matrix _ [...]
f_[i,j,k] – extract some columns of blocks from a matrix f.
The source of f should be a direct sum, and the result is obtained by composition with the inclusion into the sum of the components numbered i, j, k. Free
modules are regarded as direct sums.
i1 : f = map(ZZ^2 ++ ZZ^2, ZZ^2, {{1,2},{3,4},{5,6},{7,8}})
o1 = |
|
|
|
1
3
5
7
2
4
6
8
|
|
|
|
4
2
o1 : Matrix ZZ <--- ZZ
i2 : f^[0]
o2 = | 1 2 |
| 3 4 |
2
2
o2 : Matrix ZZ <--- ZZ
i3 : f^[1]
o3 = | 5 6 |
| 7 8 |
2
2
o3 : Matrix ZZ <--- ZZ
i4 : f^[1,0]
12.12. MATRIX _ {...}
o4 = |
|
|
|
5
7
1
3
6
8
2
4
247
|
|
|
|
4
2
o4 : Matrix ZZ <--- ZZ
See also:
submatrix [V.24.570] – select part of a matrix
Module _ [...] [III.12.17] – get inclusion map into direct sum
Matrix ^ [...] [III.12.9] – select some rows of blocks
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Matrix [III.12]
Class of argument 2: Array [III.19.1]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix1.m2:595
Matrix _ Array := Matrix => (f,v) -> f * (source f)_v
12.12. Matrix _ {...}
f_{i,j,k,...} – produce the submatrix of a matrix f consisting of columns
numbered i, j, k, ... .
Repetitions of the indices are allowed.
If the list of column indices is a permutation of 0 .. n-1, where n is the number
of columns, then the result is the corresponding permutation of the columns of f.
i1 : R = ZZ/101[a..f];
i2 : p = matrix {{a,b,c},{d,e,f}}
o2 = {0} | a b c |
{0} | d e f |
2
3
o2 : Matrix R <--- R
i3 : p_{1}
o3 = {0} | b |
{0} | e |
2
1
o3 : Matrix R <--- R
i4 : p_{1,1,2}
o4 = {0} | b b c |
{0} | e e f |
2
3
o4 : Matrix R <--- R
i5 : p_{2,1,0}
248
12. MATRIX
o5 = {0} | c b a |
{0} | f e d |
2
3
o5 : Matrix R <--- R
See also:
_ [V.24.151]
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Matrix [III.12]
Class of argument 2: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix.m2:393-397
Matrix _ List := Matrix => (f,v) -> (
v = splice v;
listZ v;
submatrix(f,v)
)
12.13. Matrix | Matrix
f|g – concatenate matrices horizontally.
It is assumed that f and g both have the same target.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : f = matrix {{x,0,0},{0,y,0},{0,0,z}}
o2 = {0} | x 0 0 |
{0} | 0 y 0 |
{0} | 0 0 z |
3
3
o2 : Matrix R <--- R
i3 : f|f|f
o3 = {0} | x 0 0 x 0 0 x 0 0 |
{0} | 0 y 0 0 y 0 0 y 0 |
{0} | 0 0 z 0 0 z 0 0 z |
3
9
o3 : Matrix R <--- R
If one of the arguments is ring element or an integer, then it will be multiplied
by a suitable identity matrix.
i4 : 2|f|3
o4 = {0} | 2 0 0 x 0 0 3 0 0 |
{0} | 0 2 0 0 y 0 0 3 0 |
{0} | 0 0 2 0 0 z 0 0 3 |
3
9
12.14. MATRIX || MATRIX
249
o4 : Matrix R <--- R
See also:
Matrix || Matrix [III.12.14] – join matrices vertically
Synopsis of use:
Operator: | [V.24.655]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix.m2:376
Matrix | Matrix := Matrix => (f,g) -> concatCols(f,g)
12.14. Matrix || Matrix
f||g – yields the matrix obtained from matrices f and g by concatenating the
columns.
i1 : R = ZZ[a..h];
i2 : p = matrix {{a,b},{c,d}}
o2 = {0} | a b |
{0} | c d |
2
2
o2 : Matrix R <--- R
i3 : q = matrix {{e,f},{g,h}}
o3 = {0} | e f |
{0} | g h |
2
2
o3 : Matrix R <--- R
i4 : p || q
o4 = {0}
{0}
{0}
{0}
|
|
|
|
a
c
e
g
b
d
f
h
|
|
|
|
4
2
o4 : Matrix R <--- R
If one of the arguments is ring element or an integer, then it will be multiplied
by a suitable identity matrix.
i5 : p || 33
o5 = {0}
{0}
{1}
{1}
|
|
|
|
a
c
33
0
b
d
0
33
|
|
|
|
4
2
o5 : Matrix R <--- R
See also:
Matrix | Matrix [III.12.13] – join matrices horizontally
250
12. MATRIX
Synopsis of use:
Operator: || [V.24.656]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix.m2:382
Matrix || Matrix := Matrix => (f,g) -> concatRows(f,g)
12.15. Module ^ [...]
M^[i,j,k] – projection onto some factors of a direct sum module.
The module M should be a direct sum, and the result is the matrix obtained by
projection onto the sum of the components numbered i, j, k. Free modules are
regarded as direct sums.
i1 : M = ZZ^2 ++ ZZ^3
5
o1 = ZZ
o1 : ZZ - module, free
i2 : M^[0]
o2 = | 1 0 0 0 0 |
| 0 1 0 0 0 |
2
5
o2 : Matrix ZZ <--- ZZ
i3 : M^[1]
o3 = | 0 0 1 0 0 |
| 0 0 0 1 0 |
| 0 0 0 0 1 |
3
5
o3 : Matrix ZZ <--- ZZ
i4 : M^[1,0]
o4 = |
|
|
|
|
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
|
|
|
|
|
5
5
o4 : Matrix ZZ <--- ZZ
See also:
Matrix ^ [...] [III.12.9] – select some rows of blocks
Module _ [...] [III.12.17] – get inclusion map into direct sum
Module ^ {...} [III.12.16] – projection map from a free module
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Module [III.13]
12.17. MODULE _ [...]
251
Class of argument 2: Array [III.19.1]
Class of typical returned value: Matrix [III.12]
12.16. Module ^ {...}
M^{i,j,k,...} – provides the projection map from a free module M to the free
module corresponding to the basis vectors whose index numbers are listed.
i1 : (ZZ^5)^{2,3}
o1 = | 0 0 1 0 0 |
| 0 0 0 1 0 |
2
5
o1 : Matrix ZZ <--- ZZ
See also:
_ [V.24.151]
Module [III.13] – the class of all modules
List [III.19.2] – class of all lists – {...}
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Module [III.13]
Class of argument 2: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/modules2.m2:546
Module ^ List := Matrix => (M,rows) -> submatrix(id_M,rows,)
12.17. Module _ [...]
M_[i,j,k] – get inclusion map of blocks from a module M.
The module M should be a direct sum, and the result is the matrix obtained by
inclusion from the sum of the components numbered i, j, k. Free modules are
regarded as direct sums.
i1 : M = ZZ^2 ++ ZZ^3
5
o1 = ZZ
o1 : ZZ - module, free
i2 : M_[0]
o2 = |
|
|
|
|
1
0
0
0
0
0
1
0
0
0
|
|
|
|
|
5
2
o2 : Matrix ZZ <--- ZZ
i3 : M_[1]
o3 = | 0 0 0 |
| 0 0 0 |
252
12. MATRIX
| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
5
3
o3 : Matrix ZZ <--- ZZ
i4 : M_[1,0]
o4 = |
|
|
|
|
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
0
1
0
0
0
|
|
|
|
|
5
5
o4 : Matrix ZZ <--- ZZ
See also:
submatrix [V.24.570] – select part of a matrix
Matrix _ [...] [III.12.11] – select some columns of blocks
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Module _ {...} [III.12.18] – map from free module to some generators
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Module [III.13]
Class of argument 2: Array [III.19.1]
Class of typical returned value: Matrix [III.12]
12.18. Module _ {...}
M_{i,j,k,...} – provides a map from a free module to the module M which
sends the basis vectors to the generators of M whose index numbers are listed.
i1 : (ZZ^5)^{2,3}
o1 = | 0 0 1 0 0 |
| 0 0 0 1 0 |
2
5
o1 : Matrix ZZ <--- ZZ
See also:
^ [V.24.149] – a binary operator, usually used for exponents
Module [III.13] – the class of all modules
List [III.19.2] – class of all lists – {...}
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Module [III.13]
Class of argument 2: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/modules2.m2:548-551
Module _ List := Matrix => (M,v) -> (
N := cover M;
f := id_N_v;
12.19. CONTRACT(MATRIX,MATRIX)
253
map(M, source f, f))
12.19. contract(Matrix,Matrix)
usage: contract(m, n) – contract the matrix n by the matrix m
This function is identical to diff [V.24.251], except that contraction is used
instead of differentiation. This means for example that x^3 contracted by x^2 is x,
not 6 x. For example,
i1 : R = ZZ/101[a..c]
o1 = R
o1 : PolynomialRing
i2 : contract(transpose matrix {{a,b,c}}, matrix {{(a+b+c)^3 ...
o2 = {1} | a2+3ab+3b2+3ac+6bc+3c2 ab3c2 |
{1} | 3a2+3ab+b2+6ac+3bc+3c2 a2b2c2 |
{1} | 3a2+6ab+3b2+3ac+3bc+c2 a2b3c |
3
2
o2 : Matrix R <--- R
As another example, the Sylvester resultant between homogeneous polynomials
f(x,y) and g(x,y) can be found in the following way.
i3 : R = (ZZ/101[a,b])[x,y]
o3 = R
o3 : PolynomialRing
i4 : f = a * x^3 + b * x^2 * y + y^3
3
2
3
o4 = a*x + b*x y + y
o4 : R
i5 : g = b * x^3 + a * x * y^2 + y^3
3
2
3
o5 = b*x + a*x*y + y
o5 : R
Multiply each of these by all quadrics, obtaining a set of elements in degree 5.
i6 : n = matrix {{f,g}} ** symmetricPower(2,vars R)
o6 = {0} | ax5+bx4y+x2y3 ax4y+bx3y2+xy4 ax3y2+bx2y3+y5 bx5+a ...
1
6
o6 : Matrix R <--- R
Now create the matrix of coefficients by using contract against all monomials
of degree 5 in x and y.
i7 : M = contract(transpose symmetricPower(5,vars R), n)
o7 = {5} | a 0 0 b 0 0 |
254
12. MATRIX
{5}
{5}
{5}
{5}
{5}
|
|
|
|
|
b
0
1
0
0
a
b
0
1
0
0
a
b
0
1
0
a
1
0
0
b
0
a
1
0
0
b
0
a
1
|
|
|
|
|
6
6
o7 : Matrix R <--- R
i8 : Resfg = minors(6, M)
5
2 3
3
2 2
3
4
3
2 ...
o8 = ideal(- a - a b - a b - a b + 2a*b - b + a - 3a b ...
o8 : Ideal of R
The free modules which are provided as the result of differention are carefully chosen to preserve homogeneity. Contraction is essentially a partially defined
division operation, so it should come as no surprise that the source and target
of contract(m, n) are the same as those we would get from the tensor product
transpose m^-1 ** n, if only m were invertible. We illustrate that now, by displaying the degrees of the basis elements.
i9 : R = ZZ/101[x]
o9 = R
o9 : PolynomialRing
i10 : A = R^{0,-1}; B = R^{0,-2}; C = R^{0,-4}; D = R^{0,-8} ...
i14 : m = random(A,B)
o14 = {0} | -22 -2x2 |
{1} | 0
35x |
2
2
o14 : Matrix R <--- R
i15 : n = random(C,D)
o15 = {0} | 38 43x8 |
{4} | 0 -37x4 |
2
2
o15 : Matrix R <--- R
i16 : contract(m,n)
o16 = {0}
{4}
{-1}
{3}
|
|
|
|
-28
0
0
0
-37x8
6x4
0
0
0
0
0
0
15x6
-27x2
-10x7
18x3
|
|
|
|
4
4
o16 : Matrix R <--- R
i17 : degrees target oo, degrees source oo
o17 = ({{0}, {4}, {-1}, {3}}, {{0}, {8}, {-2}, {6}})
12.20. DIFF(MATRIX,MATRIX)
255
o17 : Sequence
i18 : degrees (dual A ** C), degrees (dual B ** D)
o18 = ({{0}, {4}, {-1}, {3}}, {{0}, {8}, {-2}, {6}})
o18 : Sequence
See also:
diff [V.24.251] – differentiate
Synopsis of use:
Operator: contract [V.24.229]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix.m2:54-60
BinaryMatrixOperation := (operation) -> (m,n) -> (
if ring m =!= ring n then (
try m = promote(m,ring n)
else try n = promote(n,ring m)
else error "expected matrices over compatible ring ...
sendgg (ggPush m, ggPush n, operation);
getMatrix ring m)
12.20. diff(Matrix,Matrix)
diff(m,n) – differentiate the matrix n by the matrix m.
Given matrices m : F0 <--- F1, and n : G0 <--- G1, produce a matrix with
the shape diff(m,n) : F0’ ** G0 <--- F1’ ** G1, whose entry in the slot ((i,j),(k,l))
is the result of differentiating n_(j,l) by the differential operator corresponding to
m_(i,k).
If m or n is a ring element, then it is interpreted as a one-by-one matrix. If m
is a vector, it is interpreted as a matrix with one column, and if n is a vector, it is
interpreted as a matrix with one row. If both m and n are ring elements, then the
result will be a ring element rather than a one-by-one matrix. If m is a vector and
n is a ring element, then the result will be a vector rather than a matrix with one
column.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : m = genericMatrix(R,a,2,2)
o2 = {0} | a c |
{0} | b d |
2
2
o2 : Matrix R <--- R
i3 : diff(transpose m,m*m)
o3 = {1} | 2a c
c
0
|
256
12. MATRIX
{1} | b
{1} | b
{1} | 0
0
a+d c |
a+d 0
c |
b
b
2d |
4
4
o3 : Matrix R <--- R
The most common usage of this function is when m : F <— R^1 and n : R^1
<— G. In this case the result is a matrix with shape diff(m,n) : F’ <— G, and
the (i,j) th entry is the result of differentiating n_j by the differential operator
corresponding to m_i.
i4 : m = matrix {{a,b,c,d}}
o4 = {0} | a b c d |
1
4
o4 : Matrix R <--- R
i5 : n = matrix {{a^2, (b + c)*(a + d), a*b*c}}
o5 = {0} | a2 ab+ac+bd+cd abc |
1
3
o5 : Matrix R <--- R
i6 : p = diff(transpose m,n)
o6 = {1}
{1}
{1}
{1}
|
|
|
|
2a
0
0
0
b+c
a+d
a+d
b+c
bc
ac
ab
0
|
|
|
|
4
3
o6 : Matrix R <--- R
i7 : target p
4
o7 = R
o7 : R - module, free
i8 : source p
3
o8 = R
o8 : R - module, free
As another example, we show how to compute the Wronskian of a polynomial
f.
i9 : R = ZZ/101[a, x .. z]
o9 = R
o9 : PolynomialRing
i10 : f = matrix {{x^3 + y^3 + z^3 - a*x*y*z}}
12.20. DIFF(MATRIX,MATRIX)
257
o10 = {0} | -axyz+x3+y3+z3 |
1
1
o10 : Matrix R <--- R
i11 : v = matrix {{x,y,z}}
o11 = {0} | x y z |
1
3
o11 : Matrix R <--- R
i12 : W = diff(transpose v * v, f)
o12 = {1} | 6x -az -ay |
{1} | -az 6y -ax |
{1} | -ay -ax 6z |
3
3
o12 : Matrix R <--- R
i13 : Wf = minors(3,W)
3
2 3
2 3
2 3
o13 = ideal(- 2a x*y*z - 6a x - 6a y - 6a z + 14x*y*z)
o13 : Ideal of R
The free modules which are provided as the result of differentiation are chosen
to preserve homogeneity. Just as with contract [V.24.229], it should come as no
surprise that the source and target of diff(m,n) are the same as those we would
get from the tensor product transpose m^-1 ** n, if only m were invertible. We
illustrate that now, by displaying the degrees of the basis elements.
i14 : R = ZZ/101[x]
o14 = R
o14 : PolynomialRing
i15 : A = R^{0,-1}; B = R^{0,-2}; C = R^{0,-4}; D = R^{0,-8} ...
i19 : m = random(A,B)
o19 = {0} | -22 -2x2 |
{1} | 0
35x |
2
2
o19 : Matrix R <--- R
i20 : n = random(C,D)
o20 = {0} | 38 43x8 |
{4} | 0 -37x4 |
2
2
o20 : Matrix R <--- R
i21 : diff(m,n)
258
12. MATRIX
o21 = {0}
{4}
{-1}
{3}
|
|
|
|
-28
0
0
0
-37x8
6x4
0
0
0
0
0
0
32x6
-21x2
21x7
-29x3
|
|
|
|
4
4
o21 : Matrix R <--- R
i22 : degrees target oo, degrees source oo
o22 = ({{0}, {4}, {-1}, {3}}, {{0}, {8}, {-2}, {6}})
o22 : Sequence
i23 : degrees (dual A ** C), degrees (dual B ** D)
o23 = ({{0}, {4}, {-1}, {3}}, {{0}, {8}, {-2}, {6}})
o23 : Sequence
See also:
contract [V.24.229] – contract one matrix by another
jacobian [V.24.372] – the Jacobian matrix of partial derivatives
Synopsis of use:
Operator: diff [V.24.251]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix.m2:54-60
BinaryMatrixOperation := (operation) -> (m,n) -> (
if ring m =!= ring n then (
try m = promote(m,ring n)
else try n = promote(n,ring m)
else error "expected matrices over compatible ring ...
sendgg (ggPush m, ggPush n, operation);
getMatrix ring m)
12.21. dual Matrix
dual f – the dual (transpose) of a homomorphism.
Synopsis of use:
Operator: dual [V.24.260]
Class of argument 1: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix1.m2:586-589
dual(Matrix) := Matrix => f -> (
R := ring f;
Hom(f,R^1)
)
12.22. flip(Module,Module)
flip(F,G) – yields the matrix representing the map F ** G –> G ** F.
Synopsis of use:
Operator: flip [V.24.292]
12.25. MAP MODULE
259
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/matrix1.m2:320-322
flip(Module,Module) := Matrix => (F,G) -> (
sendgg(ggPush F, ggPush G, ggflip);
getMatrix ring F)
12.23. generators GroebnerBasis
generators g – returns a matrix whose columns are the generators of the
Groebner basis.
Synopsis of use:
Operator: generators [III.13.12.1]
Class of argument 1: GroebnerBasis [III.15]
Class of typical returned value: Matrix [III.12]
Code:
-- ../m2/gb.m2:197-199
generators GroebnerBasis := Matrix => (g) -> (
sendgg(ggPush g, gggetgb);
getMatrix ring g)
12.24. map Matrix
map(f, Degree => d) – make a map of degree d from a map f of modules by
tensoring the source module with a free module of rank 1 and appropriate degree.
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
Code:
-- ../m2/matrix1.m2:11-17
map(Matrix) := Matrix => options -> (f) -> (
if options.Degree === null then f
else (
R := ring source f;
d := options.Degree;
if class d === ZZ then d = {d};
map(target f, source f ** R^{d - degree f}, f, opt ...
12.25. map Module
map M – construct the identity map from M to itself.
This can also be accomplished with id_M or map(M,1).
See also:
map [V.24.399] – make a map
id [V.24.344] – identity map
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of typical returned value: Matrix [III.12]
260
12. MATRIX
Optional arguments :
map(..., Degree => ...)
12.26. map(Module,Matrix)
map(M,p) – recasts a matrix p to a map whose target is M by tensoring p with
a graded free module of rank 1.
i1 : R = ZZ/101[x,y]
o1 = R
o1 : PolynomialRing
i2 : p = matrix{{x,y}}
o2 = {0} | x y |
1
2
o2 : Matrix R <--- R
i3 : q = map(R^{3},p)
o3 = {-3} | x y |
1
2
o3 : Matrix R <--- R
i4 : degrees target q
o4 = {{-3}}
o4 : List
i5 : degrees source q
o5 = {{-2}, {-2}}
o5 : List
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.27. map(Module,Module)
map(M,N) – constructs the natural map from N to M.
The modules M and N should be subquotient modules of the same free module
See also:
map [V.24.399] – make a map
isWellDefined [III.21.2.27] – whether a map is well defined
12.29. MAP(MODULE,MODULE,MATRIX)
261
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.28. map(Module,Module,Function)
map(M,N,f) – creates a map from the module N to the module M whose matrix
entries are obtained from the function f by evaluating f(i,j)
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of argument 3: Function [III.18]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
Code:
-- ../m2/matrix1.m2:7-9
map(Module,Module,Function) := Matrix => options -> (M,N,f) ...
map(M,N,table(numgens M, numgens N, f))
)
12.29. map(Module,Module,Matrix)
map(M,N,p) – recasts the matrix p as a map (matrix) from the module N to
the module M.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : p = matrix {{x,y,z}}
o2 = {0} | x y z |
1
3
o2 : Matrix R <--- R
i3 : q = map(R^1,R^3,p)
o3 = {0} | x y z |
1
3
o3 : Matrix R <--- R
i4 : degrees source p
o4 = {{1}, {1}, {1}}
o4 : List
262
12. MATRIX
i5 : degrees source q
o5 = {{0}, {0}, {0}}
o5 : List
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of argument 3: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.30. map(Module,Module,RingElement)
map(M,N,r) – construct a map from a module N to M which is provided by the
ring element r.
If r is nonzero, then M and N should be equal, or at least have the same number
of generators.
i1 : R = ZZ/101[x]
o1 = R
o1 : PolynomialRing
i2 : map(R^2,R^3,0)
o2 = 0
2
3
o2 : Matrix R <--- R
i3 : map(R^2,R^2,x)
o3 = {0} | x 0 |
{0} | 0 x |
2
2
o3 : Matrix R <--- R
i4 : q = map(R^2,R^2,x,Degree=>1)
o4 = {0} | x 0 |
{0} | 0 x |
2
2
o4 : Matrix R <--- R
i5 : isHomogeneous q
o5 = false
12.31. MAP(MODULE,MODULE,ZZ)
263
See also:
map(Module,Module,ZZ) [III.12.31] – make a map
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of argument 3: RingElement [III.21.5.4.9]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.31. map(Module,Module,ZZ)
map(M,N,k) – construct a map from a module N to M which is provided by the
integer k.
If k is 0, then the zero map is constructed. If k is 1, then M and N should have
the same number and degrees of generators in the sense that the modules cover M
and cover N are equal, and then the map which sends the i-th generator of N to
the i-th generator of M is constructed (and it may not be well-defined). Otherwise,
M and N should be equal, or at least have the same number of generators.
i1 : R = QQ[x,y];
i2 : M = image vars R
o2 = image {0} | x y |
1
o2 : R - module, submodule of R
i3 : N = coker presentation M
o3 = cokernel {1} | 1/-1y |
{1} | -1/-1x |
2
o3 : R - module, quotient of R
i4 : f = map(M,N,1)
o4 = {1} | 1 0 |
{1} | 0 1 |
o4 : Matrix
i5 : isWellDefined f
o5 = true
i6 : isIsomorphism f
o6 = true
i7 : g = map(M,cover M,1)
264
12. MATRIX
o7 = {1} | 1 0 |
{1} | 0 1 |
o7 : Matrix
i8 : isWellDefined g
o8 = true
i9 : isIsomorphism g
o9 = false
i10 : h = map(cover M,M,1)
o10 = {1} | 1 0 |
{1} | 0 1 |
o10 : Matrix
i11 : isWellDefined h
o11 = false
See also:
map(Module,Module,RingElement) [III.12.30] – make a map
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of argument 3: ZZ [III.21.11]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.32. map(Module,Module,{...})
map(M,N,v) – produces a map (matrix) from the module N to the module M
whose entries are obtained from the doubly-nested list v of ring elements.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : p = map(R^2,R^{-2,-2},{{x^2,0},{0,y^2}})
o2 = {0} | x2 0 |
{0} | 0 y2 |
2
2
o2 : Matrix R <--- R
i3 : isHomogeneous p
12.33. MAP(MODULE,NOTHING,{...})
265
o3 = true
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of argument 3: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.33. map(Module,Nothing,{...})
map(M,,v) – construct a map from a free graded module to M whose entries
are obtained from the doubly-nested list v of ring elements.
The absence of the second argument indicates that the source of the map is to
be a free module constructed with an attempt made to assign degrees to its basis
elements so as to make the map homogeneous of degree zero.
i1 : R = ZZ/101[x,y]
o1 = R
o1 : PolynomialRing
i2 : f = map(R^2,,{{x^2,y^2},{x*y,0}})
o2 = {0} | x2 y2 |
{0} | xy 0 |
2
2
o2 : Matrix R <--- R
i3 : degrees source f
o3 = {{2}, {2}}
o3 : List
i4 : isHomogeneous f
o4 = true
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: Nothing [III.21.7]
Class of argument 3: List [III.19.2]
Class of typical returned value: Matrix [III.12]
266
12. MATRIX
Optional arguments :
map(..., Degree => ...)
12.34. map(Module,RingElement)
map(M,r) – construct the map from M to itself which is provided by scalar
multiplication by the ring element r.
i1 : R = ZZ/101[x]
o1 = R
o1 : PolynomialRing
i2 : map(R^2,x)
o2 = {0} | x 0 |
{0} | 0 x |
2
2
o2 : Matrix R <--- R
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: RingElement [III.21.5.4.9]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
Code:
-- ../m2/matrix.m2:531-537
map(Module,RingElement) := Matrix => options -> (M,r) -> (
R := ring M;
try r = r + R#0
else error "encountered scalar of unrelated ring";
if r == 0 then map(M,M,0)
else if r == 1 then map(M,1)
else r * (map(M,1)))
12.35. map(Module,ZZ,Function)
map(M,n,f) – construct a map from a free graded module of rank n to M whose
entries are obtained from the function f by evaluating f(i,j).
The degrees of the basis elements of the source module are chosen in an attempt
to ensure that the resulting map is homogeneous of degree zero.
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: ZZ [III.21.11]
Class of argument 3: Function [III.18]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.38. MATRIX {...}
267
12.36. map(Module,ZZ,{...})
map(M,n,v) – construct a map from a free graded module of rank n to M whose
entries are in the doubly nested list v.
The degrees of the basis elements of the source module are chosen in an attempt
to ensure that the resulting map is homogeneous of degree zero.
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: Module [III.13]
Class of argument 2: ZZ [III.21.11]
Class of argument 3: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Optional arguments :
map(..., Degree => ...)
12.37. matrix Matrix
matrix f – produce the matrix of a map f.
If the source and target of f are free, then the result is f itself. Otherwise,
the source and target will be replaced by the free modules whose basis elements
correspond to the generators of the modules.
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
Synopsis of use:
Operator: matrix [V.24.401]
Class of argument 1: Matrix [III.12]
Class of typical returned value: Matrix [III.12]
Optional arguments :
matrix(..., Degree => ...)
12.38. matrix {...}
matrix v – create a matrix from a doubly-nested list of ring elements or matrices, or from a list of (column) vectors.
An attempt is made to coerce the ring elements and matrices to a common
ring. If the entries are ring elements, they are used as the entries of the matrix,
and if the entries are matrices, then they are used to provide blocks of entries in
the resulting matrix.
An attempt is made to set up the degrees of the generators of the free module
serving as source so that the map will be homogeneous and of degree zero.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : p = matrix {{x,y,z}}
o2 = {0} | x y z |
268
12. MATRIX
1
3
o2 : Matrix R <--- R
i3 : degrees source p
o3 = {{1}, {1}, {1}}
o3 : List
i4 : isHomogeneous p
o4 = true
Notice that the degrees were set up so that p is homogeneous, because the
source module is not explicitly specified by the user. The next example involves
block matrices.
i5 : q = vars R
o5 = {0} | x y z |
1
3
o5 : Matrix R <--- R
i6 : matrix {{q,q,q}}
o6 = {0} | x y z x y z x y z |
1
9
o6 : Matrix R <--- R
i7 : matrix {{q},{q},{q}}
o7 = {0} | x y z |
{0} | x y z |
{0} | x y z |
3
3
o7 : Matrix R <--- R
Here we construct a matrix from column vectors.
i8 : F = R^3
3
o8 = R
o8 : R - module, free
i9 : matrix {F_2, F_1, x*F_0 + y*F_1 + z*F_2}
o9 = {0} | 0 0 x |
{0} | 0 1 y |
{0} | 1 0 z |
3
3
o9 : Matrix R <--- R
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
12.41. SUM CHAINCOMPLEXMAP
269
Synopsis of use:
Operator: matrix [V.24.401]
Class of argument 1: List [III.19.2]
Class of typical returned value: Matrix [III.12]
Optional arguments :
matrix(..., Degree => ...)
12.39. mingens GroebnerBasis
Synopsis of use:
Operator: mingens [V.24.413]
Class of argument 1: GroebnerBasis [III.15]
Class of typical returned value: Matrix [III.12]
Optional arguments :
Code:
-- ../m2/gb.m2:186-189
mingens GroebnerBasis := Matrix => options -> (g) -> (
sendgg(ggPush g, gggetmingens);
getMatrix ring g
-- we’re losing in ...
)
12.40. random(Module,Module)
random(F,G) – yields a random graded, degree 0, map from the free module G
to the free module F.
i1 : R = ZZ/101[x,y];
i2 : random(R^{1,2,3},R^{1,2,3})
o2 = {-1} | -22
0
0 |
{-2} | 38x-37y
-2
0 |
{-3} | -39x2+41xy-16y2 43x+49y 35 |
3
3
o2 : Matrix R <--- R
Synopsis of use:
Operator: random [V.24.216.1]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Matrix [III.12]
12.41. sum ChainComplexMap
sum C – yields the sum of the modules in a chain complex map.
The degrees of the components are preserved.
i1 : R = ZZ/101[a..c];
i2 : C = res coker vars R
1
3
3
1
o2 = R <-- R <-- R <-- R
0
1
2
3
270
12. MATRIX
o2 : ChainComplex
i3 : sum C.dd
o3 = {0}
{1}
{1}
{1}
{2}
{2}
{2}
{3}
|
|
|
|
|
|
|
|
0
0
0
0
0
0
0
0
a
0
0
0
0
0
0
0
b
0
0
0
0
0
0
0
c
0
0
0
0
0
0
0
0
-b
a
0
0
0
0
0
0
-c
0
a
0
0
0
0
0
0
-c
b
0
0
0
0
0
0
0
0
c
-b
a
0
|
|
|
|
|
|
|
|
8
8
o3 : Matrix R <--- R
i4 : betti oo
o4 = total:
-1:
0:
1:
2:
3:
8
.
1
3
3
1
8
1
3
3
1
.
o4 : Net
See also:
sum [V.24.575] – compute the sum
sum ChainComplex [III.13.13] – direct sum of the components of a chain
complex
Synopsis of use:
Operator: sum [V.24.575]
Class of argument 1: ChainComplexMap [III.21.5.4.1]
Class of typical returned value: Matrix [III.12]
12.42. syz GroebnerBasis
Synopsis of use:
Operator: syz [V.24.599]
Class of argument 1: GroebnerBasis [III.15]
Class of typical returned value: Matrix [III.12]
Optional arguments :
syz(..., BasisElementLimit => ...)
syz(..., ChangeMatrix => ...) [V.24.600] – whether to produce the
change of basis matrix
syz(..., CodimensionLimit => ...) [V.24.60.2] – stop when this codimension is reached
syz(..., DegreeLimit => ...)
syz(..., PairLimit => ...)
syz(..., StopBeforeComputation => ...) [V.24.601] – whether to
stop the computation immediately
syz(..., StopWithMinimalGenerators => ...) [V.24.129.4] – stop
when minimal generators have been determined
12.45. MATRIX // RINGELEMENT
271
syz(..., Strategy => ...) [V.24.602] – specify the strategy used to
compute the Groebner basis
syz(..., SubringLimit => ...)
syz(..., Syzygies => ...)
syz(..., SyzygyLimit => ...)
syz(..., SyzygyRows => ...)
Code:
-- ../m2/gb.m2:193-195
syz GroebnerBasis := Matrix => options -> (g) -> (
sendgg(ggPush g, gggetsyz);
getMatrix ring g )
12.43. HH_Matrix Matrix
homology(g,f) – computes the homology module ker g/im f.
Here g and f should be composable maps with g*f equal to zero.
See also:
homology [V.24.341] – general homology functor
Synopsis of use:
Operator: homology [V.24.341]
Class of argument 1: Matrix [III.12]
Class of argument 2: Matrix [III.12]
Class of typical returned value: Module [III.13]
Optional arguments :
12.44. Matrix % RingElement
f % r – yields the reduction of the columns of the matrix f modulo the ring
element r.
Synopsis of use:
Operator: % [V.24.9]
Class of argument 1: Matrix [III.12]
Class of argument 2: RingElement [III.21.5.4.9]
Code:
-- ../m2/matrix2.m2:103
Matrix % RingElement := (f,r) -> f % (r * id_(target f))
12.45. Matrix // RingElement
f//r – yields a matrix h from a matrix f and a ring element r such that f - r*h
is the reduction of f modulo a Groebner basis for the image of r times the identity
matrix.
See also:
% [V.24.9] – a binary operator, usually used for remainder
Synopsis of use:
Operator: // [V.24.26]
Class of argument 1: Matrix [III.12]
Class of argument 2: RingElement [III.21.5.4.9]
Code:
-- ../m2/matrix2.m2:85
Matrix // RingElement := (f,r) -> f // (r * id_(target f))
272
12. MATRIX
12.46. Matrix _ (...)
f_(i,j) – provide the element in row i and column j of the matrix f.
See also:
_ [V.24.151]
Matrix [III.12] – the class of all matrices
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Matrix [III.12]
Class of argument 2: Sequence [III.19.3]
Class of typical returned value: RingElement [III.21.5.4.9]
12.47. Matrix _ ZZ
f_i – provide the i-th column of a matrix f as a vector.
Vectors are disparaged, so we may do away with this function in the future.
See also:
_ [V.24.151]
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Matrix [III.12]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Vector [III.21.5.4.12]
Code:
-- ../m2/matrix.m2:92-96
Matrix _ ZZ := Vector => (m,i) -> (
if 0 <= i and i < numgens source m then (
sendgg (ggPush m, ggPush i, ggelem);
new m.target)
else error ("subscript ’", toString i, "’ out of range" ...
12.48. chainComplex Matrix
chainComplex f – create a chain complex C with the map f serving as the
differential C.dd_1.
Synopsis of use:
Operator: chainComplex [V.24.196]
Class of argument 1: Matrix [III.12]
Class of typical returned value: ChainComplexMap [III.21.5.4.1]
Code:
-- ../m2/chaincomplexes.m2:452
chainComplex Matrix := ChainComplexMap => f -> chainComplex ...
12.49. diff Matrix
diff m – differentiate the matrix m with respect to the variables of its ring.
Synopsis of use:
Operator: diff [V.24.251]
Class of argument 1: Matrix [III.12]
Code:
-- ../m2/matrix.m2:447
diff(Matrix)
:= m -> diff(vars ring m, m)
12.52. RESOLUTION MATRIX
273
12.50. monomialIdeal Matrix
monomialIdeal f – create a monomial ideal from a 1 by n matrix f.
i1 : R=ZZ/101[a,b,c]
o1 = R
o1 : PolynomialRing
i2 : m = monomialIdeal vars R
o2 = monomialIdeal | a b c |
o2 : MonomialIdeal
i3 : m^2
o3 = monomialIdeal | a2 ab b2 ac bc c2 |
o3 : MonomialIdeal
i4 : m^3
o4 = monomialIdeal | a3 a2b ab2 b3 a2c abc b2c ac2 bc2 c3 |
o4 : MonomialIdeal
Synopsis of use:
Operator: monomialIdeal [V.24.426]
Class of argument 1: Matrix [III.12]
Class of typical returned value: MonomialIdeal [III.21.5.4.7]
Code:
-- ../m2/monideal.m2:48-50
monomialIdeal Matrix := MonomialIdeal => f -> (
sendgg(ggPush f, ggPush 0, ggmonideal);
newMonomialIdeal ring f)
12.51. monomialIdeal(ZZ,Matrix)
monomialIdeal(i,f) – create a monomial ideal from a matrix f generated by
those columns of f whose lead terms are in row i.
Synopsis of use:
Operator: monomialIdeal [V.24.426]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Matrix [III.12]
Class of typical returned value: MonomialIdeal [III.21.5.4.7]
Code:
-- ../m2/monideal.m2:52-54
monomialIdeal(ZZ,Matrix) := MonomialIdeal => (i,m) -> (
sendgg(ggPush m, ggPush i, ggmonideal);
newMonomialIdeal ring m)
12.52. resolution Matrix
resolution f – when f is a module homomorphism, produces a chain map
from a resolution of the source of f to a resolution of the target of f.
i1 : R = ZZ/101[x,y];
274
12. MATRIX
i2 : m = ideal vars R
o2 = ideal (x, y)
o2 : Ideal of R
i3 : resolution map(m/m^3, m^2/m^4)
2
3
o3 = 0 : R <----------------- R : 0
{1} | x y 0 |
{1} | 0 0 y |
5
7
1 : R <--------------------------- R : 1
{2} | y x 0 0 0 0 y2 |
{3} | 0 0 y 0 0 0 0 |
{3} | 0 1 0 y 0 0 0 |
{3} | 0 0 0 0 y 0 y |
{3} | 0 -1 0 0 0 y 0 |
3
4
2 : R <------------------- R : 2
{4} | y 0 0 0 |
{4} | 0 y 0 y |
{4} | 0 0 y 0 |
o3 : ChainComplexMap
Synopsis of use:
Operator: resolution [V.24.517]
Class of argument 1: Matrix [III.12]
Class of typical returned value: ChainComplexMap [III.21.5.4.1]
Optional arguments :
resolution(..., DegreeLimit => ...) [V.24.518] – compute only up
to this degree
resolution(..., HardDegreeLimit => ...) [V.24.519] – compute only
up to this degree
resolution(..., LengthLimit => ...) [V.24.520] – stop when the resolution reaches this length
resolution(..., PairLimit => ...) [V.24.521] – stop when this number
of pairs are handled
resolution(..., SortStrategy => ...) [V.24.522] – specify a strategy
for sorting S-pairs
resolution(..., StopBeforeComputation => ...) [V.24.523] – whether
to stop the computation immediately
resolution(..., Strategy => ...) [V.24.524] – specify a computational
strategy
resolution(..., SyzygyLimit => ...) [V.24.525] – stop when this
number of syzygies are obtained
Code:
-- ../m2/res.m2:167-170
resolution Matrix := ChainComplexMap => options -> (f) -> ex ...
resolution(target f, options),
resolution(source f, options),
12.52. RESOLUTION MATRIX
matrix f)
275
CHAPTER 13
Module
The most general module M is represented as a submodule of a quotient module
of a free module F. The matrix of relations used to produce the quotient module is
stored as M.relations (if there is a nonzero relation) and the matrix of generators
is stored as M.generators (if the submodule is smaller than the free module).
Elements of modules are implemented as instances of the class Vector [III.21.5.4.12].
See also:
modules [V.24.421]
The type Module is a member of the class Type [III.21.5.4.11]. Each object
of class Module is called a module. Each module is also a member of class Type
[III.21.5.4.11].
Making a module :
ChainComplex ^ ZZ
ChainComplex _ ZZ [III.13.1] – get component
Ext(Module,Module)
Ext(ZZ,Module,Module)
GradedModule _ ZZ
HH^ZZ ChainComplex [III.13.2] – cohomology of a chain complex
HH^ZZ CoherentSheaf [III.13.3] – coherent sheaf cohomology
HH^ZZ Module [III.13.4] – local cohomology
HH_Matrix Matrix [III.12.43] – kernel modulo image
HH_ZZ ChainComplex [III.13.5] – homology of a chain complex
Hom(Ideal,Ideal)
Hom(Ideal,Module)
Hom(Ideal,Ring)
Hom(Module,Ideal)
Hom(Module,Module)
Hom(Module,Ring)
Hom(Ring,Ideal)
Hom(Ring,Module)
Ideal * Module
Ideal / Ideal [III.11.6] – quotient module
Module ** Module [III.13.6] – tensor product of modules
Module ** Ring [III.10.7] – tensor product
Module + Module [III.13.7] – sum of submodules
Module ++ Module [III.13.8] – direct sum of modules
Module / (...)
Module / Ideal [III.11.7] – quotient module by an ideal
Module / Module [III.13.9] – quotient module
Module / RingElement
277
278
13. MODULE
Module / Vector
Module / {...}
Module : Ideal
Module : RingElement
Module ^ ZZ
Ring ^ ZZ [III.10.8] – make a free module
Ring ^ {...} [III.10.9] – make a free module
RingElement * Module
RingMap Module
Tor(ZZ,Module,Module)
ambient Module
coimage Matrix
cokernel Matrix
cokernel RingElement
cover Module
dual Module [III.13.10] – dual module
exteriorPower(ZZ,Module)
homogenize(Module,RingElement)
homogenize(Module,RingElement,{...})
image Matrix
image RingElement
kernel Matrix
kernel RingElement
module CoherentSheaf [III.13.11] – get the module defining a coherent
sheaf
module Ideal [III.11.8] – turn an ideal into a module
prune Module
pushForward(RingMap,Module)
pushForward1(RingMap,Module)
quotient(Module,Ideal)
quotient(Module,RingElement)
removeLowestDimension Module
saturate Module
saturate Vector
saturate(Module,Ideal)
saturate(Module,RingElement)
subquotient [III.13.12] – make a subquotient module
subquotient(Matrix,Matrix)
subquotient(Matrix,Nothing)
subquotient(Nothing,Matrix)
substitute(Module,Matrix)
substitute(Module,Ring)
substitute(Module,{...})
sum ChainComplex [III.13.13] – direct sum of the components of a chain
complex
super Module
top Module
trim Module
13. MODULE
279
truncate(ZZ,Module)
truncate({...},Module)
Methods for using a module :
ChainComplex ** Module
Ext(ZZ,Ideal,Module)
Ext(ZZ,Matrix,Module)
Ext(ZZ,Module,Ideal)
Ext(ZZ,Module,Matrix)
Ext(ZZ,Module,Ring)
Ext(ZZ,Ring,Module)
GradedModule ** Module
GradedModule ++ Module
Hom(ChainComplex,Module) [III.13.14] – Hom
Hom(ChainComplexMap,Module)
Hom(Matrix,Module)
Hom(Module,ChainComplex)
Hom(Module,ChainComplexMap)
Hom(Module,Matrix)
Ideal == Module
Matrix % Module
Matrix ** Module [III.12.6] – tensor product
Module ** ChainComplex
Module ** GradedModule
Module ** Matrix
Module ++ GradedModule
Module : Module
Module == Ideal
Module == Module [III.13.15] – equality
Module == ZZ
Module [...] [III.13.16] – make a chain complex from a module
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Module ^ {...} [III.12.16] – projection map from a free module
Module _ ZZ [III.13.17] – get a generator
Module _ [...] [III.12.17] – get inclusion map into direct sum
Module _ {...} [III.12.18] – map from free module to some generators
Ring / Module
ZZ * Module
ZZ == Module
ZZ _ Module
annihilator Module
basis Module
basis(ZZ,Module)
basis({...},Module)
betti Module
codim Module
components Module
degree Module
280
13. MODULE
degrees Module
dim Module
euler Module
fittingIdeal(ZZ,Module)
flip(Module,Module) [III.12.22] – matrix of commutativity of tensor
product
gb Module
genera Module
generators Module
gradedModule Module
hilbertFunction(ZZ,Module)
hilbertFunction({...},Module)
hilbertPolynomial Module
hilbertSeries Module
ideal Module
inducedMap(Module,Module)
inducedMap(Module,Module,Matrix)
inducedMap(Module,Nothing,Matrix)
inducedMap(Nothing,Module,Matrix)
inducesWellDefinedMap(Module,Module,Matrix)
inducesWellDefinedMap(Module,Nothing,Matrix)
inducesWellDefinedMap(Nothing,Module,Matrix)
isDirectSum Module
isFreeModule Module
isHomogeneous Module
isIdeal Module
isModule Module
isQuotientModule Module
isSubmodule Module
isSubset(Ideal,Module)
isSubset(Module,Ideal)
isSubset(Module,Module)
map Module [III.12.25] – make a map
map(Module,Matrix) [III.12.26] – make a map
map(Module,Module) [III.12.27] – make a map
map(Module,Module,Function) [III.12.28] – make a map
map(Module,Module,Matrix) [III.12.29] – make a map
map(Module,Module,RingElement) [III.12.30] – make a map
map(Module,Module,ZZ) [III.12.31] – make a map
map(Module,Module,{...}) [III.12.32] – make a map
map(Module,Nothing,Matrix)
map(Module,Nothing,{...}) [III.12.33] – make a map
map(Module,RingElement) [III.12.34] – make a map
map(Module,ZZ)
map(Module,ZZ,Function) [III.12.35] – make a map
map(Module,ZZ,{...}) [III.12.36] – make a map
mingens Module
net Module
13.2. HH^ZZ CHAINCOMPLEX
281
new Module from Ring
numgens Module
pdim Module
poincare Module
presentation Module
quotient(Module,Module)
random(Module,Module) [III.12.40] – make a random module map
rank Module
regularity Module
relations Module
resolution Module [III.13.18] – make a projective resolution
sheaf Module [III.13.19] – make a coherent sheaf
sheaf(Module,Variety) [III.13.20] – make a coherent sheaf
substitute(Module,Option)
symmetricAlgebra Module
tensorAssociativity(Module,Module,Module)
toExternalString Module
toString Module
wedgeProduct(ZZ,ZZ,Module)
13.1. ChainComplex _ ZZ
C_i – yields the i-th module in a chain complex C.
Returns the zero module if no module has been stored in the i-th spot. You
can use code like C#?i to determine if there is a module in the i-th spot, but if the
chain complex arose as a resolution, first use complete ChainComplex [III.16.8]
to fill all the spots with their modules.
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: ChainComplex [III.16]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Module [III.13]
Next more general method: GradedModule _ ZZ
13.2. HH^ZZ ChainComplex
HH^i C – homology at the i-th spot of the chain complex C.
By definition, this is the same as HH_(-i) C.
Synopsis of use:
Operator: cohomology [V.24.210]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ChainComplex [III.16]
Class of typical returned value: Module [III.13]
Optional arguments :
cohomology(..., Degree => ...)
Code:
-- ../m2/chaincomplexes.m2:421
cohomology(ZZ,ChainComplex) := Module => opts -> (i,C) -> ho ...
282
13. MODULE
13.3. HH^ZZ CoherentSheaf
HH^i(F) – for a coherent sheaf F on a projective variety X, computes the direct
sum over at least the natural numbers n, of the i-th cohomology groups of F(n).
HH^i(F, Degree=>e) – same as above, but n ranges over at least the integers at
least as large as e.
i1 : R = QQ[a,b,c,d]/(a^4+b^4+c^4+d^4);
i2 : X = Proj R
o2 = Proj R
o2 : ProjectiveVariety
i3 : HH^1(cotangentSheaf X)
o3 = cokernel {0} | 0
0
0
0
-1/-1d
{-4} | -1/-1d3 -1/-1c3 -1/-1b3 -1/-1a3 0
...
...
2
o3 : R - module, quotient of R
i4 : hilbertFunction(0,oo)
o4 = 20
Synopsis of use:
Operator: cohomology [V.24.210]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: Module [III.13]
Optional arguments :
cohomology(..., Degree => ...)
13.4. HH^ZZ Module
HH^i(M) – computes the i-th local cohomology of M with respect to the maximal
ideal generated by the variables of the ring.
i1 : R = QQ[x,y];
i2 : HH^2 (R^{-3})
o2 = cokernel {0} | 0 1/-1y -1/-1x |
{0} | y -1/-1x 0
|
2
o2 : R - module, quotient of R
i3 : HH^2 (R^{-4})
o3 = cokernel {0} | 0 0
1/-1y -1/-1x |
{0} | 0 1/-1y -1/-1x 0
|
{0} | y -1/-1x 0
0
|
3
o3 : R - module, quotient of R
13.6. MODULE ** MODULE
283
Synopsis of use:
Operator: cohomology [V.24.210]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Module [III.13]
Class of typical returned value: Module [III.13]
Optional arguments :
cohomology(..., Degree => ...)
13.5. HH_ZZ ChainComplex
HH_i C – homology at the i-th spot of the chain complex C.
i1 : R = ZZ/101[x,y]
o1 = R
o1 : PolynomialRing
i2 : C = chainComplex(matrix{{x,y}},matrix{{x*y},{-x^2}})
1
2
1
o2 = R <-- R <-- R
0
1
2
o2 : ChainComplex
i3 : M = HH_1 C
o3 = subquotient ({1} | -y |, {1} | xy |)
{1} | x | {1} | -x2 |
2
o3 : R - module, subquotient of R
i4 : prune M
o4 = cokernel {2} | x |
1
o4 : R - module, quotient of R
Synopsis of use:
Operator: homology [V.24.341]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ChainComplex [III.16]
Class of typical returned value: Module [III.13]
Optional arguments :
13.6. Module ** Module
M ** N – produce the tensor product of two modules.
Since M and N may be provided as submodules or subquotient modules, it may
be necessary to replace them by quotient modules in the course of the computation, but the generators provided in the resulting tensor product will correspond to
the tensor products of the generators, i.e., the modules cover M ** cover N and
cover(M ** N) are equal. This makes it easier to make M ** N into a functor.
284
13. MODULE
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Module [III.13]
13.7. Module + Module
M + N – the sum of two submodules.
The two modules should be submodules of the same module.
Synopsis of use:
Operator: + [V.24.16]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Module [III.13]
13.8. Module ++ Module
M++N – computes the direct sum of two modules.
i1 : R = ZZ/101[a..c];
i2 : image vars R ++ kernel vars R
o2 = image {0}
{1}
{1}
{1}
|
|
|
|
a
0
0
0
b
0
0
0
c
0
0
0
0
0
-c
b
0
-b
a
0
0
-c
0
a
|
|
|
|
4
o2 : R - module, submodule of R
Projection and inclusion maps for direct sums:
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Module _ [...] [III.12.17] – get inclusion map into direct sum
See also:
directSum [V.24.254] – direct sum of modules or maps
Synopsis of use:
Operator: ++ [V.24.17]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Module [III.13]
13.9. Module / Module
M/N – computes the quotient module M/N.
The modules should be submodules of the same module.
Synopsis of use:
Operator: / [V.24.25]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Module [III.13]
13.12. SUBQUOTIENT
285
13.10. dual Module
dual M – the dual of a module.
Synopsis of use:
Operator: dual [V.24.260]
Class of argument 1: Module [III.13]
Class of typical returned value: Module [III.13]
Code:
-- ../m2/modules2.m2:393-397
dual Module := Module => F -> if F.?dual then F.dual else F. ...
if not isFreeModule F then kernel transpose presentatio ...
else (
sendgg (ggPush F, ggtranspose);
new Module from ring F))
13.11. module CoherentSheaf
module F – produce the module from which the coherent sheaf F was defined.
i1 : X = Proj(QQ[x,y,z])
o1 = Proj(QQ [x, y, z])
o1 : ProjectiveVariety
i2 : F = OO_X(3)
1
o2 = sheaf((QQ [x, y, z]) )
o2 : CoherentSheaf
i3 : module F
1
o3 = (QQ [x, y, z])
o3 : QQ [x, y, z] - module, free
i4 : degrees oo
o4 = {{-3}}
o4 : List
Synopsis of use:
Operator: module [V.24.420]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: Module [III.13]
Code:
-- ../m2/varieties.m2:48
module CoherentSheaf := Module => (F) -> F.module
13.12. subquotient
subquotient(f,g) – given matrices f and g with the same target, produces a
new module representing the image of f in the cokernel of g.
The columns of f are called the generators, and the columns of g are the relations.
286
13. MODULE
Functions:
generators [III.13.12.1] – matrix of generators
relations [III.13.12.2] – the defining relations
prune [III.13.12.3] – prune generators and relations
This is the general form in which modules are represented, and subquotient
modules are often returned as values of computations.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : M = kernel vars R ++ cokernel vars R
o2 = subquotient ({1}
{1}
{1}
{1}
{0}
|
|
|
|
|
0
0
-d
c
0
0
-c
b
0
0
0
-d
0
b
0
-b
a
0
0
0
-c
0
a
0
0
-d
0
0
a
0
5
o2 : R - module, subquotient of R
i3 : generators M
o3 = {1}
{1}
{1}
{1}
{0}
|
|
|
|
|
0
0
-d
c
0
0
-c
b
0
0
0
-d
0
b
0
-b
a
0
0
0
-c
0
a
0
0
-d
0
0
a
0
0
0
0
0
1
|
|
|
|
|
0
0
0
-c
d
b
0
0
-b
c
0
a
0
0
5
7
o3 : Matrix R <--- R
i4 : relations M
o4 = {1}
{1}
{1}
{1}
{0}
|
|
|
|
|
0
0
0
0
a
0
0
0
0
b
0
0
0
0
c
0
0
0
0
d
|
|
|
|
|
5
4
o4 : Matrix R <--- R
i5 : prune M
o5 = cokernel {2}
{2}
{2}
{2}
{2}
{2}
{0}
|
|
|
|
|
|
|
0
0
0
0
0
0
d
0
0
0
0
0
0
c
0
0
0
0
0
0
b
0
0
0
0
0
0
a
7
o5 : R - module, quotient of R
See also:
-b
0
d
a
0
0
0
-c
d
0
0
0
a
0
|
|
|
|
|
|
|
0
0
0
0
1
|,
|
|
|
|
{1}
{1}
{1}
{1}
{0}
|
|
|
|
|
0
0
0
0
a
0
0
0
0
b
0
0
0
0
c
0
0
0
0
d
...
...
...
...
...
13.12. SUBQUOTIENT
287
generators [III.13.12.1] – matrix of generators
relations [III.13.12.2] – the defining relations
The function subquotient is a member of the class Function [III.18].
Class of returned value: Module [III.13] – the class of all modulesWays to use
subquotient :
subquotient(Matrix,Matrix)
subquotient(Matrix,Nothing)
subquotient(Nothing,Matrix)
13.12.1. generators
generators x – produces the generators of x.
For an abbreviation, use gens [V.24.319].
Produces the generators of a Groebner basis, a polynomial ring, a monoid ring,
a free module, a free group, a submodule given by means of generators (or for which
generators have been computed), or a free monoid.
Usually the result is a list of generators, but the generators of a module or
Groebner basis are provided as the columns in a matrix. The matrix is stored in a
module M under M.generators, unless the matrix is the identity matrix.
See also:
Monoid [III.21.5.4.11.3] – the class of all monoids
GroebnerBasis [III.15] – the class of all Groebner bases
Module [III.13] – the class of all modules
relations [III.13.12.2] – the defining relations
subquotient [III.13.12] – make a subquotient module
The function generators is a member of the class Function [III.18].
Ways to use generators :
generators EngineRing
generators GeneralOrderedGroup
generators GeneralOrderedMonoid
generators GroebnerBasis [III.12.23] – – the Groebner basis matrix
generators Ideal
generators Module
generators MonomialIdeal
generators PolynomialRing
generators QuotientRing
generators Ring
generators(ZZ,Resolution)
13.12.2. relations
relations M – produce the relations defining a module M.
The relations are represented as a matrix, and if not stored in the module under
M.relations, the matrix is understood to be empty.
See also:
generators [III.13.12.1] – matrix of generators
subquotient [III.13.12] – make a subquotient module
The function relations is a member of the class Function [III.18].
Ways to use relations :
relations Module
288
13. MODULE
13.12.3. prune
prune M – replace M by an isomorphic module with a minimal number of generators and relations.
prune f – replace f by an isomorphic map of modules by pruning its source and
target.
The isomorphism from N = prune M back to M can be obtained with code such
as g = N.pruningMap unless M.pruningMap already exists, in which case N is the
same as M. You may obtain the inverse isomorphism with g^-1.
See also:
presentation [V.24.480] – presentation of a module or ring
trim [V.24.630] – simplify the presentation
pruningMap [V.24.492] – store the isomorphism obtained by pruning
The function prune is a member of the class Function [III.18].
Ways to use prune :
prune ChainComplex
prune ChainComplexMap
prune GradedModule
prune GradedModuleMap
prune Matrix
prune Module
13.13. sum ChainComplex
sum C – yields the sum of the modules in a chain complex.
The degrees of the components are preserved.
i1 : R = ZZ/101[a..d];
i2 : C = res coker vars R
1
4
6
4
1
o2 = R <-- R <-- R <-- R <-- R
0
1
2
3
4
o2 : ChainComplex
i3 : sum C
16
o3 = R
o3 : R - module, free
i4 : degrees oo
o4 = {{0}, {1}, {1}, {1}, {1}, {2}, {2}, {2}, {2}, {2}, {2}, ...
o4 : List
See also:
sum [V.24.575] – compute the sum
sum ChainComplexMap [III.12.41] – direct sum of the components of
a chain map
Synopsis of use:
13.16. MODULE [...]
289
Operator: sum [V.24.575]
Class of argument 1: ChainComplex [III.16]
Class of typical returned value: Module [III.13]
Code:
-- ../m2/chaincomplexes.m2:67
sum ChainComplex := Module => C -> directSum apply(sort spot ...
13.14. Hom(ChainComplex,Module)
Hom(C,M) – produces the Hom complex from a chain complex C and a module
M.
Synopsis of use:
Operator: Hom [V.24.90]
Class of argument 1: ChainComplex [III.16]
Class of argument 2: Module [III.13]
Class of typical returned value: ChainComplex [III.16]
13.15. Module == Module
M == N – test whether two modules are equal.
Two modules are equal if they are isomorphic as subquotients of the same
ambient free module.
i1 : R = ZZ/101[x]
o1 = R
o1 : PolynomialRing
i2 : image matrix {{2,x},{1,5}} == R^2
o2 = false
i3 : image matrix {{2,x},{0,5}} == R^2
o3 = true
Synopsis of use:
Operator: == [V.24.39]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
13.16. Module [...]
M[n] – create a chain complex with the module M concentrated in degree -n.
See also:
ChainComplex [III.16] – the class of all chain complexes
Synopsis of use:
Operator: [V.24.1]
Class of argument 1: Module [III.13]
Class of argument 2: Array [III.19.1]
Class of typical returned value: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:837-844
Module Array := ChainComplex => (M,v) -> (
if #v =!= 1 then error "expected array of length 1";
290
13. MODULE
n := v#0;
if class n =!= ZZ then error "expected [n] with n an in ...
C := new ChainComplex;
C.ring = ring M;
C#-n = M;
C)
13.17. Module _ ZZ
M_i – get the i-th generator of a module M
i1 : (ZZ^5)_2
o1 = <2>
5
o1 : ZZ
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Module [III.13]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Vector [III.21.5.4.12]
13.18. resolution Module
resolution M – produces a projective resolution of the module M.
If the computation is interrupted after the skeleton has been successfully computed, then the partially completed resolution is available as M.resolution. The
computation can be continued with resolution M.
If the user has a chain complex in hand which is known to be a projective
resolution of M, then it can be installed with M.resolution = C.
For an abbreviation, use res [V.24.515].
Synopsis of use:
Operator: resolution [V.24.517]
Class of argument 1: Module [III.13]
Class of typical returned value: ChainComplex [III.16]
Optional arguments :
resolution(..., DegreeLimit => ...) [V.24.518] – compute only up
to this degree
resolution(..., HardDegreeLimit => ...) [V.24.519] – compute only
up to this degree
resolution(..., LengthLimit => ...) [V.24.520] – stop when the resolution reaches this length
resolution(..., PairLimit => ...) [V.24.521] – stop when this number
of pairs are handled
resolution(..., SortStrategy => ...) [V.24.522] – specify a strategy
for sorting S-pairs
resolution(..., StopBeforeComputation => ...) [V.24.523] – whether
to stop the computation immediately
resolution(..., Strategy => ...) [V.24.524] – specify a computational
strategy
13.20. SHEAF(MODULE,VARIETY)
291
resolution(..., SyzygyLimit => ...) [V.24.525] – stop when this
number of syzygies are obtained
13.19. sheaf Module
sheaf M – produce the coherent sheaf on a projective variety X corresponding
to a homegeneous module M.
Synopsis of use:
Operator: sheaf [III.21.5.4.2.8]
Class of argument 1: Module [III.13]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:43
Module ~ := sheaf Module := CoherentSheaf => (M) -> sheaf(M, ...
13.20. sheaf(Module,Variety)
sheaf(M,X) – produce the coherent sheaf on the variety X corresponding to the
module M.
If X is the affine variety Spec R, then M should be an R-module. If X is the
projective variety Proj R, then M should be a homogeneous R-module.
Synopsis of use:
Operator: sheaf [III.21.5.4.2.8]
Class of argument 1: Module [III.13]
Class of argument 2: Variety [III.17]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
CHAPTER 14
RingMap
The type RingMap is a member of the class Type [III.21.5.4.11]. Each object
of class RingMap is called a ring map. Each ring map is also a member of class
MutableHashTable [III.21.5.4].
Making a ring map :
RingMap * RingMap
map(Ring,Matrix)
map(Ring,Ring)
map(Ring,Ring,Matrix)
map(Ring,Ring,{...}) [III.10.15] – make a ring map
Methods for using a ring map :
RingMap ChainComplex
RingMap Ideal
RingMap Matrix
RingMap Module
RingMap QQ
RingMap RingElement
RingMap Vector
RingMap ZZ
expression RingMap
graphIdeal RingMap
graphRing RingMap
image RingMap
isHomogeneous RingMap
isInjective RingMap
kernel RingMap
net RingMap
pushForward(RingMap,Module)
pushForward1(RingMap,Module)
toString RingMap
293
CHAPTER 15
GroebnerBasis
A Groebner basis in Macaulay 2 consists of a Groebner basis computation,
and several associated matrices. Normally you don’t need to refer to these objects
directly, as many operations on matrices and modules create them, and refer to
them. For more information, see Groebner bases [I.3.34] or computing Groebner bases [I.3.35].
The type GroebnerBasis is a member of the class Type [III.21.5.4.11]. Each
object of class GroebnerBasis is called a Groebner basis. Each Groebner basis is
also a member of class MutableHashTable [III.21.5.4].
Making a Groebner basis :
forceGB [III.15.1] – declare that the columns of a matrix are a Groebner
basis
forceGB Matrix
gb [III.15.2] – compute a Groebner basis
gb Ideal
gb Matrix
gb Module
Methods for using a Groebner basis :
GroebnerBasis == GroebnerBasis
Matrix % GroebnerBasis
Matrix // GroebnerBasis
RingElement % GroebnerBasis
RingElement // GroebnerBasis
ZZ % GroebnerBasis
betti GroebnerBasis
generators GroebnerBasis [III.12.23] – – the Groebner basis matrix
getChangeMatrix GroebnerBasis
mingens GroebnerBasis [III.12.39] – – a matrix whose columns are minimal generators of the submodule
net GroebnerBasis
stats GroebnerBasis [III.15.3] – – display some statistics about the computation
syz GroebnerBasis [III.12.42] – – a matrix whose columns are the syzygies on the columns of the original matrix
toString GroebnerBasis
15.1. forceGB
forceGB f – declares that the columns of the matrix f constitute a Groebner
basis, and returns a Groebner basis object encapsulating that assertion.
295
296
15. GROEBNERBASIS
We should probably rename this function or incorporate it into gb [III.15.2]
somehow.
The function forceGB is a member of the class Function [III.18].
Class of returned value: GroebnerBasis [III.15] – the class of all Groebner
basesWays to use forceGB :
forceGB Matrix
Optional arguments :
forceGB(..., ChangeMatrix => ...) [V.24.296] – set the change of basis
matrix
forceGB(..., MinimalMatrix => ...)
forceGB(..., SyzygyMatrix => ...)
15.2. gb
gb f – compute the Groebner basis for the image of a Matrix [III.12] f.
If the computation is interrupted, then the partially completed Groebner basis
is available as f#{t,i}, where t is true or false depending on whether syzygies or
the change of basis matrix are to be computed, and i is the number of rows of the
syzygy matrix to be retained. The computation can be continued by repeating the
gb command with the same options.
The function gb is a member of the class Function [III.18].
Class of returned value: GroebnerBasis [III.15] – the class of all Groebner
basesWays to use gb :
gb Ideal
gb Matrix
gb Module
Optional arguments :
gb(..., BasisElementLimit => ...)
gb(..., ChangeMatrix => ...) [V.24.303] – whether to produce the change
of basis matrix
gb(..., CodimensionLimit => ...) [V.24.60.1] – stop when this codimension is reached
gb(..., DegreeLimit => ...) [V.24.304] – compute up to a certain degree
gb(..., PairLimit => ...) [V.24.305] – stop when this number of pairs is
handled
gb(..., StopBeforeComputation => ...) [V.24.306] – whether to stop
the computation immediately
gb(..., StopWithMinimalGenerators => ...) [V.24.129.1] – stop when
minimal generators have been determined
gb(..., Strategy => ...) [V.24.307] – specify the strategy used to compute
Groebner bases
gb(..., SubringLimit => ...)
gb(..., Syzygies => ...)
gb(..., SyzygyLimit => ...) [V.24.308] – stop when this number of syzygies is obtained
gb(..., SyzygyRows => ...)
15.3. stats GroebnerBasis
Synopsis of use:
15.3. STATS GROEBNERBASIS
Operator: stats [V.24.565]
Class of argument 1: GroebnerBasis [III.15]
Code:
-- ../m2/gb.m2:8
stats GroebnerBasis := g -> sendgg(ggPush g, ggstats)
297
CHAPTER 16
ChainComplex
If C is a chain complex, then C_i will produce the i-th module in the complex,
and C.dd_i will produce the differential whose source is C_i.
A new chain complex can be made with C = new ChainComplex. This will
automatically initialize C.dd, in which the differentials are stored. The modules
can be installed with statements like C#i=M and the differentials can be installed
with statements like C.dd#i=d.
See also ChainComplexMap [III.21.5.4.1] for a discussion of maps between
chain complexes. (The boundary map C.dd is regarded as one.)
The default display for a chain complex shows the modules and the stage at
which they appear.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : C = resolution cokernel matrix {{x,y,z}}
1
3
3
1
o2 = R <-- R <-- R <-- R
0
1
2
3
o2 : ChainComplex
In order to see the matrices of the differentials, examine ’C.dd’.
i3 : C.dd
1
o3 = -1 : 0 <----- R : 0
0
1
3
0 : R <----------------- R : 1
{0} | x y z |
3
3
1 : R <-------------------- R : 2
{1} | -y -z 0 |
{1} | x 0 -z |
{1} | 0 x y |
3
1
2 : R <-------------- R : 3
{2} | z |
299
300
16. CHAINCOMPLEX
{2} | -y |
{2} | x |
o3 : ChainComplexMap
See also:
Resolution [III.21.5.4.8] – the class of all resolution computations
dd [V.24.237] – differential in a chain complex
symbol Resolution [V.24.580] – a key for storing resolutions
The type ChainComplex is a member of the class Type [III.21.5.4.11]. Each
object of class ChainComplex is called a chain complex. Each chain complex is also
a member of class GradedModule [III.21.5.4.3].
Making a chain complex :
ChainComplex ** ChainComplex [III.16.1] – tensor product
ChainComplex ** GradedModule [III.16.2] – tensor product
ChainComplex ** Module
ChainComplex ++ ChainComplex [III.16.3] – direct sum
ChainComplex [...] [III.16.4] – chain complex degree shift
GradedModule ** ChainComplex [III.16.5] – tensor product
Hom(ChainComplex,Module) [III.13.14] – Hom
Hom(Module,ChainComplex)
Module ** ChainComplex
Module [...] [III.13.16] – make a chain complex from a module
RingMap ChainComplex
chainComplex (...) [III.16.6] – make a chain complex
chainComplex GradedModule [III.16.7] – make a chain complex from
a graded module
chainComplex {...}
coimage ChainComplexMap
cokernel ChainComplexMap
complete ChainComplex [III.16.8] – complete the internal parts
cone ChainComplexMap
dual ChainComplex [III.16.9] – dual
image ChainComplexMap
kernel ChainComplexMap
new ChainComplex [III.16.10] – make a new chain complex from scratch
prune ChainComplex
resolution Ideal [III.11.9] – make a projective resolution
resolution Module [III.13.18] – make a projective resolution
Methods for using a chain complex :
ChainComplex ** ChainComplexMap [III.16.11] – tensor product
ChainComplex == ChainComplex
ChainComplex == ZZ
ChainComplex ^ ZZ
ChainComplex ^ [...]
ChainComplex _ ZZ [III.13.1] – get component
ChainComplex _ [...]
ChainComplexMap ** ChainComplex [III.16.12] – tensor product
HH ChainComplex [III.16.13] – homology of a chain complex
HH^ZZ ChainComplex [III.13.2] – cohomology of a chain complex
16.2. CHAINCOMPLEX ** GRADEDMODULE
301
HH_ZZ ChainComplex [III.13.5] – homology of a chain complex
ZZ == ChainComplex
betti ChainComplex
components ChainComplex [III.16.14] – list the components of a direct
sum
extend(ChainComplex,ChainComplex,Matrix)
gradedModule ChainComplex
isDirectSum ChainComplex
length ChainComplex [III.16.15] – length of a chain complex or graded
module
map(ChainComplex,ChainComplex)
map(ChainComplex,ChainComplex,ChainComplexMap)
map(ChainComplex,ChainComplex,Function) [III.16.16] – make a
map of chain complexes
max ChainComplex [III.16.17] – – maximum index in a chain complex
min ChainComplex [III.16.18] – minimum index in a chain complex
net ChainComplex
poincare ChainComplex
poincareN ChainComplex
rank ChainComplex
regularity ChainComplex
status ChainComplex
sum ChainComplex [III.13.13] – direct sum of the components of a chain
complex
tensorAssociativity(ChainComplex,ChainComplex,ChainComplex)
16.1. ChainComplex ** ChainComplex
C**D – the tensor product of two chain complexes.
The result, E, is a chain complex. Each module E_k in it is a direct sum of
modules of the form C_i**D_j with i+j=k, and the preferred keys for the components of this direct sum are the pairs (i,j), sorted increasing values of i. For
information about how to use preferred keys, see directSum.
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: ChainComplex [III.16]
Class of argument 2: ChainComplex [III.16]
Class of typical returned value: ChainComplex [III.16]
Next more general method: ChainComplex ** GradedModule [III.16.2]
– tensor product
16.2. ChainComplex ** GradedModule
C**D – the tensor product of a chain complex with a graded module.
The result is a chain complex.
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: ChainComplex [III.16]
Class of argument 2: GradedModule [III.21.5.4.3]
Class of typical returned value: ChainComplex [III.16]
302
16. CHAINCOMPLEX
Next more general method: GradedModule ** GradedModule – a
binary operator, usually used for tensor product
Code:
-- ../m2/chaincomplexes.m2:739-746
ChainComplex ** GradedModule := ChainComplex => (C,D) -> (
P := youngest(C,D);
key := (C,D,symbol **);
if P#?key then P#key
else C**D = (
C ** chainComplex D
)
)
16.3. ChainComplex ++ ChainComplex
C++D – direct sum of chain complexes.
i1 : C = resolution cokernel matrix {{4,5}}
1
2
1
o1 = ZZ <-- ZZ <-- ZZ
0
1
2
o1 : ChainComplex
i2 : C ++ C[-2]
1
2
2
2
1
o2 = ZZ <-- ZZ <-- ZZ <-- ZZ <-- ZZ
0
1
2
3
4
o2 : ChainComplex
Synopsis of use:
Operator: ++ [V.24.17]
Class of argument 1: ChainComplex [III.16]
Class of argument 2: ChainComplex [III.16]
Class of typical returned value: ChainComplex [III.16]
Next more general method: GradedModule ++ GradedModule – a
binary operator, usually used for direct sum
Code:
-- ../m2/chaincomplexes.m2:502
ChainComplex ++ ChainComplex := ChainComplex => (C,D) -> dir ...
16.4. ChainComplex [...]
C[i] – shifts the chain complex C, producing a new chain complex D in which
D_j is C_(i+j). The signs of the differentials are reversed if i is odd.
Synopsis of use:
Operator: [V.24.1]
Class of argument 1: ChainComplex [III.16]
Class of argument 2: Array [III.19.1]
Class of typical returned value: ChainComplex [III.16]
Next more general method: GradedModule [...] – blank operator for
adjacent expressions
16.7. CHAINCOMPLEX GRADEDMODULE
303
16.5. GradedModule ** ChainComplex
C**D – the tensor product of a graded module with a chain complex.
The result is a chain complex.
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: GradedModule [III.21.5.4.3]
Class of argument 2: ChainComplex [III.16]
Class of typical returned value: ChainComplex [III.16]
Next more general method: GradedModule ** GradedModule – a
binary operator, usually used for tensor product
Code:
-- ../m2/chaincomplexes.m2:748-755
GradedModule ** ChainComplex := ChainComplex => (C,D) -> (
P := youngest(C,D);
key := (C,D,symbol **);
if P#?key then P#key
else C**D = (
chainComplex C ** D
)
)
16.6. chainComplex (...)
chainComplex(f,g,h,...) – create a chain complex C whose differentials are
the maps f, g, h.
The map f appears as C.dd_1, the map g appears as C.dd_2, and so on.
Synopsis of use:
Operator: chainComplex [V.24.196]
Class of argument 1: Sequence [III.19.3]
Class of typical returned value: ChainComplex [III.16]
16.7. chainComplex GradedModule
chainComplex M – convert a graded module to a chain complex by installing
the zero map as differential.
See also:
GradedModule [III.21.5.4.3] – the class of all graded modules
ChainComplex [III.16] – the class of all chain complexes
Synopsis of use:
Operator: chainComplex [V.24.196]
Class of argument 1: GradedModule [III.21.5.4.3]
Class of typical returned value: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:691-696
chainComplex GradedModule := ChainComplex => (M) -> (
C := new ChainComplex from M;
b := C.dd = new ChainComplexMap;
b.degree = -1;
b.source = b.target = C;
C)
304
16. CHAINCOMPLEX
16.8. complete ChainComplex
complete C – fills in the modules of a chain complex obtained as a resolution
with information from the engine.
For the sake of efficiency, when a chain complex arises as a resolution of a
module, the free modules are not filled in until they are needed. This routine can
be used to fill them all in, and is called internally when a chain complex is printed.
Normally users will not need this function, unless they use # [V.24.4] to obtain
the modules of the chain complex, or use keys [V.24.377] to see which spots are
occupied by modules.
i1 : R = ZZ/101[a..d];
i2 : C = resolution cokernel vars R;
i3 : keys C
o3 = {ring, Resolution, dd}
o3 : List
i4 : complete C;
i5 : keys C
o5 = {0, 1, Resolution, 2, 3, 4, ring, dd}
o5 : List
Synopsis of use:
Operator: complete [V.24.221]
Class of argument 1: ChainComplex [III.16]
Class of typical returned value: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:12-14
complete ChainComplex := ChainComplex => C -> (
if C.?Resolution then (i := 0; while C_i != 0 do i = i+ ...
C)
16.9. dual ChainComplex
dual C – the dual of a chain complex.
Synopsis of use:
Operator: dual [V.24.260]
Class of argument 1: ChainComplex [III.16]
Class of typical returned value: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:545-547
dual ChainComplex := ChainComplex => (C) -> (
R := ring C;
Hom(C,R^1))
16.10. new ChainComplex
C = new ChainComplex – make a new chain complex.
16.11. CHAINCOMPLEX ** CHAINCOMPLEXMAP
305
The new chain complex is initialized with a differential of degree -1 accessible
as C.dd and of type ChainComplexMap [III.21.5.4.1]. You can take the new
chain complex and fill in the ring, the modules, and the differentials.
i1 : C = new ChainComplex;
i2 : C.ring = ZZ;
i3 : C#2 = ZZ^1;
i4 : C#3 = ZZ^2;
i5 : C.dd#3 = matrix {{3,-11}};
1
2
o5 : Matrix ZZ <--- ZZ
i6 : C
1
2
o6 = ZZ <-- ZZ
2
3
o6 : ChainComplex
i7 : C.dd
1
o7 = 1 : 0 <----- ZZ : 2
0
1
2
2 : ZZ <------------- ZZ : 3
| 3 -11 |
o7 : ChainComplexMap
Synopsis of use:
Operator: NewMethod [V.24.105]
Class of argument 1: ChainComplex [III.16]
Class of typical returned value: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:5-10
new ChainComplex := ChainComplex => (cl) -> (
C := newClass(ChainComplex,new MutableHashTable); -- si ...
b := C.dd = new ChainComplexMap;
b.degree = -1;
b.source = b.target = C;
C)
16.11. ChainComplex ** ChainComplexMap
C ** f – tensor product of a chain complex with a map of chain complexes.
See also:
ChainComplexMap [III.21.5.4.1] – the class of all maps between chain
complexes
Synopsis of use:
Operator: ** [V.24.15]
306
16. CHAINCOMPLEX
Class of argument 1: ChainComplex [III.16]
Class of argument 2: ChainComplexMap [III.21.5.4.1]
Class of typical returned value: ChainComplexMap [III.21.5.4.1]
Code:
-- ../m2/chaincomplexes.m2:787-794
ChainComplex ** ChainComplexMap := ChainComplexMap => (C,f) ...
P := youngest(C,f);
key := (C,f,symbol **);
if P#?key then P#key
else C**f = (
id_C ** f
)
)
16.12. ChainComplexMap ** ChainComplex
f ** C – tensor product of a map of chain complexes with a chain complex.
See also:
ChainComplexMap [III.21.5.4.1] – the class of all maps between chain
complexes
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: ChainComplexMap [III.21.5.4.1]
Class of argument 2: ChainComplex [III.16]
Class of typical returned value: ChainComplexMap [III.21.5.4.1]
Code:
-- ../m2/chaincomplexes.m2:779-786
ChainComplexMap ** ChainComplex := ChainComplexMap => (f,C) ...
P := youngest(f,C);
key := (f,C,symbol **);
if P#?key then P#key
else f**C = (
f ** id_C
)
)
16.13. HH ChainComplex
HH C – produces the direct sum of the homology modules of the chain complex
C as a graded module.
See also:
GradedModule [III.21.5.4.3] – the class of all graded modules
HH [V.24.88] – general homology and cohomology functor
Synopsis of use:
Operator: homology [V.24.341]
Class of argument 1: ChainComplex [III.16]
Class of typical returned value: GradedModule [III.21.5.4.3]
Optional arguments :
Code:
-- ../m2/chaincomplexes.m2:428-433
homology(ChainComplex) := GradedModule => opts -> (C) -> (
H := new GradedModule;
H.ring = ring C;
complete C;
scan(spots C, i -> H#i = homology(i,C));
16.16. MAP(CHAINCOMPLEX,CHAINCOMPLEX,FUNCTION)
307
H)
16.14. components ChainComplex
components C – returns from which C was formed, if C was formed as a direct
sum.
See also:
isDirectSum [V.24.364] – whether something is a direct sum
Synopsis of use:
Operator: components [V.24.223]
Class of argument 1: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:504
components ChainComplex := C -> if C.?components then C.comp ...
16.15. length ChainComplex
length C – the length of a chain complex.
The length of a chain complex is defined to be the difference between the
smallest and largest indices of spots occupied by modules, even if those modules
happen to be zero.
Synopsis of use:
Operator: length [V.24.385]
Class of argument 1: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:35-39
length ChainComplex := (C) -> (
complete C;
s := spots C;
if #s === 0 then 0 else max s - min s
)
16.16. map(ChainComplex,ChainComplex,Function)
map(C,D,f) – construct a map from the chain complex D to the chain complex
C which in degree k is the map provided as the value of f(k).
As a convenience, the value returned by f(k) is used as the third argument in
map(C_k,D_k,f(k)).
The function f is called only for those indices which represent spots occupied
in both the source and target chain complexes.
See also:
ChainComplex [III.16] – the class of all chain complexes
Synopsis of use:
Operator: map [V.24.399]
Class of argument 1: ChainComplex [III.16]
Class of argument 2: ChainComplex [III.16]
Class of argument 3: Function [III.18]
Class of typical returned value: ChainComplexMap [III.21.5.4.1]
Optional arguments :
map(..., Degree => ...)
Next more general method: map(GradedModule,GradedModule,Function)
– make a map
308
16. CHAINCOMPLEX
16.17. max ChainComplex
max C – the maximum index occuring in a chain complex.
Synopsis of use:
Operator: max [V.24.402]
Class of argument 1: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:797
max ChainComplex := C -> max spots C
16.18. min ChainComplex
min C – the minimum index occuring in a chain complex.
Synopsis of use:
Operator: min [V.24.411]
Class of argument 1: ChainComplex [III.16]
Code:
-- ../m2/chaincomplexes.m2:796
min ChainComplex := C -> min spots C
CHAPTER 17
Variety
See also:
CoherentSheaf [III.21.5.4.2] – the class of all coherent sheaves
The type Variety is a member of the class Type [III.21.5.4.11]. Each object
of class Variety is called a variety. Each variety is also a member of class MutableHashTable [III.21.5.4].
Types of Variety :
AffineVariety [III.17.1] – the class of all affine varieties
ProjectiveVariety [III.17.2] – the class of all projective varieties
Making a variety :
variety CoherentSheaf [III.17.3] – get the variety under a sheaf
Methods for using a variety :
hilbertPolynomial Variety
ideal Variety
ring Variety
sheaf(Module,Variety) [III.13.20] – make a coherent sheaf
17.1. AffineVariety
To create an affine variety, use Spec [V.24.127].
i1 : Spec(QQ[x,y])
o1 = Spec(QQ [x, y])
o1 : AffineVariety
The type AffineVariety is a member of the class Type [III.21.5.4.11]. Each
object of class AffineVariety is called an affine variety. Each affine variety is also a
member of class Variety [III.17].
Making an affine variety :
AffineVariety * AffineVariety
AffineVariety ** Ring
Spec Ring
Methods for using an affine variety :
dim AffineVariety
expression AffineVariety
net AffineVariety
17.2. ProjectiveVariety
To create a projective variety, use Proj [V.24.118].
i1 : Proj(QQ[x,y])
309
310
17. VARIETY
o1 = Proj(QQ [x, y])
o1 : ProjectiveVariety
The type ProjectiveVariety is a member of the class Type [III.21.5.4.11].
Each object of class ProjectiveVariety is called a projective variety. Each projective
variety is also a member of class Variety [III.17].
Making a projective variety :
Proj Ring
ProjectiveVariety ** Ring
Methods for using a projective variety :
cotangentSheaf ProjectiveVariety [III.17.2.1] – make the cotangent
sheaf
cotangentSheaf(ZZ,ProjectiveVariety) [III.17.2.2] – make an exterior
power of the cotangent sheaf
dim ProjectiveVariety
expression ProjectiveVariety
net ProjectiveVariety
singularLocus ProjectiveVariety
17.2.1. cotangentSheaf ProjectiveVariety
cotangentSheaf X – calculate the cotangent sheaf of a variety X.
Synopsis of use:
Operator: cotangentSheaf [V.24.233]
Class of argument 1: ProjectiveVariety [III.17.2]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:109-116
cotangentSheaf ProjectiveVariety := CoherentSheaf => (X) -> ...
if X.?cotangentSheaf
then X.cotangentSheaf
else X.cotangentSheaf = (
R := ring X;
F := presentation R;
sheaf( prune
homology(vars ring F ** R,jacobian F ** R), X ...
17.2.2. cotangentSheaf(ZZ,ProjectiveVariety)
cotangentSheaf(p,X) – calculate the p-th exterior power of the cotangent
sheaf of a variety X.
Synopsis of use:
Operator: cotangentSheaf [V.24.233]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ProjectiveVariety [III.17.2]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:117-120
cotangentSheaf(ZZ,ProjectiveVariety) := CoherentSheaf => (i, ...
if X#?(cotangentSheaf,i)
then X#(cotangentSheaf,i)
else X#(cotangentSheaf,i) = exteriorPower(i,cotangentSh ...
17.3. VARIETY COHERENTSHEAF
17.3. variety CoherentSheaf
variety F – produce the variety over which a coherent sheaf is defined.
i1 : X = Proj(QQ[x,y,z])
o1 = Proj(QQ [x, y, z])
o1 : ProjectiveVariety
i2 : OO_X(3)
1
o2 = sheaf((QQ [x, y, z]) )
o2 : CoherentSheaf
i3 : variety oo
o3 = Proj(QQ [x, y, z])
o3 : ProjectiveVariety
Synopsis of use:
Operator: variety [V.24.642]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: Variety [III.17]
Code:
-- ../m2/varieties.m2:46
variety CoherentSheaf := Variety => (F) -> F.variety
311
CHAPTER 18
Function
See also:
functions [V.24.302]
The type Function is a member of the class Type [III.21.5.4.11]. Each object
of class Function is called a function.
Making a function :
Function @@ Function
Function _ Thing
OptionTable ==> Function [III.18.1] – declare option names and default
values
profile Function
{...} ==> Function [III.18.2] – declare option names and default values
Methods for using a function :
Function ## (...)
Function Thing [III.18.3] – function application
Function \ VisibleList [III.18.4] – apply a function to each member of a
list
VisibleList / Function [III.18.5] – apply a function to each member of
a list
accumulate(Function,Thing,VisibleList) [III.18.6] – apply binary operator repeatedly
accumulate(Function,VisibleList) [III.18.7] – apply binary operator repeatedly
accumulate(VisibleList,Function) [III.18.8] – apply binary operator repeatedly
accumulate(VisibleList,Thing,Function) [III.18.9] – apply binary operator repeatedly
any(BasicList,Function)
any(HashTable,Function)
apply(BasicList,BasicList,Function) [III.18.10] – apply function to elements in pairs
apply(BasicList,Function) [III.18.11] – apply function to each element
apply(HashTable,Function) [III.18.12] – apply function to each value
apply(ZZ,Function) [III.18.13] – apply function to 0 .. n-1
applyKeys(HashTable,Function)
applyPairs(HashTable,Function)
applyValues(HashTable,Function)
autoload(Function,String)
code Function
documentation Function
313
314
18. FUNCTION
expression Function
fold(Function,Thing,VisibleList) [III.18.14] – apply binary operator repeatedly
fold(Function,VisibleList) [III.18.15] – apply binary operator repeatedly
fold(VisibleList,Function) [III.18.16] – apply binary operator repeatedly
fold(VisibleList,Thing,Function) [III.18.17] – apply binary operator repeatedly
formatDocumentTag Function
locate Function
map(ChainComplex,ChainComplex,Function) [III.16.16] – make a
map of chain complexes
map(GradedModule,GradedModule,Function)
map(Module,Module,Function) [III.12.28] – make a map
map(Module,ZZ,Function) [III.12.35] – make a map
memoize Function
memoize(Function,{...})
merge(HashTable,HashTable,Function)
mergePairs(BasicList,BasicList,Function)
net Function
new Command from Function
new Manipulator from Function
options Function [III.18.18] – get optional arguments and defaults
precedence Function
product((...),(...),Function)
product((...),Function)
product((...),{...},Function)
product(ZZ,Function) [III.18.19] – product of consecutive values of a
function
product({...},(...),Function)
product({...},Function) [III.18.20] – product of values of a function
product({...},{...},Function) [III.18.21] – product of results of applying
a function pairwise
profile(String,Function)
scan(BasicList,Function) [III.18.22] – apply a function to each element
of a list
scan(ZZ,Function) [III.18.23] – apply a function to 0 .. n-1
scanKeys(Database,Function)
scanKeys(HashTable,Function)
scanPairs(HashTable,Function) [III.18.24] – apply a function to pairs
in a hash table
scanValues(HashTable,Function)
select(BasicList,Function) [III.18.25] – select elements from a list
select(HashTable,Function) [III.18.26] – select from a hash table
select(ZZ,BasicList,Function) [III.18.27] – select elements from a list
select(ZZ,HashTable,Function) [III.18.28] – select from a hash table
sum((...),(...),Function)
18. FUNCTION
315
sum((...),Function)
sum((...),{...},Function)
sum(ZZ,Function) [III.18.29] – sum consecutive values of a function
sum({...},(...),Function)
sum({...},Function) [III.18.30] – sum results of applying a function
sum({...},{...},Function) [III.18.31] – sum results of applying a function
pairwise
toString Function
ultimate(Function,Thing)
{...} / Function
Fixed objects of class Function :
BinaryPowerMethod [V.24.58] – compute powers by squaring
ConvertApply [IV.22.1.9.1] – apply a function after specified engine format conversions
ConvertFixedRepeat [IV.22.1.9.2] – convert a fixed length sequence of
items from engine format
ConvertJoin [IV.22.1.9.3] – convert several items from engine format
ConvertList [IV.22.1.9.4] – convert a sequence of items from engine format
ConvertRepeat [IV.22.1.9.6] – convert a sequence of items from engine
format
End [V.24.73] – module of endomorphisms
Fano [V.24.78] – Fano scheme
GF [V.24.83] – make a finite field
Grassmannian [V.24.87] – find the ideal of a Grassmannian
Hom [V.24.90] – module of homomorphisms
Numeric
Proj [V.24.118] – make a projective variety
SEEALSO [V.24.121] – crossreferences in documentation
Schur [V.24.122] – make a Schur ring
SimplePowerMethod [V.24.123] – compute powers by multiplying
Spec [V.24.127] – make an affine variety
TEST [V.24.137] – commands for testing later
TeX [V.24.139] – convert to TeX and display on screen
abs [V.24.152] – absolute value function
accumulate [V.24.153] – apply binary operator repeatedly
acos [V.24.154] – arccosine function
addEndFunction [V.24.155] – add an ending function
addStartFunction [V.24.156] – add a startup function
adjoint [V.24.157] – the adjoint map
adjoint1 [V.24.158] – the adjoint map
alarm [V.24.160] – set an alarm
all [V.24.161] – whether all elements satisfy a condition
ambient [V.24.162] – ambient free module or ring
ancestor [V.24.163] – whether one type is an ancestor of another
ann
annihilator [V.24.166] – the annihilator ideal
any [V.24.167] – whether an element satisfies a condition
append [V.24.168] – add to the end of a list
316
18. FUNCTION
apply [V.24.169] – apply a function to each element
applyKeys [V.24.170] – apply a function to each key in a hash table
applyPairs [V.24.171] – apply a function to pairs in a hash table
applyTable [V.24.172] – apply a function to elements of a table
applyValues [V.24.173] – apply a function to each value
apropos [V.24.174] – symbols matching a pattern
ascii [V.24.176] – ASCII character conversion
asin [V.24.177] – arcsine function
assert [V.24.178] – assert something is true
assign [V.24.179] – assign a value
atEndOfFile [V.24.180] – test for end of file
atan [V.24.181] – arctangent function
autoload [V.24.182] – arrange for a function to be loaded automatically
backtrace [V.24.183] – trace back through evaluations after an error
baseName [V.24.184] – the base name of a generator
basictype [V.24.186] – the basic type
basis [V.24.187] – a k-basis of all or part of a module
benchmark [V.24.188] – accurate timing of execution
betti [III.21.6.5] – display degrees in a free resolution
between [V.24.189] – insert something between elements of a list
binomial [V.24.191] – binomial coefficient
borel [V.24.192] – make a Borel fixed submodule
briefDocumentation [V.24.193] – get brief documentation
browse [V.24.194] – browse the contents of an object
buckets [I.5.5.1] – list the buckets in a hash table
callgg [IV.22.3.1] – call the engine
ceiling [V.24.195] – ceiling function
chainComplex [V.24.196] – make a chain complex
char [V.24.197] – the characteristic of a field or ring
characters [V.24.198] – get characters from a string
class [V.24.199] – class of an object
clearEcho [V.24.201] – turn off echoing
code [V.24.206] – display source code
codim [V.24.207] – calculate the codimension
coefficientRing [V.24.208] – get the coefficient ring
coefficients [V.24.209] – the coefficients
cohomology [V.24.210] – general cohomology functor
coimage [V.24.211] – coimage of a map
coker
cokernel [V.24.213] – cokernel of a map
collectGarbage [V.24.214] – collect the garbage in memory
columnate [V.24.215] – arrange strings in columns
combine [V.24.217] – combine hash tables
complement [V.24.220] – find the minimal generators for cokernel of a
matrix (low level form)
complete [V.24.221]
components [V.24.223] – list the components of a direct sum
compress [V.24.224] – remove columns which are zero
18. FUNCTION
317
concatenate [V.24.225] – join strings
cone [V.24.226] – mapping cone of a chain map
conjugate [III.21.1.1.1] – complex conjugate
connectionCount [V.24.227] – the number of connections
content [V.24.228] – the content of a polynomial
contract [V.24.229] – contract one matrix by another
contract’
convert [IV.22.1.9] – convert to engine format
copy [V.24.230] – copy an object
cos [V.24.231] – cosine function
cosh [V.24.232] – hyperbolic cosine function
cotangentSheaf [V.24.233] – make the cotangent sheaf
cover [V.24.234] – get the covering free module
currentDirectory [V.24.235] – current working directory
decompose [V.24.238] – irreducible components of an ideal
deepSplice [V.24.239] – remove subsequences
degree [V.24.240] – the degree
degreeLength [V.24.241] – the number of degrees
degrees [V.24.242] – get degrees of basis elements
degreesMonoid [V.24.243] – get the monoid of degrees
degreesRing [V.24.244] – the ring of degrees
delete [V.24.245] – delete elements of a list
demark [V.24.246] – insert a string between elements of a list of strings
denominator [V.24.247] – denominator of a fraction
depth [V.24.248] – depth of a net
describe [V.24.249] – real description
det [V.24.250] – determinant of a matrix
diff [V.24.251] – differentiate
difference [V.24.252] – difference
dim [V.24.253] – calculate the dimension
directSum [V.24.254] – direct sum of modules or maps
divideByVariable [V.24.255] – divide all columns by a (power of a) variable
document [V.24.257] – install documentation
documentation [V.24.258] – get documentation, unformatted
drop [V.24.259] – drop some elements
dual [V.24.260] – dual module or map
dumpdata [V.24.261] – dump state of the system to a file
echoOff [V.24.262] – turn off echoing
echoOn [V.24.263] – turn on echoing
eeLift [IV.22.3.12] – call engine to lift a ring element
eePop [IV.22.3.7] – pop object from engine stack
eePopBool [IV.22.3.8] – pop Boolean value from engine stack
eePopInt [IV.22.3.9] – pop integer from engine stack
eePopIntarray [IV.22.3.10] – pop array of integers from engine stack
eePromote [IV.22.3.13] – call engine to promote a ring element
elements
entries [V.24.270] – list the entries of a matrix
318
18. FUNCTION
erase [V.24.272] – remove a global symbol
error [V.24.273] – deliver error message
errorDepth [V.24.274] – set the error printing depth
euler [V.24.275] – list the sectional Euler characteristics
evaluate
even [V.24.276] – tell whether an integer is even
examine [V.24.277] – examine internal information about functions or
symbols
examples [V.24.278] – list the examples in documentation
exec [V.24.279] – execute another program
exp [V.24.281] – exponential function
expand
exponents [V.24.282] – list the exponents in a polynomial
expression [III.21.1.3.20] – convert to an expression
extend [V.24.283] – extend a partial map of chain complexes
exteriorPower [V.24.284] – exterior power
factor [V.24.285] – factor a ring element
first [V.24.287] – first element of a list
firstkey [V.24.288] – get the first key
fittingIdeal [V.24.289] – Fitting ideal of a module
flag [V.24.290] – flag a symbol
flatten [V.24.291] – flatten a list by unnesting lists
flip
floor [V.24.293] – floor function
fold [V.24.295] – apply binary operator repeatedly
forceGB [III.15.1] – declare that the columns of a matrix are a Groebner
basis
fork [V.24.297] – fork the process
format [V.24.298] – format a string
formatDocumentTag [IV.23.1] – format documentation tags
frac [III.10.1.1.1] – construct a fraction field
fraction [V.24.299]
frame [III.21.1.9.1] – the frame of a function
fromDual [V.24.301]
gb [III.15.2] – compute a Groebner basis
gbTrace [V.24.309] – – provide tracing output during various computations in the engine.
gcDump [V.24.310] – the status of the memory allocator
gcd [V.24.311] – greatest common divisor
gcdCoefficients [V.24.312] – gcd with coefficients
genera [V.24.313] – list the sectional arithmetic genera
generators [III.13.12.1] – matrix of generators
genericMatrix [V.24.316] – make a generic matrix of variables
genericSkewMatrix [V.24.317] – make a generic skew symmetric matrix
genericSymmetricMatrix [V.24.318] – make a generic symmetric matrix
gens [V.24.319] – matrix of generators
get [V.24.320] – get an entire file
getChangeMatrix [V.24.321] – get the change of basis matrix
18. FUNCTION
319
getMatrix [IV.22.3.11] – get a matrix from the engine’s stack
getWWW [V.24.322] – get a web page
getc [V.24.323] – get a byte
getenv [V.24.324] – get value of environment variable
gg [IV.22.3.2] – convert to engine communication format
ggPush [IV.22.3.3] – convert a push command to engine communication
format
globalAssignFunction [V.24.326] – the standard method for the global
assignment hook
globalReleaseFunction [V.24.327] – the standard method for the global
variable release hook
gradedModule [V.24.328] – make a graded module
gradedModuleMap [V.24.329] – make a map of graded modules
graphIdeal [V.24.330] – the ideal of the graph of a ring map
graphRing [V.24.331] – the ring of the graph of a ring map
group [V.24.332] – make a group (monoid with inverses)
handle [IV.22.3.4] – get the handle of an object
hash [V.24.333] – hash code of an object
hashTable [V.24.334] – make a hash table
headline
height [V.24.336] – height of a net
help [V.24.337] – get help
hilbertFunction [V.24.338] – Hilbert function of a module
hilbertPolynomial [III.21.5.6.3] – compute Hilbert polynomial
hilbertSeries [V.24.339] – compute Hilbert series
hold [III.21.1.3.9.3] – hold something in a holder expression
homogenize [V.24.340] – homogenize with respect to a variable
homology [V.24.341] – general homology functor
homomorphism [V.24.342] – get the homomorphism from element of Hom
horizontalJoin [III.21.6.6] – join nets or strings horizontally
html [III.21.6.1.1] – convert hypertext to html format
ideal [III.11.5] – make an ideal
identity [V.24.345] – the identity function
image [V.24.348] – image of a map
imaginaryPart [III.21.9.1] – imaginary part
index [V.24.351] – yields the numeric index of a ring variable
indices [V.24.353] – specify keys for components of a direct sum
inducedMap [V.24.354] – compute an induced map
inducesWellDefinedMap [III.21.2.5] – whether a map is well defined
input [V.24.358] – read Macaulay 2 commands and echo
installMethod [V.24.359] – install methods
instance [V.24.360] – whether something has a certain type
integrate [V.24.361] – numerical integration
intersect [V.24.362] – compute an intersection
irreducibleCharacteristicSeries [V.24.363] – compute the irreducible
characteristic series
isAffineRing [III.21.2.6] – whether something is an affine ring
isBorel [III.21.2.7] – whether an ideal is Borel fixed
320
18. FUNCTION
isCommutative [III.21.2.8] – whether a ring is commutative
isDirectSum [V.24.364] – whether something is a direct sum
isField [III.21.2.9] – whether something is a field
isFreeModule [III.21.2.10] – whether something a free module
isHomogeneous [III.21.2.11] – test for homogeneity
isIdeal [III.21.2.12] – whether something is an ideal
isInjective [III.21.2.13] – whether a map is injective
isInputFile [V.24.365] – whether a file is open for input
isIsomorphism [III.21.2.14] – whether a map is an isomorphism
isListener [V.24.366] – whether a file is open for listening
isModule [III.21.2.15] – whether something is a module.
isOpenFile [V.24.367] – whether a file is open
isOutputFile [V.24.368] – whether a file is open for output
isPolynomialRing [III.21.2.16] – whether something is a polynomial ring
isPrime [III.21.2.17] – tell whether an integer is a prime
isPrimitive [V.24.369] – whether an element is a primitive element of a
finite field
isQuotientModule [III.21.2.18] – whether a module is evidently a quotient of a free module
isQuotientOf [III.21.2.19] – whether one thing is a quotient of another
isQuotientRing [III.21.2.20] – whether something is a quotient ring
isReady [V.24.370] – whether a file has data available for reading
isRing [III.21.2.21] – whether something is a ring
isSubmodule [III.21.2.22] – whether a module is evidently a submodule
of a free module
isSubset [III.21.2.23] – whether something is a subset of another
isSurjective [III.21.2.25] – whether a map is surjective
isTable [V.24.371] – whether something is a rectangular list of lists
isUnit [III.21.2.26] – whether a ring element is a unit
isWellDefined [III.21.2.27] – whether a map is well defined
jacobian [V.24.372] – the Jacobian matrix of partial derivatives
join [V.24.373] – join lists
ker
kernel [V.24.375] – kernel of a map
keys [V.24.377] – keys used in a hash table
kill [V.24.378] – kill a process
koszul [V.24.379] – a differential in a Koszul map
last [V.24.380] – last element of a list
leadCoefficient [V.24.381] – the leading coefficient
leadComponent [V.24.382] – the leading component of a vector
leadMonomial [V.24.383] – the leading monomial
leadTerm [V.24.384] – get the leading term
length [V.24.385] – length
lift [V.24.386] – lift to another ring
liftable [V.24.387] – whether a ring element can be lifted to another ring
lineNumber [V.24.388] – current line number
lines [V.24.389] – split a string into lines
listForm [V.24.390] – convert to list form
18. FUNCTION
321
load [V.24.392] – read Macaulay 2 commands
loaddata [V.24.393] – load state of the system from a file
locate [V.24.395] – locate source code
log [V.24.396] – logarithm function
lookup [V.24.397] – look up methods
lookupCount [V.24.398] – reference count for a symbol
map [V.24.399] – make a map
match [V.24.400] – whether a string matches a pattern
mathML [III.21.6.1.2] – convert to MathML format
matrix [V.24.401] – make a matrix
max [V.24.402] – maximum of elements of a list
maxPosition [V.24.403] – position of largest element
member [V.24.404] – test membership in a list
memoize [V.24.405] – record results of function evaluation for future use
merge [V.24.406] – merge hash tables
mergePairs [V.24.407] – merge sorted lists of pairs
method [I.4.31.1] – make a new method function
methods [V.24.410] – list methods
min [V.24.411] – minimum of elements of a list
minPosition [V.24.412] – position of smallest element
mingens [V.24.413] – returns a minimal generatoring set of a graded module
mingle [V.24.414] – mingle elements of several lists
minors [V.24.415] – ideal generated by minors
minprimes [V.24.416] – compute the minimal primes
minus [V.24.417] – additive inverse
mod [V.24.418] – reduce modulo an integer
modifyRing [V.24.419] – make a copy of a ring, with some features
changed
module
modulo [V.24.422] – find the pre-image of a map (low level version)
monoid [V.24.424] – make a monoid
monomialCurve [V.24.425] – make a monomial curve
monomialIdeal [V.24.426] – make a monomial ideal
mutable [V.24.427] – whether something may be modified
needs [V.24.430] – read Macaulay 2 commands if necessary
net [III.21.6.7] – convert to net
netRows [V.24.431] – list the rows of a net
newClass [V.24.433] – copy an object, changing the class
newCoordinateSystem [V.24.434] – change variables
newHandle [III.21.4.1] – make a new handle
nextkey [V.24.436] – the next key in a database
notImplemented [V.24.439] – print an ’not implemented’ error message
nullhomotopy [V.24.441] – make a null homotopy
number [V.24.442] – count how many elements of a list satisfy a condition
numerator [V.24.443] – numerator of a fraction
numeric [V.24.444] – convert to floating point
numgens [V.24.445] – the number of generators
322
18. FUNCTION
odd [V.24.446] – tell whether an integer is odd
on [V.24.448] – trace a function each time it’s run
openDatabase [V.24.452] – open a database file
openDatabaseOut [V.24.453] – open a database file for writing
openFiles [V.24.454] – list the open files
openIn [V.24.455] – open an input file
openInOut [V.24.456] – open an input outpuf file
openListener [V.24.457] – open a port for listening
openOut [V.24.458] – open an output file
options [III.21.5.5.1] – get options
override [V.24.461] – override default values for optional arguments
pack [V.24.462] – pack elements of a list into shorter ones
pad [V.24.463] – pad a string with spaces
pairs [V.24.464] – list the pairs in a hash table
parent [V.24.465] – parent type of an object
partitions [V.24.216.4] – list the partitions of an integer
pdim [V.24.468] – calculate the projective dimension
peek [III.21.6.8] – examine contents of an object
peek2 [III.21.6.9] – examine contents of an object
pfaffians [V.24.469] – ideal generated by Pfaffians
plus [V.24.471] – addition
poincare [V.24.472] – assemble degrees into polynomial
poincareN [V.24.474] – assemble degrees into polynomial
position [V.24.476] – find first element of a list satisfying a condition
positions [V.24.477] – which elements of a list satisfy a condition
power [V.24.478] – power
precedence [III.21.1.3.2] – parsing precedence
prepend [V.24.479] – add to the beginning of a list
presentation [V.24.480] – presentation of a module or ring
print [V.24.481] – print something
printExamples [V.24.483] – print examples of use from documentation
printString [V.24.484] – lowlevel function to print a string
processID [V.24.485] – the process identifier
product [V.24.486]
profile [V.24.487] – profile a function
projectiveHilbertPolynomial [V.24.489] – Hilbert polynomial of projective space
promote [V.24.490] – promote to another ring
protect [V.24.491] – protect a symbol
prune [III.13.12.3] – prune generators and relations
pseudoRemainder [V.24.493] – compute the pseudo-remainder
pushForward [V.24.494]
pushForward1 [V.24.497] – the main computational component of pushForward
quote
quotient [V.24.505] – ideal or submodule quotient
radical [V.24.507] – compute the radical of an ideal
random [V.24.216.1] – get a random element
18. FUNCTION
323
rank [V.24.508] – compute the rank
read [V.24.509] – read from a file
realPart [III.21.9.3] – real part
regularity [V.24.510] – compute the regularity
relations [III.13.12.2] – the defining relations
remove [V.24.512] – remove an entry from a hash table
removeLowestDimension [V.24.513] – remove components of lower dimension
reorganize [V.24.514] – reorganize a database file
res
reshape [V.24.516] – reshape a matrix
resolution [V.24.517] – make a projective resolution
reverse [V.24.528] – reverse a list
ring [III.10.5] – get the associated ring
rsort [V.24.529] – sort a list in reverse order
run [V.24.530] – run an external command
runEndFunctions [V.24.531] – run the ending functions
runStartFunctions [V.24.532] – run the start up functions
same [V.24.533] – whether everything in a list is the same
sameFunctionBody
saturate [V.24.534] – saturation of ideal or submodule
scan [V.24.537] – apply a function to each element
scanKeys [V.24.538] – apply a function to each key in a hash table or
database
scanPairs [V.24.539] – apply a function to pairs in a hash table
scanValues [V.24.540] – apply a function to each value in a hash table
see [IV.22.3.18] – display engine object
seeParsing [I.5.5.2] – print syntax table
select [V.24.541] – select elements from a list or hash table
selectInSubring [V.24.542] – select columns in a subring
sendToEngine [IV.22.3.5] – send a command string to the engine
sendgg [IV.22.3.6] – send commands to engine
separate
seq
sequence [V.24.543] – make a sequence
set [V.24.544] – make a set
setEcho [V.24.545] – turn on echoing
setSpin [IV.23.2] – set interval for spinning the cursor
setrecursionlimit [V.24.546] – set the limit on recursion
sheaf [III.21.5.4.2.8] – make a coherent sheaf
sin [V.24.550] – sine function
singleton [III.19.3.1] – make a sequence of length one
singularLocus [V.24.551] – singular locus
sinh [V.24.552] – hyperbolic sine function
size [V.24.553] – the size of an object
sleep [V.24.554] – sleep for a while
someTerms [V.24.555] – select some terms of a polynomial
sort [V.24.556] – sort a list
324
18. FUNCTION
sortColumns [V.24.557] – sort the columns of a matrix
source [V.24.560] – source of a map
splice [V.24.562] – remove subsequences
sqrt [V.24.563] – square root function
stack [III.21.6.10] – join nets or string vertically
standardForm [V.24.564] – convert to standard form
stats [V.24.565]
status [V.24.566] – status of a resolution computation
submatrix [V.24.570] – select part of a matrix
submodule
subquotient [III.13.12] – make a subquotient module
subsets [V.24.216.2] – produce all the subsets
substitute [V.24.572] – substitute values for variables
substring [V.24.573] – extract part of a string
subtable [V.24.574] – extract a subtable from a table
sum [V.24.575] – compute the sum
super [V.24.576] – get the ambient module
symbolTable [V.24.596] – the global symbols
symmetricAlgebra [V.24.597] – the symmetric algebra of a module
symmetricPower [V.24.598] – symmetric power
syz [V.24.599] – compute the syzygy matrix
syzygyScheme [V.24.603] – construct a syzygy scheme
table [V.24.604] – make a table (nested list)
take [V.24.605] – take some elements from a list
tally [V.24.216.3] – tally the elements of a list
tan [V.24.606] – tangent function
tanh [V.24.607] – hyperbolic tangent function
target [V.24.608] – target of a map
tensor [V.24.609] – tensor product
tensorAssociativity [V.24.610] – associativity isomorphisms for tensor
products
terms [V.24.611] – provide a list of terms of a polynomial
tex [III.21.6.1.3] – convert to TeX
texMath [III.21.6.1.4] – convert to TeX math
text [III.21.6.1.5] – convert hypertext to text
times [V.24.614] – multiplication
tmpname [V.24.616] – make a temporary file name
toDual [V.24.617]
toExternalString [III.21.6.1.6] – convert to a readable string
toHandle [V.24.618] – convert to handle
toList [V.24.619] – list of elements
toSequence [V.24.620] – convert to sequence
toString [III.21.6.1.7] – convert to a string
top [V.24.621] – compute the top dimensional components
topCoefficients [V.24.624] – list of top coefficients of a matrix
topicList [V.24.625] – list of help topics
trace [V.24.627] – trace of a matrix
transnet [V.24.628] – assemble bytes into 4-byte integers
18.1. OPTIONTABLE ==> FUNCTION
325
transpose [V.24.629] – transpose
trim [V.24.630] – simplify the presentation
truncate [V.24.632] – truncate the module at a specified degree
ultimate [V.24.635] – – ultimate value for an iteration
unSingleton
unhex [V.24.637] – translate a URL
uniform [V.24.638] – test whether elements of a list are of the same class
unique [III.19.2.4] – eliminate duplicates from a list
unlist
usage
use [V.24.639] – install defaults
userSymbols [V.24.640] – a list of the user’s symbols
value [III.21.1.3.1] – evaluate
values [V.24.641] – values in a hash table
variety [V.24.642] – get the variety
vars [V.24.643] – the matrix of the variables
vector [V.24.644] – make a vector
verticalJoin
wait [V.24.647] – wait for child process
wedgeProduct [V.24.648] – the exterior multiplication map
width [V.24.650] – width of a file or net
xor [V.24.651] – logical exclusive-or
youngest [V.24.652] – the youngest member of a sequence
18.1. OptionTable ==> Function
g = defs ==> fun – produces a new function g from the function fun that
processes optional arguments.
Here defs is a hash table of class OptionTable [III.21.5.5] whose keys are the
names of the optional arguments, and whose values are the corresponding default
values. The value of g args, say, is obtained by evaluation of (fun opts)(args’),
where args’ is obtained from args by removing the options of the form X=>A (where
X is a name of an optional argument), and opts is a hash table of the same form
as defs in which the default values have been replaced by the user-supplied values,
e.g., the value stored under the key X has been replaced by A.
Remark: defs can also be simply a list of options.
In the following example we use a simple definition for fun so we can see
everything that fun receives.
i1 : g = {a=>1, b=>2} ==> opts -> args -> {args, opts}
o1 = g
o1 : Function
i2 : g x
o2 = {x, OptionTable{a => 1}}
b => 2
o2 : List
326
18. FUNCTION
i3 : g(x,y,b=>66)
o3 = {(x, y), OptionTable{a => 1 }}
b => 66
o3 : List
i4 : g(t,u,a=>44,b=>77)
o4 = {(t, u), OptionTable{a => 44}}
b => 77
o4 : List
See also:
making new functions with optional arguments [I.4.12]
OptionTable [III.21.5.5] – the class of hash tables for optional arguments
Option [III.21.1.10] – the class of all pairs x => y
=> [V.24.42] – produce an Option
Synopsis of use:
Operator: ==> [V.24.41]
Class of argument 1: OptionTable [III.21.5.5]
Class of argument 2: Function [III.18]
Class of typical returned value: Function [III.18]
Code:
-- ../m2/option.m2:31-38
(defaults,f) -> (
args -> (
-- Common code for functions created with ==> to
-- process options and arguments.
f ## override (defaults,args)
)
)
)
18.2. {...} ==> Function
See OptionTable ==> Function [III.18.1] for details.
Synopsis of use:
Operator: ==> [V.24.41]
Class of argument 1: List [III.19.2]
Class of argument 2: Function [III.18]
Class of typical returned value: Function [III.18]
Code:
-- ../m2/option.m2:41-42
(o,f) -> (new OptionTable from o) ==> f
)
18.3. Function Thing
f x – yields the result of applying the function f to x.
Synopsis of use:
Operator: [V.24.1]
Class of argument 1: Function [III.18]
Class of argument 2: Thing [III.21]
18.5. VISIBLELIST / FUNCTION
327
18.4. Function \ VisibleList
f \ w – apply the function f to each member of the list or sequence w returning
a list or sequence containing the results. The same as apply(w,f).
This operator is right associative, which means that g \ f \ w is interpreted
as meaning g \ (f \ w).
i1 : (j -> j^2) \ (i -> i+1) \ {1,2,3}
o1 = {4, 9, 16}
o1 : List
The precendence is lower than that of @@. Hence, the following two examples
yield the same result.
i2 : sin \ sin \ {1,2,3}
o2 = {0.745624, 0.789072, 0.140652}
o2 : List
i3 : sin @@ sin \ {1,2,3}
o3 = {0.745624, 0.789072, 0.140652}
o3 : List
See also:
apply [V.24.169] – apply a function to each element
@@ [V.24.48] – a binary operator
{...} / Function [V.24.653] – a binary operator, usually used for division
Synopsis of use:
Operator: \ [V.24.147]
Class of argument 1: Function [III.18]
Class of argument 2: VisibleList [III.19]
Class of typical returned value: VisibleList [III.19]
Code:
-- ../m2/classes.m2:64
Function \ VisibleList := VisibleList => (f,v) -> apply(v,f)
18.5. VisibleList / Function
w / f – apply the function f to each member of the list or sequence w returning
a list or sequence containing the results. The same as apply(w,f).
This operator is left associative, which means that w / f / g is interpreted as
meaning (w / f) / g.
i1 : {1,2,3} / (i -> i+1) / (j -> j^2)
o1 = {4, 9, 16}
o1 : List
See also:
apply [V.24.169] – apply a function to each element
Function \ {...} [V.24.80] – apply a function to each member of a list
Synopsis of use:
328
18. FUNCTION
Operator: / [V.24.25]
Class of argument 1: VisibleList [III.19]
Class of argument 2: Function [III.18]
Class of typical returned value: VisibleList [III.19]
Code:
-- ../m2/classes.m2:66
VisibleList / Function := VisibleList => (v,f) -> apply(v,f)
18.6. accumulate(Function,Thing,VisibleList)
accumulate(f,x0,{x1,...,xn}) – computes the list {f(x0,x1),f(f(x0,x1),x2),...}.
i1 : accumulate(identity, a, {b,c,d,e})
o1 = {(a, b), ((a, b), c), (((a, b), c), d), ((((a, b), c),
...
o1 : List
i2 : accumulate (times, 1, 1 .. 10)
o2 = (1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800)
o2 : Sequence
Synopsis of use:
Operator: accumulate [V.24.153]
Class of argument 1: Function [III.18]
Class of argument 2: Thing [III.21]
Class of argument 3: VisibleList [III.19]
Class of typical returned value: VisibleList [III.19]
18.7. accumulate(Function,VisibleList)
accumulate(f,{x0,x1,...,xn}) – computes the list {f(x0,x1),f(f(x0,x1),x2),...}.
i1 : accumulate(identity, {a,b,c,d,e})
o1 = {(a, b), ((a, b), c), (((a, b), c), d), ((((a, b), c),
...
o1 : List
i2 : accumulate(plus, 0 .. 10)
o2 = (1, 3, 6, 10, 15, 21, 28, 36, 45, 55)
o2 : Sequence
Synopsis of use:
Operator: accumulate [V.24.153]
Class of argument 1: Function [III.18]
Class of argument 2: VisibleList [III.19]
Class of typical returned value: VisibleList [III.19]
Code:
-- ../m2/fold.m2:6-8
accumulate(Function,VisibleList) := VisibleList => (f,v) ->
if #v === 0 then error "expected a nonempty list";
accumulate(f,v#0,drop(v,1)))
...
18.10. APPLY(BASICLIST,BASICLIST,FUNCTION)
329
18.8. accumulate(VisibleList,Function)
accumulate({xn,...,x1,x0},f) – computes the list {...,f(x2,f(x1,x0)),f(x1,x0)}.
i1 : accumulate({a,b,c,d,e}, identity)
o1 = {(a, (b, (c, (d, e)))), (b, (c, (d, e))), (c, (d, e)),
o1 : List
Synopsis of use:
Operator: accumulate [V.24.153]
Class of argument 1: VisibleList [III.19]
Class of argument 2: Function [III.18]
Class of typical returned value: VisibleList [III.19]
Code:
-- ../m2/fold.m2:9-11
accumulate(VisibleList,Function) := VisibleList => (v,f) ->
if #v === 0 then error "expected a nonempty list";
accumulate(drop(v,-1),v#-1,f))
...
...
18.9. accumulate(VisibleList,Thing,Function)
accumulate({xn,...,x1},x0,f) – computes the list {...,f(x2,f(x1,x0)),f(x1,x0)}.
i1 : accumulate({a,b,c,d}, e, identity)
o1 = {(a, (b, (c, (d, e)))), (b, (c, (d, e))), (c, (d, e)),
...
o1 : List
Synopsis of use:
Operator: accumulate [V.24.153]
Class of argument 1: VisibleList [III.19]
Class of argument 2: Thing [III.21]
Class of argument 3: Function [III.18]
Class of typical returned value: VisibleList [III.19]
18.10. apply(BasicList,BasicList,Function)
apply(v,w,f) – produces, from lists v and w, a list z in which the i-th element
w_i is obtained by evaluating f(v_i,w_i). If v and w are lists of the same class,
then the result is also of that class.
i1 : apply({1,2,3}, {100,200,300}, (i,j) -> i+j)
o1 = {101, 202, 303}
o1 : List
Synopsis of use:
Operator: apply [V.24.169]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: BasicList [III.21.1]
Class of argument 3: Function [III.18]
Class of typical returned value: List [III.19.2]
330
18. FUNCTION
18.11. apply(BasicList,Function)
apply(v,f) – applies the function f to each element of the list v, returning the
list of results. The result is of the same class, for example, Array [III.19.1].
i1 : apply([1,3,5,7], i->i^2)
o1 = [1, 9, 25, 49]
o1 : Array
See also:
VisibleList / Function [III.18.5] – apply a function to each member of
a list
Function \ VisibleList [III.18.4] – apply a function to each member of a
list
Synopsis of use:
Operator: apply [V.24.169]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: Function [III.18]
Class of typical returned value: BasicList [III.21.1]
18.12. apply(HashTable,Function)
apply(x,f) – produces a new hash table y from an hash table x by applying
the function f to each of the values of x. This means that if x#k === v then y#k
=== f(v).
Synopsis of use:
Operator: apply [V.24.169]
Class of argument 1: HashTable [III.21.5]
Class of argument 2: Function [III.18]
Class of typical returned value: HashTable [III.21.5]
18.13. apply(ZZ,Function)
apply(n,f) – applies the function f to each integer in the range 0 .. n-1 returning the sequence of results. This is equivalent to apply( toList(0 .. n-1),f).
i1 : apply(10, i -> i^2)
o1 = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81}
o1 : List
Synopsis of use:
Operator: apply [V.24.169]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Function [III.18]
Class of typical returned value: List [III.19.2]
18.14. fold(Function,Thing,VisibleList)
fold(f,x0,{x1,...,xn}) – computes f(...f(f(x0,x1),x2)...)}.
i1 : fold(identity, a, {b,c,d,e})
o1 = ((((a, b), c), d), e)
18.17. FOLD(VISIBLELIST,THING,FUNCTION)
o1 : Sequence
Synopsis of use:
Operator: fold [V.24.295]
Class of argument 1: Function [III.18]
Class of argument 2: Thing [III.21]
Class of argument 3: VisibleList [III.19]
Class of typical returned value: VisibleList [III.19]
18.15. fold(Function,VisibleList)
fold(f,{x0,x1,...,xn}) – computes f(...f(f(x0,x1),x2)...)}.
i1 : fold(identity, {a,b,c,d,e})
o1 = ((((a, b), c), d), e)
o1 : Sequence
Synopsis of use:
Operator: fold [V.24.295]
Class of argument 1: Function [III.18]
Class of argument 2: VisibleList [III.19]
Class of typical returned value: VisibleList [III.19]
Code:
-- ../m2/fold.m2:16-18
fold(Function,VisibleList) := VisibleList => (f,v) -> (
if # v === 0 then error "expected a nonempty list";
fold(f,v#0,drop(v,1)))
18.16. fold(VisibleList,Function)
fold({xn,...,x1,x0},f) – computes f(...f(x2,f(x1,x0))...)}.
i1 : fold({a,b,c,d,e}, identity)
o1 = (a, (b, (c, (d, e))))
o1 : Sequence
Synopsis of use:
Operator: fold [V.24.295]
Class of argument 1: VisibleList [III.19]
Class of argument 2: Function [III.18]
Class of typical returned value: VisibleList [III.19]
Code:
-- ../m2/fold.m2:19-21
fold(VisibleList,Function) := VisibleList => (v,f) -> (
if #v === 0 then error "expected a nonempty list";
fold(drop(v,-1),v#-1,f))
18.17. fold(VisibleList,Thing,Function)
fold({xn,...,x1},x0,f) – computes f(...f(x2,f(x1,x0))...)}.
i1 : fold({a,b,c,d}, e, identity)
o1 = (a, (b, (c, (d, e))))
331
332
18. FUNCTION
o1 : Sequence
Synopsis of use:
Operator: fold [V.24.295]
Class of argument 1: VisibleList [III.19]
Class of argument 2: Thing [III.21]
Class of argument 3: Function [III.18]
Class of typical returned value: VisibleList [III.19]
18.18. options Function
options f – returns the table of option names and default values provided for
the function f.
Synopsis of use:
Operator: options [III.21.5.5.1]
Class of argument 1: Function [III.18]
Class of typical returned value: OptionTable [III.21.5.5]
Code:
-- ../m2/methods.m2:226-228
options Function := OptionTable => function -> (
if sameFunctionBody(function, optionFunction) then firs ...
else null)
18.19. product(ZZ,Function)
product(n,f) – compute the product f(0) * f(1) * ... * f(n-1).
i1 : product(5, i -> 2*i+1)
o1 = 945
See also:
product [V.24.486]
Synopsis of use:
Operator: product [V.24.486]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Function [III.18]
Code:
-- ../m2/lists.m2:75-81
product(ZZ,Function) := (n,f) -> (
s := 1;
g := x -> (
s = f x;
g = x -> s = s * f x);
scan(n,x -> g x);
s);
18.20. product({...},Function)
product(v,f) – yields the product of the expressions obtained by applying f
to each of the elements of the list or sequence v.
i1 : product(1 .. 5, i -> i^2)
o1 = 14400
18.22. SCAN(BASICLIST,FUNCTION)
333
See also:
product [V.24.486]
Synopsis of use:
Operator: product [V.24.486]
Class of argument 1: List [III.19.2]
Class of argument 2: Function [III.18]
Code:
-- ../m2/lists.m2:75-81
product(ZZ,Function) := (n,f) -> (
s := 1;
g := x -> (
s = f x;
g = x -> s = s * f x);
scan(n,x -> g x);
s);
18.21. product({...},{...},Function)
product(v,w,f) – yields the product of the results obtained by applying f to
each of the pairs (i,j) of elements from the lists v and w, which should be of the
same length.
i1 : M = monoid [x,y,z];
i2 : product({2,3,4},{x,y,z},(i,j)->j^i)
2 3 4
o2 = x y z
o2 : M
See also:
product [V.24.486]
Synopsis of use:
Operator: product [V.24.486]
Class of argument 1: List [III.19.2]
Class of argument 2: List [III.19.2]
Class of argument 3: Function [III.18]
Code:
-- ../m2/lists.m2:86
product(List, List, Function) := (v,w,f) -> product(apply(v, ...
18.22. scan(BasicList,Function)
scan(v,f) – applies the function f to each element of the list v. The function
values are discarded.
i1 : scan({a,4,"George",2^100}, print)
a
4
George
1267650600228229401496703205376
Synopsis of use:
Operator: scan [V.24.537]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: Function [III.18]
334
18. FUNCTION
Class of typical returned value: Nothing [III.21.7]
18.23. scan(ZZ,Function)
scan(n,f) – applies the function f to each integer in the range 0 .. n-1
discarding the results.
This is equivalent to scan(0 .. n-1, f).
i1 : scan(3,print)
0
1
2
i2 : v = {a,b,c}
o2 = {a, b, c}
o2 : List
i3 : scan(#v, i -> print(i,v#i))
(0, a)
(1, b)
(2, c)
Synopsis of use:
Operator: scan [V.24.537]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Function [III.18]
Class of typical returned value: Nothing [III.21.7]
18.24. scanPairs(HashTable,Function)
scanPairs(x,f) – applies the function f to each pair (k,v) where k is a key
in the hash table x and v is the corresponding value x#k.
This function requires an immutable hash table. To scan the pairs in a mutable
hash table, use scan(pairs x, f).
See also:
scan [V.24.537] – apply a function to each element
Synopsis of use:
Operator: scanPairs [V.24.539]
Class of argument 1: HashTable [III.21.5]
Class of argument 2: Function [III.18]
Class of typical returned value: Nothing [III.21.7]
18.25. select(BasicList,Function)
select(v,f) – select elements of the list v that yield true when the function
f is applied.
The order of the elements in the result will be the same as in the original list
v, and the class will be the same, too.
i1 : select({1,2,3,4,5}, odd)
o1 = {1, 3, 5}
o1 : List
18.28. SELECT(ZZ,HASHTABLE,FUNCTION)
335
i2 : select([1,2,3,4,5], odd)
o2 = [1, 3, 5]
o2 : Array
Synopsis of use:
Operator: select [V.24.541]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: Function [III.18]
Class of typical returned value: BasicList [III.21.1]
18.26. select(HashTable,Function)
select(v,f) – select pairs of the hash table v that yield true when the function
f is applied to the value.
The hash table should be immutable: to scan the values in a mutable hash
table, use scan(values x, f).
Synopsis of use:
Operator: select [V.24.541]
Class of argument 1: HashTable [III.21.5]
Class of argument 2: Function [III.18]
Class of typical returned value: HashTable [III.21.5]
18.27. select(ZZ,BasicList,Function)
select(n,v,f) – select at most n elements of the list v that yield true when
the function f is applied.
The order of the elements in the result will be the same as in the original list
v.
i1 : select(2,[1,2,3,4,5], odd)
o1 = [1, 3]
o1 : Array
Synopsis of use:
Operator: select [V.24.541]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: BasicList [III.21.1]
Class of argument 3: Function [III.18]
Class of typical returned value: BasicList [III.21.1]
18.28. select(ZZ,HashTable,Function)
select(n,v,f) – select at most n pairs of the hash table v that yield true
when the function f is applied to the value.
The hash table should be immutable: to scan the values in a mutable hash
table, use scan(values x, f).
Synopsis of use:
Operator: select [V.24.541]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: HashTable [III.21.5]
336
18. FUNCTION
Class of argument 3: Function [III.18]
Class of typical returned value: HashTable [III.21.5]
18.29. sum(ZZ,Function)
sum(n,f) – compute the sum f(0) + f(1) + ... + f(n-1).
i1 : sum(10, i -> i^2)
o1 = 285
See also:
sum [V.24.575] – compute the sum
Synopsis of use:
Operator: sum [V.24.575]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Function [III.18]
Code:
-- ../m2/lists.m2:58-64
sum(ZZ,Function) := (n,f) -> (
s := 0;
g := x -> (
s = f x;
g = x -> s = s + f x);
scan(n,x -> g x);
s);
18.30. sum({...},Function)
sum(v,f) – yields the sum of the expressions obtained by applying f to each
of the elements of the list or sequence v.
i1 : sum(1 .. 10, i -> i^2)
o1 = 385
See also:
sum [V.24.575] – compute the sum
Synopsis of use:
Operator: sum [V.24.575]
Class of argument 1: List [III.19.2]
Class of argument 2: Function [III.18]
Code:
-- ../m2/lists.m2:58-64
sum(ZZ,Function) := (n,f) -> (
s := 0;
g := x -> (
s = f x;
g = x -> s = s + f x);
scan(n,x -> g x);
s);
18.31. sum({...},{...},Function)
sum(v,w,f) – yields the sum of the results obtained by applying f to each of
the pairs (i,j) of elements from the lists or sequences v and w, which should be of
the same length.
18.31. SUM({...},{...},FUNCTION)
337
i1 : R = ZZ[x,y,z];
i2 : sum({2,3,4},{x,y,z},(i,j)->j^i)
4
3
2
o2 = z + y + x
o2 : R
See also:
sum [V.24.575] – compute the sum
Synopsis of use:
Operator: sum [V.24.575]
Class of argument 1: List [III.19.2]
Class of argument 2: List [III.19.2]
Class of argument 3: Function [III.18]
Code:
-- ../m2/lists.m2:69
sum(List, List, Function) := (v,w,f) -> sum(apply(v,w,identi ...
CHAPTER 19
VisibleList
There are three types of lists that can be entered directly from the keyboard,
as follows.
i1 : {a,b,c}
o1 = {a, b, c}
o1 : List
i2 : [a,b,c]
o2 = [a, b, c]
o2 : Array
i3 : (a,b,c)
o3 = (a, b, c)
o3 : Sequence
We introduce the class of visible lists as a convenience for referring to lists of
these types.
The type VisibleList is a member of the class Type [III.21.5.4.11]. Each
object of class VisibleList is called a visible list. Each visible list is also a member
of class BasicList [III.21.1].
Types of VisibleList :
Array [III.19.1] – class of all arrays – [...]
List [III.19.2] – class of all lists – {...}
Sequence [III.19.3] – class of all sequences – (...)
Making a visible list :
Function \ VisibleList [III.18.4] – apply a function to each member of a
list
VisibleList / Function [III.18.5] – apply a function to each member of
a list
accumulate(Function,Thing,VisibleList) [III.18.6] – apply binary operator repeatedly
accumulate(Function,VisibleList) [III.18.7] – apply binary operator repeatedly
accumulate(VisibleList,Function) [III.18.8] – apply binary operator repeatedly
accumulate(VisibleList,Thing,Function) [III.18.9] – apply binary operator repeatedly
flatten VisibleList
339
340
19. VISIBLELIST
fold(Function,Thing,VisibleList) [III.18.14] – apply binary operator repeatedly
fold(Function,VisibleList) [III.18.15] – apply binary operator repeatedly
fold(VisibleList,Function) [III.18.16] – apply binary operator repeatedly
fold(VisibleList,Thing,Function) [III.18.17] – apply binary operator repeatedly
Methods for using a visible list :
member(Thing,VisibleList)
19.1. Array
An array is like a list, except that brackets are used instead of braces when
entering or displaying an array, and arrays can’t be used as vectors. Their main
use is notational: for example, they appear in the construction of polynomial rings.
i1 : v = [a,b,c]
o1 = [a, b, c]
o1 : Array
i2 : v#2
o2 = c
o2 : Symbol
i3 : ZZ[a,b,c]
o3 = ZZ [a, b, c]
o3 : PolynomialRing
See also:
lists [I.4.15]
The type Array is a member of the class Type [III.21.5.4.11]. Each object of
class Array is called an array. Each array is also a member of class VisibleList
[III.19].
Methods for using an array :
ChainComplex [...] [III.16.4] – chain complex degree shift
ChainComplex ^ [...]
ChainComplex _ [...]
ChainComplexMap ^ [...]
ChainComplexMap _ [...]
Expression [...]
GradedModule [...]
GradedModuleMap ^ [...]
GradedModuleMap _ [...]
Holder [...]
Matrix ^ [...] [III.12.9] – select some rows of blocks
Matrix _ [...] [III.12.11] – select some columns of blocks
Module [...] [III.13.16] – make a chain complex from a module
19.2. LIST
341
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Module _ [...] [III.12.17] – get inclusion map into direct sum
Ring [...] [III.10.1.3.2] – the standard way to make a polynomial ring
expression [...]
group [...]
monoid [...] [III.19.1.1] – make a polynomial ring or monoid ring
net [...]
precedence [...]
toExternalString [...]
toString [...]
19.1.1. monoid [...]
monoid [a,b,c,...] – makes a free ordered commutative monoid on the
variables listed.
Optional arguments (placed between the brackets):
MonomialOrder [III.10.1.3.2.1] – monomial ordering
MonomialSize [III.10.1.3.2.2] – specify maximum exponent size
Degrees [III.10.1.3.2.3] – specify the degrees
Weights [III.10.1.3.2.4] – specify monomial ordering by weights
Inverses [III.10.1.3.2.5] – specify whether generators are invertible
WeylAlgebra [III.10.1.3.2.6] – make a Weyl algebra
VariableBaseName [III.10.1.3.2.7] – base name for variables
SkewCommutative [III.10.1.3.2.8] – make a skewcommutative (alternating) ring
Variables [III.10.1.3.2.9] – specify the variable names
VariableOrder [III.10.1.3.2.10]
See also:
Ring [...] [III.10.1.3.2] – the standard way to make a polynomial ring
Synopsis of use:
Operator: monoid [V.24.424]
Class of argument 1: Array [III.19.1]
Class of typical returned value: Monoid [III.21.5.4.11.3]
19.2. List
See also:
lists [I.4.15]
The type List is a member of the class Type [III.21.5.4.11]. Each object of
class List is called a list. Each list is also a member of class VisibleList [III.19].
Making a list :
- {...}
Thing * {...}
apply(BasicList,BasicList,Function) [III.18.10] – apply function to elements in pairs
apply(ZZ,Function) [III.18.13] – apply function to 0 .. n-1
ascii String
characters String
keys HashTable
342
19. VISIBLELIST
mingle BasicList
netRows Net
pack(BasicList,ZZ)
pack(ZZ,BasicList)
pairs HashTable
toList BasicList [III.19.2.1] – list of elements
toList HashTable [III.19.2.2] – convert to list
toList Set [III.19.2.3] – list of elements
transpose {...}
unique [III.19.2.4] – eliminate duplicates from a list
values HashTable
{...} + {...} [III.19.2.5] – sum of two vectors
{...} - {...}
{...} / Function
{...} / Thing
{...} << Thing
{...} _ {...} [III.19.2.6] – get some entries of a list
{...} | {...} [III.19.2.7] – join lists
Methods for using a list :
(...) _ {...}
EmptyMarkUpType {...}
HeaderType {...}
MarkUpType \ {...}
MarkUpType {...}
Matrix ^ {...} [III.12.10] – select some rows of a matrix
Matrix _ {...} [III.12.12] – get some columns from a matrix
Module / {...}
Module ^ {...} [III.12.16] – projection map from a free module
Module _ {...} [III.12.18] – map from free module to some generators
Monoid _ {...}
PolynomialRing _ {...}
Ring / {...}
Ring ^ {...} [III.10.9] – make a free module
Ring _ {...} [III.10.12] – make a monomial from a list of exponents
SchurRing _ {...} [III.10.1.5.1] – make an element of a Schur ring
SelfInitializingType \ {...}
WrapperType {...}
ascii {...}
basis({...},Ideal)
basis({...},Module)
basis({...},Ring)
chainComplex {...}
code {...}
coefficients({...},Matrix)
coefficients({...},RingElement)
concatenate {...}
directSum {...}
document {...}
19.2. LIST
343
drop(BasicList,{...}) [III.19.2.8] – drop some elements
expression {...}
ggPush {...}
gradedModule {...}
gradedModuleMap {...}
hashTable {...}
help {...}
hilbertFunction({...},Ideal)
hilbertFunction({...},Module)
hilbertFunction({...},Ring)
homogenize(Matrix,RingElement,{...})
homogenize(Module,RingElement,{...})
homogenize(RingElement,RingElement,{...})
homogenize(Vector,RingElement,{...})
html {...}
ideal {...}
intersect {...}
isSubset((...),{...})
isSubset(Set,{...})
isSubset({...},(...))
isSubset({...},Set)
isSubset({...},{...})
map(Module,Module,{...}) [III.12.32] – make a map
map(Module,Nothing,{...}) [III.12.33] – make a map
map(Module,ZZ,{...}) [III.12.36] – make a map
map(Ring,Ring,{...}) [III.10.15] – make a ring map
matrix {...} [III.12.38] – make a matrix
matrix(Ring,{...}) [III.10.16] – make a matrix
max {...}
memoize(Function,{...})
min {...}
net {...}
new EngineRing from {...}
new HashTable from {...} [III.19.2.9] – make a hash table from a list
new SEQ from {...}
new Set from {...}
new Vector from {...}
peek2({...},ZZ)
precedence {...}
product {...} [III.19.2.10] – product of elements
product((...),{...},Function)
product({...},(...),Function)
product({...},Function) [III.18.20] – product of values of a function
product({...},{...},Function) [III.18.21] – product of results of applying
a function pairwise
random({...},Ring) [III.10.21] – a random ring element of a given degree
set {...}
submatrix(Matrix,(...),{...})
344
19. VISIBLELIST
submatrix(Matrix,Nothing,{...})
submatrix(Matrix,{...})
submatrix(Matrix,{...},(...))
submatrix(Matrix,{...},Nothing)
submatrix(Matrix,{...},{...})
subsets {...} [III.19.2.11] – produce all the subsets
subsets({...},ZZ)
substitute(Ideal,{...})
substitute(Matrix,{...})
substitute(Module,{...})
substitute(RingElement,{...})
substitute(Vector,{...})
sum {...} [III.19.2.12] – sum the elements of a list
sum((...),{...},Function)
sum({...},(...),Function)
sum({...},Function) [III.18.30] – sum results of applying a function
sum({...},{...},Function) [III.18.31] – sum results of applying a function
pairwise
take(BasicList,{...})
tally {...}
tex {...}
texMath {...}
text {...}
toList {...}
truncate({...},Ideal)
truncate({...},Module)
vars {...}
{...} .. {...}
{...} / MarkUpType
{...} / SelfInitializingType
{...} << Manipulator
{...} == {...}
{...} ==> Function [III.18.2] – declare option names and default values
{...} _ ZZ [III.19.2.13] – get element from list
Fixed objects of class List :
commandLine [V.24.218] – the command line arguments
environment [V.24.271] – the environment variables
19.2.1. toList BasicList
toList x – provides a list of elements in the basic list x.
This is a good way to convert a list of some other type to a list of type List
[III.19.2].
i1 : toList [a,b,c]
o1 = {a, b, c}
o1 : List
Synopsis of use:
19.2. LIST
345
Operator: toList [V.24.619]
Class of argument 1: BasicList [III.21.1]
Class of typical returned value: List [III.19.2]
19.2.2. toList HashTable
toList x – provides a list of keys in the hash table x.
For a set, which is implemented as a hash table where only the keys are important, this is a reasonable operation. See also, keys [V.24.377], which does the
same thing.
i1 : x = hashTable { a=>1, b=>2}
o1 = HashTable{a => 1}
b => 2
o1 : HashTable
i2 : toList x
o2 = {a, b}
o2 : List
Synopsis of use:
Operator: toList [V.24.619]
Class of argument 1: HashTable [III.21.5]
Class of typical returned value: List [III.19.2]
19.2.3. toList Set
toList x – provides a list of element in the set x.
i1 : x = set {a,b,c}
o1 = Set {a, b, c}
o1 : Set
i2 : toList x
o2 = {a, b, c}
o2 : List
Synopsis of use:
Operator: toList [V.24.619]
Class of argument 1: Set [III.21.5.8.1]
Class of typical returned value: List [III.19.2]
19.2.4. unique
unique v – yields the elements of the list v, without duplicates.
i1 : unique {3,2,1,3,2,4,3,2,3,-2,1,2,4}
o1 = {1, 2, 3, 4, -2}
o1 : List
346
19. VISIBLELIST
The order of elements is not necessarily maintained.
See also:
sort [V.24.556] – sort a list
The function unique is a member of the class Function [III.18].
Class of returned value: List [III.19.2] – class of all lists – {...}Code:
-- code for unique:
-- ../m2/set.m2:56
unique = x -> keys set x
19.2.5. {...} + {...}
v + w – the sum of two vectors represented as lists.
Synopsis of use:
Operator: + [V.24.16]
Class of argument 1: List [III.19.2]
Class of argument 2: List [III.19.2]
Class of typical returned value: List [III.19.2]
Code:
-- ../m2/lists.m2:10
List + List := List => (v,w) -> apply(v,w,plus)
19.2.6. {...} _ {...}
w_{i,j,...} – selects entries from a list or sequence w.
i1 : w = {a,b,c,d,e,f,g,h};
i2 : w_{1,3,4}
o2 = {b, d, e}
o2 : List
We can use this operation to compute composition of permutations represented
as lists.
i3 : {4,2,3,1,0} _ {2,1,3,4,0}
o3 = {3, 2, 1, 0, 4}
o3 : List
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: List [III.19.2]
Class of argument 2: List [III.19.2]
Class of typical returned value: List [III.19.2]
Code:
-- ../m2/lists.m2:18
List _ List := List
=> (x,y) -> apply(splice y, i -> ...
19.2.7. {...} | {...}
v|w – join two lists.
i1 : {1,2,3}|{4,5,6}
o1 = {1, 2, 3, 4, 5, 6}
19.2. LIST
347
o1 : List
Synopsis of use:
Operator: | [V.24.655]
Class of argument 1: List [III.19.2]
Class of argument 2: List [III.19.2]
Class of typical returned value: List [III.19.2]
19.2.8. drop(BasicList,{...})
drop(v,{m,n}) – yields the list obtained from the list v by dropping the elements at positions m through n.
i1 : drop({a,b,c,d,e},{2,3})
o1 = {a, b, e}
o1 : List
See also:
take [V.24.605] – take some elements from a list
Synopsis of use:
Operator: drop [V.24.259]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: List [III.19.2]
Class of typical returned value: BasicList [III.21.1]
19.2.9. new HashTable from {...}
new HashTable from x – produce a new hash table from a list x.
Elements of x which are options, k => v cause the value v to be stored in x
under the key k.
See also:
hashTable [V.24.334] – make a hash table
Synopsis of use:
Operator: NewFromMethod [V.24.104]
Class of argument 1: HashTable [III.21.5]
Class of argument 2: List [III.19.2]
Class of typical returned value: HashTable [III.21.5]
Code:
-- ../m2/option.m2:3
new HashTable from List := HashTable => (O,v) -> hashTable v
19.2.10. product {...}
product v – yields the product of the elements in the list v.
i1 : product {1,2,3,4,5}
o1 = 120
Synopsis of use:
Operator: product [V.24.486]
Class of argument 1: List [III.19.2]
Code:
-- ../m2/lists.m2:71
348
19. VISIBLELIST
product List := x -> times toSequence x
19.2.11. subsets {...}
subsets s – yields a list of the subsets of the list s.
The subsets are returned as lists whose elements are in the same order.
i1 : subsets {1,2,3}
o1 = {{}, {1}, {2}, {1, 2}, {3}, {1, 3}, {2, 3}, {1, 2, 3}}
o1 : List
See also:
subsets [V.24.216.2] – produce all the subsets
Synopsis of use:
Operator: subsets [V.24.216.2]
Class of argument 1: List [III.19.2]
Code:
-- ../m2/combinatorics.m2:19-25
subsets List := x -> (
if #x === 0 then {x}
else (
a := x#-1;
x = drop(x,-1);
s := subsets x;
join(s,apply(s,y->append(y,a)))))
19.2.12. sum {...}
sum v – yields the sum of the elements in the list v.
i1 : sum {1,2,3,4,5}
o1 = 15
See also:
sum [V.24.575] – compute the sum
Synopsis of use:
Operator: sum [V.24.575]
Class of argument 1: List [III.19.2]
Code:
-- ../m2/lists.m2:54
sum(List) := x -> plus toSequence x
19.2.13. {...} _ ZZ
x_i – provides the i-th element of the list x.
This is merely a convenient synonym for x#i.
See also:
BasicList # ZZ [III.21.1.16] – get element from list
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: List [III.19.2]
Class of argument 2: ZZ [III.21.11]
Code:
-- ../m2/lists.m2:6
List _ ZZ
:= (x,i) -> x#i
19.3. SEQUENCE
349
19.3. Sequence
A sequence is an ordered collection of things enclosed by parentheses and separated by commas. Use # [V.24.4] to get the length of a sequence of to get one of
the elements.
i1 : v = (a,b,c)
o1 = (a, b, c)
o1 : Sequence
i2 : #v
o2 = 3
i3 : v#2
o3 = c
o3 : Symbol
See also:
sequences [I.4.16]
The type Sequence is a member of the class Type [III.21.5.4.11]. Each object
of class Sequence is called a sequence. Each sequence is also a member of class
VisibleList [III.19].
Making a sequence :
(...) .. (...)
(...) _ {...}
IndexedVariable .. IndexedVariable
locate (...)
locate Function
locate Nothing
locate Symbol
sequence Thing
singleton [III.19.3.1] – make a sequence of length one
toList {...}
toSequence BasicList
{...} .. {...}
Methods for using a sequence :
(...) == (...)
(...) ? (...)
(...) _ ZZ [III.19.3.2] – get element from list
Fano (...)
Function ## (...)
GF (...)
Grassmannian (...)
HH (...)
HH (...)
HH^ZZ (...)
HH_ZZ (...)
HeaderType (...)
350
19. VISIBLELIST
Hom (...)
Matrix _ (...) [III.12.46] – get an entry
Module / (...)
Proj (...)
Ring / (...)
Schur (...)
Spec (...)
String ^ (...)
String _ (...)
WrapperType (...)
accumulate (...)
ambient (...)
annihilator (...)
assign (...)
autoload (...)
baseName (...)
basis (...)
betti (...)
binomial (...)
borel (...)
chainComplex (...) [III.16.6] – make a chain complex
char (...)
code (...)
codim (...)
coefficientRing (...)
coefficients (...)
coimage (...)
cokernel (...)
complement (...)
complete (...)
components (...)
compress (...)
cone (...)
conjugate (...)
content (...)
contract (...)
contract’ (...)
cotangentSheaf (...)
cover (...)
decompose (...)
degree (...)
degreeLength (...)
degrees (...)
degreesMonoid (...)
degreesRing (...)
denominator (...)
depth (...)
describe (...)
19.3. SEQUENCE
det (...)
diff (...)
dim (...)
directSum (...)
divideByVariable (...)
document (...)
documentation (...)
dual (...)
entries (...)
euler (...)
exponents (...)
expression (...)
extend (...)
exteriorPower (...)
factor (...)
fittingIdeal (...)
flip (...)
fold (...)
forceGB (...)
formatDocumentTag (...)
frac (...)
fraction (...)
gb (...)
gcd (...)
gcdCoefficients (...)
genera (...)
generators (...)
getChangeMatrix (...)
getWWW (...)
ggPush (...)
gradedModule (...)
gradedModuleMap (...)
graphIdeal (...)
graphRing (...)
group (...)
height (...)
hilbertFunction (...)
hilbertPolynomial (...)
hilbertSeries (...)
homogenize (...)
homomorphism (...)
html (...)
ideal (...)
image (...)
imaginaryPart (...)
index (...)
indices (...)
inducedMap (...)
351
352
19. VISIBLELIST
inducesWellDefinedMap (...)
intersect (...)
irreducibleCharacteristicSeries (...)
isAffineRing (...)
isBorel (...)
isCommutative (...)
isDirectSum (...)
isField (...)
isFreeModule (...)
isHomogeneous (...)
isIdeal (...)
isInjective (...)
isIsomorphism (...)
isModule (...)
isPolynomialRing (...)
isPrime (...)
isQuotientModule (...)
isQuotientOf (...)
isQuotientRing (...)
isRing (...)
isSubmodule (...)
isSubset (...)
isSubset((...),(...))
isSubset((...),Set)
isSubset((...),{...})
isSubset(Set,(...))
isSubset({...},(...))
isSurjective (...)
isUnit (...)
isWellDefined (...)
jacobian (...)
kernel (...)
koszul (...)
leadCoefficient (...)
leadComponent (...)
leadMonomial (...)
leadTerm (...)
length (...)
lift (...)
liftable (...)
listForm (...)
map (...)
matrix (...)
max (...)
member (...)
memoize (...)
methods (...)
min (...)
19.3. SEQUENCE
mingens (...)
minors (...)
minprimes (...)
modifyRing (...)
module (...)
modulo (...)
monomialIdeal (...)
net (...)
new EngineRing from (...)
newCoordinateSystem (...)
nullhomotopy (...)
numerator (...)
numgens (...)
options (...)
pad (...)
partitions (...)
pdim (...)
peek2 (...)
peek2((...),ZZ)
pfaffians (...)
poincare (...)
poincareN (...)
precedence (...)
presentation (...)
product (...)
product((...),(...),Function)
product((...),Function)
product((...),{...},Function)
product({...},(...),Function)
profile (...)
projectiveHilbertPolynomial (...)
promote (...)
prune (...)
pseudoRemainder (...)
pushForward (...)
pushForward1 (...)
quotient (...)
radical (...)
random (...)
rank (...)
reach1 (...)
read (...)
realPart (...)
regularity (...)
relations (...)
removeLowestDimension (...)
resolution (...)
ring (...)
353
354
19. VISIBLELIST
saturate (...)
scanKeys (...)
scanValues (...)
see (...)
selectInSubring (...)
set (...)
sheaf (...)
singularLocus (...)
size (...)
someTerms (...)
sortColumns (...)
standardForm (...)
stats (...)
status (...)
submatrix (...)
submatrix(Matrix,(...),(...))
submatrix(Matrix,(...),{...})
submatrix(Matrix,{...},(...))
subquotient (...)
subsets (...)
subsets((...),ZZ)
substitute (...)
sum (...)
sum((...),(...),Function)
sum((...),Function)
sum((...),{...},Function)
sum({...},(...),Function)
super (...)
symmetricAlgebra (...)
symmetricPower (...)
syz (...)
tally (...)
tensor (...)
tensorAssociativity (...)
terms (...)
tex (...)
texMath (...)
text (...)
toExternalString (...)
toString (...)
top (...)
topCoefficients (...)
trace (...)
transpose (...)
trim (...)
truncate (...)
ultimate (...)
use (...)
19.3. SEQUENCE
value (...)
variety (...)
vars (...)
wedgeProduct (...)
width (...)
Fixed objects of class Sequence :
binaryOperators
postfixOperators
prefixOperators
19.3.1. singleton
singleton x – returns a sequence of length one whose single element is x.
i1 : singleton 3
o1 = singleton 3
o1 : Sequence
i2 : #oo
o2 = 1
See also:
unSingleton [V.24.636]
The function singleton is a member of the class Function [III.18].
Class of returned value: Sequence [III.19.3] – class of all sequences – (...)
19.3.2. (...) _ ZZ
x_i – provides the i-th element of the sequence x.
This is merely a convenient synonym for x#i.
See also:
BasicList # ZZ [III.21.1.16] – get element from list
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Sequence [III.19.3]
Class of argument 2: ZZ [III.21.11]
Code:
-- ../m2/underscore.m2:3
Sequence _ ZZ := List _ ZZ := (s,i) -> s#i
355
CHAPTER 20
File
Files may be input files, output files, pipes, or sockets. A list of currently open
files may be obtained with openFiles [V.24.454].
The type File is a member of the class Type [III.21.5.4.11]. Each object of
class File is called a file.
Making a file :
File << Manipulator
File << Net
File << String
File << Symbol
File << Thing [III.20.1] – pirnt something to a file
String << Thing [III.20.2] – print to a file
openIn String
openInOut String
openListener String
openOut String
{...} << Manipulator
Methods for using a file :
Manipulator File
atEndOfFile File
echoOff File
echoOn File
expression File
get File
getc File
isInputFile File
isListener File
isOpenFile File
isOutputFile File
isReady File
kill File
net File
read File
width File
Fixed objects of class File :
stderr [V.24.567] – the standard error output file
stdio [V.24.568] – the standard input output file
20.1. File << Thing
f << x – prints the expression x on the output file f.
357
358
20. FILE
Returns f as its value. Parsing associates leftward, so that several expressions
may be displayed with something like f<<x<<y<<z. If f is a string, then a new file
with name f is created, the expression x is printed into f, and the file f is closed.
i1 : x = 5
o1 = 5
i2 : << "the value of x is " << x << endl
the value of x is 5
o2 = stdio
o2 : File
See also:
<< [V.24.34]
Synopsis of use:
Operator: << [V.24.34]
Class of argument 1: File [III.20]
Class of argument 2: Thing [III.21]
Class of typical returned value: File [III.20]
Code:
-- ../m2/expressions.m2:1053
File << Thing := File => (o,x) -> printString(o,net x)
20.2. String << Thing
"name" << x – prints the expression x on the output file named ”name”.
Returns the newly created File [III.20] associated to the given name. Parsing
associates leftward, so that several expressions may be displayed with something
like "name"<<x<<y<<z. It will often be convenient to let the last output operation
close the file, as illustrated below.
i1 : "foo" << 2^30 << endl << close
o1 = foo
o1 : File
i2 : get "foo"
o2 = 1073741824
o2 : String
Synopsis of use:
Operator: << [V.24.34]
Class of argument 1: String [III.21.6.1]
Class of argument 2: Thing [III.21]
Class of typical returned value: File [III.20]
Code:
-- ../m2/files.m2:5
String << Thing := File => (filename,x) -> openOut filename
...
CHAPTER 21
Thing
Everything in Macaulay 2 is a thing. This includes numbers, strings, and lists.
More complicated things such as polynomials, groups, rings, and chain complexes
are implemented as hash tables. See Type [III.21.5.4.11] for information about
what types of things there are.
The type Thing is a member of the class Type [III.21.5.4.11]. Each object of
class Thing is called a thing.
Types of Thing :
BasicList [III.21.1] – the class of all basic lists
Boolean [III.21.2] – the class of Boolean values
Database [III.21.3] – the class of all database files
File [III.20] – the class of all files
Function [III.18] – the class of all functions
Handle [III.21.4] – the class of all handles for engine objects
HashTable [III.21.5] – the class of all hash tables
Net [III.21.6] – the class of all nets and strings
Nothing [III.21.7] – the empty class
QQ [III.21.8] – the class of all rational numbers
RR [III.21.9] – the class of all real numbers
Symbol [III.21.10] – the class of all symbols
ZZ [III.21.11] – the class of all integers
Making a thing :
BasicList # ZZ [III.21.1.16] – get element from list
Function ## (...)
Function Thing [III.18.3] – function application
HashTable # Thing [III.21.5.9] – get value from hash table
String # ZZ [III.21.6.1.8] – get character from string
Methods for using a thing :
Command Thing
EmptyMarkUpType Thing
Expression * Thing
Expression ** Thing
Expression + Thing
Expression - Thing
Expression / Thing
Expression == Thing
Expression Thing
Expression ^ Thing
File << Thing [III.20.1] – pirnt something to a file
Function _ Thing
359
360
21. THING
HashTable #? Thing [III.21.2.2] – check for value in hash table
IndexedVariableTable _ Thing
InfiniteNumber == Thing
InfiniteNumber ? Thing
MarkUpType Thing
Nothing << Thing [III.21.7.1] – dummy file output
ScriptedFunctor Thing
ScriptedFunctor ^ Thing
ScriptedFunctor _ Thing
SelfInitializingType Thing
Set #? Thing [III.21.2.3] – test set membership
String << Thing [III.20.2] – print to a file
Symbol _ Thing
Tally _ Thing [III.21.5.8.6] – get a count from a tally
Thing != Thing
Thing * Expression
Thing * {...}
Thing ** Expression
Thing + Expression
Thing - Expression
Thing .. Thing
Thing / Expression
Thing /^ ZZ [III.21.11.8] – divided power
Thing < Thing
Thing <= Thing
Thing =!= Thing
Thing == Expression
Thing == InfiniteNumber
Thing === Thing
Thing => Thing
Thing > Thing
Thing >= Thing
Thing ? InfiniteNumber
Thing ? Thing
Thing Expression
Thing ^ Expression
Thing ^ QQ
WrapperType Thing
ZZ : Thing [III.21.11.9] – repeat an item
accumulate(Function,Thing,VisibleList) [III.18.6] – apply binary operator repeatedly
accumulate(VisibleList,Thing,Function) [III.18.9] – apply binary operator repeatedly
append(BasicList,Thing)
assign(IndexedVariable,Thing)
assign(Symbol,Thing)
basictype Thing
class Thing
21.1. BASICLIST
361
describe Thing
documentation Thing
fold(Function,Thing,VisibleList) [III.18.14] – apply binary operator repeatedly
fold(VisibleList,Thing,Function) [III.18.17] – apply binary operator repeatedly
formatDocumentTag Thing
help Thing
html Thing
instance(Thing,Type)
isFreeModule Thing
isIdeal Thing
isModule Thing
isPolynomialRing Thing
isQuotientModule Thing
isRing Thing
isSubmodule Thing
mathML Thing
member(Thing,Set)
member(Thing,VisibleList)
methods Thing
mutable Thing
net Thing
newHandle Thing
parent Thing
peek2(Thing,ZZ)
precedence Thing
prepend(Thing,BasicList)
reach1 Thing
reach2 Thing
reach3 Thing
remove(HashTable,Thing)
ring Thing
sequence Thing
tex Thing
texMath Thing
toExternalString Thing
toString Thing
ultimate(Function,Thing)
use Thing
value Thing
{...} / Thing
{...} << Thing
21.1. BasicList
A list is a sequence of expressions indexed by integers 0, 1, ..., N-1, where N is
the length of the sequence.
362
21. THING
The reason for distinguishing List [III.19.2] from BasicList is so lists can be
treated as vectors, without everything else implemented as a basic list inheriting
that behavior.
The type BasicList is a member of the class Type [III.21.5.4.11]. Each object
of class BasicList is called a basic list.
Types of BasicList :
CC [III.21.1.1] – the class of all complex numbers
Command [III.21.1.2] – the class of all commands
Eliminate [III.10.1.3.2.1.5] – elimination ordering
Expression [III.21.1.3] – the class of all expressions
IndexedVariable [III.21.1.4] – the class of all indexed variables
Manipulator [III.21.1.5] – the class of all file manipulators
MarkUpList [III.21.1.6] – the class of mark-up lists used with hypertext
MinorsComputation [III.21.1.7] – the class of all minors computations
MonoidElement [III.21.1.8] – the class of all monoid elements
MutableList [III.21.1.9] – the class of all mutable lists
Option [III.21.1.10] – the class of all pairs x => y
PfaffiansComputation [III.21.1.11] – the class of all Pfaffians computations
Position [III.21.1.12] – the class of all file positions
ProductOrder [III.10.1.3.2.1.6] – product ordering
PushforwardComputation [III.21.1.13] – a type of list used internally
by pushForward1
Time [III.21.1.14] – the class of all timing results
VisibleList [III.19] – class of all visible lists
Making a basic list :
append(BasicList,Thing)
apply(BasicList,Function) [III.18.11] – apply function to each element
deepSplice BasicList
drop(BasicList,ZZ) [III.21.1.15] – drop some elements
drop(BasicList,{...}) [III.19.2.8] – drop some elements
join(BasicList,BasicList)
mergePairs(BasicList,BasicList,Function)
prepend(Thing,BasicList)
reverse BasicList
select(BasicList,Function) [III.18.25] – select elements from a list
select(ZZ,BasicList,Function) [III.18.27] – select elements from a list
splice BasicList
take(BasicList,ZZ)
take(BasicList,{...})
Methods for using a basic list :
BasicList # ZZ [III.21.1.16] – get element from list
BasicList #? ZZ [III.21.1.17] – check for element in list
BasicList ? BasicList
any(BasicList,Function)
apply(BasicList,BasicList,Function) [III.18.10] – apply function to elements in pairs
expression BasicList
21.1. BASICLIST
363
horizontalJoin BasicList
mingle BasicList
net BasicList
pack(BasicList,ZZ)
pack(ZZ,BasicList)
peek2(BasicList,ZZ)
reach1 BasicList
scan(BasicList,Function) [III.18.22] – apply a function to each element
of a list
stack BasicList
toExternalString BasicList
toList BasicList [III.19.2.1] – list of elements
toSequence BasicList
toString BasicList
21.1.1. CC
The symbol ii [V.24.347] represents the square root of -1.
i1 : z = 3-4*ii
o1 = 3 - 4ii
o1 : CC
i2 : z^5
o2 = - 237 + 3116ii
o2 : CC
i3 : 1/z
3
4
o3 = -- + --*ii
25
25
o3 : CC
The field CC is a member of the class Field [III.10.2]. Each object of class
CC is called a complex number. Each complex number is also a member of class
BasicList [III.21.1].
Making a complex number :
conjugate [III.21.1.1.1] – complex conjugate
conjugate CC
Methods for using a complex number :
CC * CC
CC * QQ
CC * RR
CC * ZZ
CC + CC
CC + QQ
CC + RR
CC + ZZ
364
21. THING
CC - CC
CC - QQ
CC - RR
CC - ZZ
CC / CC
CC / QQ
CC / RR
CC / ZZ
CC == QQ
CC == RR
CC == ZZ
CC ^ ZZ
QQ * CC
QQ + CC
QQ - CC
QQ / CC
QQ == CC
RR * CC
RR + CC
RR - CC
RR / CC
RR == CC
ZZ * CC
ZZ + CC
ZZ - CC
ZZ / CC
ZZ == CC
expression CC
imaginaryPart CC
mathML CC
net CC
realPart CC
toExternalString CC
toString CC
Fixed objects of class CC :
ii [V.24.347] – square root of -1
21.1.1.1. conjugate
conjugate z – the complex conjugate of the complex number z.
The function conjugate is a member of the class Function [III.18].
Class of returned value: CC [III.21.1.1] – the class of all complex numbersWays
to use conjugate :
conjugate CC
conjugate QQ
conjugate RR
conjugate ZZ
21.1. BASICLIST
365
21.1.2. Command
A command behaves as a function does if it is followed by an adjacent expression
which can serve as its argument or argument list. In addition, if it appears as the
value of an expression typed by the user at top level, then it gets executed with
empty argument list. This is accomplished by installing a method for AfterEval
[V.24.49].
Create a new command f from a function g with f = Command g.
Create a new command f from a shell command named g with f = Command
"g". Arguments to f will be provided to g.
The self initializing type Command is a member of the class SelfInitializingType [III.21.5.4.11.4]. Each object of class Command is called a command. Each
command is also a member of class BasicList [III.21.1].
Making a command :
new Command from Function
new Command from String
Methods for using a command :
Command Thing
code Command
net Command
toExternalString Command
toString Command
Fixed objects of class Command :
clearAll [V.24.200] – forget evertything
clearOutput [V.24.202] – forget output values
edit [V.24.264] – edit source code
engineMemory [IV.22.3.15] – display engine memory usage
engineStack [IV.22.3.16] – display the engine’s stack
exit [V.24.280] – exit the program
heap [IV.22.3.17] – display the engine’s heap
listUserSymbols [V.24.391] – display the user’s symbols
look [IV.22.3.14] – look at the engine’s stack
profileSummary [V.24.488] – display profiling data
quit [V.24.504] – quit the program
restart [V.24.526] – restart Macaulay 2
showStructure [V.24.548] – show relationship between types
showUserStructure [V.24.549] – show relationship between types defined
by user
topics [V.24.626] – display available help topics
21.1.3. Expression
These expressions are symbolic representations of algebraic expressions, mainly
useful in printing. The method for producing them is expression [III.21.1.3.20].
The usual algebraic operations are available for them, but most simplifications do
not occur.
The parts of expressions are not always expressions. For example, factor
[V.24.285] returns such an expression.
i1 : (expression 2)^5 * (expression 3)^3 / ((expression 5) * ...
366
21. THING
5 3
2 3
o1 = -------2 6
(5*11 )
o1 : Divide
Functions which act on expressions:
value [III.21.1.3.1] – evaluate
precedence [III.21.1.3.2] – parsing precedence
The type Expression is a member of the class Type [III.21.5.4.11]. Each
object of class Expression is called an expression. Each expression is also a member
of class BasicList [III.21.1].
Types of Expression :
Adjacent [III.21.1.3.3] – the class of all adjacent expression pairs
AssociativeExpression [III.21.1.3.4] – the class of associative expressions
BinaryOperation [III.21.1.3.5] – the class of all binary operation expressions
Divide [III.21.1.3.6] – the class of all divide expressions
DoubleArrow [III.21.1.3.7]
FunctionApplication [III.21.1.3.8] – the class of all function application
expressions
Holder [III.21.1.3.9] – the class of all holder expressions
MatrixExpression [III.21.1.3.10] – the class of all matrix expressions
Minus [III.21.1.3.11] – the class of all minus expressions
NonAssociativeProduct [III.21.1.3.12] – the class of all nonassociative
product expressions
Power [III.21.1.3.13] – the class of all power expressions
RowExpression [III.21.1.3.14] – the class of all matrix expressions
SparseMonomialVectorExpression [III.21.1.3.15] – the class of all sparse
monomial vector expressions
SparseVectorExpression [III.21.1.3.16] – the class of all sparse vector
expressions
Subscript [III.21.1.3.17] – the class of all subscript expressions
Superscript [III.21.1.3.18] – the class of all superscript expressions
Table [III.21.1.3.19] – the class of all table expressions
Making an expression :
expression [III.21.1.3.20] – convert to an expression
Methods for using an expression :
Equation == Expression
Expression * Expression
Expression * Holder
Expression * Minus
Expression * OneExpression
Expression * Product
Expression * Thing
Expression * ZeroExpression
Expression ** Expression
Expression ** Holder
21.1. BASICLIST
Expression ** NonAssociativeProduct
Expression ** OneExpression
Expression ** Thing
Expression + Expression
Expression + Sum
Expression + Thing
Expression + ZeroExpression
Expression - Expression
Expression - Thing
Expression / Expression
Expression / Holder
Expression / OneExpression
Expression / Thing
Expression == Equation
Expression == Expression
Expression == Thing
Expression Expression
Expression Holder
Expression Thing
Expression [...]
Expression ^ Expression
Expression ^ Holder
Expression ^ OneExpression
Expression ^ Thing
Expression ^ ZeroExpression
Holder * Expression
Holder ** Expression
Holder / Expression
Holder Expression
Holder ^ Expression
Minus * Expression
NonAssociativeProduct ** Expression
OneExpression * Expression
OneExpression ** Expression
Product * Expression
Sum + Expression
Thing * Expression
Thing ** Expression
Thing + Expression
Thing - Expression
Thing / Expression
Thing == Expression
Thing Expression
Thing ^ Expression
ZeroExpression * Expression
ZeroExpression + Expression
ZeroExpression ^ Expression
expression Expression
367
368
21. THING
html Expression
precedence Expression
tex Expression
texMath Expression
toString Expression
21.1.3.1. value
value s – provides the value of s, which may be a symbol, string, or an expression.
i1 : a = 11111111111
o1 = 11111111111
i2 : x = symbol a
o2 = a
o2 : Symbol
i3 : x
o3 = a
o3 : Symbol
i4 : value x
o4 = 11111111111
i5 : p = (expression 2)^3 * (expression 3)^2
3 2
o5 = 2 3
o5 : Product
i6 : value p
o6 = 72
i7 : value "2 + 2"
o7 = 4
If s is a string, its contents are treated as code in the Macaulay 2 language,
parsed it in its own scope, the same way a file is, and evaluated. The string may
even contain multiple lines.
i8 : value "a := 2 \n a+a"
o8 = 4
Since the local assignment to a above occurred in a new scope, the value of the
global variable a is unaffected.
i9 : a
o9 = 11111111111
21.1. BASICLIST
369
The function value is a member of the class Function [III.18].
Ways to use value :
value Adjacent
value BinaryOperation
value Divide
value DoubleArrow
value Entity
value Equation
value FunctionApplication
value Holder
value MatrixExpression
value Minus
value NonAssociativeProduct
value OneExpression
value Power
value Product
value SparseMonomialVectorExpression
value SparseVectorExpression
value String
value Subscript
value Sum
value Superscript
value Symbol
value Table
value Thing
value ZeroExpression
21.1.3.2. precedence
precedence x – returns the parsing precedence of x for use in the printing
routines.
See also:
Expression [III.21.1.3] – the class of all expressions
net [III.21.6.7] – convert to net
toString [III.21.6.1.7] – convert to a string
The function precedence is a member of the class Function [III.18].
Class of returned value: ZZ [III.21.11] – the class of all integersWays to use
precedence :
precedence (...)
precedence Adjacent
precedence Divide
precedence DoubleArrow
precedence Equation
precedence Expression
precedence Function
precedence FunctionApplication
precedence HashTable
precedence Holder
precedence IndexedVariableTable
370
21. THING
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
precedence
Matrix
Minus
NonAssociativeProduct
Power
Product
RR
String
Subscript
Sum
Superscript
Symbol
Thing
ZZ
[...]
{...}
21.1.3.3. Adjacent
Adjacent – a type of Expression [III.21.1.3] representing a pair of adjacent
expressions, separated only by white space.
The header type Adjacent is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Adjacent is called an adjacent expression. Each adjacent expression is also a member of class Expression [III.21.1.3].
Methods for using an adjacent expression :
net Adjacent
precedence Adjacent
toString Adjacent
value Adjacent
21.1.3.4. AssociativeExpression
The type AssociativeExpression is a member of the class Type [III.21.5.4.11].
Each object of class AssociativeExpression is called an associative expression. Each
associative expression is also a member of class Expression [III.21.1.3].
Types of AssociativeExpression :
Equation [III.21.1.3.4.1] – the class of all equation expressions
Product [III.21.1.3.4.2] – the class of all product expressions
Sum [III.21.1.3.4.3] – the class of all sum expressions
21.1.3.4.1. Equation
Equation – a type of Expression [III.21.1.3] representing an equation.
The header type Equation is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Equation is called an equation expression. Each equation expression is also a member of class AssociativeExpression [III.21.1.3.4].
Methods for using an equation expression :
Equation == Equation
Equation == Expression
Equation == Holder
Expression == Equation
Holder == Equation
21.1. BASICLIST
371
net Equation
precedence Equation
toString Equation
value Equation
21.1.3.4.2. Product
Product – a type of Expression [III.21.1.3] representing a product.
The wrapper type Product is a member of the class WrapperType [III.21.5.4.11.5].
Each object of class Product is called a product expression. Each product expression is also a member of class AssociativeExpression [III.21.1.3.4].
Methods for using a product expression :
Expression * Product
Holder * Product
Product * Expression
Product * Holder
Product * Product
html Product
mathML Product
net Product
precedence Product
texMath Product
toString Product
value Product
21.1.3.4.3. Sum
Sum – a type of Expression [III.21.1.3] representing a sum.
The wrapper type Sum is a member of the class WrapperType [III.21.5.4.11.5].
Each object of class Sum is called a sum expression. Each sum expression is also a
member of class AssociativeExpression [III.21.1.3.4].
Methods for using a sum expression :
Expression + Sum
Holder + Sum
Sum + Expression
Sum + Holder
Sum + Sum
html Sum
mathML Sum
net Sum
precedence Sum
texMath Sum
toString Sum
value Sum
21.1.3.5. BinaryOperation
BinaryOperation – a type of Expression [III.21.1.3] representing the result
of a binary operation.
The header type BinaryOperation is a member of the class HeaderType
[III.21.5.4.11.1]. Each object of class BinaryOperation is called a binary operation
372
21. THING
expression. Each binary operation expression is also a member of class Expression
[III.21.1.3].
Methods for using a binary operation expression :
net BinaryOperation
toString BinaryOperation
value BinaryOperation
21.1.3.6. Divide
Divide – a type of Expression [III.21.1.3] representing a quotient.
The header type Divide is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Divide is called a divide expression. Each divide expression is
also a member of class Expression [III.21.1.3].
Methods for using a divide expression :
denominator Divide
html Divide
mathML Divide
net Divide
numerator Divide
precedence Divide
texMath Divide
value Divide
21.1.3.7. DoubleArrow
DoubleArrow – a type of Expression [III.21.1.3] which represents something
of the form a => b.
This is experimental, and intended for internal use only.
The header type DoubleArrow is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class DoubleArrow is called a double arrow expression. Each double
arrow expression is also a member of class Expression [III.21.1.3].
Methods for using a double arrow expression :
net DoubleArrow
precedence DoubleArrow
value DoubleArrow
21.1.3.8. FunctionApplication
FunctionApplication – a type of Expression [III.21.1.3] representing an application of a function.
The header type FunctionApplication is a member of the class HeaderType
[III.21.5.4.11.1]. Each object of class FunctionApplication is called a function application expression. Each function application expression is also a member of class
Expression [III.21.1.3].
Methods for using a function application expression :
net FunctionApplication
precedence FunctionApplication
toString FunctionApplication
value FunctionApplication
21.1. BASICLIST
373
21.1.3.9. Holder
Holder – a type of Expression [III.21.1.3].
This type of expresssion is a container for a single, arbitrary, thing which is
basic enough that the correct method for printing does not depend on its neighbors
in the containing expression. A negative number would not be basic enough for
this purpose, since as a member of a sum, it would require special treatment.
The wrapper type Holder is a member of the class WrapperType [III.21.5.4.11.5].
Each object of class Holder is called a holder. Each holder is also a member of class
Expression [III.21.1.3].
Types of Holder :
OneExpression [III.21.1.3.9.1] – the class all one expressions
ZeroExpression [III.21.1.3.9.2] – the class of all zero expressions
Making a holder :
hold [III.21.1.3.9.3] – hold something in a holder expression
Methods for using a holder :
Equation == Holder
Expression * Holder
Expression ** Holder
Expression / Holder
Expression Holder
Expression ^ Holder
Holder * Expression
Holder * Holder
Holder * OneExpression
Holder * Product
Holder * ZeroExpression
Holder ** Expression
Holder ** Holder
Holder ** NonAssociativeProduct
Holder ** OneExpression
Holder + Holder
Holder + Sum
Holder / Expression
Holder / Holder
Holder / OneExpression
Holder == Equation
Holder == Holder
Holder Expression
Holder Holder
Holder [...]
Holder ^ Expression
Holder ^ Holder
Holder ^ OneExpression
Holder ^ ZeroExpression
NonAssociativeProduct ** Holder
OneExpression * Holder
OneExpression ** Holder
Product * Holder
374
21. THING
Sum + Holder
ZeroExpression * Holder
ZeroExpression + Holder
ZeroExpression ^ Holder
html Holder
mathML Holder
net Holder
precedence Holder
texMath Holder
toString Holder
value Holder
21.1.3.9.1. OneExpression
OneExpression – a type of Expression [III.21.1.3] of which there is just one
instance, an expression representing the number 1.
The type OneExpression is a member of the class Type [III.21.5.4.11]. Each
object of class OneExpression is called a one expression. Each one expression is
also a member of class Holder [III.21.1.3.9].
Methods for using a one expression :
Expression * OneExpression
Expression ** OneExpression
Expression / OneExpression
Expression ^ OneExpression
Holder * OneExpression
Holder ** OneExpression
Holder / OneExpression
Holder ^ OneExpression
OneExpression * Expression
OneExpression * Holder
OneExpression ** Expression
OneExpression ** Holder
html OneExpression
mathML OneExpression
texMath OneExpression
value OneExpression
21.1.3.9.2. ZeroExpression
ZeroExpression – a type of Expression [III.21.1.3] of which there is just one
instance, an expression representing the number 0.
The type ZeroExpression is a member of the class Type [III.21.5.4.11]. Each
object of class ZeroExpression is called a zero expression. Each zero expression is
also a member of class Holder [III.21.1.3.9].
Methods for using a zero expression :
Expression * ZeroExpression
Expression + ZeroExpression
Expression ^ ZeroExpression
Holder * ZeroExpression
Holder ^ ZeroExpression
21.1. BASICLIST
375
ZeroExpression * Expression
ZeroExpression * Holder
ZeroExpression + Expression
ZeroExpression + Holder
ZeroExpression ^ Expression
ZeroExpression ^ Holder
ZeroExpression ^ ZeroExpression
html ZeroExpression
mathML ZeroExpression
texMath ZeroExpression
value ZeroExpression
21.1.3.9.3. hold
hold x – embeds it argument x in a list of class Holder [III.21.1.3.9].
It might be useful for displaying an integer in factored form, for example,
because the usual algebraic operations are available for Expression [III.21.1.3]s,
but no simplification occurs.
i1 : (hold 2)^5 * (hold 3)^3 * (hold 5) * (hold 11)^2
5 3
2
o1 = 2 3 5*11
o1 : Product
Here is example of a little function that expresses rational numbers as Egyptian
fractions using hold.
i2 : egyptian = method();
i3 : egyptian QQ := x -> (
if x == 0 then 0
else (
n := ceiling(1/x);
hold(1/n) + egyptian(x - 1/n)
));
i4 : egyptian(30/31)
1
1
1
1
1
1
o4 = (-) + (-) + (-) + (---) + (-----) + (---------) + 0
2
3
8
107
15922
633759288
o4 : Sum
The function hold is a member of the class Function [III.18].
Class of returned value: Holder [III.21.1.3.9] – the class of all holder expressionsCode:
-- code for hold:
-- ../m2/expressions.m2:1107
hold = x -> new Holder from {x}
21.1.3.10. MatrixExpression
MatrixExpression – a type of Expression [III.21.1.3] representing a matrix.
i1 : MatrixExpression {{a,b,c},{a,bb,ccc}}
376
21. THING
o1 = | a
|
| a
b
bb
c
|
|
ccc |
o1 : MatrixExpression
See also:
Table [III.21.1.3.19] – the class of all table expressions
The header type MatrixExpression is a member of the class HeaderType
[III.21.5.4.11.1]. Each object of class MatrixExpression is called a matrix expression. Each matrix expression is also a member of class Expression [III.21.1.3].
Methods for using a matrix expression :
html MatrixExpression
mathML MatrixExpression
net MatrixExpression
texMath MatrixExpression
toString MatrixExpression
value MatrixExpression
21.1.3.11. Minus
Minus – a type of Expression [III.21.1.3] representing negation.
This is a unary operator.
The wrapper type Minus is a member of the class WrapperType [III.21.5.4.11.5].
Each object of class Minus is called a minus expression. Each minus expression is
also a member of class Expression [III.21.1.3].
Methods for using a minus expression :
Expression * Minus
Minus * Expression
Minus * Minus
html Minus
mathML Minus
net Minus
precedence Minus
texMath Minus
toString Minus
value Minus
21.1.3.12. NonAssociativeProduct
NonAssociativeProduct – a type of Expression [III.21.1.3] representing a
nonassociative product.
The wrapper type NonAssociativeProduct is a member of the class WrapperType [III.21.5.4.11.5]. Each object of class NonAssociativeProduct is called a
nonassociative product expression. Each nonassociative product expression is also
a member of class Expression [III.21.1.3].
Methods for using a nonassociative product expression :
Expression ** NonAssociativeProduct
Holder ** NonAssociativeProduct
NonAssociativeProduct ** Expression
NonAssociativeProduct ** Holder
21.1. BASICLIST
377
NonAssociativeProduct ** NonAssociativeProduct
net NonAssociativeProduct
precedence NonAssociativeProduct
toString NonAssociativeProduct
value NonAssociativeProduct
21.1.3.13. Power
Power – a type of Expression [III.21.1.3] representing a power.
Normally power expressions with an exponent equal to 1 will not be produced.
But it is desirable for factor [V.24.285] to return a product of powers, and some
of them will have 1 as exponent. The routines for printing of expressions will take
this into account, suppress exponents equal to 1, and arrange for parenthesization
correctly.
The header type Power is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Power is called a power expression. Each power expression is
also a member of class Expression [III.21.1.3].
Methods for using a power expression :
html Power
mathML Power
net Power
precedence Power
texMath Power
toString Power
value Power
21.1.3.14. RowExpression
RowExpression – a type of Expression [III.21.1.3] representing a horizontal
sequence of expressions.
The header type RowExpression is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class RowExpression is called a row expression. Each row expression
is also a member of class Expression [III.21.1.3].
Methods for using a row expression :
html RowExpression
net RowExpression
texMath RowExpression
toString RowExpression
21.1.3.15. SparseMonomialVectorExpression
SparseMonomialVectorExpression – a type of Expression [III.21.1.3] representing a sparse monomial vector.
The difference between this and SparseVectorExpression [III.21.1.3.16] is
that the basis vectors are treated like variables for printing purposes.
The header type SparseMonomialVectorExpression is a member of the class
HeaderType [III.21.5.4.11.1]. Each object of class SparseMonomialVectorExpression is called a sparse monomial vector expression. Each sparse monomial vector
expression is also a member of class Expression [III.21.1.3].
Methods for using a sparse monomial vector expression :
net SparseMonomialVectorExpression
378
21. THING
texMath SparseMonomialVectorExpression
toString SparseMonomialVectorExpression
value SparseMonomialVectorExpression
21.1.3.16. SparseVectorExpression
SparseVectorExpression – a type of Expression [III.21.1.3] representing a
sparse vector.
The header type SparseVectorExpression is a member of the class HeaderType [III.21.5.4.11.1]. Each object of class SparseVectorExpression is called a
sparse vector expression. Each sparse vector expression is also a member of class
Expression [III.21.1.3].
Methods for using a sparse vector expression :
net SparseVectorExpression
texMath SparseVectorExpression
toString SparseVectorExpression
value SparseVectorExpression
21.1.3.17. Subscript
Subscript – a type of Expression [III.21.1.3] representing a subscripted expression.
The header type Subscript is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Subscript is called a subscript expression. Each subscript expression is also a member of class Expression [III.21.1.3].
Methods for using a subscript expression :
html Subscript
net Subscript
precedence Subscript
texMath Subscript
toString Subscript
value Subscript
21.1.3.18. Superscript
Superscript – a type of Expression [III.21.1.3] representing a superscripted
expression.
The header type Superscript is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Superscript is called a superscript expression. Each superscript
expression is also a member of class Expression [III.21.1.3].
Methods for using a superscript expression :
html Superscript
net Superscript
precedence Superscript
texMath Superscript
toString Superscript
value Superscript
21.1.3.19. Table
Table – a type of Expression [III.21.1.3] representing a table, i.e., a list of
lists of the same length.
21.1. BASICLIST
379
i1 : Table {{a,b,c},{a,bb,ccc}}
o1 =
a
b
c
a
bb
ccc
o1 : Table
i2 : value oo
o2 = {{a, b, c}, {a, bb, ccc}}
o2 : List
See also:
MatrixExpression [III.21.1.3.10] – the class of all matrix expressions
The header type Table is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Table is called a table expression. Each table expression is also
a member of class Expression [III.21.1.3].
Methods for using a table expression :
net Table
toString Table
value Table
21.1.3.20. expression
expression x – make an Expression [III.21.1.3] from x.
The function expression is a member of the class Function [III.18].
Class of returned value: Expression [III.21.1.3] – the class of all expressionsWays to use expression :
expression (...)
expression AffineVariety
expression BasicList
expression Boolean
expression CC
expression CoherentSheaf
expression Database
expression Eliminate
expression Expression
expression File
expression Function
expression GeneralOrderedMonoid
expression Handle
expression HashTable
expression Ideal
expression IndexedVariable
expression IndexedVariableTable
expression Matrix
expression Net
expression Nothing
expression Option
expression PolynomialRing
380
21. THING
expression
expression
expression
expression
expression
expression
expression
expression
expression
expression
expression
expression
expression
ProjectiveHilbertPolynomial
ProjectiveVariety
QQ
QuotientRing
RR
RingElement
RingMap
String
Symbol
Vector
ZZ
[...]
{...}
21.1.4. IndexedVariable
Indexed variables provide the possibility of producing polynomial rings R[x_0,
x_1, ..., x_(n-1)] in n variables, where n is not known in advance. If x is an
symbol, and i is an integer, then x_i produces an indexed variable. (What actually
happens is a hash table been assigned to the as the value of the symbol x. After
this has been done, an assignment x#i=v will assign a value to it. A new sequence
of indexed variables of length n assigned to the symbol x can be produced with x_1
.. x_n and that sequence can be used in constructing a polynomial ring.
i1 : ZZ/101[t_0 .. t_4]
ZZ
o1 = --- [t , t , t , t , t ]
101
0
1
2
3
4
o1 : PolynomialRing
i2 : (t_0 -
2*t_1)^3
3
2
2
3
o2 = t - 6t t + 12t t - 8t
0
0 1
0 1
1
ZZ
o2 : --- [t , t , t , t , t ]
101
0
1
2
3
4
See also:
IndexedVariableTable [III.21.5.4.5] – the class of indexed variable tables
The type IndexedVariable is a member of the class Type [III.21.5.4.11]. Each
object of class IndexedVariable is called an indexed variable. Each indexed variable
is also a member of class BasicList [III.21.1].
Making an indexed variable :
IndexedVariableTable _ Thing
Symbol _ Thing
Methods for using an indexed variable :
IndexedVariable .. IndexedVariable
IndexedVariable ? IndexedVariable
Symbol ? IndexedVariable
21.1. BASICLIST
381
assign(IndexedVariable,Thing)
baseName IndexedVariable
expression IndexedVariable
net IndexedVariable
toString IndexedVariable
vars IndexedVariable
21.1.5. Manipulator
A file manipulator is a type of list which, when put out to a file with << [V.24.34]
causes a chosen function to be applied to the file.
The type Manipulator is a member of the class Type [III.21.5.4.11]. Each
object of class Manipulator is called a manipulator. Each manipulator is also a
member of class BasicList [III.21.1].
Making a manipulator :
new Manipulator from Function
Methods for using a manipulator :
File << Manipulator
Manipulator Database
Manipulator File
Manipulator Nothing
Nothing << Manipulator
net Manipulator
toExternalString Manipulator
toString Manipulator
{...} << Manipulator
Fixed objects of class Manipulator :
close [V.24.203] – close a file
closeIn [V.24.204] – close an input file
closeOut [V.24.205] – close an output file
endl [V.24.269] – end an output line
flush [V.24.294] – flush output to file
21.1.6. MarkUpList
Intended for internal use only.
The type MarkUpList is a member of the class Type [III.21.5.4.11]. Each
object of class MarkUpList is called a mark-up list. Each mark-up list is also a
member of class BasicList [III.21.1].
Types of MarkUpList :
BIG [III.21.1.6.1] – HTML BIG item
BLOCKQUOTE [III.21.1.6.2] – HTML BLOCKQUOTE item
BODY [III.21.1.6.3] – HTML BODY item
BOLD [III.21.1.6.4] – HTML BOLD item
BR [III.21.1.6.5] – line break
CENTER [III.21.1.6.6] – HTML CENTER item
CITE [III.21.1.6.7] – HTML CITE item
CODE [III.21.1.6.8] – HTML CODE item
DFN [III.21.1.6.9] – HTML DFN item
DL [III.21.1.6.10] – HTML DL item
382
21. THING
EM [III.21.1.6.11] – HTML EM item
EXAMPLE [III.21.1.6.12] – HTML EXAMPLE item
ExampleTABLE [III.21.1.6.13] – hypertext list of examples
H1 [III.21.1.6.14] – HTML H1 item
H2 [III.21.1.6.15] – HTML H2 item
H3 [III.21.1.6.16] – HTML H3 item
H4 [III.21.1.6.17] – HTML H4 item
H5 [III.21.1.6.18] – HTML H5 item
H6 [III.21.1.6.19] – HTML H6 item
HEAD [III.21.1.6.20] – HTML HEAD item
HEADLINE [III.21.1.6.21] – make a documentation HEADLINE item
HR [III.21.1.6.22] – horizontal rule
HREF [III.21.1.6.23] – HTML link
HTML [III.21.1.6.24] – HTML item
IMG [III.21.1.6.25] – HTML IMG item
ITALIC [III.21.1.6.26] – HTML italic font
KBD [III.21.1.6.27] – HTML KBD item
LISTING [III.21.1.6.28] – HTML LISTING item
LITERAL [III.21.1.6.29] – hypertext literal text
MENU [III.21.1.6.30] – HTML MENU item
NL [III.21.1.6.31] – HTML NL item
NOINDENT [III.21.1.6.32] – cancel hypertext indentation
OL [III.21.1.6.33] – HTML OL item
PARA [III.21.1.6.34] – paragraph separator
PRE [III.21.1.6.35] – preformatted text
SAMP [III.21.1.6.36] – HTML SAMP item
SEQ [III.21.1.6.37] – hypertext sequence
SHIELD [III.21.1.6.38] – shield menu items so they don’t produce subsections
SMALL [III.21.1.6.39] – HTML SMALL item
STRONG [III.21.1.6.40] – HTML STRONG item
SUB [III.21.1.6.41] – HTML subscript
SUP [III.21.1.6.42] – HTML superscript
TABLE [III.21.1.6.43] – hypertext table
TEX [III.21.1.6.44] – hypertext TEX item
TITLE [III.21.1.6.45] – hypertext title
TO [III.21.1.6.46] – hypertext documentation link
TOH
TT [III.21.1.6.47] – HTML TT item
UL [III.21.1.6.48] – HTML UL item
UNDERLINE [III.21.1.6.49] – HTML underlining
VAR [III.21.1.6.50] – HTML VAR item
XMP [III.21.1.6.51] – HTML XMP item
Methods for using a mark-up list :
MarkUpList ^ MarkUpList
MarkUpList _ MarkUpList
html MarkUpList
mathML MarkUpList
21.1. BASICLIST
383
net MarkUpList
tex MarkUpList
texMath MarkUpList
text MarkUpList
toExternalString MarkUpList
toString MarkUpList
21.1.6.1. BIG
BIG x – encloses x in a hypertext BIG item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is some big text.
See also:
hypertext [V.24.343]
The mark-up type BIG is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class BIG is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class BIG :
html BIG
net BIG
21.1.6.2. BLOCKQUOTE
BLOCKQUOTE x – encloses x in a hypertext BLOCKQUOTE item.
The argument x should be a string.
Here is an example.Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line. Here is a long line. 1234 2345 4567 5678 34
345 3455 7
See also:
hypertext [V.24.343]
The mark-up type BLOCKQUOTE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class BLOCKQUOTE is also a member of class MarkUpList
[III.21.1.6].
Methods for using an object of class BLOCKQUOTE :
html BLOCKQUOTE
21.1.6.3. BODY
BODY x – encloses x in a hypertext BODY item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
See also:
hypertext [V.24.343]
The mark-up type BODY is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class BODY is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class BODY :
html BODY
384
21. THING
21.1.6.4. BOLD
BOLD x – encloses x in a hypertext BOLD item.
The argument x should be a string, or a list or sequence of strings or hypertext
items. This corresponds to B in html format.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type BOLD is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class BOLD is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class BOLD :
html BOLD
21.1.6.5. BR
BR{} – a hypertext [V.24.343] line break.
The empty mark-up type BR is a member of the class EmptyMarkUpType
[III.21.5.4.11.2.1]. Each object of class BR is also a member of class MarkUpList
[III.21.1.6].
Methods for using an object of class BR :
html BR
tex BR
text BR
21.1.6.6. CENTER
CENTER x – encloses x in a hypertext CENTER item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
See also:
hypertext [V.24.343]
The mark-up type CENTER is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class CENTER is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class CENTER :
html CENTER
net CENTER
21.1.6.7. CITE
CITE x – encloses x in a hypertext CITE item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type CITE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class CITE is also a member of class MarkUpList [III.21.1.6].
21.1. BASICLIST
385
Methods for using an object of class CITE :
html CITE
21.1.6.8. CODE
CODE x – encloses x in a hypertext CODE item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long l ...
See also:
hypertext [V.24.343]
The mark-up type CODE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class CODE is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class CODE :
html CODE
net CODE
21.1.6.9. DFN
DFN x – encloses x in a hypertext DFN item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type DFN is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class DFN is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class DFN :
html DFN
21.1.6.10. DL
DL x – encloses the list x as a hypertext DL itemized list.
The argument x should be a list, each member of which should be a list of
length two.
Here is an example. The expression
DL {
{"first heading","first item’s text"},
{"second heading","second item’s text"},
{"third heading","third item’s text"}}
producesfirst headingfirst item’s textsecond headingsecond item’s textthird headingthird item’s text
See also:
hypertext [V.24.343]
The mark-up type DL is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class DL is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class DL :
html DL
text DL
386
21. THING
21.1.6.11. EM
EM x – encloses x in a hypertext EM item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type EM is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class EM is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class EM :
html EM
21.1.6.12. EXAMPLE
EXAMPLE x – evaluates the string or list of strings x as Macaulay 2 code, inserting the results in hypertext preformatted PRE [III.21.1.6.35] items.
The evaluation is done by the Makefile at a separate time, and the results are
left where they can be found the next time the same EXAMPLE is encountered.
See also:
hypertext [V.24.343]
The mark-up type EXAMPLE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class EXAMPLE is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class EXAMPLE :
html EXAMPLE
text EXAMPLE
21.1.6.13. ExampleTABLE
ExampleTABLE x – produces a hypertext display suitable for displaying a list
of examples.
The mark-up type ExampleTABLE is a member of the class MarkUpType
[III.21.5.4.11.2]. Each object of class ExampleTABLE is also a member of class
MarkUpList [III.21.1.6].
Methods for using an object of class ExampleTABLE :
html ExampleTABLE
net ExampleTABLE
tex ExampleTABLE
text ExampleTABLE
21.1.6.14. H1
H1 x – encloses x in a hypertext H1 header item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example. The code
H1 "Interesting thing"
21.1. BASICLIST
produces
387
Interesting thing
See also:
hypertext [V.24.343]
The mark-up type H1 is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class H1 is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class H1 :
html H1
21.1.6.15. H2
H2 x – encloses x in a hypertext H2 header item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example. The code
H2 "Interesting thing"
produces Interesting thing
See also:
hypertext [V.24.343]
The mark-up type H2 is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class H2 is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class H2 :
html H2
21.1.6.16. H3
H3 x – encloses x in a hypertext H3 header item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example. The code
H3 "Interesting thing"
produces Interesting thing
See also:
hypertext [V.24.343]
The mark-up type H3 is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class H3 is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class H3 :
html H3
21.1.6.17. H4
H4 x – encloses x in a hypertext H4 header item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example. The code
H4 "Interesting thing"
produces Interesting thing
See also:
hypertext [V.24.343]
The mark-up type H4 is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class H4 is also a member of class MarkUpList [III.21.1.6].
388
21. THING
Methods for using an object of class H4 :
html H4
21.1.6.18. H5
H5 x – encloses x in a hypertext H5 header item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example. The code
H5 "Interesting thing"
produces Interesting thing
See also:
hypertext [V.24.343]
The mark-up type H5 is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class H5 is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class H5 :
html H5
21.1.6.19. H6
H6 x – encloses x in a hypertext H6 header item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example. The code
H6 "Interesting thing"
produces Interesting thing
See also:
hypertext [V.24.343]
The mark-up type H6 is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class H6 is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class H6 :
html H6
21.1.6.20. HEAD
HEAD x – encloses x in a hypertext HEAD item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
See also:
hypertext [V.24.343]
The mark-up type HEAD is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class HEAD is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class HEAD :
html HEAD
21.1.6.21. HEADLINE
HEADLINE x – encloses x in a hypertext HEADLINE item.
The argument x should be a string, or a list or sequence of strings or hypertext
items. This item is ordinarily invisible, but if it occurs as the first item in a
21.1. BASICLIST
389
documentation node, it can be used as a brief descriptor to accompany links to the
node from menus in other nodes.
See also:
hypertext [V.24.343]
The mark-up type HEADLINE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class HEADLINE is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class HEADLINE :
html HEADLINE
net HEADLINE
tex HEADLINE
texMath HEADLINE
text HEADLINE
21.1.6.22. HR
HR{} – a hypertext [V.24.343] horiziontal rule.
The empty mark-up type HR is a member of the class EmptyMarkUpType
[III.21.5.4.11.2.1]. Each object of class HR is also a member of class MarkUpList
[III.21.1.6].
Methods for using an object of class HR :
html HR
tex HR
text HR
21.1.6.23. HREF
HREF{u,p} – encloses the phrase p in a hypertext HREF link pointing to the
url u.
See also:
hypertext [V.24.343]
The mark-up type HREF is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class HREF is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class HREF :
html HREF
tex HREF
text HREF
21.1.6.24. HTML
HTML x – encloses x in a hypertext HTML item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
See also:
hypertext [V.24.343]
The mark-up type HTML is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class HTML is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class HTML :
html HTML
390
21. THING
21.1.6.25. IMG
IMG x – encloses x in a hypertext IMG item.
The argument x should be a string containing the URL of the image.
See also:
hypertext [V.24.343]
The mark-up type IMG is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class IMG is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class IMG :
html IMG
tex IMG
text IMG
21.1.6.26. ITALIC
ITALIC x – encloses x in a hypertext ITALIC item.
The argument x should be a string, or a list or sequence of strings or hypertext
items. The result corresponds to the html I command.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type ITALIC is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class ITALIC is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class ITALIC :
html ITALIC
tex ITALIC
texMath ITALIC
21.1.6.27. KBD
KBD x – encloses x in a hypertext KBD item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type KBD is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class KBD is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class KBD :
html KBD
21.1.6.28. LISTING
LISTING x – encloses x in a hypertext LISTING item.
The argument x should be a string.
21.1. BASICLIST
391
Here is an example.Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line. Here is a long line. 1234 2345 4567 5678 34
345 3455 7
See also:
hypertext [V.24.343]
The mark-up type LISTING is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class LISTING is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class LISTING :
html LISTING
21.1.6.29. LITERAL
LITERAL x – produces a special hypertext item which contains HTML text that
should be left unchanged by html [III.21.6.1.1].
The mark-up type LITERAL is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class LITERAL is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class LITERAL :
html LITERAL
21.1.6.30. MENU
MENU x – encloses the list x as a hypertext MENU.
The argument x should be a list of hypertext items or strings.
Here is an example. The expression
MENU {"first","second","third"}
produces
first
second
third
See also:
hypertext [V.24.343]
The mark-up type MENU is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class MENU is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class MENU :
html MENU
net MENU
reach1 MENU
reach3 MENU
tex MENU
text MENU
21.1.6.31. NL
NL x – encloses the list x as a hypertext NL itemized list.
The argument x should be a list of strings or hypertext items.
Here is an example. The expression
NL {"first","second","third"}
producesfirstsecondthird
See also:
hypertext [V.24.343]
392
21. THING
The mark-up type NL is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class NL is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class NL :
html NL
text NL
21.1.6.32. NOINDENT
NOINDENT{} – specifies that no indentation should be used for following hypertext items.
This item is mainly of interest for hypertext that ultimately will be viewed with
TeX, for html viewers don’t indent paragraphs.
See also:
hypertext [V.24.343]
The empty mark-up type NOINDENT is a member of the class EmptyMarkUpType [III.21.5.4.11.2.1]. Each object of class NOINDENT is also a member of class
MarkUpList [III.21.1.6].
Methods for using an object of class NOINDENT :
html NOINDENT
net NOINDENT
tex NOINDENT
text NOINDENT
21.1.6.33. OL
OL x – encloses the list x as a hypertext OL itemized list.
The argument x should be a list of strings or hypertext items. The items are
numbered in the display.
Here is an example. The expression
OL {"first","second","third"}
producesfirstsecondthird
See also:
hypertext [V.24.343]
The mark-up type OL is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class OL is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class OL :
html OL
text OL
21.1.6.34. PARA
PARA x – a hypertext [V.24.343] paragraph.
The mark-up type PARA is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class PARA is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class PARA :
html PARA
tex PARA
text PARA
21.1. BASICLIST
393
21.1.6.35. PRE
PRE x – encloses x in a hypertext PRE item.
The argument x should be a string, possibly containing newlines.
Here is an example.
1234
2345
4567
5678
34
345
3455
7
See also:
hypertext [V.24.343]
The mark-up type PRE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class PRE is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class PRE :
html PRE
net PRE
tex PRE
text PRE
21.1.6.36. SAMP
SAMP x – encloses x in a hypertext SAMP item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type SAMP is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class SAMP is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class SAMP :
html SAMP
21.1.6.37. SEQ
SEQ x – encloses x in a hypertext SEQ item.
The argument x should be a string, or a list or sequence of strings or hypertext
items. The result is that the entries in the list or sequence are displayed sequentially.
See also:
hypertext [V.24.343]
The mark-up type SEQ is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class SEQ is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class SEQ :
html SEQ
net SEQ
new SEQ from {...}
tex SEQ
texMath SEQ
text SEQ
394
21. THING
21.1.6.38. SHIELD
SHIELD v – indicates that the hypertext [V.24.343] links in the menu v will
not lead immediately to subsections of the book.
The documentation is organized as a tree, rooted at the most general type
(Thing [III.21]), and descending to more specific types. The branches of the tree
are those menu items that are not protected by SHIELD. The book is created by
searching the tree in a depth-first fashion, and printing the sections as they are
encountered. Sections never encountered are assembled alphabetically into an appendix.
The mark-up type SHIELD is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class SHIELD is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class SHIELD :
html SHIELD
net SHIELD
reach1 SHIELD
text SHIELD
21.1.6.39. SMALL
SMALL x – encloses x in a hypertext SMALL item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is some small text.
See also:
hypertext [V.24.343]
The mark-up type SMALL is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class SMALL is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class SMALL :
html SMALL
21.1.6.40. STRONG
STRONG x – encloses x in a hypertext STRONG item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type STRONG is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class STRONG is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class STRONG :
html STRONG
tex STRONG
texMath STRONG
21.1. BASICLIST
395
21.1.6.41. SUB
SUB x – encloses x in a hypertext SUB item, thereby making it a subscript.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
See also:
hypertext [V.24.343]
The mark-up type SUB is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class SUB is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class SUB :
html SUB
texMath SUB
21.1.6.42. SUP
SUP x – encloses x in a hypertext SUP item, thereby making it a superscript.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
See also:
hypertext [V.24.343]
The mark-up type SUP is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class SUP is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class SUP :
html SUP
texMath SUP
21.1.6.43. TABLE
TABLE x – produces a hypertext TABLE from a list of lists.
The mark-up type TABLE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class TABLE is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class TABLE :
html TABLE
net TABLE
tex TABLE
texMath TABLE
text TABLE
21.1.6.44. TEX
TEX s – includes the string s, presumably containing TeX commands, in the
TeX version of the documentation containing this hypertext [V.24.343] item.
Invisible in the text and html versions.
The mark-up type TEX is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class TEX is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class TEX :
html TEX
tex TEX
texMath TEX
396
21. THING
21.1.6.45. TITLE
TITLE x – encloses x in a hypertext TITLE item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
See also:
hypertext [V.24.343]
The mark-up type TITLE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class TITLE is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class TITLE :
html TITLE
21.1.6.46. TO
TO "x" – produces a hypertext link to the documentation page labelled x.
See also hypertext [V.24.343]. The word hypertext in the previous sentence
is an example of the use of TO.
The special form TO {"x", "s"} produces a hypertext link to the page labelled
x, but with the string ”s” appended to the string ”x” at the point where the reference
occurs. This form is needed because in some modes of output the link is indicated
with a section number in brackets.
The special form TO (f,X) produces a hypertext link to the page documenting
the method used for applying the function f to an argument of class X. For more
arguments, use TO (f,X,Y) or TO (f,X,Y,Z).
The special form TO (f => X) produces a hypertext link to the page documenting the optional argument named X for the function f.
If TO x is an entry in a MENU [III.21.1.6.30], then it is treated as TOH x, and
headlines are added automatically. See also TOH [V.24.138].
The mark-up type TO is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class TO is also a member of class MarkUpList [III.21.1.6].
Types of TO :
optionalTO
Methods for using an object of class TO :
html TO
net TO
reach1 TO
reach2 TO
tex TO
text TO
21.1.6.47. TT
TT x – encloses x in a hypertext TT item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here
is a long line. Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
21.1. BASICLIST
397
The mark-up type TT is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class TT is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class TT :
html TT
net TT
tex TT
texMath TT
text TT
21.1.6.48. UL
UL x – encloses the list x as a hypertext UL itemized list.
The argument x should be a list of strings or hypertext items.
Here is an example. The expression
UL {"first","second","third"}
producesfirstsecondthird
See also:
hypertext [V.24.343]
The mark-up type UL is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class UL is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class UL :
html UL
text UL
21.1.6.49. UNDERLINE
UNDERLINE x – encloses x in a hypertext UNDERLINE item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type UNDERLINE is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class UNDERLINE is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class UNDERLINE :
html UNDERLINE
21.1.6.50. VAR
VAR x – encloses x in a hypertext VAR item.
The argument x should be a string, or a list or sequence of strings or hypertext
items.
Here is an example.
Here is a long line. Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line.
See also:
hypertext [V.24.343]
The mark-up type VAR is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class VAR is also a member of class MarkUpList [III.21.1.6].
398
21. THING
Methods for using an object of class VAR :
html VAR
21.1.6.51. XMP
XMP x – encloses x in a hypertext XMP item.
The argument x should be a string.
Here is an example.Here is a long line. Here is a long line. Here is a long line.
Here is a long line. Here is a long line. Here is a long line. 1234 2345 4567 5678 34
345 3455 7
See also:
hypertext [V.24.343]
The mark-up type XMP is a member of the class MarkUpType [III.21.5.4.11.2].
Each object of class XMP is also a member of class MarkUpList [III.21.1.6].
Methods for using an object of class XMP :
html XMP
21.1.7. MinorsComputation
MinorsComputation – a type of self initializing list used internally by minors
[V.24.415].
The self initializing type MinorsComputation is a member of the class SelfInitializingType [III.21.5.4.11.4]. Each object of class MinorsComputation is called a
minors computation. Each minors computation is also a member of class BasicList
[III.21.1].
21.1.8. MonoidElement
See also:
monoid [V.24.424] – make a monoid
The type MonoidElement is a member of the class Type [III.21.5.4.11]. Each
object of class MonoidElement is called a monoid element. Each monoid element
is also a member of class BasicList [III.21.1].
Making a monoid element :
Monoid _ ZZ [III.21.1.8.1] – get a generator of a monoid
Monoid _ {...}
ZZ _ Monoid [III.21.1.8.2] – get unit element
leadMonomial RingElement
leadMonomial Vector
Methods for using a monoid element :
RingElement _ MonoidElement
exponents MonoidElement
listForm MonoidElement
promote(MonoidElement,Ring)
promote(MonoidElement,RingElement)
standardForm MonoidElement
21.1.8.1. Monoid _ ZZ
M_i – produces the i-th generator of a monoid M.
See also:
Monoid [III.21.5.4.11.3] – the class of all monoids
21.1. BASICLIST
399
_ [V.24.151]
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Monoid [III.21.5.4.11.3]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: MonoidElement [III.21.1.8]
Code:
-- ../m2/ofcm.m2:54
Monoid _ ZZ := MonoidElement => (M,i) -> M.generators#i
21.1.8.2. ZZ _ Monoid
1_M – provides the unit element of a group or monoid M.
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Monoid [III.21.5.4.11.3]
Class of typical returned value: MonoidElement [III.21.1.8]
Code:
-- ../m2/ofcm.m2:6-9
ZZ _ Monoid := MonoidElement => (i,M) -> (
if i === 1 then M#1
else error "expected integer to be 1"
)
21.1.9. MutableList
Normally the entries in a mutable list are not printed, to prevent infinite loops
in the printing routines. To print them out, use peek [III.21.6.8].
i1 : s = new MutableList from {a,b,c};
i2 : s#2 = 1234;
i3 : s
o3 = MutableList{...}
o3 : MutableList
i4 : peek s
o4 = MutableList{a,b,1234}
o4 : Net
See also:
BasicList [III.21.1] – the class of all basic lists
The type MutableList is a member of the class Type [III.21.5.4.11]. Each
object of class MutableList is called a mutable list. Each mutable list is also a
member of class BasicList [III.21.1].
Making a mutable list :
frame [III.21.1.9.1] – the frame of a function
Methods for using a mutable list :
net MutableList
toExternalString MutableList
400
21. THING
toString MutableList
21.1.9.1. frame
frame f – provides the frame of values for local variables bound up in a function
closure.
It also works when f is a symbol, and returns the frame for the scope it was
defined in, even if the function that created it has returned.
The return value is a mutable list, so it’s possible to modify the values of the
local variables, but it’s probably not a good idea.
Exception: if the scope of f is the global scope, then an empty list is returned
instead, since some of the global variables are protected.
This function is provisional, and is to be used mainly for debugging.
The function frame is a member of the class Function [III.18].
Class of returned value: MutableList [III.21.1.9] – the class of all mutable
lists
21.1.10. Option
Such pairs are used as optional arguments for functions. There is also a way
to make new hash tables with new [V.24.432] by providing a list of option pairs.
i1 : a => 5
o1 = a => 5
o1 : Option
i2 : peek (a => 5)
o2 = Option{a,5}
o2 : Net
i3 : new HashTable from {a => 5, b => 7}
o3 = HashTable{a => 5}
b => 7
o3 : HashTable
These pairs are implemented as lists, so that if z is x => y, then x is z#0 and
y is z#1.
See also:
classes [I.5.1]
=> [V.24.42] – produce an Option
The type Option is a member of the class Type [III.21.5.4.11]. Each object of
class Option is called an option. Each option is also a member of class BasicList
[III.21.1].
Making an option :
Thing => Thing
Methods for using an option :
Option ++ Option
documentation Option
expression Option
21.1. BASICLIST
401
formatDocumentTag Option
html Option
net Option
substitute(Ideal,Option)
substitute(Matrix,Option)
substitute(Module,Option)
substitute(RingElement,Option)
substitute(Vector,Option)
text Option
toExternalString Option
toString Option
21.1.11. PfaffiansComputation
PfaffiansComputation – a type of self initializing list used internally by pfaffians [V.24.469].
The self initializing type PfaffiansComputation is a member of the class SelfInitializingType [III.21.5.4.11.4]. Each object of class PfaffiansComputation is
called a Pfaffians computation. Each Pfaffians computation is also a member of
class BasicList [III.21.1].
21.1.12. Position
Position – a type of list designed to represent a position in a file.
It’s implemented as a list whose three elements are the file name, the line
number, and the column number.
The type Position is a member of the class Type [III.21.5.4.11]. Each object of
class Position is called a position. Each position is also a member of class BasicList
[III.21.1].
Methods for using a position :
net Position
toString Position
21.1.13. PushforwardComputation
PushforwardComputation – a type of list used internally by pushForward1
[V.24.497].
The self initializing type PushforwardComputation is a member of the class
SelfInitializingType [III.21.5.4.11.4]. Each object of class PushforwardComputation is called a push-forward computation. Each push-forward computation is
also a member of class BasicList [III.21.1].
21.1.14. Time
Time – is the class of all timing results. Each timing result is a BasicList
[III.21.1] of the form {t,v}, where t is the number of seconds of cpu time used,
and v is the value of the the expression.
See also:
timing [V.24.615] – time a computation
The type Time is a member of the class Type [III.21.5.4.11]. Each object of
class Time is called a timing result. Each timing result is also a member of class
BasicList [III.21.1].
402
21. THING
Methods for using a timing result :
net Time
21.1.15. drop(BasicList,ZZ)
drop(v,n) – yields the list obtained from the list v by dropping the first n
elements.
If n is negative, then the last -n elements are dropped.
i1 : drop({a,b,c,d,e},2)
o1 = {c, d, e}
o1 : List
i2 : drop({a,b,c,d,e},-2)
o2 = {a, b, c}
o2 : List
See also:
take [V.24.605] – take some elements from a list
Synopsis of use:
Operator: drop [V.24.259]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: BasicList [III.21.1]
21.1.16. BasicList # ZZ
x#i – provides the i-th element of the list x.
If i is out of range, an error is signalled. If i is negative, then the i-th entry
counting from the end is provided.
Assignment to x#i can change the value if x is mutable.
See also:
BasicList #? ZZ [III.21.1.17] – check for element in list
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: ZZ [III.21.11]
21.1.17. BasicList #? ZZ
x#?i – tells whether there is an i-th element in the list x.
i1 : {a,b,c} #? 2
o1 = true
i2 : {a,b,c} #? 22
o2 = false
21.2. BOOLEAN
403
See also:
BasicList # ZZ [III.21.1.16] – get element from list
Synopsis of use:
Operator: #? [V.24.8]
Class of argument 1: BasicList [III.21.1]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Boolean [III.21.2]
21.2. Boolean
Predicate functions return these as values, and the logical connectives expect
to receive them as arguments.
Special operators dealing with truth values.
not [V.24.437] – negation
and [V.24.164] – conjunction
or [V.24.459] – disjunction
if [V.24.346] – condition testing
while [V.24.649] – loop control
The type Boolean is a member of the class Type [III.21.5.4.11]. Each object
of class Boolean is called a boolean value.
Making a boolean value :
BasicList #? ZZ [III.21.1.17] – check for element in list
Database #? String [III.21.2.1] – check for value in database
HashTable #? Thing [III.21.2.2] – check for value in hash table
Set #? Thing [III.21.2.3] – test set membership
String #? ZZ [III.21.2.4] – check for character in string
Thing != Thing
Thing < Thing
Thing <= Thing
Thing =!= Thing
Thing === Thing
Thing > Thing
Thing >= Thing
ancestor(Type,Type)
any(BasicList,Function)
any(HashTable,Function)
atEndOfFile File
inducesWellDefinedMap [III.21.2.5] – whether a map is well defined
instance(Thing,Type)
isAffineRing [III.21.2.6] – whether something is an affine ring
isBorel [III.21.2.7] – whether an ideal is Borel fixed
isCommutative [III.21.2.8] – whether a ring is commutative
isField [III.21.2.9] – whether something is a field
isFreeModule [III.21.2.10] – whether something a free module
isHomogeneous [III.21.2.11] – test for homogeneity
isHomogeneous Module
isIdeal [III.21.2.12] – whether something is an ideal
isInjective [III.21.2.13] – whether a map is injective
isInputFile File
404
21. THING
isIsomorphism [III.21.2.14] – whether a map is an isomorphism
isListener File
isModule [III.21.2.15] – whether something is a module.
isOpenFile File
isOutputFile File
isPolynomialRing [III.21.2.16] – whether something is a polynomial ring
isPrime [III.21.2.17] – tell whether an integer is a prime
isPrime ZZ
isQuotientModule [III.21.2.18] – whether a module is evidently a quotient of a free module
isQuotientOf [III.21.2.19] – whether one thing is a quotient of another
isQuotientRing [III.21.2.20] – whether something is a quotient ring
isReady File
isRing [III.21.2.21] – whether something is a ring
isSubmodule [III.21.2.22] – whether a module is evidently a submodule
of a free module
isSubset [III.21.2.23] – whether something is a subset of another
isSubset((...),(...))
isSubset((...),Set)
isSubset((...),{...})
isSubset(Set,(...))
isSubset(Set,Set) [III.21.2.24] – whether something is a subset of another
isSubset(Set,{...})
isSubset({...},(...))
isSubset({...},Set)
isSubset({...},{...})
isSurjective [III.21.2.25] – whether a map is surjective
isUnit [III.21.2.26] – whether a ring element is a unit
isWellDefined [III.21.2.27] – whether a map is well defined
liftable(RingElement,Ring)
match(String,String)
member(Thing,Set)
member(Thing,VisibleList)
mutable Thing
Methods for using a boolean value :
expression Boolean
html Boolean
mathML Boolean
net Boolean
tex Boolean
texMath Boolean
text Boolean
Fixed objects of class Boolean :
false [V.24.286] – Boolean value false
true [V.24.631] – Boolean value true
21.2. BOOLEAN
405
21.2.1. Database #? String
x#?i – tells whether there is a value associated to the string i in the database
x.
See also:
Database # String [III.21.3.1] – get value from database
Synopsis of use:
Operator: #? [V.24.8]
Class of argument 1: Database [III.21.3]
Class of argument 2: String [III.21.6.1]
Class of typical returned value: Boolean [III.21.2]
21.2.2. HashTable #? Thing
x#?i – tells whether there is a value associated to the key i stored in the hash
table x.
See also:
HashTable # Thing [III.21.5.9] – get value from hash table
hashing [V.24.335]
Synopsis of use:
Operator: #? [V.24.8]
Class of argument 1: HashTable [III.21.5]
Class of argument 2: Thing [III.21]
Class of typical returned value: Boolean [III.21.2]
21.2.3. Set #? Thing
x#?i – tests whether i is a member of the set x.
Synopsis of use:
Operator: #? [V.24.8]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: Thing [III.21]
Class of typical returned value: Boolean [III.21.2]
Next more general method: HashTable #? Thing [III.21.2.2] – check
for value in hash table
21.2.4. String #? ZZ
x#?i – tells whether there is an i-th character in the string x.
i1 : "asdf" #? 2
o1 = true
i2 : "asdf" #? 22
o2 = false
See also:
String # ZZ [III.21.6.1.8] – get character from string
Synopsis of use:
Operator: #? [V.24.8]
Class of argument 1: String [III.21.6.1]
Class of argument 2: ZZ [III.21.11]
406
21. THING
Class of typical returned value: Boolean [III.21.2]
21.2.5. inducesWellDefinedMap
inducesWellDefinedMap(M,N,f) – tells whether the matrix f would induce a
well defined map from N to M.
See also:
inducedMap [V.24.354] – compute an induced map
The function inducesWellDefinedMap is a member of the class Function
[III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use inducesWellDefinedMap :
inducesWellDefinedMap(Module,Module,Matrix)
inducesWellDefinedMap(Module,Nothing,Matrix)
inducesWellDefinedMap(Nothing,Module,Matrix)
inducesWellDefinedMap(Nothing,Nothing,Matrix)
21.2.6. isAffineRing
An affine ring is a quotient of a polynomial ring over a field.
The function isAffineRing is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isAffineRing :
isAffineRing PolynomialRing
isAffineRing QuotientRing
isAffineRing Ring
21.2.7. isBorel
The function isBorel is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isBorel :
isBorel MonomialIdeal
21.2.8. isCommutative
isCommutative R – tells whether the ring R is commutative.
The function isCommutative is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isCommutative :
isCommutative Ring
21.2.9. isField
No computation is done – the question is whether the ring was explicitly constructed a field.
The function isField is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isField :
isField FractionField
isField GaloisField
isField QuotientRing
21.2. BOOLEAN
407
isField Ring
21.2.10. isFreeModule
isFreeModule M – determine whether M is evidently a free module.
No computation is done, so the module may be free but we don’t detect it. To
try to determine whether M is isomorphic to a free module, one may prune M first.
i1 : R = ZZ/101[x,y]
o1 = R
o1 : PolynomialRing
i2 : M = kernel vars R
o2 = image {1} | -y |
{1} | x |
2
o2 : R - module, submodule of R
i3 : isFreeModule M
o3 = false
i4 : isFreeModule prune M
o4 = true
The function isFreeModule is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isFreeModule :
isFreeModule Module
isFreeModule Thing
21.2.11. isHomogeneous
isHomogeneous x – whether the polynomial or ideal x is homogeneous.
The function isHomogeneous is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isHomogeneous :
isHomogeneous ChainComplexMap
isHomogeneous FractionField
isHomogeneous Ideal
isHomogeneous Matrix
isHomogeneous Module
isHomogeneous PolynomialRing
isHomogeneous QuotientRing
isHomogeneous Ring
isHomogeneous RingElement
isHomogeneous RingMap
isHomogeneous Vector
408
21. THING
21.2.12. isIdeal
The function isIdeal is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isIdeal :
isIdeal Module
isIdeal Thing
21.2.13. isInjective
See also:
isSurjective [III.21.2.25] – whether a map is surjective
The function isInjective is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isInjective :
isInjective Matrix
isInjective RingMap
21.2.14. isIsomorphism
isIsomorphism f – whether the map f of modules is an isomorphism.
The function isIsomorphism is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isIsomorphism :
isIsomorphism Matrix
21.2.15. isModule
The function isModule is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isModule :
isModule Module
isModule Thing
21.2.16. isPolynomialRing
The function isPolynomialRing is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isPolynomialRing :
isPolynomialRing PolynomialRing
isPolynomialRing Thing
21.2.17. isPrime
isPrime x – tests for primality
isPrime n – returns true if the integer n is probably a prime, and false if n is
not a prime.
At the moment, for numbers larger than 2^31-1 it checks for divisibility by
small primes, and then applies a strong pseudoprimality test (Rabin-Miller) to the
base 2.
isPrime f – returns true if the polynomial f is irreducible, otherwise false.
The function isPrime is a member of the class Function [III.18].
21.2. BOOLEAN
409
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isPrime :
isPrime ZZ
21.2.18. isQuotientModule
The function isQuotientModule is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isQuotientModule :
isQuotientModule Module
isQuotientModule Thing
21.2.19. isQuotientOf
The function isQuotientOf is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isQuotientOf :
isQuotientOf(QuotientRing,Ring)
isQuotientOf(Ring,Ring)
21.2.20. isQuotientRing
The function isQuotientRing is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isQuotientRing :
isQuotientRing QuotientRing
isQuotientRing Ring
21.2.21. isRing
isRing x – determines whether x is a ring.
The function isRing is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isRing :
isRing Ring
isRing Thing
21.2.22. isSubmodule
The function isSubmodule is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isSubmodule :
isSubmodule Module
isSubmodule Thing
21.2.23. isSubset
The function isSubset is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isSubset :
isSubset((...),(...))
isSubset((...),Set)
isSubset((...),{...})
410
21. THING
isSubset(Ideal,Ideal)
isSubset(Ideal,Module)
isSubset(Module,Ideal)
isSubset(Module,Module)
isSubset(Set,(...))
isSubset(Set,Set) [III.21.2.24] – whether something is a subset of another
isSubset(Set,{...})
isSubset({...},(...))
isSubset({...},Set)
isSubset({...},{...})
21.2.24. isSubset(Set,Set)
isSubset(X,Y) – tells whether X is a subset of Y.
Synopsis of use:
Operator: isSubset [III.21.2.23]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: Set [III.21.5.8.1]
Class of typical returned value: Boolean [III.21.2]
Code:
-- ../m2/set.m2:61
isSubset(Set,Set) := Boolean => (S,T) -> all(S, (k,v) -> T#? ...
21.2.25. isSurjective
See also:
isInjective [III.21.2.13] – whether a map is injective
The function isSurjective is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isSurjective :
isSurjective Matrix
21.2.26. isUnit
i1 : S = QQ[x,y]/(1-(x-1)*(y-1));
i2 : isUnit (x^2 - 2*x + 1)
o2 = true
The function isUnit is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isUnit :
isUnit QQ
isUnit RingElement
isUnit ZZ
21.2.27. isWellDefined
The function isWellDefined is a member of the class Function [III.18].
Class of returned value: Boolean [III.21.2] – the class of Boolean valuesWays
to use isWellDefined :
isWellDefined Matrix
21.3. DATABASE
411
21.3. Database
A database file is just like a hash table, except both the keys and values have
to be strings.
i1 : filename = tmpname "test.dbm"
o1 = /tmp/26724test.dbm
o1 : String
i2 : x = openDatabaseOut filename
o2 = /tmp/26724test.dbm
o2 : Database
i3 : x#"first" = "hi there"
o3 = hi there
o3 : String
i4 : x#"first"
o4 = hi there
o4 : String
i5 : x#"second" = "ho there"
o5 = ho there
o5 : String
i6 : scanKeys(x,print)
first
second
i7 : close x
o7 = 0
i8 : run ("rm -f " | filename)
o8 = 0
See also:
HashTable [III.21.5] – the class of all hash tables
String [III.21.6.1] – the class of all strings
The type Database is a member of the class Type [III.21.5.4.11]. Each object
of class Database is called a database.
Making a database :
openDatabase String
openDatabaseOut String
Methods for using a database :
Database # String [III.21.3.1] – get value from database
Database #? String [III.21.2.1] – check for value in database
Manipulator Database
412
21. THING
expression Database
net Database
scanKeys(Database,Function)
21.3.1. Database # String
x#i – provides the value associated to the key i in the database x.
See also:
Database #? String [III.21.2.1] – check for value in database
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: Database [III.21.3]
Class of argument 2: String [III.21.6.1]
Class of typical returned value: String [III.21.6.1]
21.4. Handle
This concept is mainly for internal use.
A handle is essentially a small integer by means of which the engine [IV.22]
refers to the algebraic entities in it.
One advantage of a handle is that it can be registered with the Boehm garbage
collector for last minute action at the time the handle is about to be destroyed.
newHandle [III.21.4.1] – make a new handle
The type Handle is a member of the class Type [III.21.5.4.11]. Each object of
class Handle is called a hash table.
Making a hash table :
handle HashTable
newHandle Thing
toHandle ZZ
Methods for using a hash table :
expression Handle
ggPush Handle
net Handle
new EngineRing from Handle
see Handle
21.4.1. newHandle
newHandle x – passes the commands x to the engine with sendgg [IV.22.3.6],
pops an object off the engine’s stack and produces the handle.
See also:
toHandle [V.24.618] – convert to handle
Handle [III.21.4] – the class of all handles for engine objects
The function newHandle is a member of the class Function [III.18].
Ways to use newHandle :
newHandle Thing
Code:
-- code for newHandle:
-- ../m2/handles.m2:13
newHandle = ggcmds -> toHandle convert(ConvertInteger, sendg ...
21.5. HASHTABLE
413
21.5. HashTable
A hash table consists of: a class type, a parent type, and a set of key-value
pairs. The keys and values can be anything. The access functions below accept a
key and return the corresponding value. For details of the mechanism underlying
this, see hashing [V.24.335].
One important feature of hash tables that when the keys are consecutive integers starting at 0, the keys are scanned in the natural order.
There is a subclass of HashTable called MutableHashTable [III.21.5.4] which
consists of those hash tables whose entries can be changed.
Access functions:
# [V.24.4] – length, or access to elements
. [V.24.22] – access to elements whose key is a symbol
Query functions:
#? [V.24.8] – check for presence of elements
.? [V.24.24] – check for presence of elements whose key is a symbol
The type HashTable is a member of the class Type [III.21.5.4.11].
Types of HashTable :
Entity [III.21.5.1] – the class of all entities
IndeterminateNumber [III.21.5.2] – the class of all indeterminate numbers
InfiniteNumber [III.21.5.3] – the class of all infinite numbers
MutableHashTable [III.21.5.4] – the class of all mutable hash tables
OptionTable [III.21.5.5] – the class of hash tables for optional arguments
ProjectiveHilbertPolynomial [III.21.5.6] – the class of all Hilbert polynomials
SymbolTable [III.21.5.7] – the class of all symbol tables
Tally [III.21.5.8] – the class of all tally results
Making an object of class HashTable :
apply(HashTable,Function) [III.18.12] – apply function to each value
applyKeys(HashTable,Function)
applyPairs(HashTable,Function)
applyValues(HashTable,Function)
hashTable {...}
merge(HashTable,HashTable,Function)
new HashTable from {...} [III.19.2.9] – make a hash table from a list
select(HashTable,Function) [III.18.26] – select from a hash table
select(ZZ,HashTable,Function) [III.18.28] – select from a hash table
Methods for using an object of class HashTable :
HashTable # Thing [III.21.5.9] – get value from hash table
HashTable #? Thing [III.21.2.2] – check for value in hash table
any(HashTable,Function)
documentation HashTable
expression HashTable
ggPush HashTable
handle HashTable
keys HashTable
methods HashTable
net HashTable
414
21. THING
pairs HashTable
peek2(HashTable,ZZ)
precedence HashTable
remove(HashTable,Thing)
scanKeys(HashTable,Function)
scanPairs(HashTable,Function) [III.18.24] – apply a function to pairs
in a hash table
scanValues(HashTable,Function)
see HashTable
toExternalString HashTable
toList HashTable [III.19.2.2] – convert to list
toString HashTable
use HashTable
values HashTable
Fixed objects of class HashTable :
version [V.24.645] – information about this version of the program
21.5.1. Entity
Entities are special typsettable objects which have different realizations in various typesetting systems.
An example of an entity is DownArrow [V.24.70], a downward pointing arrow.
i1 : DownArrow
o1 = |
|
V
o1 : Entity
i2 : peek2(DownArrow,2)
o2 = Entity{name => "DownArrow"
}
symbol html => "<IMG SRC=\"DownArrow.gif\">"
symbol symbol => symbol DownArrow
symbol texMath => "\\downarrow{}"
+-+
symbol net => |||
|||
|V|
+-+
o2 : Net
i3 : html DownArrow
o3 = <IMG SRC="DownArrow.gif">
o3 : String
The header type Entity is a member of the class HeaderType [III.21.5.4.11.1].
Each object of class Entity is called an entity. Each entity is also a member of class
HashTable [III.21.5].
Methods for using an entity :
html Entity
21.5. HASHTABLE
415
net Entity
tex Entity
texMath Entity
toString Entity
use Entity
value Entity
Fixed objects of class Entity :
DownArrow [V.24.70]
RightArrow [V.24.120]
21.5.2. IndeterminateNumber
Indeterminate numbers result, for exmaple, from multiplying 0 by infinity.
There is only one instance of this class.
The type IndeterminateNumber is a member of the class Type [III.21.5.4.11].
Each object of class IndeterminateNumber is called an indeterminate number. Each
indeterminate number is also a member of class HashTable [III.21.5].
Fixed objects of class IndeterminateNumber :
indeterminate [V.24.350] – an indeterminate number
21.5.3. InfiniteNumber
The type InfiniteNumber is a member of the class Type [III.21.5.4.11]. Each
object of class InfiniteNumber is called an infinite number. Each infinite number is
also a member of class HashTable [III.21.5].
Methods for using an infinite number :
InfiniteNumber * InfiniteNumber
InfiniteNumber * ZZ
InfiniteNumber + InfiniteNumber
InfiniteNumber + ZZ
InfiniteNumber - InfiniteNumber
InfiniteNumber - ZZ
InfiniteNumber / InfiniteNumber
InfiniteNumber == Thing
InfiniteNumber ? InfiniteNumber
InfiniteNumber ? Thing
Thing == InfiniteNumber
Thing ? InfiniteNumber
ZZ * InfiniteNumber
ZZ + InfiniteNumber
ZZ - InfiniteNumber
mathML InfiniteNumber
Fixed objects of class InfiniteNumber :
infinity [V.24.356] – infinity
21.5.4. MutableHashTable
A mutable hash table is a type of hash table whose entries can be changed.
Normally the entries in a mutable hash table are not printed, to prevent infinite
loops in the printing routines. To print them out, use peek [III.21.6.8].
416
21. THING
i1 : x = new MutableHashTable
o1 = MutableHashTable{...}
o1 : MutableHashTable
i2 : scan(0 .. 30, i -> x#i = i^2)
i3 : x # 20
o3 = 400
i4 : x #? 40
o4 = false
See also:
HashTable [III.21.5] – the class of all hash tables
The type MutableHashTable is a member of the class Type [III.21.5.4.11].
Each object of class MutableHashTable is called a mutable hash table. Each mutable hash table is also a member of class HashTable [III.21.5].
Types of MutableHashTable :
ChainComplexMap [III.21.5.4.1] – the class of all maps between chain
complexes
CoherentSheaf [III.21.5.4.2] – the class of all coherent sheaves
GradedModule [III.21.5.4.3] – the class of all graded modules
GradedModuleMap [III.21.5.4.4] – the class of all maps between graded
modules
GroebnerBasis [III.15] – the class of all Groebner bases
Ideal [III.11] – the class of all ideals
IndexedVariableTable [III.21.5.4.5] – the class of indexed variable tables
ModuleMap [III.21.5.4.6] – the class of all maps between modules
MonomialIdeal [III.21.5.4.7] – the class of all monomial ideals handled
by the engine
Resolution [III.21.5.4.8] – the class of all resolution computations
RingElement [III.21.5.4.9] – the class of all ring elements handled by the
engine
RingMap [III.14] – the class of all ring maps
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
Type [III.21.5.4.11] – class of all types
Variety [III.17] – the class of all algebraic varieties
Vector [III.21.5.4.12] – the class of all elements of free modules which are
handled by the engine
Methods for using a mutable hash table :
describe MutableHashTable
indices MutableHashTable
net MutableHashTable
toExternalString MutableHashTable
toString MutableHashTable
Fixed objects of class MutableHashTable :
Documentation
21.5. HASHTABLE
417
Symbols
methodFunctionOptions
typicalValues
21.5.4.1. ChainComplexMap
The usual algebraic operations are available: addition, subtraction, scalar multiplication, and composition. The identity map from a chain complex to itself can
be produced with id [V.24.344]. An attempt to add (subtract, or compare) a ring
element to a chain complex will result in the ring element being multiplied by the
appropriate identity map.
The type ChainComplexMap is a member of the class Type [III.21.5.4.11]. Each
object of class ChainComplexMap is called a chain complex map. Each chain
complex map is also a member of class MutableHashTable [III.21.5.4].
Making a chain complex map :
- ChainComplexMap
ChainComplex ** ChainComplexMap [III.16.11] – tensor product
ChainComplex ^ [...]
ChainComplex _ [...]
ChainComplexMap * ChainComplexMap
ChainComplexMap ** ChainComplex [III.16.12] – tensor product
ChainComplexMap ** ChainComplexMap [III.21.5.4.1.1] – tensor
product
ChainComplexMap + ChainComplexMap
ChainComplexMap ++ ChainComplexMap
ChainComplexMap - ChainComplexMap
ChainComplexMap ^ ZZ
ChainComplexMap ^ [...]
ChainComplexMap _ [...]
Hom(ChainComplexMap,Module)
Hom(Module,ChainComplexMap)
chainComplex Matrix [III.12.48] – make a small chain complex
dual ChainComplexMap
extend(ChainComplex,ChainComplex,Matrix)
map(ChainComplex,ChainComplex)
map(ChainComplex,ChainComplex,ChainComplexMap)
map(ChainComplex,ChainComplex,Function) [III.16.16] – make a
map of chain complexes
nullhomotopy ChainComplexMap
prune ChainComplexMap
resolution Matrix [III.12.52] – make a projective resolution
tensorAssociativity(ChainComplex,ChainComplex,ChainComplex)
transpose ChainComplexMap
Methods for using a chain complex map :
ChainComplexMap + RingElement
ChainComplexMap + ZZ
ChainComplexMap - RingElement
ChainComplexMap == ChainComplexMap
ChainComplexMap == RingElement
418
21. THING
ChainComplexMap == ZZ
ChainComplexMap _ ZZ [III.12.1] – get component
HH ChainComplexMap
HH^ZZ ChainComplexMap [III.12.2] – cohomology of a chain complex
map
HH_ZZ ChainComplexMap [III.12.3] – homology of a chain complex
map
RingElement * ChainComplexMap
RingElement + ChainComplexMap
RingElement - ChainComplexMap
RingElement == ChainComplexMap
ZZ * ChainComplexMap
ZZ + ChainComplexMap
ZZ == ChainComplexMap
coimage ChainComplexMap
cokernel ChainComplexMap
complete ChainComplexMap
components ChainComplexMap
cone ChainComplexMap
degree ChainComplexMap
image ChainComplexMap
isHomogeneous ChainComplexMap
kernel ChainComplexMap
net ChainComplexMap
ring ChainComplexMap
sum ChainComplexMap [III.12.41] – direct sum of the components of
a chain map
21.5.4.1.1. ChainComplexMap ** ChainComplexMap
f ** g – tensor product of two maps of chain complexes.
See also:
ChainComplexMap [III.21.5.4.1] – the class of all maps between chain
complexes
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: ChainComplexMap [III.21.5.4.1]
Class of argument 2: ChainComplexMap [III.21.5.4.1]
Class of typical returned value: ChainComplexMap [III.21.5.4.1]
21.5.4.2. CoherentSheaf
The type CoherentSheaf is a member of the class Type [III.21.5.4.11]. Each
object of class CoherentSheaf is called a coherent sheaf. Each coherent sheaf is also
a member of class MutableHashTable [III.21.5.4].
Making a coherent sheaf :
CoherentSheaf ** CoherentSheaf [III.21.5.4.2.1] – tensor product of
coherent sheaves
CoherentSheaf ++ CoherentSheaf [III.21.5.4.2.2] – direct sum of coherent sheaves
21.5. HASHTABLE
419
CoherentSheaf / CoherentSheaf [III.21.5.4.2.3] – quotient of coherent
sheaves
CoherentSheaf ZZ [III.21.5.4.2.4] – canonical twist of a coherent sheaf
Module ˜ [III.21.5.4.2.5] – make a coherent sheaf
Ring ˜ [III.21.5.4.2.6] – make the structure sheaf
cotangentSheaf ProjectiveVariety [III.17.2.1] – make the cotangent
sheaf
cotangentSheaf(ZZ,ProjectiveVariety) [III.17.2.2] – make an exterior
power of the cotangent sheaf
exteriorPower(ZZ,CoherentSheaf ) [III.21.5.4.2.7] – exterior power
sheaf [III.21.5.4.2.8] – make a coherent sheaf
sheaf Module [III.13.19] – make a coherent sheaf
sheaf Ring [III.10.22] – make the structure sheaf
Methods for using a coherent sheaf :
HH^ZZ CoherentSheaf [III.13.3] – coherent sheaf cohomology
annihilator CoherentSheaf
codim CoherentSheaf [III.21.5.4.2.9] – codimension of support
degrees CoherentSheaf [III.21.5.4.2.10] – get degrees of basis elements
expression CoherentSheaf
module CoherentSheaf [III.13.11] – get the module defining a coherent
sheaf
net CoherentSheaf
rank CoherentSheaf [III.21.5.4.2.11] – the rank of a coherent sheaf
ring CoherentSheaf [III.21.5.4.2.12] – get the coordinate ring under a
sheaf
variety CoherentSheaf [III.17.3] – get the variety under a sheaf
21.5.4.2.1. CoherentSheaf ** CoherentSheaf
F ** G – tensor product of coherent sheaves.
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Class of argument 2: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
21.5.4.2.2. CoherentSheaf ++ CoherentSheaf
F ++ G – direct sum of coherent sheaves.
Synopsis of use:
Operator: ++ [V.24.17]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Class of argument 2: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
21.5.4.2.3. CoherentSheaf / CoherentSheaf
F / G – quotient of coherent sheaves.
See also:
CoherentSheaf [III.21.5.4.2] – the class of all coherent sheaves
Synopsis of use:
420
21. THING
Operator: / [V.24.25]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Class of argument 2: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
21.5.4.2.4. CoherentSheaf ZZ
F(n) – twist a coherent sheaf F on a projective variety by the n-th power of
the hyperplane line bundle.
i1 : X = Proj(QQ[x,y,z])
o1 = Proj(QQ [x, y, z])
o1 : ProjectiveVariety
i2 : F = OO_X
1
o2 = sheaf((QQ [x, y, z]) )
o2 : CoherentSheaf
i3 : G = F(3)
1
o3 = sheaf((QQ [x, y, z]) )
o3 : CoherentSheaf
i4 : module G
1
o4 = (QQ [x, y, z])
o4 : QQ [x, y, z] - module, free
i5 : degrees oo
o5 = {{-3}}
o5 : List
Synopsis of use:
Operator: [V.24.1]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:51
CoherentSheaf ZZ := CoherentSheaf => (F,n) -> sheaf(F.module ...
21.5.4.2.5. Module ˜
M~ – produce the coherent sheaf on a projective variety X corresponding to a
homegeneous module M.
See also:
CoherentSheaf [III.21.5.4.2] – the class of all coherent sheaves
21.5. HASHTABLE
421
Synopsis of use:
Operator: ˜ [V.24.657]
Class of argument 1: Module [III.13]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:43
Module ~ := sheaf Module := CoherentSheaf => (M) -> sheaf(M, ...
21.5.4.2.6. Ring ˜
R~ – produce the structure sheaf on the projective variety Proj R.
i1 : R = QQ[x,y,z];
i2 : R~
1
o2 = sheaf(R )
o2 : CoherentSheaf
i3 : variety oo
o3 = Proj R
o3 : ProjectiveVariety
Synopsis of use:
Operator: ˜ [V.24.657]
Class of argument 1: Ring [III.10]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:44
Ring ~ := sheaf Ring := CoherentSheaf => (R) -> sheaf R^1
21.5.4.2.7. exteriorPower(ZZ,CoherentSheaf )
exteriorPower(i,F) – calculate the i-th exterior power of a coherent sheaf F.
Synopsis of use:
Operator: exteriorPower [V.24.284]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: CoherentSheaf [III.21.5.4.2]
21.5.4.2.8. sheaf
The function sheaf is a member of the class Function [III.18].
Class of returned value: CoherentSheaf [III.21.5.4.2] – the class of all coherent
sheavesWays to use sheaf :
sheaf Module [III.13.19] – make a coherent sheaf
sheaf Ring [III.10.22] – make the structure sheaf
sheaf(Module,Variety) [III.13.20] – make a coherent sheaf
21.5.4.2.9. codim CoherentSheaf
Synopsis of use:
Operator: codim [V.24.207]
422
21. THING
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:54
codim CoherentSheaf := (F) -> codim F.module
21.5.4.2.10. degrees CoherentSheaf
degrees F – produce a list of the degrees of the generators of the module
defining a coherent sheaf F.
Synopsis of use:
Operator: degrees [V.24.242]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:57
degrees CoherentSheaf := (F) -> degrees F.module
21.5.4.2.11. rank CoherentSheaf
Synopsis of use:
Operator: rank [V.24.508]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Code:
-- ../m2/varieties.m2:55
rank CoherentSheaf := (F) -> rank F.module
21.5.4.2.12. ring CoherentSheaf
ring F – produce the coordinate ring of the variety on which a coherent sheaf
F is defined.
Synopsis of use:
Operator: ring [III.10.5]
Class of argument 1: CoherentSheaf [III.21.5.4.2]
Class of typical returned value: Ring [III.10]
Code:
-- ../m2/varieties.m2:47
ring CoherentSheaf := (F) -> ring F.module
21.5.4.3. GradedModule
A new graded module can be made with ’M = new GradedModule’. The i-th
module can be installed with a statement like M#i=N, and can be retrieved with
an expression like M_i. The ground ring should be installed with a statement like
M.ring = R.
See also:
GradedModuleMap [III.21.5.4.4] – the class of all maps between graded
modules
The type GradedModule is a member of the class Type [III.21.5.4.11]. Each
object of class GradedModule is called a graded module. Each graded module is
also a member of class MutableHashTable [III.21.5.4].
Types of GradedModule :
ChainComplex [III.16] – the class of all chain complexes
Making a graded module :
GradedModule ** GradedModule
GradedModule ** Module
21.5. HASHTABLE
423
GradedModule ++ GradedModule
GradedModule ++ Module
GradedModule [...]
HH ChainComplex [III.16.13] – homology of a chain complex
Module ** GradedModule
Module ++ GradedModule
ambient GradedModule
coimage GradedModuleMap
cokernel GradedModuleMap
cover GradedModule
gradedModule (...)
gradedModule ChainComplex
gradedModule Module
gradedModule {...}
image GradedModuleMap
kernel GradedModuleMap
prune GradedModule
super GradedModule
Methods for using a graded module :
ChainComplex ** GradedModule [III.16.2] – tensor product
GradedModule ** ChainComplex [III.16.5] – tensor product
GradedModule == GradedModule
GradedModule _ ZZ
chainComplex GradedModule [III.16.7] – make a chain complex from
a graded module
complete GradedModule
components GradedModule
isDirectSum GradedModule
length GradedModule [III.21.5.4.3.1] – length of a graded module
map(GradedModule,GradedModule,Function)
net GradedModule
rank GradedModule
tensorAssociativity(GradedModule,GradedModule,GradedModule)
21.5.4.3.1. length GradedModule
Synopsis of use:
Operator: length [V.24.385]
Class of argument 1: GradedModule [III.21.5.4.3]
Code:
-- ../m2/gradedmodules.m2:23-25
length GradedModule := (M) -> (
s := spots M;
if #s === 0 then 0 else max s - min s)
21.5.4.4. GradedModuleMap
See also:
GradedModule [III.21.5.4.3] – the class of all graded modules
424
21. THING
The type GradedModuleMap is a member of the class Type [III.21.5.4.11]. Each
object of class GradedModuleMap is called a graded module map. Each graded
module map is also a member of class MutableHashTable [III.21.5.4].
Making a graded module map :
- GradedModuleMap
GradedModuleMap * GradedModuleMap
GradedModuleMap + GradedModuleMap
GradedModuleMap ++ GradedModuleMap
GradedModuleMap - GradedModuleMap
GradedModuleMap ^ ZZ
GradedModuleMap ^ [...]
GradedModuleMap _ [...]
HH ChainComplexMap
gradedModuleMap (...)
gradedModuleMap ModuleMap
gradedModuleMap {...}
map(GradedModule,GradedModule,Function)
prune GradedModuleMap
tensorAssociativity(GradedModule,GradedModule,GradedModule)
Methods for using a graded module map :
GradedModuleMap + RingElement
GradedModuleMap - RingElement
GradedModuleMap == GradedModuleMap
GradedModuleMap == RingElement
GradedModuleMap == ZZ
GradedModuleMap _ ZZ
RingElement * GradedModuleMap
RingElement + GradedModuleMap
RingElement - GradedModuleMap
RingElement == GradedModuleMap
ZZ * GradedModuleMap
ZZ == GradedModuleMap
coimage GradedModuleMap
cokernel GradedModuleMap
components GradedModuleMap
degree GradedModuleMap
image GradedModuleMap
kernel GradedModuleMap
net GradedModuleMap
21.5.4.5. IndexedVariableTable
These hash tables are used to hold the values of those indexed variables sharing
a given base name.
i1 : t_0
o1 = t
0
o1 : IndexedVariable
21.5. HASHTABLE
425
i2 : scan(3, i -> t#i = i^2)
i3 : t
o3 = t
o3 : IndexedVariableTable
i4 : peek t
o4 = IndexedVariableTable{0 => 0
}
1 => 1
2 => 4
Symbol => t
name => t
o4 : Net
See also:
IndexedVariable [III.21.1.4] – the class of all indexed variables
The type IndexedVariableTable is a member of the class Type [III.21.5.4.11].
Each object of class IndexedVariableTable is called an indexed variable table. Each
indexed variable table is also a member of class MutableHashTable [III.21.5.4].
Methods for using an indexed variable table :
IndexedVariableTable _ Thing
baseName IndexedVariableTable
expression IndexedVariableTable
precedence IndexedVariableTable
21.5.4.6. ModuleMap
This class is experimental, designed to support graded modules.
See also:
Matrix [III.12] – the class of all matrices
The type ModuleMap is a member of the class Type [III.21.5.4.11]. Each object
of class ModuleMap is called a module map. Each module map is also a member
of class MutableHashTable [III.21.5.4].
Types of ModuleMap :
Matrix [III.12] – the class of all matrices
Methods for using a module map :
gradedModuleMap ModuleMap
21.5.4.7. MonomialIdeal
See also:
engine [IV.22]
The type MonomialIdeal is a member of the class Type [III.21.5.4.11]. Each
object of class MonomialIdeal is called a monomial ideal. Each monomial ideal is
also a member of class MutableHashTable [III.21.5.4].
Making a monomial ideal :
MonomialIdeal * MonomialIdeal
MonomialIdeal + MonomialIdeal
MonomialIdeal : MonomialIdeal
426
21. THING
MonomialIdeal ^ ZZ
borel MonomialIdeal
minprimes MonomialIdeal
monomialIdeal Matrix [III.12.50] – make a monomial ideal
monomialIdeal(ZZ,Matrix) [III.12.51] – make a monomial ideal
radical MonomialIdeal
saturate(MonomialIdeal,MonomialIdeal)
Methods for using a monomial ideal :
MonomialIdeal == MonomialIdeal
MonomialIdeal == ZZ
ZZ == MonomialIdeal
codim MonomialIdeal
generators MonomialIdeal
isBorel MonomialIdeal
monomialIdeal MonomialIdeal [III.21.5.4.7.1] – make a monomial ideal
net MonomialIdeal
numgens MonomialIdeal
poincare MonomialIdeal
toString MonomialIdeal
21.5.4.7.1. monomialIdeal MonomialIdeal
monomialIdeal I – create a copy of a monomial ideal I.
Synopsis of use:
Operator: monomialIdeal [V.24.426]
Class of argument 1: MonomialIdeal [III.21.5.4.7]
Code:
-- ../m2/monideal.m2:43-46
monomialIdeal MonomialIdeal := I -> (
if instance(I, MonomialIdeal) then (
sendgg(ggPush I, ggcopy);
newMonomialIdeal ring I))
...
21.5.4.8. Resolution
These resolutions are internal engine objects not meant to be examined by the
user.
The type Resolution is a member of the class Type [III.21.5.4.11]. Each
object of class Resolution is called a resolution. Each resolution is also a member
of class MutableHashTable [III.21.5.4].
Methods for using a resolution :
generators(ZZ,Resolution)
getChangeMatrix(ZZ,Resolution)
leadTerm(ZZ,ZZ,Resolution)
mingens(ZZ,Resolution)
status Resolution
toString Resolution
21.5.4.9. RingElement
See also:
engine [IV.22]
21.5. HASHTABLE
427
The type RingElement is a member of the class Type [III.21.5.4.11]. Each
object of class RingElement is called a ring element. Each ring element is also a
member of class MutableHashTable [III.21.5.4].
Making a ring element :
- RingElement
Ideal _ ZZ
Matrix _ (...) [III.12.46] – get an entry
Ring _ String [III.10.10] – get a variable by name
Ring _ ZZ [III.10.11] – get a variable by number
Ring _ {...} [III.10.12] – make a monomial from a list of exponents
RingElement % GroebnerBasis
RingElement % RingElement
RingElement * RingElement
RingElement + RingElement
RingElement - RingElement
RingElement / RingElement
RingElement // RingElement
RingElement ^ ZZ
RingElement _ MonoidElement
RingElement _ RingElement [III.21.5.4.9.1] – get a coefficient
RingElement _ ZZ
RingMap RingElement
ZZ _ EngineRing
ZZ _ Ring [III.10.13]
contract(RingElement,RingElement)
det Matrix
diff(RingElement,RingElement)
gcd(RingElement,RingElement)
homogenize(RingElement,RingElement)
homogenize(RingElement,RingElement,{...})
leadCoefficient RingElement
leadCoefficient Vector
leadComponent Vector
leadTerm RingElement
leadTerm Vector
lift(RingElement,Ring)
lift(RingElement,RingElement)
promote(MonoidElement,Ring)
promote(MonoidElement,RingElement)
promote(QQ,RingElement)
promote(RingElement,Ring)
promote(RingElement,RingElement)
promote(ZZ,EngineRing)
pseudoRemainder(RingElement,RingElement)
random Ring [III.10.19] – random element of a ring
random(ZZ,Ring) [III.10.20] – a random ring element of a given degree
random({...},Ring) [III.10.21] – a random ring element of a given degree
someTerms(RingElement,ZZ,ZZ)
428
21. THING
substitute(RingElement,Matrix)
substitute(RingElement,Ring)
substitute(RingElement,{...})
trace Matrix
Methods for using a ring element :
ChainComplexMap + RingElement
ChainComplexMap - RingElement
ChainComplexMap == RingElement
GradedModuleMap + RingElement
GradedModuleMap - RingElement
GradedModuleMap == RingElement
Ideal : RingElement
Matrix % RingElement [III.12.44] – reduce the columns modulo of a
ring element
Matrix ** RingElement
Matrix + RingElement
Matrix ++ RingElement
Matrix - RingElement
Matrix // RingElement [III.12.45] – factor a map through a multiplication map
Matrix == RingElement
Matrix | RingElement
Matrix || RingElement
Module / RingElement
Module : RingElement
QQ % RingElement
QQ * RingElement
QQ + RingElement
QQ - RingElement
QQ / RingElement
QQ // RingElement
Ring / RingElement
RingElement % Ideal
RingElement % Matrix
RingElement % QQ
RingElement % ZZ
RingElement * ChainComplexMap
RingElement * GradedModuleMap
RingElement * Ideal
RingElement * Matrix
RingElement * Module
RingElement * QQ
RingElement * Vector
RingElement * ZZ
RingElement ** Matrix
RingElement ** RingElement
RingElement + ChainComplexMap
RingElement + GradedModuleMap
21.5. HASHTABLE
RingElement + Matrix
RingElement + QQ
RingElement + ZZ
RingElement ++ Matrix
RingElement ++ RingElement
RingElement ++ ZZ
RingElement - ChainComplexMap
RingElement - GradedModuleMap
RingElement - Matrix
RingElement - QQ
RingElement - ZZ
RingElement / QQ
RingElement / ZZ
RingElement // GroebnerBasis
RingElement // Matrix
RingElement // QQ
RingElement // ZZ
RingElement == ChainComplexMap
RingElement == GradedModuleMap
RingElement == Matrix
RingElement == RingElement
RingElement == ZZ
RingElement ? RingElement
RingElement | Matrix
RingElement | RingElement
RingElement || Matrix
RingElement || RingElement
ZZ % RingElement
ZZ * RingElement
ZZ + RingElement
ZZ ++ RingElement
ZZ - RingElement
ZZ / RingElement
ZZ // RingElement
ZZ == RingElement
annihilator RingElement
baseName RingElement
coefficients RingElement
coefficients({...},RingElement)
cokernel RingElement
content RingElement
contract(Matrix,RingElement)
contract(RingElement,Matrix)
contract(RingElement,Vector)
contract(Vector,RingElement)
degree RingElement
diff RingElement [III.21.5.4.9.2] – differentiate a ring element
diff(Matrix,RingElement)
429
430
21. THING
diff(RingElement,Matrix)
diff(RingElement,Vector)
diff(Vector,RingElement)
divideByVariable(Matrix,RingElement)
divideByVariable(Matrix,RingElement,ZZ)
exponents RingElement
expression RingElement
gcdCoefficients(RingElement,RingElement)
homogenize(Ideal,RingElement)
homogenize(Matrix,RingElement)
homogenize(Matrix,RingElement,{...})
homogenize(Module,RingElement)
homogenize(Module,RingElement,{...})
homogenize(Vector,RingElement)
homogenize(Vector,RingElement,{...})
ideal RingElement
image RingElement
index RingElement
isHomogeneous RingElement
isUnit RingElement
kernel RingElement
leadMonomial RingElement
lift(RingElement,QQ)
lift(RingElement,ZZ)
liftable(RingElement,Ring)
listForm RingElement
map(Module,Module,RingElement) [III.12.30] – make a map
map(Module,RingElement) [III.12.34] – make a map
net RingElement
promote(ZZ,RingElement)
quotient(Ideal,RingElement)
quotient(Module,RingElement)
saturate(Ideal,RingElement)
saturate(Module,RingElement)
size RingElement
standardForm RingElement
substitute(RingElement,Option)
terms RingElement
toString RingElement
21.5.4.9.1. RingElement _ RingElement
f_m – provide the coefficient of the monomial m in the polynomial f.
i1 : ZZ[y];
i2 : ((1+y)^5) _ (y^2)
o2 = 10
See also:
21.5. HASHTABLE
431
_ [V.24.151]
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: RingElement [III.21.5.4.9]
Class of argument 2: RingElement [III.21.5.4.9]
Class of typical returned value: RingElement [III.21.5.4.9]
21.5.4.9.2. diff RingElement
diff f – differentiate the ring element f with respect to the variables of its
ring.
Synopsis of use:
Operator: diff [V.24.251]
Class of argument 1: RingElement [III.21.5.4.9]
Code:
-- ../m2/matrix.m2:446
diff(RingElement)
:= f -> diff(vars ring f, f)
21.5.4.10. ScriptedFunctor
A scripted functor accepts a subscript or a superscript: the primary example
is HH [V.24.88].
See also:
subscript [V.24.571] – specify the function in a scripted functor for a
subscript
superscript [V.24.577] – specify the function in a scripted functor for a
superscript
argument [V.24.175] – specify the function in a scripted functor for an
argument
The type ScriptedFunctor is a member of the class Type [III.21.5.4.11]. Each
object of class ScriptedFunctor is called a scripted functor. Each scripted functor
is also a member of class MutableHashTable [III.21.5.4].
Methods for using a scripted functor :
ScriptedFunctor Thing
ScriptedFunctor ^ Thing
ScriptedFunctor _ Thing
Fixed objects of class ScriptedFunctor :
Ext [V.24.75] – compute an Ext module
HH [V.24.88] – general homology and cohomology functor
OO [V.24.110] – the structure sheaf
Tor [V.24.140] – compute a Tor module
id [V.24.344] – identity map
21.5.4.11. Type
Everything in the system is classified, and the class that a thing belongs to is
a type. A type is implemented as a hash table containing method functions for its
instances.
The list of objects of class Type known to the system is displayed below.
432
21. THING
The type Type is a member of the class Type [III.21.5.4.11]. Each object
of class Type is called a type. Each type is also a member of class MutableHashTable [III.21.5.4].
Types of Type :
HeaderType [III.21.5.4.11.1] – a class of lists with abbreviated constructors
MarkUpType [III.21.5.4.11.2] – the class of mark-up types used with
hypertext
Module [III.13] – the class of all modules
Monoid [III.21.5.4.11.3] – the class of all monoids
Ring [III.10] – the class of all rings
SelfInitializingType [III.21.5.4.11.4] – the class of all self initializing
types
WrapperType [III.21.5.4.11.5] – a class of lists with abbreviated constructors
Making a type :
basictype Thing
class Thing
parent Thing
Methods for using a type :
Type ? Type
ancestor(Type,Type)
documentation Type
instance(Thing,Type)
ring Type
Fixed objects of class Type :
AffineVariety [III.17.1] – the class of all affine varieties
Array [III.19.1] – class of all arrays – [...]
AssociativeExpression [III.21.1.3.4] – the class of associative expressions
BasicList [III.21.1] – the class of all basic lists
Boolean [III.21.2] – the class of Boolean values
ChainComplex [III.16] – the class of all chain complexes
ChainComplexMap [III.21.5.4.1] – the class of all maps between chain
complexes
CoherentSheaf [III.21.5.4.2] – the class of all coherent sheaves
Database [III.21.3] – the class of all database files
EmptyMarkUpType [III.21.5.4.11.2.1] – the class of empty mark-up
types used with hypertext
EngineRing [III.10.1] – the class of rings handled by the engine
Expression [III.21.1.3] – the class of all expressions
Field [III.10.2] – the class of all fields
File [III.20] – the class of all files
FractionField [III.10.1.1] – the class of all fraction fields
Function [III.18] – the class of all functions
GaloisField [III.10.1.2] – the class of all Galois fields
GeneralOrderedGroup [III.21.5.4.11.3.1.1.1] – the class of all ordered
free commutative groups
21.5. HASHTABLE
433
GeneralOrderedMonoid [III.21.5.4.11.3.1.1] – the class of all ordered
free commutative monoids
GradedModule [III.21.5.4.3] – the class of all graded modules
GradedModuleMap [III.21.5.4.4] – the class of all maps between graded
modules
GroebnerBasis [III.15] – the class of all Groebner bases
Handle [III.21.4] – the class of all handles for engine objects
HashTable [III.21.5] – the class of all hash tables
HeaderType [III.21.5.4.11.1] – a class of lists with abbreviated constructors
Ideal [III.11] – the class of all ideals
IndeterminateNumber [III.21.5.2] – the class of all indeterminate numbers
IndexedVariable [III.21.1.4] – the class of all indexed variables
IndexedVariableTable [III.21.5.4.5] – the class of indexed variable tables
InfiniteNumber [III.21.5.3] – the class of all infinite numbers
List [III.19.2] – class of all lists – {...}
Manipulator [III.21.1.5] – the class of all file manipulators
MarkUpList [III.21.1.6] – the class of mark-up lists used with hypertext
MarkUpType [III.21.5.4.11.2] – the class of mark-up types used with
hypertext
Matrix [III.12] – the class of all matrices
Module [III.13] – the class of all modules
ModuleMap [III.21.5.4.6] – the class of all maps between modules
Monoid [III.21.5.4.11.3] – the class of all monoids
MonoidElement [III.21.1.8] – the class of all monoid elements
MonomialIdeal [III.21.5.4.7] – the class of all monomial ideals handled
by the engine
MutableHashTable [III.21.5.4] – the class of all mutable hash tables
MutableList [III.21.1.9] – the class of all mutable lists
Net [III.21.6] – the class of all nets and strings
Nothing [III.21.7] – the empty class
OneExpression [III.21.1.3.9.1] – the class all one expressions
Option [III.21.1.10] – the class of all pairs x => y
OptionTable [III.21.5.5] – the class of hash tables for optional arguments
OrderedMonoid [III.21.5.4.11.3.1] – the class of all ordered monoids
PolynomialRing [III.10.1.3] – the class of all ordered monoid rings
Position [III.21.1.12] – the class of all file positions
ProductRing [III.10.3] – the class of all product rings
ProjectiveHilbertPolynomial [III.21.5.6] – the class of all Hilbert polynomials
ProjectiveVariety [III.17.2] – the class of all projective varieties
QuotientRing [III.10.1.4] – the class of all quotient rings
Resolution [III.21.5.4.8] – the class of all resolution computations
Ring [III.10] – the class of all rings
RingElement [III.21.5.4.9] – the class of all ring elements handled by the
engine
RingMap [III.14] – the class of all ring maps
434
21. THING
SchurRing [III.10.1.5] – the class of all Schur rings
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
SelfInitializingType [III.21.5.4.11.4] – the class of all self initializing
types
Sequence [III.19.3] – class of all sequences – (...)
Set [III.21.5.8.1] – the class of all sets
String [III.21.6.1] – the class of all strings
Symbol [III.21.10] – the class of all symbols
SymbolTable [III.21.5.7] – the class of all symbol tables
Tally [III.21.5.8] – the class of all tally results
Thing [III.21] – the class of all things
Time [III.21.1.14] – the class of all timing results
Type [III.21.5.4.11] – class of all types
Variety [III.17] – the class of all algebraic varieties
Vector [III.21.5.4.12] – the class of all elements of free modules which are
handled by the engine
VisibleList [III.19] – class of all visible lists
WrapperType [III.21.5.4.11.5] – a class of lists with abbreviated constructors
ZeroExpression [III.21.1.3.9.2] – the class of all zero expressions
21.5.4.11.1. HeaderType
These are the types X of lists which can be constructed by expressions of the
form X {a,b,c,...}. They also act on sequences.
i1 : X = new HeaderType of BasicList
o1 = X
o1 : HeaderType
i2 : X {a,b,c}
o2 = X{a, b, c}
o2 : X
See also:
WrapperType [III.21.5.4.11.5] – a class of lists with abbreviated constructors
SelfInitializingType [III.21.5.4.11.4] – the class of all self initializing
types
The type HeaderType is a member of the class Type [III.21.5.4.11]. Each
object of class HeaderType is called a header type. Each header type is also a
member of class Type [III.21.5.4.11].
Methods for using a header type :
HeaderType (...)
HeaderType {...}
Fixed objects of class HeaderType :
Adjacent [III.21.1.3.3] – the class of all adjacent expression pairs
BinaryOperation [III.21.1.3.5] – the class of all binary operation expressions
21.5. HASHTABLE
435
Divide [III.21.1.3.6] – the class of all divide expressions
DoubleArrow [III.21.1.3.7]
Entity [III.21.5.1] – the class of all entities
Equation [III.21.1.3.4.1] – the class of all equation expressions
FunctionApplication [III.21.1.3.8] – the class of all function application
expressions
MatrixExpression [III.21.1.3.10] – the class of all matrix expressions
Power [III.21.1.3.13] – the class of all power expressions
RowExpression [III.21.1.3.14] – the class of all matrix expressions
SparseMonomialVectorExpression [III.21.1.3.15] – the class of all sparse
monomial vector expressions
SparseVectorExpression [III.21.1.3.16] – the class of all sparse vector
expressions
Subscript [III.21.1.3.17] – the class of all subscript expressions
Superscript [III.21.1.3.18] – the class of all superscript expressions
Table [III.21.1.3.19] – the class of all table expressions
21.5.4.11.2. MarkUpType
Intended for internal use only.
See also:
EmptyMarkUpType [III.21.5.4.11.2.1] – the class of empty mark-up
types used with hypertext
The type MarkUpType is a member of the class Type [III.21.5.4.11]. Each
object of class MarkUpType is called a mark-up type. Each mark-up type is also a
member of class Type [III.21.5.4.11].
Types of MarkUpType :
EmptyMarkUpType [III.21.5.4.11.2.1] – the class of empty mark-up
types used with hypertext
Methods for using a mark-up type :
MarkUpType Thing
MarkUpType \ {...}
MarkUpType {...}
html MarkUpType
{...} / MarkUpType
Fixed objects of class MarkUpType :
BIG [III.21.1.6.1] – HTML BIG item
BLOCKQUOTE [III.21.1.6.2] – HTML BLOCKQUOTE item
BODY [III.21.1.6.3] – HTML BODY item
BOLD [III.21.1.6.4] – HTML BOLD item
CENTER [III.21.1.6.6] – HTML CENTER item
CITE [III.21.1.6.7] – HTML CITE item
CODE [III.21.1.6.8] – HTML CODE item
DFN [III.21.1.6.9] – HTML DFN item
DL [III.21.1.6.10] – HTML DL item
EM [III.21.1.6.11] – HTML EM item
EXAMPLE [III.21.1.6.12] – HTML EXAMPLE item
ExampleTABLE [III.21.1.6.13] – hypertext list of examples
H1 [III.21.1.6.14] – HTML H1 item
436
21. THING
H2 [III.21.1.6.15] – HTML H2 item
H3 [III.21.1.6.16] – HTML H3 item
H4 [III.21.1.6.17] – HTML H4 item
H5 [III.21.1.6.18] – HTML H5 item
H6 [III.21.1.6.19] – HTML H6 item
HEAD [III.21.1.6.20] – HTML HEAD item
HEADLINE [III.21.1.6.21] – make a documentation HEADLINE item
HREF [III.21.1.6.23] – HTML link
HTML [III.21.1.6.24] – HTML item
IMG [III.21.1.6.25] – HTML IMG item
ITALIC [III.21.1.6.26] – HTML italic font
KBD [III.21.1.6.27] – HTML KBD item
LISTING [III.21.1.6.28] – HTML LISTING item
LITERAL [III.21.1.6.29] – hypertext literal text
MENU [III.21.1.6.30] – HTML MENU item
NL [III.21.1.6.31] – HTML NL item
OL [III.21.1.6.33] – HTML OL item
PARA [III.21.1.6.34] – paragraph separator
PRE [III.21.1.6.35] – preformatted text
SAMP [III.21.1.6.36] – HTML SAMP item
SEQ [III.21.1.6.37] – hypertext sequence
SHIELD [III.21.1.6.38] – shield menu items so they don’t produce subsections
SMALL [III.21.1.6.39] – HTML SMALL item
STRONG [III.21.1.6.40] – HTML STRONG item
SUB [III.21.1.6.41] – HTML subscript
SUP [III.21.1.6.42] – HTML superscript
TABLE [III.21.1.6.43] – hypertext table
TEX [III.21.1.6.44] – hypertext TEX item
TITLE [III.21.1.6.45] – hypertext title
TO [III.21.1.6.46] – hypertext documentation link
TOH
TT [III.21.1.6.47] – HTML TT item
UL [III.21.1.6.48] – HTML UL item
UNDERLINE [III.21.1.6.49] – HTML underlining
VAR [III.21.1.6.50] – HTML VAR item
XMP [III.21.1.6.51] – HTML XMP item
optionalTO
21.5.4.11.2.1. EmptyMarkUpType
The type EmptyMarkUpType is a member of the class Type [III.21.5.4.11]. Each
object of class EmptyMarkUpType is called an empty mark-up type. Each empty
mark-up type is also a member of class MarkUpType [III.21.5.4.11.2].
Methods for using an empty mark-up type :
EmptyMarkUpType Thing
EmptyMarkUpType {...}
html EmptyMarkUpType
Fixed objects of class EmptyMarkUpType :
21.5. HASHTABLE
437
BR [III.21.1.6.5] – line break
HR [III.21.1.6.22] – horizontal rule
NOINDENT [III.21.1.6.32] – cancel hypertext indentation
21.5.4.11.3. Monoid
A monoid is a set with a multiplicative operation on it and an identity element.
A typical monoid is the set of monomials in a polynomial ring, which we consider
to be created before the polynomial ring is created.
The type Monoid is a member of the class Type [III.21.5.4.11]. Each object
of class Monoid is called a monoid. Each monoid is also a member of class Type
[III.21.5.4.11].
Types of Monoid :
OrderedMonoid [III.21.5.4.11.3.1] – the class of all ordered monoids
Making a monoid :
Monoid ** Monoid [III.21.5.4.11.3.2] – tensor product of monoids
degreesMonoid GeneralOrderedMonoid
degreesMonoid ZZ
monoid Ring [III.10.17] – get the monoid from a monoid ring
monoid [...] [III.19.1.1] – make a polynomial ring or monoid ring
tensor(Monoid,Monoid)
Methods for using a monoid :
Monoid _ ZZ [III.21.1.8.1] – get a generator of a monoid
Monoid _ {...}
ZZ _ Monoid [III.21.1.8.2] – get unit element
options Monoid [III.21.5.4.11.3.3] – get values used for optional arguments
21.5.4.11.3.1. OrderedMonoid
An ordered monoid is a multiplicative monoid together with an ordering of
its elements. The ordering is required to be compatible with the multiplication
in the sense that if x < y then x z < y z. The class of all ordered monomials is
OrderedMonoid [III.21.5.4.11.3.1].
The reason for making a separate class for ordered monoids is that monoid rings
can be implemented more efficiently for them - an element of the monoid ring can
be stored as a sorted list, each element of which is a pair consisting of an element
of the monoid and a coefficient. See PolynomialRing [III.10.1.3].
A free commutative ordered monoid can be created with monoid [V.24.424].
See also:
Monoid [III.21.5.4.11.3] – the class of all monoids
group [V.24.332] – make a group (monoid with inverses)
The type OrderedMonoid is a member of the class Type [III.21.5.4.11]. Each
object of class OrderedMonoid is called an ordered monoid. Each ordered monoid
is also a member of class Monoid [III.21.5.4.11.3].
Types of OrderedMonoid :
GeneralOrderedMonoid [III.21.5.4.11.3.1.1] – the class of all ordered
free commutative monoids
Methods for using an ordered monoid :
Ring OrderedMonoid [III.10.1.3.1] – make a polynomial ring
438
21. THING
degreeLength OrderedMonoid
21.5.4.11.3.2. GeneralOrderedMonoid
This is the class of free monoids that can be handled by the engine [IV.22]. Elements of such monoids are implemented as instances of MonoidElement [III.21.1.8].
See also:
monoid [V.24.424] – make a monoid
The type GeneralOrderedMonoid is a member of the class Type [III.21.5.4.11].
Each object of class GeneralOrderedMonoid is called a general ordered monoid.
Each general ordered monoid is also a member of class OrderedMonoid [III.21.5.4.11.3.1].
Types of GeneralOrderedMonoid :
GeneralOrderedGroup [III.21.5.4.11.3.1.1.1] – the class of all ordered
free commutative groups
Methods for using a general ordered monoid :
degreeLength GeneralOrderedMonoid
degreesMonoid GeneralOrderedMonoid
expression GeneralOrderedMonoid
generators GeneralOrderedMonoid
net GeneralOrderedMonoid
numgens GeneralOrderedMonoid
options GeneralOrderedMonoid
stats GeneralOrderedMonoid
toString GeneralOrderedMonoid
vars GeneralOrderedMonoid
21.5.4.11.3.3. GeneralOrderedGroup
This is the class of free commutative groups that can be handled by the engine
[IV.22].
See also:
group [V.24.332] – make a group (monoid with inverses)
Degrees [III.10.1.3.2.3] – specify the degrees
The type GeneralOrderedGroup is a member of the class Type [III.21.5.4.11].
Each object of class GeneralOrderedGroup is called a general ordered group. Each
general ordered group is also a member of class GeneralOrderedMonoid [III.21.5.4.11.3.1.1].
Methods for using a general ordered group :
generators GeneralOrderedGroup
toString GeneralOrderedGroup
vars GeneralOrderedGroup
21.5.4.11.3.4. Monoid ** Monoid
M ** N – tensor product of monoids.
For complete documentation, see tensor [V.24.609].
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Monoid [III.21.5.4.11.3]
Class of argument 2: Monoid [III.21.5.4.11.3]
Class of typical returned value: Monoid [III.21.5.4.11.3]
Code:
21.5. HASHTABLE
439
-- ../m2/ofcm.m2:416
Monoid ** Monoid := Monoid => (M,N) -> tensor(M,N)
21.5.4.11.3.5. options Monoid
options M – returns the options used when the monoid M was created.
Synopsis of use:
Operator: options [III.21.5.5.1]
Class of argument 1: Monoid [III.21.5.4.11.3]
Class of typical returned value: OptionTable [III.21.5.5]
Code:
-- ../m2/orderedmonoidrings.m2:8
options Monoid := x -> null
21.5.4.11.4. SelfInitializingType
A self initializing type X will produce an instance of X from initial data v with
the expression X v.
i1 : X = new SelfInitializingType of BasicList
o1 = X
o1 : SelfInitializingType
i2 : x = X {1,2,3}
o2 = X{1, 2, 3}
o2 : X
i3 : class x
o3 = X
o3 : SelfInitializingType
Command [III.21.1.2] is an example of a self initializing type.
See also:
HeaderType [III.21.5.4.11.1] – a class of lists with abbreviated constructors
WrapperType [III.21.5.4.11.5] – a class of lists with abbreviated constructors
The type SelfInitializingType is a member of the class Type [III.21.5.4.11].
Each object of class SelfInitializingType is called a self initializing type. Each self
initializing type is also a member of class Type [III.21.5.4.11].
Methods for using a self initializing type :
SelfInitializingType Thing
SelfInitializingType \ {...}
{...} / SelfInitializingType
Fixed objects of class SelfInitializingType :
Command [III.21.1.2] – the class of all commands
Eliminate [III.10.1.3.2.1.5] – elimination ordering
MinorsComputation [III.21.1.7] – the class of all minors computations
440
21. THING
PfaffiansComputation [III.21.1.11] – the class of all Pfaffians computations
ProductOrder [III.10.1.3.2.1.6] – product ordering
PushforwardComputation [III.21.1.13] – a type of list used internally
by pushForward1
21.5.4.11.5. WrapperType
These are the types X of lists which can be constructed by expressions of the
form X {a,b,c,...}, or, for lists of length one, by an expression of the form X a.
They also act on sequences.
i1 : X = new WrapperType of BasicList
o1 = X
o1 : WrapperType
i2 : X {a,b,c}
o2 = X{a, b, c}
o2 : X
i3 : X a
o3 = X{a}
o3 : X
See also:
HeaderType [III.21.5.4.11.1] – a class of lists with abbreviated constructors
SelfInitializingType [III.21.5.4.11.4] – the class of all self initializing
types
The type WrapperType is a member of the class Type [III.21.5.4.11]. Each
object of class WrapperType is called a wrapper type. Each wrapper type is also a
member of class Type [III.21.5.4.11].
Methods for using a wrapper type :
WrapperType (...)
WrapperType Thing
WrapperType {...}
Fixed objects of class WrapperType :
Holder [III.21.1.3.9] – the class of all holder expressions
Minus [III.21.1.3.11] – the class of all minus expressions
NonAssociativeProduct [III.21.1.3.12] – the class of all nonassociative
product expressions
Product [III.21.1.3.4.2] – the class of all product expressions
Sum [III.21.1.3.4.3] – the class of all sum expressions
21.5.4.12. Vector
If R is a ring handled by the engine, and M is a free module over R, then M is a
subclass of Vector.
See also:
21.5. HASHTABLE
441
engine [IV.22]
Module [III.13] – the class of all modules
The type Vector is a member of the class Type [III.21.5.4.11]. Each object
of class Vector is called a vector. Each vector is also a member of class MutableHashTable [III.21.5.4].
Making a vector :
- Vector
Matrix * Vector
Matrix _ ZZ [III.12.47] – get a column from a matrix
Module _ ZZ [III.13.17] – get a generator
RingElement * Vector
RingMap Vector
Vector + Vector
Vector - Vector
ZZ * Vector
ZZ _ Module
homogenize(Vector,RingElement)
homogenize(Vector,RingElement,{...})
substitute(Vector,Matrix)
substitute(Vector,Ring)
substitute(Vector,{...})
Methods for using a vector :
Module / Vector
Vector == Vector
Vector == ZZ
Vector _ ZZ [III.21.5.4.12.1] – get a component
ZZ == Vector
components Vector
contract(Matrix,Vector)
contract(RingElement,Vector)
contract(Vector,Matrix)
contract(Vector,RingElement)
contract(Vector,Vector)
degree Vector
diff(Matrix,Vector)
diff(RingElement,Vector)
diff(Vector,Matrix)
diff(Vector,RingElement)
diff(Vector,Vector)
expression Vector
isHomogeneous Vector
leadCoefficient Vector
leadComponent Vector
leadMonomial Vector
leadTerm Vector
net Vector
new Vector from {...}
ring Vector
442
21. THING
saturate Vector
substitute(Vector,Option)
toString Vector
21.5.4.12.1. Vector _ ZZ
v_i – produce the i-th entry of a vector or module element v.
i1 : R = ZZ/101[a..f]
o1 = R
o1 : PolynomialRing
i2 : v = vector {a,b,c}
o2 = a*<0> + b*<1> + c*<2>
3
o2 : R
i3 : v_1
o3 = b
o3 : R
See also:
_ [V.24.151]
Synopsis of use:
Operator: _ [V.24.151]
Class of argument 1: Vector [III.21.5.4.12]
Class of argument 2: ZZ [III.21.11]
Code:
-- ../m2/modules.m2:242-248
Vector _ ZZ := (v,i) -> (
M := class v;
R := ring M;
n := numgens ambient M;
if i < 0 or i >= n then error "subscript out of range f ...
sendgg( ggPush v, ggINT, gg i, ggelem);
new R)
21.5.5. OptionTable
See also:
==> [V.24.41] – a binary operator
The type OptionTable is a member of the class Type [III.21.5.4.11]. Each
object of class OptionTable is called an option table. Each option table is also a
member of class HashTable [III.21.5].
Making an option table :
options [III.21.5.5.1] – get options
options Function [III.18.18] – get optional arguments and defaults
Methods for using an option table :
OptionTable ==> Function [III.18.1] – declare option names and default
values
21.5. HASHTABLE
443
21.5.5.1. options
The function options is a member of the class Function [III.18].
Class of returned value: OptionTable [III.21.5.5] – the class of hash tables for
optional argumentsWays to use options :
options (...)
options Function [III.18.18] – get optional arguments and defaults
options GeneralOrderedMonoid
options Monoid [III.21.5.4.11.3.3] – get values used for optional arguments
options PolynomialRing
options QuotientRing
options Ring [III.10.18] – get values used for optional arguments
21.5.6. ProjectiveHilbertPolynomial
For convenience, these polynomials are expressed in terms of the Hilbert polynomials of projective space.
The functions degree [V.24.240] and dim [V.24.253] are designed so they correspond the degree and dimension of the algebraic variety that may have been used
to produce the Hilbert polynomial.
i1 : Z = Proj(QQ[x_0..x_12]/(x_0^3+x_12^3))
QQ [x , x , x , x , x , x , x , x , x , x , x , x ...
0
1
2
3
4
5
6
7
8
9
10
...
o1 = Proj(-------------------------------------------------- ...
3
3
x + x
0
12
o1 : ProjectiveVariety
i2 : hilbertPolynomial Z
o2 = P - 3*P
+ 3*P
9
10
11
o2 : ProjectiveHilbertPolynomial
The type ProjectiveHilbertPolynomial is a member of the class Type [III.21.5.4.11].
Each object of class ProjectiveHilbertPolynomial is called a projective Hilbert polynomial. Each projective Hilbert polynomial is also a member of class HashTable
[III.21.5].
Making a projective Hilbert polynomial :
- ProjectiveHilbertPolynomial
ProjectiveHilbertPolynomial + ProjectiveHilbertPolynomial
ProjectiveHilbertPolynomial - ProjectiveHilbertPolynomial
ZZ * ProjectiveHilbertPolynomial
diff ProjectiveHilbertPolynomial [III.21.5.6.1] – differentiate
diff(ProjectiveHilbertPolynomial,ZZ) [III.21.5.6.2] – differentiate
hilbertPolynomial [III.21.5.6.3] – compute Hilbert polynomial
hilbertPolynomial Module
hilbertPolynomial Ring
444
21. THING
hilbertPolynomial Variety
projectiveHilbertPolynomial ZZ
projectiveHilbertPolynomial(ZZ,ZZ)
Methods for using a projective Hilbert polynomial :
ProjectiveHilbertPolynomial == ProjectiveHilbertPolynomial
ProjectiveHilbertPolynomial ZZ [III.21.5.6.4] – value of polynomial
degree ProjectiveHilbertPolynomial
dim ProjectiveHilbertPolynomial
euler ProjectiveHilbertPolynomial
expression ProjectiveHilbertPolynomial
net ProjectiveHilbertPolynomial
21.5.6.1. diff ProjectiveHilbertPolynomial
diff P – compute the difference polynomial.
Synopsis of use:
Operator: diff [V.24.251]
Class of argument 1: ProjectiveHilbertPolynomial [III.21.5.6]
Class of typical returned value: ProjectiveHilbertPolynomial [III.21.5.6]
21.5.6.2. diff(ProjectiveHilbertPolynomial,ZZ)
diff(P,i) – compute the i-th difference polynomial
Synopsis of use:
Operator: diff [V.24.251]
Class of argument 1: ProjectiveHilbertPolynomial [III.21.5.6]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: ProjectiveHilbertPolynomial [III.21.5.6]
Code:
-- ../m2/modules2.m2:231-235
diff(ProjectiveHilbertPolynomial,ZZ) := ProjectiveHilbertPol ...
new ProjectiveHilbertPolynomial from select(
apply(pairs P, (n,c) -> (n-i,c)),
(n,c) -> n >= 0
))
21.5.6.3. hilbertPolynomial
hilbertPolynomial M – the Hilbert polynomial of the module M as a polynomial in T.
The function hilbertPolynomial is a member of the class Function [III.18].
Class of returned value: ProjectiveHilbertPolynomial [III.21.5.6] – the class
of all Hilbert polynomialsWays to use hilbertPolynomial :
hilbertPolynomial Ideal
hilbertPolynomial Module
hilbertPolynomial Ring
hilbertPolynomial Variety
Optional arguments :
hilbertPolynomial(..., Projective => ...)
21.5.6.4. ProjectiveHilbertPolynomial ZZ
P i – the value of a projective Hilbert polynomial P at an integer i.
21.5. HASHTABLE
445
i1 : P = projectiveHilbertPolynomial 2
o1 = P
2
o1 : ProjectiveHilbertPolynomial
i2 : apply(0 .. 12, i -> P i)
o2 = (1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91)
o2 : Sequence
See also:
ProjectiveHilbertPolynomial [III.21.5.6] – the class of all Hilbert polynomials
Synopsis of use:
Operator: [V.24.1]
Class of argument 1: ProjectiveHilbertPolynomial [III.21.5.6]
Class of argument 2: ZZ [III.21.11]
21.5.7. SymbolTable
In a symbol table, each key is string containing the name of a symbol, and the
corresponding value is the symbol itself.
See also:
Symbol [III.21.10] – the class of all symbols
The type SymbolTable is a member of the class Type [III.21.5.4.11]. Each
object of class SymbolTable is called a symbol table. Each symbol table is also a
member of class HashTable [III.21.5].
21.5.8. Tally
Tally – a class designed to hold tally results, i.e., multisets.
The type Tally is a member of the class Type [III.21.5.4.11]. Each object of
class Tally is also a member of class HashTable [III.21.5].
Types of Tally :
Set [III.21.5.8.1] – the class of all sets
Making an object of class Tally :
Tally ** Tally [III.21.5.8.2] – Cartesian product of tallies
Tally + Tally [III.21.5.8.3] – union of tallies
Tally - Tally [III.21.5.8.4] – difference of tallies
tally (...)
tally {...}
Methods for using an object of class Tally :
Tally ? Tally [III.21.5.8.5] – comparison of tallies
Tally _ Thing [III.21.5.8.6] – get a count from a tally
net Tally
product Tally [III.21.5.8.7] – product of elements
sum Tally [III.21.5.8.8] – sum of elements
toString Tally
446
21. THING
21.5.8.1. Set
The type Set is a member of the class Type [III.21.5.4.11]. Each object of
class Set is also a member of class Tally [III.21.5.8].
Making an object of class Set :
Set * Set [III.21.5.8.1.1] – intersection of sets
Set ** Set [III.21.5.8.1.2] – Cartesian product
Set + Set [III.21.5.8.1.3] – union
Set ++ Set [III.21.5.8.1.4] – disjoint union of sets
Set - Set [III.21.5.8.1.5] – set difference
new Set from {...}
set (...)
set {...}
Methods for using an object of class Set :
Set #? Thing [III.21.2.3] – test set membership
isSubset((...),Set)
isSubset(Set,(...))
isSubset(Set,Set) [III.21.2.24] – whether something is a subset of another
isSubset(Set,{...})
isSubset({...},Set)
member(Thing,Set)
net Set
product Set [III.21.5.8.1.6] – product of elements
subsets Set [III.21.5.8.1.7] – produce all the subsets
subsets(Set,ZZ) [III.21.5.8.1.8] – produce all the subsets
sum Set [III.21.5.8.1.9] – sum of elements
toList Set [III.19.2.3] – list of elements
toString Set
21.5.8.1.1. Set * Set
i1 : set {1,2,3} * set {2,3,4}
o1 = Set {2, 3}
o1 : Set
Synopsis of use:
Operator: * [V.24.14]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: Set [III.21.5.8.1]
Class of typical returned value: Set [III.21.5.8.1]
Code:
-- ../m2/set.m2:47-51
Set * Set := Set => (x,y) -> (
if # x < # y
then set select(keys x, k -> y#?k)
else set select(keys y, k -> x#?k)
)
21.5.8.1.2. Set ** Set
X ** Y – form the Cartesian product of two sets.
21.5. HASHTABLE
447
Its elements are the sequences (x,y), where x is an element of X, and y is an
element of Y.
i1 : set {1,2} ** set {a,b,c}
o1 = Set {(2, b), (1, c), (2, c), (1, a), (2, a), (1, b)}
o1 : Set
See also:
** [V.24.15] – a binary operator, usually used for tensor product
Set [III.21.5.8.1] – the class of all sets
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: Set [III.21.5.8.1]
Class of typical returned value: Set [III.21.5.8.1]
Next more general method: Tally ** Tally [III.21.5.8.2] – Cartesian product of tallies
Code:
-- ../m2/set.m2:45
Set ** Set := Set => (x,y) -> combine(x,y,identity,(i,j)->i, ...
21.5.8.1.3. Set + Set
s + t – union of two sets
Synopsis of use:
Operator: + [V.24.16]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: Set [III.21.5.8.1]
Class of typical returned value: Set [III.21.5.8.1]
Next more general method: Tally + Tally [III.21.5.8.3] – union of tallies
Code:
-- ../m2/set.m2:43
Set + Set := Set => (x,y) -> merge(x,y,(i,j)->i)
21.5.8.1.4. Set ++ Set
i1 : set {a,b,c} ++ set {b,c,d}
o1 = Set {(1, c), (1, d), (0, a), (0, b), (1, b), (0, c)}
o1 : Set
Synopsis of use:
Operator: ++ [V.24.17]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: Set [III.21.5.8.1]
Class of typical returned value: Set [III.21.5.8.1]
Code:
-- ../m2/set.m2:44
Set ++ Set := Set => (x,y) -> applyKeys(x,i->(0,i)) + applyK ...
21.5.8.1.5. Set - Set
x - y – the difference of two sets.
448
21. THING
See also:
Set [III.21.5.8.1] – the class of all sets
- [V.24.19] – a binary operator, usually used for subtraction
Synopsis of use:
Operator: - [V.24.19]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: Set [III.21.5.8.1]
Class of typical returned value: Set [III.21.5.8.1]
Next more general method: Tally - Tally [III.21.5.8.4] – difference of
tallies
Code:
-- ../m2/set.m2:52
Set - Set := Set => (x,y) -> applyPairs(x, (i,v) -> if not y ...
21.5.8.1.6. product Set
product v – yields the product of the elements in the set v.
i1 : a = set select(1..50, isPrime)
o1 = Set {2, 3, 5, 37, 7, 41, 43, 11, 13, 47, 17, 19, 23, 29 ...
o1 : Set
i2 : product a
o2 = 614889782588491410
See also:
product [V.24.486]
Synopsis of use:
Operator: product [V.24.486]
Class of argument 1: Set [III.21.5.8.1]
Code:
-- ../m2/set.m2:54
product Set := s -> product toList s
21.5.8.1.7. subsets Set
subsets s – yields a list of the subsets of the set s.
i1 : subsets set {a,b,c}
o1 = Set {{a, b}, {a, c}, {}, {b, c}, {a}, {b}, {c}, {a, b,
o1 : Set
See also:
subsets [V.24.216.2] – produce all the subsets
Synopsis of use:
Operator: subsets [V.24.216.2]
Class of argument 1: Set [III.21.5.8.1]
Code:
-- ../m2/combinatorics.m2:18
subsets Set := x -> set subsets toList x
...
21.5. HASHTABLE
449
21.5.8.1.8. subsets(Set,ZZ)
subsets(s,j) – yields a list of those subsets of the list or set s which have j
elements.
i1 : subsets(set {a,b,c},2)
o1 = {Set {a, b}, Set {a, c}, Set {b, c}}
o1 : List
See also:
subsets [V.24.216.2] – produce all the subsets
Synopsis of use:
Operator: subsets [V.24.216.2]
Class of argument 1: Set [III.21.5.8.1]
Class of argument 2: ZZ [III.21.11]
Code:
-- ../m2/combinatorics.m2:16
subsets(Set,ZZ) := (s,j) -> apply(subsets(toList s, j), set)
21.5.8.1.9. sum Set
sum v – yields the sum of the elements in the set v.
i1 : a = set{1,100,10000}
o1 = Set {10000, 100, 1}
o1 : Set
i2 : sum a
o2 = 10101
See also:
sum [V.24.575] – compute the sum
Synopsis of use:
Operator: sum [V.24.575]
Class of argument 1: Set [III.21.5.8.1]
Code:
-- ../m2/set.m2:53
sum Set := s -> sum toList s
21.5.8.2. Tally ** Tally
x ** y – produces the Cartesian product of two tallies.
One of the arguments may be a Set [III.21.5.8.1].
i1 : x = tally {a,a,b}
o1 = Tally{a => 2}
b => 1
o1 : Tally
i2 : y = tally {1,2,2,2}
450
21. THING
o2 = Tally{1 => 1}
2 => 3
o2 : Tally
i3 : x ** y
o3 = Tally{(a,
(a,
(b,
(b,
1)
2)
1)
2)
=>
=>
=>
=>
2}
6
1
3
o3 : Tally
See also:
Tally [III.21.5.8] – the class of all tally results
tally [V.24.216.3] – tally the elements of a list
Synopsis of use:
Operator: ** [V.24.15]
Class of argument 1: Tally [III.21.5.8]
Class of argument 2: Tally [III.21.5.8]
Class of typical returned value: Tally [III.21.5.8]
Code:
-- ../m2/set.m2:14
Tally ** Tally := Tally => (x,y) -> combine(x,y,identity,tim ...
21.5.8.3. Tally + Tally
x + y – produces the union of two tallies.
One of the arguments may be a Set [III.21.5.8.1].
i1 : x = tally {a,a,a,b,b,c}
o1 = Tally{a => 3}
b => 2
c => 1
o1 : Tally
i2 : y = tally {b,c,c,d,d,d}
o2 = Tally{b => 1}
c => 2
d => 3
o2 : Tally
i3 : x + y
o3 = Tally{a
b
c
d
=>
=>
=>
=>
3}
3
3
3
o3 : Tally
See also:
Tally [III.21.5.8] – the class of all tally results
tally [V.24.216.3] – tally the elements of a list
21.5. HASHTABLE
451
Synopsis of use:
Operator: + [V.24.16]
Class of argument 1: Tally [III.21.5.8]
Class of argument 2: Tally [III.21.5.8]
Class of typical returned value: Tally [III.21.5.8]
Code:
-- ../m2/set.m2:23
Tally + Tally := Tally => (x,y) -> merge(x,y,plus)
21.5.8.4. Tally - Tally
x - y – produces the difference of two tallies.
i1 : tally {a,a,b,c} - tally {c,d,d}
o1 = Tally{a => 2 }
b => 1
d => -2
o1 : Tally
See also:
Tally [III.21.5.8] – the class of all tally results
Synopsis of use:
Operator: - [V.24.19]
Class of argument 1: Tally [III.21.5.8]
Class of argument 2: Tally [III.21.5.8]
Class of typical returned value: Tally [III.21.5.8]
21.5.8.5. Tally ? Tally
x ? y – compares two tallies, returning symbol <, symbol >, symbol ==, or
incomparable [V.24.349].
See also:
Tally [III.21.5.8] – the class of all tally results
Synopsis of use:
Operator: ? [V.24.46]
Class of argument 1: Tally [III.21.5.8]
Class of argument 2: Tally [III.21.5.8]
Next more general method: Thing ? Thing – comparison operator
Code:
-- ../m2/set.m2:16-21
Tally ? Tally := (x,y) -> (
w := values (x-y);
if #w === 0 then symbol ==
else if all(w,i -> i>0) then symbol >
else if all(w,i -> i<0) then symbol <
else incomparable)
21.5.8.6. Tally _ Thing
t_x – returns the number of times x is counted by t.
See also:
Tally [III.21.5.8] – the class of all tally results
Synopsis of use:
452
21. THING
Operator: _ [V.24.151]
Class of argument 1: Tally [III.21.5.8]
Class of argument 2: Thing [III.21]
Code:
-- ../m2/set.m2:12
Tally _ Thing := (a,b) -> if a#?b then a#b else 0
21.5.8.7. product Tally
product v – yields the product of the elements in the tally v.
i1 : a = tally{2,2,2,2,2,3,3,3,5,5}
o1 = Tally{2 => 5}
3 => 3
5 => 2
o1 : Tally
i2 : product a
o2 = 21600
See also:
product [V.24.486]
Synopsis of use:
Operator: product [V.24.486]
Class of argument 1: Tally [III.21.5.8]
Code:
-- ../m2/set.m2:30
product(Tally) := (w) -> product(pairs w, (k,v) -> k^v)
21.5.8.8. sum Tally
sum v – yields the sum of the elements in the tally v.
i1 : a = tally{1,1,1,1,1,10,10,10,100,100}
o1 = Tally{1 => 5 }
10 => 3
100 => 2
o1 : Tally
i2 : sum a
o2 = 235
See also:
sum [V.24.575] – compute the sum
Synopsis of use:
Operator: sum [V.24.575]
Class of argument 1: Tally [III.21.5.8]
Code:
-- ../m2/set.m2:29
sum(Tally) := (w) -> sum(pairs w, (k,v) -> v * k)
21.6. NET
453
21.5.9. HashTable # Thing
x#i – provides the value associated to the key i in the hash table x.
Assignment to x#i can change the value if x is mutable.
i1 : x = new MutableHashTable
o1 = MutableHashTable{...}
o1 : MutableHashTable
i2 : x#i = p
o2 = p
o2 : Symbol
i3 : x#i
o3 = p
o3 : Symbol
See also:
HashTable #? Thing [III.21.2.2] – check for value in hash table
hashing [V.24.335]
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: HashTable [III.21.5]
Class of argument 2: Thing [III.21]
21.6. Net
A net is a generalization of a string which is designed to facilitate two-dimensional
printing on ascii terminals. It consists of a rectangular array of characters subdivided horizontally by an imaginary baseline.
Operations on nets also accept strings by interpreting a string as a rectangle of
height one with the baseline just below it. In fact, the parent of String [III.21.6.1]
is Net [III.21.6].
Multiple nets per line can be sent to an output file with << [V.24.34] but care
must be taken to use endl [V.24.269] to end lines, for nets with new line characters
embedded in them will be displayed in an unexpected way.
Warning: if so many characters are written to a file that an internal buffer is
filled before the line ends or first net is seen, then the buffer will be flushed, and
writing a net subsequently will produce an unexpected result.
The type Net is a member of the class Type [III.21.5.4.11]. Each object of
class Net is called a net.
Types of Net :
String [III.21.6.1] – the class of all strings
Making a net :
Net ^ ZZ [III.21.6.2] – raise a net
Net | Net [III.21.6.3] – join strings or nets
Net || Net [III.21.6.4] – join nets or strings vertically
String ^ (...)
454
21. THING
String ^ ZZ
betti [III.21.6.5] – display degrees in a free resolution
horizontalJoin [III.21.6.6] – join nets or strings horizontally
horizontalJoin BasicList
net [III.21.6.7] – convert to net
peek [III.21.6.8] – examine contents of an object
peek2 [III.21.6.9] – examine contents of an object
stack [III.21.6.10] – join nets or string vertically
stack BasicList
symbol verticalJoin
Methods for using a net :
File << Net
Net == Net
Net == String
String == Net
depth Net
expression Net
height Net
net Net
netRows Net
peek2(Net,ZZ)
tex Net
toExternalString Net
width Net
21.6.1. String
A string is thing which contains a sequence of characters (bytes). A string is
normally entered as a sequence of characters surrounded by quotation marks.
i1 : "abcd"
o1 = abcd
o1 : String
For an alternate method of entering strings which does not involve any escape
sequences, see /// [V.24.27].
A net is a two-dimensional array of characters, and strings are regarded as a
type of net. See Net [III.21.6].
The type String is a member of the class Type [III.21.5.4.11]. Each object of
class String is called a string. Each string is also a member of class Net [III.21.6].
Making a string :
Database # String [III.21.3.1] – get value from database
String _ (...)
String _ ZZ
String | String
String | ZZ
ZZ | String
ascii {...}
concatenate {...}
21.6. NET
get File
get String
getc File
getenv String
html [III.21.6.1.1] – convert hypertext to html format
mathML [III.21.6.1.2] – convert to MathML format
pad(String,ZZ)
pad(ZZ,String)
read (...)
read File
read String
substring(String,ZZ)
substring(String,ZZ,ZZ)
tex [III.21.6.1.3] – convert to TeX
texMath [III.21.6.1.4] – convert to TeX math
text [III.21.6.1.5] – convert hypertext to text
toExternalString [III.21.6.1.6] – convert to a readable string
toString [III.21.6.1.7] – convert to a string
Methods for using a string :
Database #? String [III.21.2.1] – check for value in database
File << String
Net == String
QuotientRing _ String
Ring _ String [III.10.10] – get a variable by name
String # ZZ [III.21.6.1.8] – get character from string
String #? ZZ [III.21.2.4] – check for character in string
String + ZZ
String << Thing [III.20.2] – print to a file
String == Net
String ^ (...)
String ^ ZZ
ascii String
autoload(Function,String)
autoload(Symbol,String)
characters String
depth String
documentation String
expression String
getWWW String
getWWW(String,Nothing)
getWWW(String,String)
ggPush String
height String
html String
match(String,String)
mathML String
net String
new Command from String
455
456
21. THING
new EngineRing from String
openDatabase String
openDatabaseOut String
openIn String
openInOut String
openListener String
openOut String
peek2(String,ZZ)
precedence String
profile(String,Function)
tex String
texMath String
text String
toExternalString String
toString String
value String
width String
Fixed objects of class String :
currentFile
ggColumn2by2
ggColumnAddMultiple
ggColumnInterchange
ggColumnScale
ggEZZ
ggEcharp
ggGF
ggINT
ggINTARRAY
ggLLLcalc
ggLLLinit
ggMONClex
ggMONOMIAL
ggMOclone
ggMOcomponent
ggMOelim
ggMOgeneral
ggMOglex
ggMOgproduct
ggMOgrevlex
ggMOinit
ggMOlex
ggMOproduct
ggMOrevlex
ggMOwtfcn
ggRow2by2
ggRowAddMultiple
ggRowInterchange
ggRowScale
21.6. NET
ggSTRING
ggSetEntry
ggSmithNormalForm
ggZ
ggZn
ggadd
ggaddress
ggautoreduce
ggbasisElement
ggbetti
ggbinomialGB
ggbinomialGBaddgens
ggbinomialGBenlarge
ggborel
ggcalc
ggcharacteristic
ggcharp
ggcodim
ggcoeffs
ggcompare
ggconcat
ggcontract
ggcopy
ggdeclarefield
ggdegree
ggdenominator
ggderef
ggdets
ggdiff
ggdim
ggdirectsum
ggdiv
ggdivides
ggdivmod
ggdrop
ggdup
ggduplicate
ggelem
ggelim
ggev
ggexterior
ggexteriorproduct
ggfactor
ggfactor1
ggfactor2
ggfindGoodUnitPivot
ggflip
ggforget
457
458
21. THING
ggfraction
ggfractionfield
ggfree
ggfromint
gggb
gggcd
gggcdextended
gggetCoefficientRing
gggetColChange
gggetColumnChange
gggetFreeModule
gggetMO
gggetMonoid
gggetRingFreeModule
gggetRowChange
gggetchange
gggetcoeff
gggetcols
gggetgb
gggetideal
gggetmingens
gggetring
gggetrows
gggetshift
gggetsubring
gggetsubringGB
gggetsyz
gggetterms
gggetvalue
gggetzerodivisor
gghash
ggheap
gghermite
gghilb
gghomogenize
gghomogenize1
ggiden
ggindex
gginitial
ggintersect
ggisborel
ggisequal
ggisequal0
ggishomogeneous
ggissubset
ggisunit
ggiszero
ggkbasis
21.6. NET
ggkbasisIn
ggkbasisOut
ggker
ggkoszul
gglcm
ggleadcoeff
ggleadcomp
ggleadmonom
ggleadterm
gglength
gglift
ggmatrix
ggmem
ggminleadterms
ggmod
ggmodtensor
ggmonideal
ggmonoid
ggmonsyz
ggmult
ggnegate
ggnmonoms
ggnone
ggnumcols
ggnumerator
ggnumrows
ggnvars
ggpairs
ggpermute
ggpfaffs
ggpick
ggpolyring
ggpop
ggpoppem
ggpower
ggprimes
ggpromote
ggqring
ggquit
ggradical
ggrandom
ggrandomint
ggrandommax
ggrandomseed
ggrank
ggreceive
ggreduce
ggreducepivots
459
460
21. THING
ggremaining
ggremote
ggremove
ggres
ggresNmap
ggresNmodule
ggreshape
ggresmap
ggresmodule
ggrightmult
ggringmap
ggsagbi
ggsat
ggschur
ggsearch
ggsee
ggselect
ggsend
ggsetColChange
ggsetRowChange
ggsetshift
ggshift
ggsimplify
ggskeleton
ggskewpolyring
ggsortcolumns
ggsparsematrix
ggsparsevector
ggstack
ggstats
ggstatus
ggsubduction
ggsubmatrix
ggsubmodule
ggsubtract
ggsymm
ggtensor
ggterm
ggtermideal
ggtest
ggtonet
ggtostring
ggtracing
ggtranspose
ggtruncate
ggvar
ggvector
ggweylalgebra
21.6. NET
461
ggzero
ggzeromat
ggzeromonoid
newline
pathSeparator
21.6.1.1. html
html x – convert hypertext [V.24.343] to html format
The return value is a string which is suitable for use in an html file, readable
by a world wide web client such as netscape.
See also:
mathML [III.21.6.1.2] – convert to MathML format
The function html is a member of the class Function [III.18].
Class of returned value: String [III.21.6.1] – the class of all stringsWays to use
html :
html (...)
html BIG
html BLOCKQUOTE
html BODY
html BOLD
html BR
html Boolean
html CENTER
html CITE
html CODE
html DFN
html DL
html Divide
html EM
html EXAMPLE
html EmptyMarkUpType
html Entity
html ExampleTABLE
html Expression
html H1
html H2
html H3
html H4
html H5
html H6
html HEAD
html HEADLINE
html HR
html HREF
html HTML
html Holder
html IMG
html ITALIC
462
21. THING
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
html
KBD
LISTING
LITERAL
MENU
MarkUpList
MarkUpType
MatrixExpression
Minus
NL
NOINDENT
Nothing
OL
OneExpression
Option
PARA
PRE
Power
Product
RowExpression
SAMP
SEQ
SHIELD
SMALL
STRONG
SUB
SUP
String
Subscript
Sum
Superscript
Symbol
TABLE
TEX
TITLE
TO
TOH
TT
Thing
UL
UNDERLINE
VAR
XMP
ZeroExpression
{...}
21.6.1.2. mathML
mathML x – converts x to MathML form.
i1 : R = ZZ[x,y];
21.6. NET
463
i2 : mathML matrix {{x,y},{x^2+2,0}}
o2 = <matrix>
<matrixrow><ci>x</ci><ci>y</ci></matrixrow>
<matrixrow><apply><plus/><apply><power/><ci>x</ci><cn t ...
<cn type=’integer’>2</cn></apply>
<ci>0</ci></matrixrow>
</matrix>
o2 : String
See also:
hypertext [V.24.343]
The function mathML is a member of the class Function [III.18].
Class of returned value: String [III.21.6.1] – the class of all stringsWays to use
mathML :
mathML Boolean
mathML CC
mathML Divide
mathML Holder
mathML InfiniteNumber
mathML MarkUpList
mathML MatrixExpression
mathML Minus
mathML Nothing
mathML OneExpression
mathML Power
mathML Product
mathML QQ
mathML RR
mathML String
mathML Sum
mathML Symbol
mathML Thing
mathML ZZ
mathML ZeroExpression
21.6.1.3. tex
tex x – convert x to TeX format.
i1 : R = ZZ[a..f]
o1 = R
o1 : PolynomialRing
i2 : tex matrix {{a^2+2,b,c},{d,e,f^3-a}}
o2 = $\pmatrix{{a}^{2}+{2}&
{b}&
{c}\cr
{d}&
464
21. THING
{e}&
{f}^{3}-a\cr
}$
o2 : String
See also:
TeX [V.24.139] – convert to TeX and display on screen
texMath [III.21.6.1.4] – convert to TeX math
The function tex is a member of the class Function [III.18].
Class of returned value: String [III.21.6.1] – the class of all stringsWays to use
tex :
tex (...)
tex BR
tex Boolean
tex Entity
tex ExampleTABLE
tex Expression
tex HEADLINE
tex HR
tex HREF
tex IMG
tex ITALIC
tex MENU
tex MarkUpList
tex NOINDENT
tex Net
tex Nothing
tex PARA
tex PRE
tex SEQ
tex STRONG
tex String
tex Symbol
tex TABLE
tex TEX
tex TO
tex TOH
tex TT
tex Thing
tex {...}
21.6.1.4. texMath
texMath x – convert x to TeX format for use in TeX math mode.
The main difference between this and tex [III.21.6.1.3] is that the surrouding
dollar signs aren’t there.
i1 : R = ZZ[x]
o1 = R
21.6. NET
465
o1 : PolynomialRing
i2 : texMath (x-1)^6
o2 = {x}^{6}-6 {x}^{5}+15 {x}^{4}-20 {x}^{3}+15 {x}^{2}-6 x+ ...
o2 : String
See also:
TeX [V.24.139] – convert to TeX and display on screen
tex [III.21.6.1.3] – convert to TeX
The function texMath is a member of the class Function [III.18].
Class of returned value: String [III.21.6.1] – the class of all stringsWays to use
texMath :
texMath (...)
texMath Boolean
texMath Divide
texMath Entity
texMath Expression
texMath HEADLINE
texMath Holder
texMath ITALIC
texMath MarkUpList
texMath MatrixExpression
texMath Minus
texMath Nothing
texMath OneExpression
texMath Power
texMath Product
texMath RR
texMath RowExpression
texMath SEQ
texMath STRONG
texMath SUB
texMath SUP
texMath SparseMonomialVectorExpression
texMath SparseVectorExpression
texMath String
texMath Subscript
texMath Sum
texMath Superscript
texMath Symbol
texMath TABLE
texMath TEX
texMath TT
texMath Thing
texMath ZZ
texMath ZeroExpression
texMath {...}
466
21. THING
21.6.1.5. text
text x – convert hypertext [V.24.343] to text format
The return value is a string which is suitable display on an ascii terminal.
The function text is a member of the class Function [III.18].
Class of returned value: String [III.21.6.1] – the class of all stringsWays to use
text :
text (...)
text BR
text Boolean
text DL
text EXAMPLE
text ExampleTABLE
text HEADLINE
text HR
text HREF
text IMG
text MENU
text MarkUpList
text NL
text NOINDENT
text Nothing
text OL
text Option
text PARA
text PRE
text SEQ
text SHIELD
text String
text Symbol
text TABLE
text TO
text TOH
text TT
text UL
text {...}
21.6.1.6. toExternalString
toExternalString x – converts x to a string, in such a way that it can be read
back into the program later.
See also toString [III.21.6.1.7] which simply converts x to a string which can
be displayed meaningfully.
Not everything can be converted to a string in such a way that it can be read
back into the program later, because circular data structures are common.
The function toExternalString is a member of the class Function [III.18].
Class of returned value: String [III.21.6.1] – the class of all stringsWays to use
toExternalString :
toExternalString (...)
toExternalString BasicList
21.6. NET
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
toExternalString
467
CC
Command
HashTable
Manipulator
MarkUpList
Matrix
Module
MutableHashTable
MutableList
Net
Option
PolynomialRing
String
Symbol
Thing
[...]
21.6.1.7. toString
toString x – converts x to a string.
See also toExternalString [III.21.6.1.6] which will try to convert x to a string
which can be read back into the program later.
The function toString is a member of the class Function [III.18].
Class of returned value: String [III.21.6.1] – the class of all stringsWays to use
toString :
toString (...)
toString Adjacent
toString BasicList
toString BinaryOperation
toString CC
toString Command
toString EngineRing
toString Entity
toString Equation
toString Expression
toString FractionField
toString Function
toString FunctionApplication
toString GeneralOrderedGroup
toString GeneralOrderedMonoid
toString GroebnerBasis
toString HashTable
toString Holder
toString Ideal
toString IndexedVariable
toString Manipulator
toString MarkUpList
toString Matrix
toString MatrixExpression
468
21. THING
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
toString
Minus
Module
MonomialIdeal
MutableHashTable
MutableList
NonAssociativeProduct
Option
PolynomialRing
Position
Power
Product
ProductRing
QQ
QuotientRing
Resolution
RingElement
RingMap
RowExpression
SchurRing
Set
SparseMonomialVectorExpression
SparseVectorExpression
String
Subscript
Sum
Superscript
Symbol
Table
Tally
Thing
Vector
[...]
21.6.1.8. String # ZZ
x#i – provides the i-th character of the string x, as a string of length 1, if there
is one.
If i is out of range, a string of length 0 is returned. If i is negative, then the
i-th character from the end is provided.
See also:
String #? ZZ [III.21.2.4] – check for character in string
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: String [III.21.6.1]
Class of argument 2: ZZ [III.21.11]
21.6.2. Net ^ ZZ
n^i – elevates a net or string n by raising its characters by i rows.
The number i may be negative, in which case the net is lowered.
21.6. NET
469
If n is a string, then n^0 is an easy way to convert it to a net.
Synopsis of use:
Operator: ^ [V.24.149]
Class of argument 1: Net [III.21.6]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: Net [III.21.6]
21.6.3. Net | Net
s|t – concatenates strings or nets horizontally.
The result is a string if the arguments are all strings, otherwise it is a net. The
baselines of the nets are aligned.
i1 : "abc" | "def"
o1 = abcdef
o1 : String
i2 : x = "abc" || "ABC"
o2 = abc
ABC
o2 : Net
i3 : x|"x"|x
o3 = abcxabc
ABC ABC
o3 : Net
If one of the two arguments is an integer, it is converted to a string first.
i4 : "t = " | 333
o4 = t = 333
o4 : String
Synopsis of use:
Operator: | [V.24.655]
Class of argument 1: Net [III.21.6]
Class of argument 2: Net [III.21.6]
Class of typical returned value: Net [III.21.6]
21.6.4. Net || Net
m||n – joins nets or strings by concatenating them vertically. The baseline of
the result is the baseline of the first one.
In this example, we build a large net with arrows to indicate the location of
the baseline.
i1 : x = "x" | "3"^1
3
o1 = x
470
21. THING
o1 : Net
i2 : "<--- " | ( x || "" || x ) | " --->"
3
o2 = <--- x --->
3
x
o2 : Net
See also:
stack [III.21.6.10] – join nets or string vertically
Synopsis of use:
Operator: || [V.24.656]
Class of argument 1: Net [III.21.6]
Class of argument 2: Net [III.21.6]
Class of typical returned value: Net [III.21.6]
21.6.5. betti
betti C – display the graded Betti numbers for a ChainComplex [III.16] C.
betti f – display the graded Betti numbers for a Matrix [III.12] f, regarding it
as a complex of length one.
betti G – display the graded Betti numbers for the matrix of generators of a
GroebnerBasis [III.15] G.
Here is a sample display:
i1 : R = ZZ/101[a..h]
o1 = R
o1 : PolynomialRing
i2 : p = genericMatrix(R,a,2,4)
o2 = {0} | a c e g |
{0} | b d f h |
2
4
o2 : Matrix R <--- R
i3 : q = generators gb p
o3 = {0} | g e c a 0
0
0
0
0
0
|
{0} | h f d b fg-eh dg-ch bg-ah de-cf be-af bc-ad |
2
10
o3 : Matrix R <--- R
i4 : C = resolution cokernel leadTerm q
2
10
14
7
1
o4 = R <-- R
<-- R
<-- R <-- R
0
1
2
3
4
21.6. NET
471
o4 : ChainComplex
i5 : betti C
o5 = total: 2 10 14 7 1
0: 2 4 6 4 1
1: . 6 8 3 .
o5 : Net
The top row of the display indicates the ranks of the free module C_j in column
j. The entry below in row i column j gives the number of basis elements of degree
i+j.
If these numbers are needed in a program, one way to get them is with tally
[V.24.216.3].
i6 : degrees C_2
o6 = {{2}, {2}, {2}, {2}, {2}, {2}, {3}, {3}, {3}, {3}, {3}, ...
o6 : List
i7 : t2 = tally degrees C_2
o7 = Tally{{2} => 6}
{3} => 8
o7 : Tally
i8 : peek t2
o8 = Tally{{2} => 6}
{3} => 8
o8 : Net
i9 : t2_{2}
o9 = 6
i10 : t2_{3}
o10 = 8
The function betti is a member of the class Function [III.18].
Class of returned value: Net [III.21.6] – the class of all nets and stringsWays
to use betti :
betti ChainComplex
betti GroebnerBasis
betti Ideal
betti Matrix
betti Module
21.6.6. horizontalJoin
horizontalJoin(m,n,...) – joins nets or strings by concatenating them horizontally. The baselines in each of the nets are aligned appropriately.
Nested sequences among the arguments are first spliced together.
472
21. THING
If there are no arguments, then the net returned has zero height and zero depth.
This might be unexpected.
Null arguments are allowed and ignored.
See also:
Net [III.21.6] – the class of all nets and strings
String | String [V.24.131] – join strings or nets
The function horizontalJoin is a member of the class Function [III.18].
Class of returned value: Net [III.21.6] – the class of all nets and stringsWays
to use horizontalJoin :
horizontalJoin BasicList
21.6.7. net
net x – format x for printing.
This function is the primary function called upon by << [V.24.34] to format
expressions for printing. The default method provided by the system is to convert
x to an Expression [III.21.1.3] with expression [III.21.1.3.20] and then to convert
that to a net.
A new method for formatting expressions of class X may be installed by the
user with code of the form net X := x -> .... The function provided by the user
should return a net or a string.
A string is formatted by wrapping it in quotation marks and converting nonprinting characters to escape sequences. A net is formatted for printing by enclosing
it in a box.
i1 : "a string"
o1 = a string
o1 : String
i2 : net "a string"
o2 = a string
o2 : Net
i3 : ZZ[x];
i4 : x^2
2
o4 = x
o4 : ZZ [x]
i5 : net x^2
2
o5 = x
o5 : Net
The function net is a member of the class Function [III.18].
Class of returned value: Net [III.21.6] – the class of all nets and stringsWays
to use net :
21.6. NET
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
(...)
Adjacent
AffineVariety
BIG
BasicList
BinaryOperation
Boolean
CC
CENTER
CODE
ChainComplex
ChainComplexMap
CoherentSheaf
Command
Database
Divide
DoubleArrow
EngineRing
Entity
Equation
ExampleTABLE
File
FractionField
Function
FunctionApplication
GeneralOrderedMonoid
GradedModule
GradedModuleMap
GroebnerBasis
HEADLINE
Handle
HashTable
Holder
Ideal
IndexedVariable
MENU
Manipulator
MarkUpList
Matrix
MatrixExpression
Minus
Module
MonomialIdeal
MutableHashTable
MutableList
NOINDENT
Net
NonAssociativeProduct
473
474
21. THING
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
net
Nothing
Option
PRE
PolynomialRing
Position
Power
Product
ProductRing
ProjectiveHilbertPolynomial
ProjectiveVariety
QQ
QuotientRing
RR
RingElement
RingMap
RowExpression
SEQ
SHIELD
Set
SparseMonomialVectorExpression
SparseVectorExpression
String
Subscript
Sum
Superscript
Symbol
TABLE
TO
TOH
TT
Table
Tally
Thing
Time
Vector
ZZ
[...]
{...}
21.6.8. peek
peek s – displays contents of s to depth 1, bypassing installed methods.
i1 : t = set {1,2,3}
o1 = Set {1, 2, 3}
o1 : Set
i2 : peek t
21.6. NET
475
o2 = Set{1 => 1}
2 => 1
3 => 1
o2 : Net
i3 : new MutableHashTable from {a=>3, b=>44}
o3 = MutableHashTable{...}
o3 : MutableHashTable
i4 : peek oo
o4 = MutableHashTable{a => 3 }
b => 44
o4 : Net
See also:
peek2 [III.21.6.9] – examine contents of an object
The function peek is a member of the class Function [III.18].
Class of returned value: Net [III.21.6] – the class of all nets and stringsCode:
-- code for peek:
-- ../m2/peek.m2:66
peek = s -> peek2(s,1)
21.6.9. peek2
peek2(s,n) – displays contents of s to depth n, bypassing installed methods.
It applies the default output method to the object s, bypassing the installed
method for objects of its class.
i1 : s = factor 112
4
o1 = 2 7
o1 : Product
i2 : peek s
4
o2 = Product{2 ,7}
o2 : Net
i3 : peek2(s,2)
o3 = Product{Power{2,4},Power{7,1}}
o3 : Net
See also:
peek [III.21.6.8] – examine contents of an object
The function peek2 is a member of the class Function [III.18].
Class of returned value: Net [III.21.6] – the class of all nets and stringsWays
to use peek2 :
peek2((...),ZZ)
476
21. THING
peek2(BasicList,ZZ)
peek2(HashTable,ZZ)
peek2(Net,ZZ)
peek2(Nothing,ZZ)
peek2(String,ZZ)
peek2(Symbol,ZZ)
peek2(Thing,ZZ)
peek2({...},ZZ)
21.6.10. stack
stack(m,n,...) – joins nets or strings by concatenating them vertically. The
baseline of the result is the baseline of the first argument.
Nested sequences among the arguments are first spliced together.
If there are no arguments, then the net returned has zero height and zero depth.
This might be unexpected.
Tab characters in any of the strings are first expanded into spaces, assuming
tab stops at every eighth column.
Null arguments are allowed and ignored.
See also:
Net || Net [III.21.6.4] – join nets or strings vertically
The function stack is a member of the class Function [III.18].
Class of returned value: Net [III.21.6] – the class of all nets and stringsWays
to use stack :
stack BasicList
21.7. Nothing
This class is useful for representing the class of an argument which is missing.
It is also used as the parent for those things which are not themselves types, i.e.,
which do not have instances.
The type Nothing is a member of the class Type [III.21.5.4.11].
Making an object of class Nothing :
echoOff File
echoOn File
kill File
remove(HashTable,Thing)
scan(BasicList,Function) [III.18.22] – apply a function to each element
of a list
scan(ZZ,Function) [III.18.23] – apply a function to 0 .. n-1
scanPairs(HashTable,Function) [III.18.24] – apply a function to pairs
in a hash table
Methods for using an object of class Nothing :
Manipulator Nothing
Nothing << Manipulator
Nothing << Thing [III.21.7.1] – dummy file output
code Nothing
expression Nothing
getWWW(String,Nothing)
html Nothing
21.8. QQ
477
inducedMap(Module,Nothing,Matrix)
inducedMap(Nothing,Module,Matrix)
inducedMap(Nothing,Nothing,Matrix)
inducesWellDefinedMap(Module,Nothing,Matrix)
inducesWellDefinedMap(Nothing,Module,Matrix)
inducesWellDefinedMap(Nothing,Nothing,Matrix)
locate Nothing
map(Module,Nothing,Matrix)
map(Module,Nothing,{...}) [III.12.33] – make a map
mathML Nothing
modulo(Matrix,Nothing)
modulo(Nothing,Matrix)
net Nothing
peek2(Nothing,ZZ)
submatrix(Matrix,Nothing,{...})
submatrix(Matrix,{...},Nothing)
subquotient(Matrix,Nothing)
subquotient(Nothing,Matrix)
tex Nothing
texMath Nothing
text Nothing
Fixed objects of class Nothing :
null [V.24.440] – nothingness
21.7.1. Nothing << Thing
null << x – does nothing and returns null.
The intention here is that you can use null as a dummy output file, but a bit
of time is wasted converting x to a net.
Synopsis of use:
Operator: << [V.24.34]
Class of argument 1: Nothing [III.21.7]
Class of argument 2: Thing [III.21]
21.8. QQ
i1 : 1/2 + 3/5
11
o1 = -10
o1 : QQ
The field QQ is a member of the class Field [III.10.2]. Each object of class QQ
is called a rational number.
Methods for using a rational number :
CC * QQ
CC + QQ
CC - QQ
CC / QQ
CC == QQ
478
21. THING
QQ % RingElement
QQ * CC
QQ * RingElement
QQ + CC
QQ + RingElement
QQ - CC
QQ - RingElement
QQ / CC
QQ / RingElement
QQ // RingElement
QQ == CC
QQ == RR
QQ == ZZ
RR == QQ
RingElement % QQ
RingElement * QQ
RingElement + QQ
RingElement - QQ
RingElement / QQ
RingElement // QQ
RingMap QQ
Thing ^ QQ
ZZ == QQ
conjugate QQ
denominator QQ
expression QQ
factor QQ
ggPush QQ
ideal QQ
imaginaryPart QQ
isUnit QQ
lift(QQ,QQ)
lift(QQ,Ring)
lift(QQ,ZZ)
lift(RingElement,QQ)
liftable(QQ,Ring)
mathML QQ
net QQ
numerator QQ
promote(Matrix,QQ)
promote(QQ,QQ)
promote(QQ,Ring)
promote(QQ,RingElement)
promote(ZZ,QQ)
realPart QQ
toString QQ
21.9. RR
479
21.9. RR
A real number is entered as a sequence of decimal digits with a point.
i1 : 3.14159
o1 = 3.14159
o1 : RR
See also:
basictype [V.24.186] – the basic type
The field RR is a member of the class Field [III.10.2]. Each object of class RR
is called a real number.
Making a real number :
acos RR
acos ZZ
asin RR
asin ZZ
atan RR
atan ZZ
cos RR
cos ZZ
cosh RR
cosh ZZ
exp RR
exp ZZ
imaginaryPart [III.21.9.1] – imaginary part
imaginaryPart CC
log RR
log ZZ
random RR [III.21.9.2] – random real number
realPart [III.21.9.3] – real part
realPart CC
sin RR
sin ZZ
sinh RR
sinh ZZ
sqrt RR
sqrt ZZ
tan RR
tan ZZ
tanh RR
tanh ZZ
Methods for using a real number :
CC * RR
CC + RR
CC - RR
CC / RR
CC == RR
QQ == RR
480
21. THING
RR * CC
RR + CC
RR - CC
RR / CC
RR == CC
RR == QQ
RR == ZZ
ZZ == RR
conjugate RR
expression RR
floor RR
imaginaryPart RR
mathML RR
net RR
precedence RR
realPart RR
texMath RR
Fixed objects of class RR :
pi
21.9.1. imaginaryPart
imaginaryPart z – return the imaginary part of a complex number z.
The function imaginaryPart is a member of the class Function [III.18].
Class of returned value: RR [III.21.9] – the class of all real numbersWays to
use imaginaryPart :
imaginaryPart CC
imaginaryPart QQ
imaginaryPart RR
imaginaryPart ZZ
21.9.2. random RR
random x – yields a random real number in the range 0 .. x.
Synopsis of use:
Operator: random [V.24.216.1]
Class of argument 1: RR [III.21.9]
Class of typical returned value: RR [III.21.9]
Code:
-- ../m2/integers.m2:68-72
random RR := RR => x -> (
if x <= 0. then (
error "expected a positive number"
);
x * (randomint() / d))
21.9.3. realPart
realPart z – return the real part of a complex number z.
The function realPart is a member of the class Function [III.18].
Class of returned value: RR [III.21.9] – the class of all real numbersWays to
use realPart :
21.10. SYMBOL
realPart
realPart
realPart
realPart
481
CC
QQ
RR
ZZ
21.10. Symbol
Symbols are entered as an alphabetic character followed by a sequence of alphanumeric characters; case is significant. The single symbol character ’ is regarded
as alphabetic, so that symbols such as x’ may be used.
Symbols are used as names for values to be preserved, as indeterminates in
polynomial rings, and as keys in hash tables. They may have global scope, meaning
they are visible from every line of code, or local scope, with visibility restricted to
a single file or function body.
i1 : ab12345cde
o1 = ab12345cde
o1 : Symbol
See also:
symbolTable [V.24.596] – the global symbols
local [V.24.394] – get a local symbol
global [V.24.325] – get a global symbol
symbol [V.24.578] – get a symbol
:= [V.24.30] – assignment to a new local variable
The type Symbol is a member of the class Type [III.21.5.4.11]. Each object of
class Symbol is called a symbol.
Methods for using a symbol :
File << Symbol
Symbol .. Symbol
Symbol ? IndexedVariable
Symbol _ Thing
assign(Symbol,Thing)
autoload(Symbol,String)
baseName Symbol
code Symbol
documentation Symbol
expression Symbol
formatDocumentTag Symbol
html Symbol
locate Symbol
mathML Symbol
net Symbol
peek2(Symbol,ZZ)
precedence Symbol
tex Symbol
texMath Symbol
text Symbol
toExternalString Symbol
482
21. THING
toString Symbol
value Symbol
vars Symbol
Fixed objects of class Symbol :
[V.24.1] – blank operator for adjacent expressions
! [V.24.2] – factorial
!= [V.24.3] – inequality
# [V.24.4] – length, or access to elements
## [V.24.7] – uncurry a function
#? [V.24.8] – check for presence of elements
% [V.24.9] – a binary operator, usually used for remainder
& [V.24.10] – a binary operator
&& [V.24.11] – a binary operator
* [V.24.14] – a binary operator, usually used for multiplication
** [V.24.15] – a binary operator, usually used for tensor product
+ [V.24.16] – a bina operator
++ [V.24.17] – a binary operator, usually used for direct sum
, [V.24.18] – separator
- [V.24.19] – a binary operator, usually used for subtraction
-> [V.24.21] – make a function
. [V.24.22] – access to elements whose key is a symbol
.. [V.24.23] – sequence of consecutive items
.? [V.24.24] – check for presence of elements whose key is a symbol
/ [V.24.25] – a binary operator, usually used for division
// [V.24.26] – a binary operator, usually used for quotient
/^ [V.24.28] – a binary operator
: [V.24.29] – a binary operator
:= [V.24.30] – assignment to a new local variable
; [V.24.31] – statement separator
< [V.24.32] – less than
<- [V.24.33] – assignment
<< [V.24.34]
<= [V.24.36] – less than or equal
= [V.24.37] – assignment
=!= [V.24.38] – strict inequality
== [V.24.39] – equality
=== [V.24.40] – strict equality
==> [V.24.41] – a binary operator
=> [V.24.42] – produce an Option
> [V.24.43] – greater than
>= [V.24.44] – greater than or equal
>> [V.24.45] – shift bits rightward
? [V.24.46] – comparison operator
@ [V.24.47] – a binary operator
@@ [V.24.48] – a binary operator
AfterEval [V.24.49] – top level method applied before printing results
AfterNoPrint [V.24.50] – top level method applied after not printing
AfterPrint [V.24.51] – top level method applied after printing
21.10. SYMBOL
483
Algorithm [V.24.52] – an obsolete synonym for Strategy
Ascending [V.24.53]
Associative
BasisElementLimit [V.24.55] – stop when this number of basis elements
is obtained
Bayer [V.24.56] – use the method in Bayer’s thesis
BeforePrint [V.24.57] – top level method applied before printing results
CallLimit
ChangeMatrix [V.24.59] – whether to produce the change of basis matrix
CodimensionLimit [V.24.60] – stop when this codimension is reached
CompleteIntersection [V.24.61] – provide a hint when computing a radical
ConversionFormat [V.24.62] – convert to engine format
ConvertInteger [V.24.63] – convert an integer from engine format
ConvertMissing [IV.22.1.9.5] – a missing engine conversion format item
ConvertToExpression [V.24.64] – specify mehtod for converting to engine format
Degree [V.24.65]
DegreeLimit [V.24.66] – compute up to a certain degree
DegreeOrder [V.24.67] – sort primarily by degree
Degrees [III.10.1.3.2.3] – specify the degrees
Descending [V.24.68] – specify descending order
Elimination [V.24.71] – compute the saturation by elimination
EliminationOrder [V.24.72] – use the natural elmination order in a pushForward1 computation
Engine [V.24.74] – specify whether a ring is handled by the engine
FindOne [V.24.79] – find a primitive element
GBtype [V.24.81]
GLex [III.10.1.3.2.1.2] – graded lexicographic ordering
GRevLex [III.10.1.3.2.1.1] – reverse lexicographic ordering
GlobalAssignHook [V.24.85] – hook for assignment to global variables
GlobalReleaseHook [V.24.86]
HardDegreeLimit [V.24.89] – compute only up to this degree
Homogeneous [V.24.91]
Inhomogeneous [V.24.92]
InverseMethod [V.24.93] – compute reciprocals
Inverses [III.10.1.3.2.5] – specify whether generators are invertible
Iterate [V.24.94] – use successive ideal quotients (the default)
LengthLimit [V.24.95] – stop when the resolution reaches this length
Lex [III.10.1.3.2.1.3] – lexicographic ordering
Limit [V.24.96] – specify how many to compute
Linear [V.24.97] – use the reverse lex order
LongPolynomial [V.24.98]
MinimalGenerators [V.24.100]
MinimalMatrix [V.24.101] – set the matrix of minimal generators
MonomialOrder [III.10.1.3.2.1] – monomial ordering
MonomialSize [III.10.1.3.2.2] – specify maximum exponent size
Monomials [V.24.103] – whether to display the number of monomial
484
21. THING
NewFromMethod [V.24.104]
NewMethod [V.24.105]
NewOfFromMethod [V.24.106]
NewOfMethod [V.24.107]
NoPrint [V.24.108] – top level method for non-printing results
NonLinear [V.24.109] – use the algorithm which doesn’t assume that the
ring map is linear
Options [V.24.111] – specify optional arguments for a method
Order [V.24.112] – specify the order of a Hilbert series required
PairLimit [V.24.113] – stop when this number of pairs is handled
PairsRemaining [V.24.114] – whether to display the number of S-pairs
remaining
Primary [V.24.115]
PrimitiveElement [V.24.116] – specify a primitive element
Print [V.24.117] – top level method for printing results
Projective [V.24.119] – whether to produce a projective Hilbert polynomial
RevLex [III.10.1.3.2.1.4] – reverse lexicographic ordering
SingleArgumentDispatch [V.24.124] – make a method for handling sequences individually
SkewCommutative [III.10.1.3.2.8] – make a skewcommutative (alternating) ring
Sort [V.24.125]
SortStrategy [V.24.126] – specify a strategy for sorting S-pairs
StopBeforeComputation [V.24.128] – initialize but do not begin the
computation
StopWithMinimalGenerators [V.24.129] – stop when minimal generators have been determined
Strategy [V.24.130] – specify a computational strategy
SubringLimit [V.24.132] – stop after finding enough elements of a subring
Syzygies [V.24.133] – whether to collect syzygies
SyzygyLimit [V.24.134] – stop when this number of syzygies is obtained
SyzygyMatrix [V.24.135] – set the syzygy matrix
SyzygyRows [V.24.136] – the number rows of the syzygy matrix to collect
TotalPairs [V.24.141] – whether to display the total number of S-pairs
TypicalValue
Unmixed [V.24.143] – provide a hint when computing a radical
UseHilbertFunction [V.24.144]
Variable [V.24.145] – specify a name for the generator of a Galois field
VariableBaseName [III.10.1.3.2.7] – base name for variables
VariableOrder [III.10.1.3.2.10]
Variables [III.10.1.3.2.9] – specify the variable names
Verify [V.24.146] – verify that a map is well-defined
Weights [III.10.1.3.2.4] – specify monomial ordering by weights
WeylAlgebra [III.10.1.3.2.6] – make a Weyl algebra
\ [V.24.147] – a binary operator
\\ [V.24.148] – a binary operator
^ [V.24.149] – a binary operator, usually used for exponents
21.10. SYMBOL
485
^^ [V.24.150] – a binary operator
_ [V.24.151]
adjust [V.24.159] – adjust the degree in a total Ext module
and [V.24.164] – conjunction
argument [V.24.175] – specify the function in a scripted functor for an
argument
baseRings [V.24.185] – store the list of base rings of a ring
dd [V.24.237] – differential in a chain complex
do [V.24.256] – loop control
else [V.24.266] – condition testing
end [V.24.268] – stop loading a file
from [V.24.300] – a keyword
generatorExpressions [V.24.314] – store the generators
generatorSymbols [V.24.315] – store the symbols for the generators
global [V.24.325] – get a global symbol
if [V.24.346] – condition testing
incomparable [V.24.349] – a result indicating incomparability
indexComponents [V.24.352] – specify keys for components of a direct
sum
local [V.24.394] – get a local symbol
name [V.24.429] – store the name of a hash table
new [V.24.432] – new objects of various types
not [V.24.437] – negation
of [V.24.447] – a keyword
or [V.24.459] – disjunction
order [V.24.460] – a key used internally
poincareComputation [V.24.473] – store the Poincare polynomial computation
pop [V.24.475] – pop a value from the engine’s stack
pruningMap [V.24.492] – store the isomorphism obtained by pruning
returnCode [V.24.527]
shield [V.24.547] – shield evaluation from interrupts
subscript [V.24.571] – specify the function in a scripted functor for a
subscript
superscript [V.24.577] – specify the function in a scripted functor for a
superscript
symbol [V.24.578] – get a symbol
synonym
then [V.24.612] – condition testing
time [V.24.613] – time a computation
timing [V.24.615] – time a computation
try [V.24.633] – catch an error
while [V.24.649] – loop control
| [V.24.655] – a binary operator
|| [V.24.656] – a binary operator
˜ [V.24.657] – a unary postfix operator
486
21. THING
21.11. ZZ
The ring ZZ is a member of the class Ring [III.10]. Each object of class ZZ is
called an integer.
Making an integer :
# BasicList [III.21.11.1] – length
# File [III.21.11.2] – length
# HashTable [III.21.11.3] – length
# String [III.21.11.4] – length
ZZ !
ZZ & ZZ [III.21.11.5] – logical and
ZZ >> ZZ [III.21.11.6] – shift bits rightward
binomial(ZZ,ZZ)
floor RR
gcd(ZZ,ZZ)
precedence [III.21.1.3.2] – parsing precedence
random ZZ [III.21.11.7] – random integer
xor(ZZ,ZZ)
Methods for using an integer :
(...) _ ZZ [III.19.3.2] – get element from list
BasicList # ZZ [III.21.1.16] – get element from list
BasicList #? ZZ [III.21.1.17] – check for element in list
CC * ZZ
CC + ZZ
CC - ZZ
CC / ZZ
CC == ZZ
CC ^ ZZ
ChainComplex == ZZ
ChainComplex ^ ZZ
ChainComplex _ ZZ [III.13.1] – get component
ChainComplexMap + ZZ
ChainComplexMap == ZZ
ChainComplexMap ^ ZZ
ChainComplexMap _ ZZ [III.12.1] – get component
CoherentSheaf ZZ [III.21.5.4.2.4] – canonical twist of a coherent sheaf
EngineRing _ ZZ
Ext(ZZ,Ideal,Ideal)
Ext(ZZ,Ideal,Module)
Ext(ZZ,Ideal,Ring)
Ext(ZZ,Matrix,Ideal)
Ext(ZZ,Matrix,Module)
Ext(ZZ,Matrix,Ring)
Ext(ZZ,Module,Ideal)
Ext(ZZ,Module,Matrix)
Ext(ZZ,Module,Module)
Ext(ZZ,Module,Ring)
Ext(ZZ,Ring,Ideal)
Ext(ZZ,Ring,Module)
21.11. ZZ
487
Ext(ZZ,Ring,Ring)
Fano(ZZ,Ideal)
Fano(ZZ,Ideal,Ring)
GF ZZ [III.10.1.2.2] – make a finite field of a given order
GF(ZZ,ZZ) [III.10.1.2.3] – make a finite field of a given prime power order
GradedModule _ ZZ
GradedModuleMap == ZZ
GradedModuleMap ^ ZZ
GradedModuleMap _ ZZ
Grassmannian(ZZ,ZZ)
Grassmannian(ZZ,ZZ,Ring)
HH^ZZ (...)
HH^ZZ ChainComplex [III.13.2] – cohomology of a chain complex
HH^ZZ ChainComplexMap [III.12.2] – cohomology of a chain complex
map
HH^ZZ CoherentSheaf [III.13.3] – coherent sheaf cohomology
HH^ZZ Module [III.13.4] – local cohomology
HH_ZZ (...)
HH_ZZ ChainComplex [III.13.5] – homology of a chain complex
HH_ZZ ChainComplexMap [III.12.3] – homology of a chain complex
map
Ideal == ZZ
Ideal ^ ZZ [III.11.4] – power of an ideal
Ideal _ ZZ
InfiniteNumber * ZZ
InfiniteNumber + ZZ
InfiniteNumber - ZZ
Matrix * ZZ
Matrix + ZZ
Matrix ++ ZZ
Matrix - ZZ
Matrix // ZZ
Matrix == ZZ
Matrix ^ ZZ
Matrix _ ZZ [III.12.47] – get a column from a matrix
Matrix | ZZ
Matrix || ZZ
Module == ZZ
Module ^ ZZ
Module _ ZZ [III.13.17] – get a generator
Monoid _ ZZ [III.21.1.8.1] – get a generator of a monoid
MonomialIdeal == ZZ
MonomialIdeal ^ ZZ
Net ^ ZZ [III.21.6.2] – raise a net
ProjectiveHilbertPolynomial ZZ [III.21.5.6.4] – value of polynomial
QQ == ZZ
RR == ZZ
Ring / ZZ
488
21. THING
Ring ^ ZZ [III.10.8] – make a free module
Ring _ ZZ [III.10.11] – get a variable by number
RingElement % ZZ
RingElement * ZZ
RingElement + ZZ
RingElement ++ ZZ
RingElement - ZZ
RingElement / ZZ
RingElement // ZZ
RingElement == ZZ
RingElement ^ ZZ
RingElement _ ZZ
RingMap ZZ
Schur ZZ
String # ZZ [III.21.6.1.8] – get character from string
String #? ZZ [III.21.2.4] – check for character in string
String + ZZ
String ^ ZZ
String _ ZZ
String | ZZ
Thing /^ ZZ [III.21.11.8] – divided power
Tor(ZZ,Module,Module)
Vector == ZZ
Vector _ ZZ [III.21.5.4.12.1] – get a component
ZZ % GroebnerBasis
ZZ % Ideal
ZZ % RingElement
ZZ % ZZ
ZZ * CC
ZZ * ChainComplexMap
ZZ * GradedModuleMap
ZZ * Ideal
ZZ * InfiniteNumber
ZZ * Matrix
ZZ * Module
ZZ * ProjectiveHilbertPolynomial
ZZ * RingElement
ZZ * Vector
ZZ + CC
ZZ + ChainComplexMap
ZZ + InfiniteNumber
ZZ + Matrix
ZZ + RingElement
ZZ ++ Matrix
ZZ ++ RingElement
ZZ - CC
ZZ - InfiniteNumber
ZZ - Matrix
21.11. ZZ
489
ZZ - RingElement
ZZ / CC
ZZ / RingElement
ZZ // Matrix
ZZ // RingElement
ZZ : Thing [III.21.11.9] – repeat an item
ZZ << ZZ [III.21.11.10] – shift bits leftward
ZZ == CC
ZZ == ChainComplex
ZZ == ChainComplexMap
ZZ == GradedModuleMap
ZZ == Ideal
ZZ == Matrix
ZZ == Module
ZZ == MonomialIdeal
ZZ == QQ
ZZ == RR
ZZ == RingElement
ZZ == Vector
ZZ _ EngineRing
ZZ _ Module
ZZ _ Monoid [III.21.1.8.2] – get unit element
ZZ _ Ring [III.10.13]
ZZ | Matrix
ZZ | String
ZZ | ZZ [III.21.11.11] – logical or
ZZ || Matrix
acos ZZ
apply(ZZ,Function) [III.18.13] – apply function to 0 .. n-1
asin ZZ
atan ZZ
basis(ZZ,Ideal)
basis(ZZ,Module)
basis(ZZ,Ring)
conjugate ZZ
cos ZZ
cosh ZZ
cotangentSheaf(ZZ,ProjectiveVariety) [III.17.2.2] – make an exterior
power of the cotangent sheaf
degreesMonoid ZZ
degreesRing ZZ
diff(ProjectiveHilbertPolynomial,ZZ) [III.21.5.6.2] – differentiate
divideByVariable(Matrix,RingElement,ZZ)
drop(BasicList,ZZ) [III.21.1.15] – drop some elements
exp ZZ
expression ZZ
exteriorPower(ZZ,CoherentSheaf ) [III.21.5.4.2.7] – exterior power
exteriorPower(ZZ,Matrix)
490
21. THING
exteriorPower(ZZ,Module)
factor ZZ
fittingIdeal(ZZ,Module)
gcdCoefficients(ZZ,ZZ)
generators(ZZ,Resolution)
getChangeMatrix(ZZ,Resolution)
ggPush ZZ
hilbertFunction(ZZ,Ideal)
hilbertFunction(ZZ,Module)
hilbertFunction(ZZ,Ring)
ideal ZZ
imaginaryPart ZZ
isPrime ZZ
isUnit ZZ
koszul(ZZ,Matrix)
leadTerm(ZZ,Ideal)
leadTerm(ZZ,Matrix)
leadTerm(ZZ,ZZ,Resolution)
lift(Ideal,ZZ)
lift(Matrix,ZZ)
lift(QQ,ZZ)
lift(RingElement,ZZ)
lift(ZZ,Ring)
lift(ZZ,ZZ)
liftable(ZZ,Ring)
log ZZ
map(Module,Module,ZZ) [III.12.31] – make a map
map(Module,ZZ)
map(Module,ZZ,Function) [III.12.35] – make a map
map(Module,ZZ,{...}) [III.12.36] – make a map
mathML ZZ
mingens(ZZ,Resolution)
minors(ZZ,Matrix)
monomialIdeal(ZZ,Matrix) [III.12.51] – make a monomial ideal
net ZZ
new Eliminate from ZZ
pack(BasicList,ZZ)
pack(ZZ,BasicList)
pad(String,ZZ)
pad(ZZ,String)
partitions ZZ
partitions(ZZ,ZZ)
peek2((...),ZZ)
peek2(BasicList,ZZ)
peek2(HashTable,ZZ)
peek2(Net,ZZ)
peek2(Nothing,ZZ)
peek2(String,ZZ)
21.11. ZZ
491
peek2(Symbol,ZZ)
peek2(Thing,ZZ)
peek2({...},ZZ)
pfaffians(ZZ,Matrix)
precedence ZZ
product(ZZ,Function) [III.18.19] – product of consecutive values of a
function
projectiveHilbertPolynomial ZZ
projectiveHilbertPolynomial(ZZ,ZZ)
promote(Matrix,ZZ)
promote(ZZ,EngineRing)
promote(ZZ,QQ)
promote(ZZ,Ring)
promote(ZZ,RingElement)
promote(ZZ,ZZ)
random(ZZ,Ring) [III.10.20] – a random ring element of a given degree
realPart ZZ
scan(ZZ,Function) [III.18.23] – apply a function to 0 .. n-1
see ZZ
select(ZZ,BasicList,Function) [III.18.27] – select elements from a list
select(ZZ,HashTable,Function) [III.18.28] – select from a hash table
selectInSubring(ZZ,Matrix)
sin ZZ
sinh ZZ
someTerms(RingElement,ZZ,ZZ)
sqrt ZZ
subsets((...),ZZ)
subsets(Set,ZZ) [III.21.5.8.1.8] – produce all the subsets
subsets(ZZ,ZZ) [III.21.11.12] – produce all the subsets
subsets({...},ZZ)
substitute(Matrix,ZZ)
substring(String,ZZ)
substring(String,ZZ,ZZ)
sum(ZZ,Function) [III.18.29] – sum consecutive values of a function
symmetricPower(ZZ,Matrix)
take(BasicList,ZZ)
tan ZZ
tanh ZZ
texMath ZZ
toHandle ZZ
truncate(ZZ,Ideal)
truncate(ZZ,Module)
vars ZZ
wedgeProduct(ZZ,ZZ,Module)
{...} _ ZZ [III.19.2.13] – get element from list
Fixed objects of class ZZ :
reloaded
492
21. THING
21.11.1. # BasicList
#x – provides the length of a list.
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: BasicList [III.21.1]
Class of typical returned value: ZZ [III.21.11]
21.11.2. # File
#x – provides the length of a file.
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: File [III.20]
Class of typical returned value: ZZ [III.21.11]
21.11.3. # HashTable
#x – provides the number of key-value pairs recorded in a hash table.
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: HashTable [III.21.5]
Class of typical returned value: ZZ [III.21.11]
21.11.4. # String
#x – provides the length of a string.
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: String [III.21.6.1]
Class of typical returned value: ZZ [III.21.11]
21.11.5. ZZ & ZZ
m & n – produce an integer obtained from the bits of the integers m and n by
logical ’and’.
Synopsis of use:
Operator: & [V.24.10]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: ZZ [III.21.11]
21.11.6. ZZ >> ZZ
i >> j – shifts the bits in the integer i rightward j places.
i1 : 256 >> 5
o1 = 8
21.11. ZZ
493
See also:
<< [V.24.34]
Synopsis of use:
Operator: >> [V.24.45]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ZZ [III.21.11]
Class of typical returned value: ZZ [III.21.11]
Code:
-- ../m2/integers.m2:19
ZZ >> ZZ := ZZ => (i,j) -> i << -j
21.11.7. random ZZ
random n – yields a random integer in the range 0 .. n-1.
Warning: doesn’t correctly handle the case when n an integer is larger than
2^31-1.
i1 : tally apply(100, i -> random 10)
o1 = Tally{0
1
2
3
4
5
6
7
8
9
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
11}
13
8
11
11
7
15
8
8
8
o1 : Tally
Synopsis of use:
Operator: random [V.24.216.1]
Class of argument 1: ZZ [III.21.11]
Class of typical returned value: ZZ [III.21.11]
Code:
-- ../m2/integers.m2:62-64
random ZZ := ZZ => x -> (
if x <= 0 then error "expected a positive number";
randomint() % x)
21.11.8. Thing /^ ZZ
x /^ n – computes the n-th divided power of x.
This is implemented naively as x^n/n!.
i1 : ZZ/101[x];
i2 : x/^3
3
o2 = 17x
ZZ
o2 : frac(--- [x])
101
494
21. THING
Synopsis of use:
Operator: /^ [V.24.28]
Class of argument 1: Thing [III.21]
Class of argument 2: ZZ [III.21.11]
Code:
-- ../m2/powers.m2:26
Thing /^ ZZ := (x,n) -> x^n/n!
21.11.9. ZZ : Thing
n : x – repetition n times of x in a sequence
If n is an integer and x is anything, return a sequence consisting of x repeated
n times. A negative value for n will silently be treated as zero.
Warning: such sequences do not get automatically spliced into lists containing
them.
i1 : {5:a,10:b}
o1 = {(a, a, a, a, a), (b, b, b, b, b, b, b, b, b, b)}
o1 : List
Synopsis of use:
Operator: : [V.24.29]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: Thing [III.21]
21.11.10. ZZ << ZZ
i << j – shifts the bits in the integer i leftward j places.
i1 : 2 << 5
o1 = 64
See also:
>> [V.24.45] – shift bits rightward
Synopsis of use:
Operator: << [V.24.34]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ZZ [III.21.11]
21.11.11. ZZ | ZZ
m|n – produce an integer obtained from the bits of the integers m and n by
logical ’or’.
i1 : 5 | 12
o1 = 13
Synopsis of use:
Operator: | [V.24.655]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ZZ [III.21.11]
21.11. ZZ
495
21.11.12. subsets(ZZ,ZZ)
subsets(n,j) – for an integer n, yields a list of those subsets of {0, ...,
n-1} which have j elements.
i1 : subsets(3,2)
o1 = {{0, 1}, {0, 2}, {1, 2}}
o1 : List
See also:
subsets [V.24.216.2] – produce all the subsets
Synopsis of use:
Operator: subsets [V.24.216.2]
Class of argument 1: ZZ [III.21.11]
Class of argument 2: ZZ [III.21.11]
Part IV
Developer’s Corner
engine [IV.22]
internals [IV.23]
CHAPTER 22
engine
The engine is the part of the program that is dedicated to performing the
computation of Groebner bases with Buchberger’s algorithm. It is coded directly
in C++ for speed, and it communicates with the front-end interpreter through a
bidirectional stream of bytes, so that in future implementations the engine may
reside in a separate process on a distant machine.
engine communication protocol [IV.22.1]
low level gb engine commands [IV.22.2]
high level gb engine commands [IV.22.3]
The Macaulay 2 engine provides fast polynomial and matrix operations, and
Groebner bases, syzygies, Hilbert functions, resolutions and other operations that
we feel need to be implemented directly for efficiency reasons.
22.1. engine communication protocol
Here is a description of the protocol for communication between the front end
and the engine. At the moment, this protocol is used only for transmissions from
the engine to the front end.
transmitting a positive integer [IV.22.1.1]
transmitting an integer [IV.22.1.2]
transmitting an integer mod n [IV.22.1.3]
transmitting a sequence [IV.22.1.4]
transmitting a monomial [IV.22.1.5]
transmitting a polynomial [IV.22.1.6]
transmitting a vector [IV.22.1.7]
transmitting a matrix [IV.22.1.8]
convert [IV.22.1.9] – convert to engine format
22.1.1. transmitting a positive integer
The integer 0 is transmitted as a single zero byte. A positive integer of 28 bits
or less is sent 7 bits at a time, with the high-order nonzero seven bits sent first.
The highest bit of each byte except the last one is set to 1.
00000000
or
0xxxxxxx
or
1xxxxxxx 0xxxxxxx
or
1xxxxxxx 1xxxxxxx 0xxxxxxx
or
1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx
A positive integer of more than 28 bits is sent as follows. First come four bytes,
with seven bits of the number in each one, with the high bit of each byte set to
1. Then comes the number of succeeding bytes, transmitted as described above
for a positive integer of 28 bits or less. Finally come the succeeding bytes, each
containing 8 bits of the intger. Format:
1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx (first 28 bits)
499
500
22. ENGINE
1xxxxxxx
xxxxxxxx
xxxxxxxx
...
xxxxxxxx
xxxxxxxx
It may happen that
0xxxxxxx
xxxxxxxx xxxxxxxx xxxxxxxx
xxxxxxxx xxxxxxxx xxxxxxxx
(number of succeed ...
(succeeding bytes)
(succeeding bytes)
xxxxxxxx xxxxxxxx xxxxxxxx (succeeding bytes)
xxxxxxxx
(succeeding bytes)
the first byte in the sequence above has the form 10000000.
22.1.2. transmitting an integer
The integer 0 is transmitted as a single zero byte. Otherwise, the sign of the
integer is put into bit 6 of the first byte, and the bits of the absolute value of the
integer are packed as follows: 6 bits into the first byte, 7 bits into 1, 2, or 3 more
bytes, and 8 bits into each of the succeeding bytes. If 8 bit bytes are needed, then
the number of them is sent as a positive integer after the first four bytes are sent.
See also transmitting a positive integer [IV.22.1.1]. In the following illustration,
S denotes the sign bit, and x’s denote the bits of the integer.
00000000
or
0Sxxxxxx
or
1Sxxxxxx 0xxxxxxx
or
1Sxxxxxx 1xxxxxxx 0xxxxxxx
or
1Sxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx
or
1Sxxxxxx
1xxxxxxx
xxxxxxxx
xxxxxxxx
...
xxxxxxxx
xxxxxxxx
1xxxxxxx 1xxxxxxx 1xxxxxxx
0xxxxxxx
xxxxxxxx xxxxxxxx xxxxxxxx
xxxxxxxx xxxxxxxx xxxxxxxx
(first 27 bits)
(number of succee ...
(succeeding bytes ...
(succeeding bytes ...
xxxxxxxx xxxxxxxx xxxxxxxx
xxxxxxxx
(succeeding bytes ...
(succeeding bytes ...
i1 : binary = s -> concatenate between (" ",
apply(s,x -> apply(8, i-> toString ((x >> 7-i ...
i2 : << binary ascii gg 63 << endl;
00111111
i3 : << binary ascii gg 64 << endl;
10000000 01000000
i4 : << binary ascii gg 127 << endl;
10000000 01111111
i5 : << binary ascii gg 128 << endl;
10000001 00000000
i6 : << binary ascii gg 2^10 << endl;
10001000 00000000
i7 : << binary ascii gg 2^20 << endl;
10000000 11000000 10000000 00000000
i8 : << binary ascii gg (-2^20) << endl;
11000000 11000000 10000000 00000000
i9 : << binary ascii gg 2^30 << endl;
22.1. ENGINE COMMUNICATION PROTOCOL
501
10000010 10000000 10000000 10000000 00000001 00000000
i10 : << binary ascii gg 2^40 << endl;
10001000 10000000 10000000 10000000 00000010 00000000 000000 ...
i11 : << binary ascii gg 2^50 << endl;
10100000 10000000 10000000 10000000 00000011 00000000 000000 ...
22.1.3. transmitting an integer mod n
An integer mod n is sent as an integer.
i1 : ZZ/101[x];
i2 : s = 44 + x - x
o2 = 44
ZZ
o2 : --- [x]
101
i3 : ascii sendgg( ggPush s, ggleadcoeff, ggtonet)
o3 = {44}
o3 : List
22.1.4. transmitting a sequence
Several items of the same type are transmitted as follows. The number of items
is transmitted first, as a positive integer of 28 bits or less. See transmitting a
positive integer [IV.22.1.1]. Then the items are transmitted.
i1 : ascii gg {33,44,55}
o1 = {3, 33, 44, 55}
o1 : List
22.1.5. transmitting a monomial
A monomial is transmitted as a sequence of pairs (i,e) of integers, where i refers
to the i-th variable in the ring, and e is the exponent.
i1 : ZZ/3[t,u,x,y,z];
i2 : ascii sendgg(ggPush (t^22 * y^33 * z^55), ggleadmonom,
...
o2 = {3, 0, 22, 3, 33, 4, 55}
o2 : List
22.1.6. transmitting a polynomial
A polynomial is transmitted as a sequence of pairs (m,c), where m is a monomial
and c is a coefficient.
i1 : ZZ/101[x,y,z];
502
22. ENGINE
i2 : ascii callgg(ggtonet, 22*x^66+11*y^77)
o2 = {2, 1, 1, 128, 77, 11, 1, 0, 128, 66, 22}
o2 : List
22.1.7. transmitting a vector
The method for transmitting a vector depends on the ring involved.
If the ring is a monoid ring (e.g., a polynomial ring), then the vector is transmitted as a sequence of triples (i,m,a), where i is the number of the row, m is the
monomial, and a is the coefficient.
If the ring is not a monoid ring, then the vector is transmitted as a sequences
of pairs (i,r) where i is the number of the row, and r is the entry.
The columns of a matrix are transmitted as vectors.
See also:
transmitting a monomial [IV.22.1.5]
transmitting a matrix [IV.22.1.8]
22.1.8. transmitting a matrix
Most objects in the engine are stored as matrices. Even single polynomials are
usually stored as 1 by 1 matrices.
A matrix is transmitted by sending the columns as a sequence of vectors.
i1 : R = ZZ/101[x,y,z];
i2 : f = matrix ( R, {{11,0,33},{0,22,34}} )
o2 = {0} | 11 0 33 |
{0} | 0 22 34 |
2
3
o2 : Matrix R <--- R
i3 : ascii sendgg(ggPush f, ggtonet)
o3 = {3, 1, 0, 0, 11, 1, 1, 0, 22, 2, 1, 0, 34, 0, 0, 33}
o3 : List
See also:
transmitting a vector [IV.22.1.7]
22.1.9. convert
convert (fmt,str) – converts a string str containing data transmitted from
the engine in the engine communication protocol [IV.22.1]. The argument fmt
is a recursive description of the format to be used for the conversion.
The method named ConversionFormat [V.24.62] is used to provide a conversion format
A format of the form
singleton f
22.1. ENGINE COMMUNICATION PROTOCOL
503
specifies that a sequence has been transmitted, each element of which should be
converted with the format f. See transmitting a sequence [IV.22.1.4].
A format of the form
(g,x,y,z,...)
where g is a function, specifies that consecutive items are to be converted with the
formats x,y,z,..., and the results of conversion are to be passed as arguments to the
functin g for processing.
A format of the form
(n,x,y,z,...)
where n is an integer, specifies that consecutive items are to be converted wtih the
formats x,y,z,..., a total of n times. The results are to be placed in a sequence.
A format consisting of the symbol ConvertInteger [V.24.63]specifies that an
integer has been transmitted. See transmitting an integer [IV.22.1.2].
Functions which assemble formats.
ConvertApply [IV.22.1.9.1] – apply a function after specified engine format conversions
ConvertFixedRepeat [IV.22.1.9.2] – convert a fixed length sequence of
items from engine format
ConvertJoin [IV.22.1.9.3] – convert several items from engine format
ConvertList [IV.22.1.9.4] – convert a sequence of items from engine format
ConvertMissing [IV.22.1.9.5] – a missing engine conversion format item
ConvertRepeat [IV.22.1.9.6] – convert a sequence of items from engine
format
A format is usually stored under the key ConvertToExpression [V.24.64] in
the apprpriate class.
See also:
pop [V.24.475] – pop a value from the engine’s stack
The function convert is a member of the class Function [III.18].
22.1.9.1. ConvertApply
ConvertApply(f,T1,...,Tm) – a format item for communication with the engine that specifies that format items T1, ..., Tm should be applied to the bytes received from the engine, and then the function f should be applied to the sequence
of results.
See convert [IV.22.1.9].
The function ConvertApply is a member of the class Function [III.18].
Code:
-- code for ConvertApply:
-- ../m2/convert.m2:5
ConvertApply = x -> x
-- (f,T1,...,Tm)
22.1.9.2. ConvertFixedRepeat
ConvertFixedRepeat(n,T1,...,Tm) – a format item for converting data from
the engine that specifies that the format items T1,...,Tm be applied to the incoming
data a total of n times.
See convert [IV.22.1.9].
The function ConvertFixedRepeat is a member of the class Function [III.18].
Code:
-- code for ConvertFixedRepeat:
-- ../m2/convert.m2:8
504
22. ENGINE
ConvertFixedRepeat = x -> x
-- (n,T1,...,Tm)
22.1.9.3. ConvertJoin
ConvertJoin(T1,...,Tm) – a format item for converting data from the engine
that specifies that format items T1,...,Tm be applied to the data received, and the
sequence of results returned.
If there is just one format item T1, then its result is returned.
See convert [IV.22.1.9].
The function ConvertJoin is a member of the class Function [III.18].
22.1.9.4. ConvertList
ConvertList T – a format item for converting data received from the engine
[IV.22], which specifies that format item T be applied to each element in the array,
returning the results as a list.
See convert [IV.22.1.9].
The function ConvertList is a member of the class Function [III.18].
Code:
-- code for ConvertList:
-- ../m2/convert.m2:9
ConvertList = T -> (toList, ConvertRepeat T)
22.1.9.5. ConvertMissing
ConvertMissing – a format item for converting data from the engine which
specifies that the class for which this item has been installed has no conversion
format specified, presumably because it corresponds to a type which the engine
doesn’t support.
See convert [IV.22.1.9].
The symbol ConvertMissing is a member of the class Symbol [III.21.10].
22.1.9.6. ConvertRepeat
ConvertRepeat T – a format item for converting data received from the engine
[IV.22], which specifies that format item T be applied to each element in the array,
returning the results as a sequence.
See convert [IV.22.1.9].
The function ConvertRepeat is a member of the class Function [III.18].
Code:
-- code for ConvertRepeat:
-- ../m2/convert.m2:7
ConvertRepeat = T -> singleton T
22.2. low level gb engine commands
22.3. high level gb engine commands
Sending commands to the engine:
callgg [IV.22.3.1] – call the engine
gg [IV.22.3.2] – convert to engine communication format
ggPush [IV.22.3.3] – convert a push command to engine communication
format
handle [IV.22.3.4] – get the handle of an object
22.3. HIGH LEVEL GB ENGINE COMMANDS
505
sendToEngine [IV.22.3.5] – send a command string to the engine
sendgg [IV.22.3.6] – send commands to engine
This class provides an interface to rings implemented by the engine.
EngineRing [III.10.1] – the class of rings handled by the engine
These routines take an element off the stack.
eePop [IV.22.3.7] – pop object from engine stack
eePopBool [IV.22.3.8] – pop Boolean value from engine stack
eePopInt [IV.22.3.9] – pop integer from engine stack
eePopIntarray [IV.22.3.10] – pop array of integers from engine stack
getMatrix [IV.22.3.11] – get a matrix from the engine’s stack
These functions transfer ring elements to other rings.
eeLift [IV.22.3.12] – call engine to lift a ring element
eePromote [IV.22.3.13] – call engine to promote a ring element
These functions are used mainly for debugging the engine.
look [IV.22.3.14] – look at the engine’s stack
engineMemory [IV.22.3.15] – display engine memory usage
engineStack [IV.22.3.16] – display the engine’s stack
heap [IV.22.3.17] – display the engine’s heap
see [IV.22.3.18] – display engine object
22.3.1. callgg
callgg(f,x,y,...) – calls the engine [IV.22] with engine command string f,
after pushing engine objects corresponding to x, y, ... onto the engine’s stack.
The function callgg is a member of the class Function [III.18].
Code:
-- code for callgg:
-- ../m2/gbinterface.m2:7-9
callgg = args -> (
sendgg (apply(#args-1, i -> ggPush args#(i+1)), args#0)
)
22.3.2. gg
gg x – converts an integer, handle, or list of integers to the format required for
communication with the engine.
See also:
engine communication protocol [IV.22.1]
The function gg is a member of the class Function [III.18].
22.3.3. ggPush
ggPush h – provides a string which when sent to the engine will cause it to
push the object h onto the engine’s stack.
This command is intended for internal use only.
Warning: in an expression of the form ggPush f() where f is a function that
returns an object with a handle, there is no pointer to the object retained in the
string provided, so the garbage collector may cause the object and its handle to be
freed before the arrival of the command! The solution is to store the result in a
local variable until the command has been sent.
The function ggPush is a member of the class Function [III.18].
Ways to use ggPush :
506
22. ENGINE
ggPush
ggPush
ggPush
ggPush
ggPush
ggPush
Handle
HashTable
QQ
String
ZZ
{...}
22.3.4. handle
handle x – produces the Handle [III.21.4] for the object x.
The corresponding symbol is used as a key under which to store the handle.
The function handle is a member of the class Function [III.18].
Ways to use handle :
handle HashTable
Code:
-- code for handle:
-- ../m2/handles.m2:15
handle = x -> x.handle
22.3.5. sendToEngine
sendToEngine s – sends the string s to the engine and returns the result.
See also engine communication protocol [IV.22.1].
The function sendToEngine is a member of the class Function [III.18].
22.3.6. sendgg
sendgg s – uses sendToEngine [IV.22.3.5] to send the string s of data and
commands to the engine. The first byte of the result is examined for an error
indication, and then an error is raised or the remainder of the string is returned.
See also:
engine communication protocol [IV.22.1]
The function sendgg is a member of the class Function [III.18].
22.3.7. eePop
eePop f – take an engine conversion format string and use it to convert an
object popped from the top of the engine’s stack.
See also:
high level gb engine commands [IV.22.3]
The function eePop is a member of the class Function [III.18].
Code:
-- code for eePop:
-- ../m2/gbinterface.m2:12
eePop = format -> convert(format, sendgg ggtonet)
22.3.8. eePopBool
eePopBool() – pop a boolean value from the top of the engine’s stack, returning
true or false.
See also:
high level gb engine commands [IV.22.3]
The function eePopBool is a member of the class Function [III.18].
Code:
22.3. HIGH LEVEL GB ENGINE COMMANDS
507
-- code for eePopBool:
-- ../m2/gbinterface.m2:19
eePopBool = () -> eePop ConvertInteger === 1
22.3.9. eePopInt
eePopInt() – pop the integer from the top of the engine’s stack, returning its
value.
See also:
high level gb engine commands [IV.22.3]
The function eePopInt is a member of the class Function [III.18].
Code:
-- code for eePopInt:
-- ../m2/gbinterface.m2:14
ZZ.pop = eePopInt = () -> eePop ConvertInteger
22.3.10. eePopIntarray
eePopIntarray() – pop the array of integers from the top of the engine’s stack,
returning its value as a list of integers.
See also:
high level gb engine commands [IV.22.3]
The function eePopIntarray is a member of the class Function [III.18].
Code:
-- code for eePopIntarray:
-- ../m2/gbinterface.m2:20
eePopIntarray = () -> eePop ConvertList ConvertInteger
22.3.11. getMatrix
getMatrix R – pops a matrix over R from the top of the engine’s stack and
returns it.
Intended for internal use only.
The function getMatrix is a member of the class Function [III.18].
Code:
-- code for getMatrix:
-- ../m2/matrix.m2:49-52
getMatrix = (R) -> newMatrix(
(sendgg(ggdup,gggetrows); new Module from R),
(sendgg(ggdup,gggetcols); new Module from R)
)
22.3.12. eeLift
eeLift(f,R) – lift a ring element f to the ring R.
See also:
high level gb engine commands [IV.22.3]
The function eeLift is a member of the class Function [III.18].
Code:
-- code for eeLift:
-- ../m2/gbinterface.m2:24-26
eeLift = (f,R) -> (
sendgg(ggPush R, ggPush f, gglift);
R.pop())
508
22. ENGINE
22.3.13. eePromote
eePromote(f,R) – promote a ring element f to the ring R.
See also:
high level gb engine commands [IV.22.3]
The function eePromote is a member of the class Function [III.18].
Code:
-- code for eePromote:
-- ../m2/gbinterface.m2:21-23
eePromote = (f,R) -> (
sendgg(ggPush R, ggPush f, ggpromote);
R.pop())
22.3.14. look
look() – display item on the top of the engine’s stack.
It’s a Command [III.21.1.2] so it may be entered simply as look if it’s alone
on the command line.
Used mainly for debugging the engine.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : sendgg ggPush R
o2 =
o2 : String
i3 : look
ZZ/101[x,y,z; Degrees => {1, 1, 1}; MonomialOrder => grlex1[ ...
The command look is a member of the class Command [III.21.1.2].
22.3.15. engineMemory
engineMemory() – display the memory usage of the engine.
It’s a Command [III.21.1.2] so it may be entered simply as engineMemory if
it’s alone on the command line.
Used mainly for debugging the engine.
i1 : ZZ/101[x,y,z];
i2 : matrix {{x,y,z}}
o2 = {0} | x y z |
ZZ
1
ZZ
3
o2 : Matrix (--- [x, y, z]) <--- (--- [x, y, z])
101
101
i3 : engineMemory
total engine space allocated = 41k
stash
k total
k in use
polys
1k
1k
vectors
1k
1k
size
12
16
nalloc ...
7 ...
12 ...
22.3. HIGH LEVEL GB ENGINE COMMANDS
509
packed monoms
1k
1k
4
13 ...
polys
1k
1k
12
2 ...
polys
1k
1k
12
2 ...
packed monoms
1k
1k
4
3 ...
packed monoms
1k
1k
4
31 ...
fractions
1k
1k
8
3 ...
ZZ
1k
1k
12
186 ...
vectors
1k
1k
12
6 ...
hermite
1k
1k
56
1 ...
hm_elem
1k
1k
24
1 ...
Matrix
1k
1k
36
4 ...
FreeModule
1k
1k
72
13 ...
Vector
1k
1k
16
19 ...
Ringelem
1k
1k
16
182 ...
handle
1k
1k
8
49 ...
string
1k
0k
16
4 ...
obj intarray
1k
0k
20
18 ...
double
1k
0k
36
1 ...
double
1k
1k
20
43 ...
handles: highwater = 49, current = 49
The command engineMemory is a member of the class Command [III.21.1.2].
22.3.16. engineStack
engineStack() – returns a net containing a display of the contents of the
engine’s stack.
It’s a Command [III.21.1.2] so it may be entered simply as engineStack if
it’s alone on the command line.
Used mainly for debugging the engine.
i1 : ZZ/101[x,y,z]
ZZ
o1 = --- [x, y, z]
101
o1 : PolynomialRing
i2 : f = matrix {{x,y,z}}
o2 = {0} | x y z |
ZZ
1
ZZ
3
o2 : Matrix (--- [x, y, z]) <--- (--- [x, y, z])
101
101
i3 : sendgg ggPush f
o3 =
o3 : String
i4 : engineStack
o4 = stack:
Matrix x y z
o4 : Net
510
22. ENGINE
The command engineStack is a member of the class Command [III.21.1.2].
22.3.17. heap
heap() – display the contents of the engine’s heap.
It’s a Command [III.21.1.2] so it may be entered simply as heap if it’s alone
on the command line.
Used mainly for debugging the engine.
i1 : ZZ/101[x,y,z];
i2 : matrix {{x,y,z}}
o2 = {0} | x y z |
ZZ
1
ZZ
3
o2 : Matrix (--- [x, y, z]) <--- (--- [x, y, z])
101
101
i3 : heap
--- heap --------handle refcount type
0
22
Ring
1
4
ERing
2
2
ERingElement
3
2
ERingElement
4
4
Ring
5
1
MonomialOrder
6
1
MonomialOrder
7
2
Monoid
8
2
Monoid
9
5
Ring
10
1
RingElement
11
1
RingElement
12
1
RingElement
13
5
Ring
14
1
RingElement
15
1
RingElement
16
1
RingElement
17
6
FreeModule
18
1
Vector
19
2
Matrix
20
3
FreeModule
21
1
Vector
22
2
FreeModule
23
1
Vector
24
1
gb_comp
25
6
FreeModule
26
1
Vector
27
3
FreeModule
28
1
Vector
29
1
Matrix
30
1
MonomialOrder
31
2
Monoid
32
9
Ring
33
9
Ring
34
1
RingElement
35
1
RingElement
36
1
MonomialOrder
37
2
Monoid
22.3. HIGH LEVEL GB ENGINE COMMANDS
511
38
9
Ring
39
1
RingElement
40
1
RingElement
41
1
RingElement
42
1
RingElement
43
1
RingElement
44
3
FreeModule
45
1
Vector
46
1
Matrix
47
3
FreeModule
48
1
Vector
Number of null entries in table = 0
Number of null objects in table = 0
The command heap is a member of the class Command [III.21.1.2].
22.3.18. see
see i – return a string which displays the engine object whose handle is the
integer i.
see X – return a string which displays the engine object corresponding to the ring,
matrix, module, or ring element X.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : see R
o2 = ZZ/101[x,y,z; Degrees => {1, 1, 1}; MonomialOrder => gr ...
o2 : String
i3 : see (x+1)^6
o3 = x6+6x5+15x4+20x3+15x2+6x+1
o3 : String
i4 : see handle (x*y*z)
o4 = xyz
o4 : String
i5 : see 0
o5 = ZZ
o5 : String
The function see is a member of the class Function [III.18].
Ways to use see :
see Handle
see HashTable
see ZZ
CHAPTER 23
internals
Here are some functions and classes that are intended for internal use by the
developers only.
formatDocumentTag [IV.23.1] – format documentation tags
setSpin [IV.23.2] – set interval for spinning the cursor
23.1. formatDocumentTag
formatDocumentTag x – formats the tags used with TO [III.21.1.6.46] for display purposes in documents.
This function is intended for internal use only.
The function formatDocumentTag is a member of the class Function [III.18].
Ways to use formatDocumentTag :
formatDocumentTag (...)
formatDocumentTag Function
formatDocumentTag Option
formatDocumentTag Symbol
formatDocumentTag Thing
23.2. setSpin
setSpin n – sets the interval between calls to spin the cursor on the Macintosh.
The value returned is the previous interval.
The function setSpin is a member of the class Function [III.18].
513
Part V
Appendix
This appendix contains additional information about the following topics.
Miscellaneous documentation [V.24]
CHAPTER 24
Miscellaneous documentation
We present various additional documentation in this chapter.
[V.24.1] – blank operator for adjacent expressions
! [V.24.2] – factorial
!= [V.24.3] – inequality
# [V.24.4] – length, or access to elements
# (...) [V.24.5] – length
# Set [V.24.6] – cardinality
## [V.24.7] – uncurry a function
#? [V.24.8] – check for presence of elements
% [V.24.9] – a binary operator, usually used for remainder
& [V.24.10] – a binary operator
&& [V.24.11] – a binary operator
(...) # ZZ [V.24.12] – get element from sequence
(...) #? ZZ [V.24.13] – check for element in sequence
* [V.24.14] – a binary operator, usually used for multiplication
** [V.24.15] – a binary operator, usually used for tensor product
+ [V.24.16] – a bina operator
++ [V.24.17] – a binary operator, usually used for direct sum
, [V.24.18] – separator
- [V.24.19] – a binary operator, usually used for subtraction
– [V.24.20] – comment
-> [V.24.21] – make a function
. [V.24.22] – access to elements whose key is a symbol
.. [V.24.23] – sequence of consecutive items
.? [V.24.24] – check for presence of elements whose key is a symbol
/ [V.24.25] – a binary operator, usually used for division
// [V.24.26] – a binary operator, usually used for quotient
/// [V.24.27] – delineate a string
/^ [V.24.28] – a binary operator
: [V.24.29] – a binary operator
:= [V.24.30] – assignment to a new local variable
; [V.24.31] – statement separator
< [V.24.32] – less than
<- [V.24.33] – assignment
<< [V.24.34]
<< Thing [V.24.35] – print to a file
<= [V.24.36] – less than or equal
= [V.24.37] – assignment
=!= [V.24.38] – strict inequality
517
518
24. MISCELLANEOUS DOCUMENTATION
== [V.24.39] – equality
=== [V.24.40] – strict equality
==> [V.24.41] – a binary operator
=> [V.24.42] – produce an Option
> [V.24.43] – greater than
>= [V.24.44] – greater than or equal
>> [V.24.45] – shift bits rightward
? [V.24.46] – comparison operator
@ [V.24.47] – a binary operator
@@ [V.24.48] – a binary operator
AfterEval [V.24.49] – top level method applied before printing results
AfterNoPrint [V.24.50] – top level method applied after not printing
AfterPrint [V.24.51] – top level method applied after printing
Algorithm [V.24.52] – an obsolete synonym for Strategy
Ascending [V.24.53]
Associative [V.24.54]
BasisElementLimit [V.24.55] – stop when this number of basis elements
is obtained
Bayer [V.24.56] – use the method in Bayer’s thesis
BeforePrint [V.24.57] – top level method applied before printing results
BinaryPowerMethod [V.24.58] – compute powers by squaring
ChangeMatrix [V.24.59] – whether to produce the change of basis matrix
CodimensionLimit [V.24.60] – stop when this codimension is reached
CompleteIntersection [V.24.61] – provide a hint when computing a radical
ConversionFormat [V.24.62] – convert to engine format
ConvertInteger [V.24.63] – convert an integer from engine format
ConvertToExpression [V.24.64] – specify mehtod for converting to engine format
Degree [V.24.65]
DegreeLimit [V.24.66] – compute up to a certain degree
DegreeOrder [V.24.67] – sort primarily by degree
Descending [V.24.68] – specify descending order
Documentation [V.24.69]
DownArrow [V.24.70]
Elimination [V.24.71] – compute the saturation by elimination
EliminationOrder [V.24.72] – use the natural elmination order in a pushForward1 computation
End [V.24.73] – module of endomorphisms
Engine [V.24.74] – specify whether a ring is handled by the engine
Ext [V.24.75] – compute an Ext module
Factorization and characteristic sets library [V.24.76]
Factory library [V.24.77]
Fano [V.24.78] – Fano scheme
FindOne [V.24.79] – find a primitive element
Function \ {...} [V.24.80] – apply a function to each member of a list
GBtype [V.24.81]
GC garbage collector [V.24.82]
24. MISCELLANEOUS DOCUMENTATION
519
GF [V.24.83] – make a finite field
GNU MP [V.24.84]
GlobalAssignHook [V.24.85] – hook for assignment to global variables
GlobalReleaseHook [V.24.86]
Grassmannian [V.24.87] – find the ideal of a Grassmannian
HH [V.24.88] – general homology and cohomology functor
HardDegreeLimit [V.24.89] – compute only up to this degree
Hom [V.24.90] – module of homomorphisms
Homogeneous [V.24.91]
Inhomogeneous [V.24.92]
InverseMethod [V.24.93] – compute reciprocals
Iterate [V.24.94] – use successive ideal quotients (the default)
LengthLimit [V.24.95] – stop when the resolution reaches this length
Limit [V.24.96] – specify how many to compute
Linear [V.24.97] – use the reverse lex order
LongPolynomial [V.24.98]
Macaulay 2 [V.24.99]
MinimalGenerators [V.24.100]
MinimalMatrix [V.24.101] – set the matrix of minimal generators
Module : Module [V.24.102] – a binary operator
Monomials [V.24.103] – whether to display the number of monomial
NewFromMethod [V.24.104]
NewMethod [V.24.105]
NewOfFromMethod [V.24.106]
NewOfMethod [V.24.107]
NoPrint [V.24.108] – top level method for non-printing results
NonLinear [V.24.109] – use the algorithm which doesn’t assume that the
ring map is linear
OO [V.24.110] – the structure sheaf
Options [V.24.111] – specify optional arguments for a method
Order [V.24.112] – specify the order of a Hilbert series required
PairLimit [V.24.113] – stop when this number of pairs is handled
PairsRemaining [V.24.114] – whether to display the number of S-pairs
remaining
Primary [V.24.115]
PrimitiveElement [V.24.116] – specify a primitive element
Print [V.24.117] – top level method for printing results
Proj [V.24.118] – make a projective variety
Projective [V.24.119] – whether to produce a projective Hilbert polynomial
RightArrow [V.24.120]
SEEALSO [V.24.121] – crossreferences in documentation
Schur [V.24.122] – make a Schur ring
SimplePowerMethod [V.24.123] – compute powers by multiplying
SingleArgumentDispatch [V.24.124] – make a method for handling sequences individually
Sort [V.24.125]
SortStrategy [V.24.126] – specify a strategy for sorting S-pairs
520
24. MISCELLANEOUS DOCUMENTATION
Spec [V.24.127] – make an affine variety
StopBeforeComputation [V.24.128] – initialize but do not begin the
computation
StopWithMinimalGenerators [V.24.129] – stop when minimal generators have been determined
Strategy [V.24.130] – specify a computational strategy
String | String [V.24.131] – join strings or nets
SubringLimit [V.24.132] – stop after finding enough elements of a subring
Syzygies [V.24.133] – whether to collect syzygies
SyzygyLimit [V.24.134] – stop when this number of syzygies is obtained
SyzygyMatrix [V.24.135] – set the syzygy matrix
SyzygyRows [V.24.136] – the number rows of the syzygy matrix to collect
TEST [V.24.137] – commands for testing later
TOH [V.24.138]
TeX [V.24.139] – convert to TeX and display on screen
Tor [V.24.140] – compute a Tor module
TotalPairs [V.24.141] – whether to display the total number of S-pairs
TypicalValue [V.24.142]
Unmixed [V.24.143] – provide a hint when computing a radical
UseHilbertFunction [V.24.144]
Variable [V.24.145] – specify a name for the generator of a Galois field
Verify [V.24.146] – verify that a map is well-defined
\ [V.24.147] – a binary operator
\\ [V.24.148] – a binary operator
^ [V.24.149] – a binary operator, usually used for exponents
^^ [V.24.150] – a binary operator
_ [V.24.151]
abs [V.24.152] – absolute value function
accumulate [V.24.153] – apply binary operator repeatedly
acos [V.24.154] – arccosine function
addEndFunction [V.24.155] – add an ending function
addStartFunction [V.24.156] – add a startup function
adjoint [V.24.157] – the adjoint map
adjoint1 [V.24.158] – the adjoint map
adjust [V.24.159] – adjust the degree in a total Ext module
alarm [V.24.160] – set an alarm
all [V.24.161] – whether all elements satisfy a condition
ambient [V.24.162] – ambient free module or ring
ancestor [V.24.163] – whether one type is an ancestor of another
and [V.24.164] – conjunction
ann [V.24.165]
annihilator [V.24.166] – the annihilator ideal
any [V.24.167] – whether an element satisfies a condition
append [V.24.168] – add to the end of a list
apply [V.24.169] – apply a function to each element
applyKeys [V.24.170] – apply a function to each key in a hash table
applyPairs [V.24.171] – apply a function to pairs in a hash table
applyTable [V.24.172] – apply a function to elements of a table
24. MISCELLANEOUS DOCUMENTATION
521
applyValues [V.24.173] – apply a function to each value
apropos [V.24.174] – symbols matching a pattern
argument [V.24.175] – specify the function in a scripted functor for an
argument
ascii [V.24.176] – ASCII character conversion
asin [V.24.177] – arcsine function
assert [V.24.178] – assert something is true
assign [V.24.179] – assign a value
atEndOfFile [V.24.180] – test for end of file
atan [V.24.181] – arctangent function
autoload [V.24.182] – arrange for a function to be loaded automatically
backtrace [V.24.183] – trace back through evaluations after an error
baseName [V.24.184] – the base name of a generator
baseRings [V.24.185] – store the list of base rings of a ring
basictype [V.24.186] – the basic type
basis [V.24.187] – a k-basis of all or part of a module
benchmark [V.24.188] – accurate timing of execution
between [V.24.189] – insert something between elements of a list
binary method [V.24.190]
binomial [V.24.191] – binomial coefficient
borel [V.24.192] – make a Borel fixed submodule
briefDocumentation [V.24.193] – get brief documentation
browse [V.24.194] – browse the contents of an object
ceiling [V.24.195] – ceiling function
chainComplex [V.24.196] – make a chain complex
char [V.24.197] – the characteristic of a field or ring
characters [V.24.198] – get characters from a string
class [V.24.199] – class of an object
clearAll [V.24.200] – forget evertything
clearEcho [V.24.201] – turn off echoing
clearOutput [V.24.202] – forget output values
close [V.24.203] – close a file
closeIn [V.24.204] – close an input file
closeOut [V.24.205] – close an output file
code [V.24.206] – display source code
codim [V.24.207] – calculate the codimension
coefficientRing [V.24.208] – get the coefficient ring
coefficients [V.24.209] – the coefficients
cohomology [V.24.210] – general cohomology functor
coimage [V.24.211] – coimage of a map
coker [V.24.212]
cokernel [V.24.213] – cokernel of a map
collectGarbage [V.24.214] – collect the garbage in memory
columnate [V.24.215] – arrange strings in columns
combinatorial functions [V.24.216]
combine [V.24.217] – combine hash tables
commandLine [V.24.218] – the command line arguments
compactMatrixForm [V.24.219]
522
24. MISCELLANEOUS DOCUMENTATION
complement [V.24.220] – find the minimal generators for cokernel of a
matrix (low level form)
complete [V.24.221]
component example [V.24.222]
components [V.24.223] – list the components of a direct sum
compress [V.24.224] – remove columns which are zero
concatenate [V.24.225] – join strings
cone [V.24.226] – mapping cone of a chain map
connectionCount [V.24.227] – the number of connections
content [V.24.228] – the content of a polynomial
contract [V.24.229] – contract one matrix by another
copy [V.24.230] – copy an object
cos [V.24.231] – cosine function
cosh [V.24.232] – hyperbolic cosine function
cotangentSheaf [V.24.233] – make the cotangent sheaf
cover [V.24.234] – get the covering free module
currentDirectory [V.24.235] – current working directory
currentFile [V.24.236]
dd [V.24.237] – differential in a chain complex
decompose [V.24.238] – irreducible components of an ideal
deepSplice [V.24.239] – remove subsequences
degree [V.24.240] – the degree
degreeLength [V.24.241] – the number of degrees
degrees [V.24.242] – get degrees of basis elements
degreesMonoid [V.24.243] – get the monoid of degrees
degreesRing [V.24.244] – the ring of degrees
delete [V.24.245] – delete elements of a list
demark [V.24.246] – insert a string between elements of a list of strings
denominator [V.24.247] – denominator of a fraction
depth [V.24.248] – depth of a net
describe [V.24.249] – real description
det [V.24.250] – determinant of a matrix
diff [V.24.251] – differentiate
difference [V.24.252] – difference
dim [V.24.253] – calculate the dimension
directSum [V.24.254] – direct sum of modules or maps
divideByVariable [V.24.255] – divide all columns by a (power of a) variable
do [V.24.256] – loop control
document [V.24.257] – install documentation
documentation [V.24.258] – get documentation, unformatted
drop [V.24.259] – drop some elements
dual [V.24.260] – dual module or map
dumpdata [V.24.261] – dump state of the system to a file
echoOff [V.24.262] – turn off echoing
echoOn [V.24.263] – turn on echoing
edit [V.24.264] – edit source code
editing Macaulay 2 code with emacs [V.24.265]
24. MISCELLANEOUS DOCUMENTATION
523
else [V.24.266] – condition testing
emacs [V.24.267]
end [V.24.268] – stop loading a file
endl [V.24.269] – end an output line
entries [V.24.270] – list the entries of a matrix
environment [V.24.271] – the environment variables
erase [V.24.272] – remove a global symbol
error [V.24.273] – deliver error message
errorDepth [V.24.274] – set the error printing depth
euler [V.24.275] – list the sectional Euler characteristics
even [V.24.276] – tell whether an integer is even
examine [V.24.277] – examine internal information about functions or
symbols
examples [V.24.278] – list the examples in documentation
exec [V.24.279] – execute another program
exit [V.24.280] – exit the program
exp [V.24.281] – exponential function
exponents [V.24.282] – list the exponents in a polynomial
extend [V.24.283] – extend a partial map of chain complexes
exteriorPower [V.24.284] – exterior power
factor [V.24.285] – factor a ring element
false [V.24.286] – Boolean value false
first [V.24.287] – first element of a list
firstkey [V.24.288] – get the first key
fittingIdeal [V.24.289] – Fitting ideal of a module
flag [V.24.290] – flag a symbol
flatten [V.24.291] – flatten a list by unnesting lists
flip [V.24.292]
floor [V.24.293] – floor function
flush [V.24.294] – flush output to file
fold [V.24.295] – apply binary operator repeatedly
forceGB(..., ChangeMatrix => ...) [V.24.296] – set the change of basis
matrix
fork [V.24.297] – fork the process
format [V.24.298] – format a string
fraction [V.24.299]
from [V.24.300] – a keyword
fromDual [V.24.301]
functions [V.24.302]
gb(..., ChangeMatrix => ...) [V.24.303] – whether to produce the change
of basis matrix
gb(..., CodimensionLimit => ...) [V.24.60.1] – stop when this codimension is reached
gb(..., DegreeLimit => ...) [V.24.304] – compute up to a certain degree
gb(..., PairLimit => ...) [V.24.305] – stop when this number of pairs is
handled
gb(..., StopBeforeComputation => ...) [V.24.306] – whether to stop
the computation immediately
524
24. MISCELLANEOUS DOCUMENTATION
gb(..., StopWithMinimalGenerators => ...) [V.24.129.1] – stop when
minimal generators have been determined
gb(..., Strategy => ...) [V.24.307] – specify the strategy used to compute
Groebner bases
gb(..., SyzygyLimit => ...) [V.24.308] – stop when this number of syzygies is obtained
gbTrace [V.24.309] – – provide tracing output during various computations in the engine.
gcDump [V.24.310] – the status of the memory allocator
gcd [V.24.311] – greatest common divisor
gcdCoefficients [V.24.312] – gcd with coefficients
genera [V.24.313] – list the sectional arithmetic genera
generatorExpressions [V.24.314] – store the generators
generatorSymbols [V.24.315] – store the symbols for the generators
genericMatrix [V.24.316] – make a generic matrix of variables
genericSkewMatrix [V.24.317] – make a generic skew symmetric matrix
genericSymmetricMatrix [V.24.318] – make a generic symmetric matrix
gens [V.24.319] – matrix of generators
get [V.24.320] – get an entire file
getChangeMatrix [V.24.321] – get the change of basis matrix
getWWW [V.24.322] – get a web page
getc [V.24.323] – get a byte
getenv [V.24.324] – get value of environment variable
global [V.24.325] – get a global symbol
globalAssignFunction [V.24.326] – the standard method for the global
assignment hook
globalReleaseFunction [V.24.327] – the standard method for the global
variable release hook
gradedModule [V.24.328] – make a graded module
gradedModuleMap [V.24.329] – make a map of graded modules
graphIdeal [V.24.330] – the ideal of the graph of a ring map
graphRing [V.24.331] – the ring of the graph of a ring map
group [V.24.332] – make a group (monoid with inverses)
hash [V.24.333] – hash code of an object
hashTable [V.24.334] – make a hash table
hashing [V.24.335]
height [V.24.336] – height of a net
help [V.24.337] – get help
hilbertFunction [V.24.338] – Hilbert function of a module
hilbertSeries [V.24.339] – compute Hilbert series
homogenize [V.24.340] – homogenize with respect to a variable
homology [V.24.341] – general homology functor
homomorphism [V.24.342] – get the homomorphism from element of Hom
hypertext [V.24.343]
id [V.24.344] – identity map
identity [V.24.345] – the identity function
if [V.24.346] – condition testing
ii [V.24.347] – square root of -1
24. MISCELLANEOUS DOCUMENTATION
525
image [V.24.348] – image of a map
incomparable [V.24.349] – a result indicating incomparability
indeterminate [V.24.350] – an indeterminate number
index [V.24.351] – yields the numeric index of a ring variable
indexComponents [V.24.352] – specify keys for components of a direct
sum
indices [V.24.353] – specify keys for components of a direct sum
inducedMap [V.24.354] – compute an induced map
inducedMap(..., Degree => ...) [V.24.355] – specify the degree of a map
inducedMap(..., Verify => ...) [V.24.146.1] – verify that a map is welldefined
infinity [V.24.356] – infinity
initialization file [V.24.357]
input [V.24.358] – read Macaulay 2 commands and echo
installMethod [V.24.359] – install methods
instance [V.24.360] – whether something has a certain type
integrate [V.24.361] – numerical integration
intersect [V.24.362] – compute an intersection
irreducibleCharacteristicSeries [V.24.363] – compute the irreducible
characteristic series
isDirectSum [V.24.364] – whether something is a direct sum
isInputFile [V.24.365] – whether a file is open for input
isListener [V.24.366] – whether a file is open for listening
isOpenFile [V.24.367] – whether a file is open
isOutputFile [V.24.368] – whether a file is open for output
isPrimitive [V.24.369] – whether an element is a primitive element of a
finite field
isReady [V.24.370] – whether a file has data available for reading
isTable [V.24.371] – whether something is a rectangular list of lists
jacobian [V.24.372] – the Jacobian matrix of partial derivatives
join [V.24.373] – join lists
ker [V.24.374]
kernel [V.24.375] – kernel of a map
kernel(..., SubringLimit => ...) [V.24.376] – stop after finding enough
elements of a subring
keys [V.24.377] – keys used in a hash table
kill [V.24.378] – kill a process
koszul [V.24.379] – a differential in a Koszul map
last [V.24.380] – last element of a list
leadCoefficient [V.24.381] – the leading coefficient
leadComponent [V.24.382] – the leading component of a vector
leadMonomial [V.24.383] – the leading monomial
leadTerm [V.24.384] – get the leading term
length [V.24.385] – length
lift [V.24.386] – lift to another ring
liftable [V.24.387] – whether a ring element can be lifted to another ring
lineNumber [V.24.388] – current line number
lines [V.24.389] – split a string into lines
526
24. MISCELLANEOUS DOCUMENTATION
listForm [V.24.390] – convert to list form
listUserSymbols [V.24.391] – display the user’s symbols
load [V.24.392] – read Macaulay 2 commands
loaddata [V.24.393] – load state of the system from a file
local [V.24.394] – get a local symbol
locate [V.24.395] – locate source code
log [V.24.396] – logarithm function
lookup [V.24.397] – look up methods
lookupCount [V.24.398] – reference count for a symbol
map [V.24.399] – make a map
match [V.24.400] – whether a string matches a pattern
matrix [V.24.401] – make a matrix
max [V.24.402] – maximum of elements of a list
maxPosition [V.24.403] – position of largest element
member [V.24.404] – test membership in a list
memoize [V.24.405] – record results of function evaluation for future use
merge [V.24.406] – merge hash tables
mergePairs [V.24.407] – merge sorted lists of pairs
method(..., Associative => ...) [V.24.408] – allows associative methods
to be created
method(..., TypicalValue => ...) [V.24.409] – specify return value type
methods [V.24.410] – list methods
min [V.24.411] – minimum of elements of a list
minPosition [V.24.412] – position of smallest element
mingens [V.24.413] – returns a minimal generatoring set of a graded module
mingle [V.24.414] – mingle elements of several lists
minors [V.24.415] – ideal generated by minors
minprimes [V.24.416] – compute the minimal primes
minus [V.24.417] – additive inverse
mod [V.24.418] – reduce modulo an integer
modifyRing [V.24.419] – make a copy of a ring, with some features
changed
module [V.24.420]
modules [V.24.421]
modulo [V.24.422] – find the pre-image of a map (low level version)
modulus [V.24.423] – store the modulus
monoid [V.24.424] – make a monoid
monomialCurve [V.24.425] – make a monomial curve
monomialIdeal [V.24.426] – make a monomial ideal
mutable [V.24.427] – whether something may be modified
n [V.24.428]
name [V.24.429] – store the name of a hash table
needs [V.24.430] – read Macaulay 2 commands if necessary
netRows [V.24.431] – list the rows of a net
new [V.24.432] – new objects of various types
newClass [V.24.433] – copy an object, changing the class
newCoordinateSystem [V.24.434] – change variables
24. MISCELLANEOUS DOCUMENTATION
527
newline [V.24.435]
nextkey [V.24.436] – the next key in a database
not [V.24.437] – negation
not documented yet [V.24.438]
notImplemented [V.24.439] – print an ’not implemented’ error message
null [V.24.440] – nothingness
nullhomotopy [V.24.441] – make a null homotopy
number [V.24.442] – count how many elements of a list satisfy a condition
numerator [V.24.443] – numerator of a fraction
numeric [V.24.444] – convert to floating point
numgens [V.24.445] – the number of generators
odd [V.24.446] – tell whether an integer is odd
of [V.24.447] – a keyword
on [V.24.448] – trace a function each time it’s run
oo [V.24.449] – the last output value
ooo [V.24.450] – the next to the last output value
oooo [V.24.451] – the third to the last output value
openDatabase [V.24.452] – open a database file
openDatabaseOut [V.24.453] – open a database file for writing
openFiles [V.24.454] – list the open files
openIn [V.24.455] – open an input file
openInOut [V.24.456] – open an input outpuf file
openListener [V.24.457] – open a port for listening
openOut [V.24.458] – open an output file
or [V.24.459] – disjunction
order [V.24.460] – a key used internally
override [V.24.461] – override default values for optional arguments
pack [V.24.462] – pack elements of a list into shorter ones
pad [V.24.463] – pad a string with spaces
pairs [V.24.464] – list the pairs in a hash table
parent [V.24.465] – parent type of an object
partitions [V.24.216.4] – list the partitions of an integer
path [V.24.466] – list of directories to look in
pathSeparator [V.24.467]
pdim [V.24.468] – calculate the projective dimension
pfaffians [V.24.469] – ideal generated by Pfaffians
phase [V.24.470]
plus [V.24.471] – addition
poincare [V.24.472] – assemble degrees into polynomial
poincareComputation [V.24.473] – store the Poincare polynomial computation
poincareN [V.24.474] – assemble degrees into polynomial
pop [V.24.475] – pop a value from the engine’s stack
position [V.24.476] – find first element of a list satisfying a condition
positions [V.24.477] – which elements of a list satisfy a condition
power [V.24.478] – power
prepend [V.24.479] – add to the beginning of a list
presentation [V.24.480] – presentation of a module or ring
528
24. MISCELLANEOUS DOCUMENTATION
print [V.24.481] – print something
print C.dd [V.24.482]
printExamples [V.24.483] – print examples of use from documentation
printString [V.24.484] – lowlevel function to print a string
processID [V.24.485] – the process identifier
product [V.24.486]
profile [V.24.487] – profile a function
profileSummary [V.24.488] – display profiling data
projectiveHilbertPolynomial [V.24.489] – Hilbert polynomial of projective space
promote [V.24.490] – promote to another ring
protect [V.24.491] – protect a symbol
pruningMap [V.24.492] – store the isomorphism obtained by pruning
pseudoRemainder [V.24.493] – compute the pseudo-remainder
pushForward [V.24.494]
pushForward(..., StopBeforeComputation => ...) [V.24.495] – initialize but do not begin the computation
pushForward(..., StopWithMinimalGenerators => ...) [V.24.129.2]
– stop when minimal generators have been determined
pushForward(..., Strategy => ...) [V.24.496] – specify a computational
strategy
pushForward1 [V.24.497] – the main computational component of pushForward
pushForward1(..., DegreeLimit => ...) [V.24.498] – compute only up
to this degree
pushForward1(..., MonomialOrder => ...) [V.24.499] – specify the
elimination order to use in pushForward1
pushForward1(..., PairLimit => ...) [V.24.500] – stop when this number
of pairs is handled
pushForward1(..., StopBeforeComputation => ...) [V.24.501] – initialize but do not begin the computation
pushForward1(..., StopWithMinimalGenerators => ...) [V.24.129.3]
– stop when minimal generators have been determined
pushForward1(..., Strategy => ...) [V.24.502] – specify which algorithm
to use in the computation
pushForward1(..., UseHilbertFunction => ...) [V.24.503] – whether
to use knowledge of the Hilbert function
quit [V.24.504] – quit the program
quotient [V.24.505] – ideal or submodule quotient
quotient(..., MinimalGenerators => ...) [V.24.100.1]
quotient(..., Strategy => ...) [V.24.506] – specify a computational strategy
radical [V.24.507] – compute the radical of an ideal
random [V.24.216.1] – get a random element
rank [V.24.508] – compute the rank
read [V.24.509] – read from a file
regularity [V.24.510] – compute the regularity
reloaded [V.24.511]
24. MISCELLANEOUS DOCUMENTATION
529
remove [V.24.512] – remove an entry from a hash table
removeLowestDimension [V.24.513] – remove components of lower dimension
reorganize [V.24.514] – reorganize a database file
res [V.24.515]
reshape [V.24.516] – reshape a matrix
resolution [V.24.517] – make a projective resolution
resolution(..., DegreeLimit => ...) [V.24.518] – compute only up to this
degree
resolution(..., HardDegreeLimit => ...) [V.24.519] – compute only up
to this degree
resolution(..., LengthLimit => ...) [V.24.520] – stop when the resolution
reaches this length
resolution(..., PairLimit => ...) [V.24.521] – stop when this number of
pairs are handled
resolution(..., SortStrategy => ...) [V.24.522] – specify a strategy for
sorting S-pairs
resolution(..., StopBeforeComputation => ...) [V.24.523] – whether
to stop the computation immediately
resolution(..., Strategy => ...) [V.24.524] – specify a computational
strategy
resolution(..., SyzygyLimit => ...) [V.24.525] – stop when this number
of syzygies are obtained
restart [V.24.526] – restart Macaulay 2
returnCode [V.24.527]
reverse [V.24.528] – reverse a list
rsort [V.24.529] – sort a list in reverse order
run [V.24.530] – run an external command
runEndFunctions [V.24.531] – run the ending functions
runStartFunctions [V.24.532] – run the start up functions
running Macaulay 2 in emacs [V.24.267.1]
same [V.24.533] – whether everything in a list is the same
saturate [V.24.534] – saturation of ideal or submodule
saturate(..., DegreeLimit => ...) [V.24.535] – compute up to a certain
degree
saturate(..., MinimalGenerators => ...) [V.24.100.2]
saturate(..., Strategy => ...) [V.24.536] – specify a computational strategy
scan [V.24.537] – apply a function to each element
scanKeys [V.24.538] – apply a function to each key in a hash table or
database
scanPairs [V.24.539] – apply a function to pairs in a hash table
scanValues [V.24.540] – apply a function to each value in a hash table
select [V.24.541] – select elements from a list or hash table
selectInSubring [V.24.542] – select columns in a subring
sequence [V.24.543] – make a sequence
set [V.24.544] – make a set
setEcho [V.24.545] – turn on echoing
530
24. MISCELLANEOUS DOCUMENTATION
setrecursionlimit [V.24.546] – set the limit on recursion
shield [V.24.547] – shield evaluation from interrupts
showStructure [V.24.548] – show relationship between types
showUserStructure [V.24.549] – show relationship between types defined
by user
sin [V.24.550] – sine function
singularLocus [V.24.551] – singular locus
sinh [V.24.552] – hyperbolic sine function
size [V.24.553] – the size of an object
sleep [V.24.554] – sleep for a while
someTerms [V.24.555] – select some terms of a polynomial
sort [V.24.556] – sort a list
sortColumns [V.24.557] – sort the columns of a matrix
sortColumns(..., DegreeOrder => ...) [V.24.558] – sort primarily by
degree
sortColumns(..., MonomialOrder => ...) [V.24.559] – specify Ascending or Descending sort order
source [V.24.560] – source of a map
specifying typical values [V.24.561]
splice [V.24.562] – remove subsequences
sqrt [V.24.563] – square root function
standardForm [V.24.564] – convert to standard form
stats [V.24.565]
status [V.24.566] – status of a resolution computation
stderr [V.24.567] – the standard error output file
stdio [V.24.568] – the standard input output file
subclass [V.24.569]
submatrix [V.24.570] – select part of a matrix
subscript [V.24.571] – specify the function in a scripted functor for a
subscript
subsets [V.24.216.2] – produce all the subsets
substitute [V.24.572] – substitute values for variables
substring [V.24.573] – extract part of a string
subtable [V.24.574] – extract a subtable from a table
sum [V.24.575] – compute the sum
super [V.24.576] – get the ambient module
superscript [V.24.577] – specify the function in a scripted functor for a
superscript
symbol [V.24.578] – get a symbol
symbol Documentation [V.24.579] – where the documentation is stored
symbol Resolution [V.24.580] – a key for storing resolutions
symbol Symbols [V.24.581] – find the symbol with a given value
symbol ann [V.24.582] – the annihilator ideal
symbol coker [V.24.583] – cokernel of a map
symbol compactMatrixForm [V.24.584] – global flag for compact printing
symbol currentFile [V.24.585] – the current source file
symbol directSum [V.24.586] – speciy method for forming direct sums
24. MISCELLANEOUS DOCUMENTATION
531
symbol frac [V.24.587]
symbol ker [V.24.588] – kernel of a map
symbol newline [V.24.589] – the new line character sequence
symbol pathSeparator [V.24.590] – path separator for filenames
symbol phase [V.24.591] – compilation phase
symbol pi [V.24.592] – the number ’pi’
symbol reloaded [V.24.593] – count of how many times data has been
dumped and restored
symbol res [V.24.594] – make a projective resolution
symbol typicalValues [V.24.595] – types of values returned by functions
symbolTable [V.24.596] – the global symbols
symmetricAlgebra [V.24.597] – the symmetric algebra of a module
symmetricPower [V.24.598] – symmetric power
syz [V.24.599] – compute the syzygy matrix
syz(..., ChangeMatrix => ...) [V.24.600] – whether to produce the
change of basis matrix
syz(..., CodimensionLimit => ...) [V.24.60.2] – stop when this codimension is reached
syz(..., StopBeforeComputation => ...) [V.24.601] – whether to stop
the computation immediately
syz(..., StopWithMinimalGenerators => ...) [V.24.129.4] – stop when
minimal generators have been determined
syz(..., Strategy => ...) [V.24.602] – specify the strategy used to compute
the Groebner basis
syzygyScheme [V.24.603] – construct a syzygy scheme
table [V.24.604] – make a table (nested list)
take [V.24.605] – take some elements from a list
tally [V.24.216.3] – tally the elements of a list
tan [V.24.606] – tangent function
tanh [V.24.607] – hyperbolic tangent function
target [V.24.608] – target of a map
tensor [V.24.609] – tensor product
tensorAssociativity [V.24.610] – associativity isomorphisms for tensor
products
terms [V.24.611] – provide a list of terms of a polynomial
then [V.24.612] – condition testing
time [V.24.613] – time a computation
times [V.24.614] – multiplication
timing [V.24.615] – time a computation
tmpname [V.24.616] – make a temporary file name
toDual [V.24.617]
toHandle [V.24.618] – convert to handle
toList [V.24.619] – list of elements
toSequence [V.24.620] – convert to sequence
top [V.24.621] – compute the top dimensional components
top level loop [V.24.622]
top-method [V.24.623]
topCoefficients [V.24.624] – list of top coefficients of a matrix
532
24. MISCELLANEOUS DOCUMENTATION
topicList [V.24.625] – list of help topics
topics [V.24.626] – display available help topics
trace [V.24.627] – trace of a matrix
transnet [V.24.628] – assemble bytes into 4-byte integers
transpose [V.24.629] – transpose
trim [V.24.630] – simplify the presentation
true [V.24.631] – Boolean value true
truncate [V.24.632] – truncate the module at a specified degree
try [V.24.633] – catch an error
typicalValues [V.24.634]
ultimate [V.24.635] – – ultimate value for an iteration
unSingleton [V.24.636]
unhex [V.24.637] – translate a URL
uniform [V.24.638] – test whether elements of a list are of the same class
use [V.24.639] – install defaults
userSymbols [V.24.640] – a list of the user’s symbols
values [V.24.641] – values in a hash table
variety [V.24.642] – get the variety
vars [V.24.643] – the matrix of the variables
vector [V.24.644] – make a vector
version [V.24.645] – information about this version of the program
w3 [V.24.646]
wait [V.24.647] – wait for child process
wedgeProduct [V.24.648] – the exterior multiplication map
while [V.24.649] – loop control
width [V.24.650] – width of a file or net
xor [V.24.651] – logical exclusive-or
youngest [V.24.652] – the youngest member of a sequence
{...} / Function [V.24.653] – a binary operator, usually used for division
{} [V.24.654]
| [V.24.655] – a binary operator
|| [V.24.656] – a binary operator
˜ [V.24.657] – a unary postfix operator
24.1.
See also:
Function Thing [III.18.3] – function application
This operator may be used as a binary operator in an expression like x
y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X
Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol " " is a member of the class Symbol [III.21.10].
Methods for :
ChainComplex [...] [III.16.4] – chain complex degree shift
CoherentSheaf ZZ [III.21.5.4.2.4] – canonical twist of a coherent sheaf
Command Thing
EmptyMarkUpType Thing
EmptyMarkUpType {...}
24.3. !=
533
Expression Expression
Expression Holder
Expression Thing
Expression [...]
Function Thing [III.18.3] – function application
GradedModule [...]
HeaderType (...)
HeaderType {...}
Holder Expression
Holder Holder
Holder [...]
Manipulator Database
Manipulator File
Manipulator Nothing
MarkUpType Thing
MarkUpType {...}
Module [...] [III.13.16] – make a chain complex from a module
ProjectiveHilbertPolynomial ZZ [III.21.5.6.4] – value of polynomial
Ring OrderedMonoid [III.10.1.3.1] – make a polynomial ring
Ring [...] [III.10.1.3.2] – the standard way to make a polynomial ring
RingMap ChainComplex
RingMap Ideal
RingMap Matrix
RingMap Module
RingMap QQ
RingMap RingElement
RingMap Vector
RingMap ZZ
ScriptedFunctor Thing
SelfInitializingType Thing
Thing Expression
WrapperType (...)
WrapperType Thing
WrapperType {...}
24.2. !
n ! – computes n factorial, 1*2*3*...*n.
The symbol symbol ! is a member of the class Symbol [III.21.10].
Methods for ! :
ZZ !
24.3. !=
x != y – the negation of x == y.
See also:
== [V.24.39] – equality
The symbol symbol != is a member of the class Symbol [III.21.10].
Methods for != :
Thing != Thing
534
24. MISCELLANEOUS DOCUMENTATION
24.4. #
The precedence of # when used as a binary operator is high, as high as .,
but the precedence when used as a unary operator lower, as low as adjacency or
function application.
See also:
#? [V.24.8] – check for presence of elements
The symbol symbol # is a member of the class Symbol [III.21.10].
Methods for # :
# BasicList [III.21.11.1] – length
# File [III.21.11.2] – length
# HashTable [III.21.11.3] – length
# String [III.21.11.4] – length
BasicList # ZZ [III.21.1.16] – get element from list
Database # String [III.21.3.1] – get value from database
HashTable # Thing [III.21.5.9] – get value from hash table
String # ZZ [III.21.6.1.8] – get character from string
24.5. # (...)
#x – provides the length of a sequence.
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: Sequence [III.19.3]
24.6. # Set
#x – provides the number of elements in the set x.
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: Set [III.21.5.8.1]
24.7. ##
f ## (a,b) – computes ((f a) b).
f ## (a,b,c) – computes (((f a) b) c).
f ## (a,b,c,d) – computes ((((f a) b) c) d).
... and so on.
i1 : f = a -> b -> c -> [a,b,c]
o1 = f
o1 : Function
i2 : f ## (1,2,3)
o2 = [1, 2, 3]
o2 : Array
The symbol symbol ## is a member of the class Symbol [III.21.10].
Methods for ## :
Function ## (...)
24.10. &
535
24.8. #?
See also:
# [V.24.4] – length, or access to elements
The symbol symbol #? is a member of the class Symbol [III.21.10].
Methods for #? :
BasicList #? ZZ [III.21.1.17] – check for element in list
Database #? String [III.21.2.1] – check for value in database
HashTable #? Thing [III.21.2.2] – check for value in hash table
Set #? Thing [III.21.2.3] – test set membership
String #? ZZ [III.21.2.4] – check for character in string
24.9. %
x % y – a binary operator used for remainder and reduction.
This operator may be used as a binary operator in an expression like x % y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X % Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol % is a member of the class Symbol [III.21.10].
Methods for % :
Matrix % GroebnerBasis
Matrix % Ideal
Matrix % Matrix [III.12.4] – find the normal form modulo the image of
a map
Matrix % Module
Matrix % RingElement [III.12.44] – reduce the columns modulo of a
ring element
QQ % RingElement
RingElement % GroebnerBasis
RingElement % Ideal
RingElement % Matrix
RingElement % QQ
RingElement % RingElement
RingElement % ZZ
ZZ % GroebnerBasis
ZZ % Ideal
ZZ % RingElement
ZZ % ZZ
24.10. &
This operator may be used as a binary operator in an expression like x & y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X & Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol & is a member of the class Symbol [III.21.10].
Methods for & :
ZZ & ZZ [III.21.11.5] – logical and
536
24. MISCELLANEOUS DOCUMENTATION
24.11. &&
This operator may be used as a binary operator in an expression like x && y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X && Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol && is a member of the class Symbol [III.21.10].
24.12. (...) # ZZ
x#i – provides the i-th element of the sequence x.
If i is out of range, an error is signalled. If i is negative, then the i-th entry
counting from the end is provided.
See also:
(...) # ZZ [V.24.12] – get element from sequence
Synopsis of use:
Operator: # [V.24.4]
Class of argument 1: Sequence [III.19.3]
Class of argument 2: ZZ [III.21.11]
Next more general method: BasicList # ZZ [III.21.1.16] – get element
from list
24.13. (...) #? ZZ
x#?i –tells whether ther is an i-th element in the sequence x.
See also:
(...) # ZZ [V.24.12] – get element from sequence
Synopsis of use:
Operator: #? [V.24.8]
Class of argument 1: Sequence [III.19.3]
Class of argument 2: ZZ [III.21.11]
Next more general method: BasicList #? ZZ [III.21.1.17] – check for
element in list
24.14. *
x * y – usually yields the product of x and y.
See also:
times [V.24.614] – multiplication
product [V.24.486]
This operator may be used as a binary operator in an expression like x * y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X * Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
This operator may be used as a prefix unary operator in an expression like * y.
The user may install a method for handling such expressions with code such as
* Y := (y) -> ...
24.14. *
where Y is the class of y.
The symbol symbol * is a member of the class Symbol [III.21.10].
Methods for * :
AffineVariety * AffineVariety
CC * CC
CC * QQ
CC * RR
CC * ZZ
ChainComplexMap * ChainComplexMap
Expression * Expression
Expression * Holder
Expression * Minus
Expression * OneExpression
Expression * Product
Expression * Thing
Expression * ZeroExpression
GradedModuleMap * GradedModuleMap
Holder * Expression
Holder * Holder
Holder * OneExpression
Holder * Product
Holder * ZeroExpression
Ideal * Ideal [III.11.1] – product of ideals
Ideal * Module
Ideal * Ring
InfiniteNumber * InfiniteNumber
InfiniteNumber * ZZ
Matrix * Matrix
Matrix * Vector
Matrix * ZZ
Minus * Expression
Minus * Minus
MonomialIdeal * MonomialIdeal
OneExpression * Expression
OneExpression * Holder
Product * Expression
Product * Holder
Product * Product
QQ * CC
QQ * RingElement
RR * CC
Ring * Ideal
Ring * Ring
RingElement * ChainComplexMap
RingElement * GradedModuleMap
RingElement * Ideal
RingElement * Matrix
RingElement * Module
537
538
24. MISCELLANEOUS DOCUMENTATION
RingElement * QQ
RingElement * RingElement
RingElement * Vector
RingElement * ZZ
RingMap * RingMap
Set * Set [III.21.5.8.1.1] – intersection of sets
Thing * Expression
Thing * {...}
ZZ * CC
ZZ * ChainComplexMap
ZZ * GradedModuleMap
ZZ * Ideal
ZZ * InfiniteNumber
ZZ * Matrix
ZZ * Module
ZZ * ProjectiveHilbertPolynomial
ZZ * RingElement
ZZ * Vector
ZeroExpression * Expression
ZeroExpression * Holder
24.15. **
This operator may be used as a binary operator in an expression like x ** y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X ** Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol ** is a member of the class Symbol [III.21.10].
Methods for ** :
AffineVariety ** Ring
ChainComplex ** ChainComplex [III.16.1] – tensor product
ChainComplex ** ChainComplexMap [III.16.11] – tensor product
ChainComplex ** GradedModule [III.16.2] – tensor product
ChainComplex ** Module
ChainComplexMap ** ChainComplex [III.16.12] – tensor product
ChainComplexMap ** ChainComplexMap [III.21.5.4.1.1] – tensor
product
CoherentSheaf ** CoherentSheaf [III.21.5.4.2.1] – tensor product of
coherent sheaves
Expression ** Expression
Expression ** Holder
Expression ** NonAssociativeProduct
Expression ** OneExpression
Expression ** Thing
GradedModule ** ChainComplex [III.16.5] – tensor product
GradedModule ** GradedModule
GradedModule ** Module
Holder ** Expression
Holder ** Holder
24.16. +
539
Holder ** NonAssociativeProduct
Holder ** OneExpression
Matrix ** Matrix [III.12.5] – tensor product of matrices
Matrix ** Module [III.12.6] – tensor product
Matrix ** Ring [III.10.6] – tensor product
Matrix ** RingElement
Module ** ChainComplex
Module ** GradedModule
Module ** Matrix
Module ** Module [III.13.6] – tensor product of modules
Module ** Ring [III.10.7] – tensor product
Monoid ** Monoid [III.21.5.4.11.3.2] – tensor product of monoids
NonAssociativeProduct ** Expression
NonAssociativeProduct ** Holder
NonAssociativeProduct ** NonAssociativeProduct
OneExpression ** Expression
OneExpression ** Holder
PolynomialRing ** PolynomialRing
PolynomialRing ** QuotientRing
ProjectiveVariety ** Ring
QuotientRing ** PolynomialRing
QuotientRing ** QuotientRing
Ring ** Ring [III.10.4] – tensor product
RingElement ** Matrix
RingElement ** RingElement
Set ** Set [III.21.5.8.1.2] – Cartesian product
Tally ** Tally [III.21.5.8.2] – Cartesian product of tallies
Thing ** Expression
24.16. +
x + y – a binary operator used for addition in many situations and union of
sets.
See also:
plus [V.24.471] – addition
sum [V.24.575] – compute the sum
This operator may be used as a binary operator in an expression like x + y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X + Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol + is a member of the class Symbol [III.21.10].
Methods for + :
CC + CC
CC + QQ
CC + RR
CC + ZZ
ChainComplexMap + ChainComplexMap
ChainComplexMap + RingElement
ChainComplexMap + ZZ
540
24. MISCELLANEOUS DOCUMENTATION
Expression + Expression
Expression + Sum
Expression + Thing
Expression + ZeroExpression
GradedModuleMap + GradedModuleMap
GradedModuleMap + RingElement
Holder + Holder
Holder + Sum
Ideal + Ideal [III.11.2] – sum of ideals
InfiniteNumber + InfiniteNumber
InfiniteNumber + ZZ
Matrix + Matrix
Matrix + RingElement
Matrix + ZZ
Module + Module [III.13.7] – sum of submodules
MonomialIdeal + MonomialIdeal
ProjectiveHilbertPolynomial + ProjectiveHilbertPolynomial
QQ + CC
QQ + RingElement
RR + CC
RingElement + ChainComplexMap
RingElement + GradedModuleMap
RingElement + Matrix
RingElement + QQ
RingElement + RingElement
RingElement + ZZ
Set + Set [III.21.5.8.1.3] – union
String + ZZ
Sum + Expression
Sum + Holder
Sum + Sum
Tally + Tally [III.21.5.8.3] – union of tallies
Thing + Expression
Vector + Vector
ZZ + CC
ZZ + ChainComplexMap
ZZ + InfiniteNumber
ZZ + Matrix
ZZ + RingElement
ZeroExpression + Expression
ZeroExpression + Holder
{...} + {...} [III.19.2.5] – sum of two vectors
24.17. ++
This operator may be used as a binary operator in an expression like x ++ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X ++ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
24.19. -
541
The symbol symbol ++ is a member of the class Symbol [III.21.10].
Methods for ++ :
ChainComplex ++ ChainComplex [III.16.3] – direct sum
ChainComplexMap ++ ChainComplexMap
CoherentSheaf ++ CoherentSheaf [III.21.5.4.2.2] – direct sum of coherent sheaves
GradedModule ++ GradedModule
GradedModule ++ Module
GradedModuleMap ++ GradedModuleMap
Matrix ++ Matrix [III.12.7] – direct sum of maps
Matrix ++ RingElement
Matrix ++ ZZ
Module ++ GradedModule
Module ++ Module [III.13.8] – direct sum of modules
Option ++ Option
RingElement ++ Matrix
RingElement ++ RingElement
RingElement ++ ZZ
Set ++ Set [III.21.5.8.1.4] – disjoint union of sets
ZZ ++ Matrix
ZZ ++ RingElement
24.18. ,
x,y,...,z – the comma is used to separate elements of a list or sequence.
i1 : a,b,c
o1 = (a, b, c)
o1 : Sequence
i2 : {a,b,c}
o2 = {a, b, c}
o2 : List
24.19. x - y – a binary operator used for subtraction in many situations and set
difference.
- y – a unary operator usually used for negation.
See also:
difference [V.24.252] – difference
minus [V.24.417] – additive inverse
This operator may be used as a binary operator in an expression like x - y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X - Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
This operator may be used as a prefix unary operator in an expression like - y.
The user may install a method for handling such expressions with code such as
542
24. MISCELLANEOUS DOCUMENTATION
- Y := (y) -> ...
where Y is the class of y.
The symbol symbol - is a member of the class Symbol [III.21.10].
Methods for - :
- CC
- ChainComplexMap
- Expression
- GradedModuleMap
- Holder
- InfiniteNumber
- Matrix
- Minus
- ProjectiveHilbertPolynomial
- RingElement
- Vector
- ZeroExpression
- {...}
CC - CC
CC - QQ
CC - RR
CC - ZZ
ChainComplexMap - ChainComplexMap
ChainComplexMap - RingElement
Expression - Expression
Expression - Thing
GradedModuleMap - GradedModuleMap
GradedModuleMap - RingElement
InfiniteNumber - InfiniteNumber
InfiniteNumber - ZZ
Matrix - Matrix
Matrix - RingElement
Matrix - ZZ
ProjectiveHilbertPolynomial - ProjectiveHilbertPolynomial
QQ - CC
QQ - RingElement
RR - CC
RingElement - ChainComplexMap
RingElement - GradedModuleMap
RingElement - Matrix
RingElement - QQ
RingElement - RingElement
RingElement - ZZ
Set - Set [III.21.5.8.1.5] – set difference
Tally - Tally [III.21.5.8.4] – difference of tallies
Thing - Expression
Vector - Vector
ZZ - CC
ZZ - InfiniteNumber
24.22. .
543
ZZ - Matrix
ZZ - RingElement
{...} - {...}
24.20. –
Use a double hyphen (--) to introduce a comment in the text of a program.
The comment runs from to the end of the line.
Emacs does a good job displaying the comments in a different color for visibility.
i1 : x = 1 -- this is a comment
o1 = 1
24.21. ->
x -> e – denotes a function. When the function is called, the initial value
of the variable x is the argument if there is just one, or else is the sequence of
arguments.
(x) -> e – denotes a function of one argument. When the function is applied to
an expression w three things may happen:if w is not a sequence, then the initial
value of x is w;if w is a sequence of length one, then the initial value of x is the
unique element of w; orif w is a sequence of length other than one, then it is an
error.
(x,y) -> e – denotes a function of two arguments.
Similarly for more arguments.
These operations create what is usually called a closure, which signifies that the
function remembers the values of local variables in effect at the time of its creation,
can change those values, and share the changes with other functions created at the
same time.
i1 : f = x -> 2*x+1
o1 = f
o1 : Function
i2 : f 100
o2 = 201
The class of all functions is Function [III.18].
24.22. .
x.k – the same as x#(global k), i.e., treat k as a global symbol and provide
the value stored in the hash table x under the key k.
May also be used in an assignment.
i1 : x = new MutableHashTable;
i2 : x.k = 444
o2 = 444
i3 : x.k
544
24. MISCELLANEOUS DOCUMENTATION
o3 = 444
i4 : peek x
o4 = MutableHashTable{k => 444}
o4 : Net
See also:
# [V.24.4] – length, or access to elements
.? [V.24.24] – check for presence of elements whose key is a symbol
global [V.24.325] – get a global symbol
24.23. ..
m .. n – produces a sequence of integers in the range from m to n inclusive.
If n is less than m then the result is an empty sequence.
i1 : 1..5
o1 = (1, 2, 3, 4, 5)
o1 : Sequence
i2 : {1..5}
o2 = {(1, 2, 3, 4, 5)}
o2 : List
i3 : toList(1..5)
o3 = {1, 2, 3, 4, 5}
o3 : List
The most confusing thing about this operator is that it is not a syntactic
construction, and so the resulting sequences do not splice themselves into enclosing
lists, as in each of the following examples. Use splice [V.24.562] to fix that.
i4 : {10..10}
o4 = {singleton 10}
o4 : List
i5 : {10..8}
o5 = {()}
o5 : List
i6 : {3..5,8..10}
o6 = {(3, 4, 5), (8, 9, 10)}
o6 : List
i7 : splice {3..5,8..10}
24.23. ..
545
o7 = {3, 4, 5, 8, 9, 10}
o7 : List
a .. i – produces a sequence of symbols for use as variables in polynomial rings.
i8 : a .. i
o8 = (a, b, c, d, e, f, g, h, i)
o8 : Sequence
x_0 .. x_9 – produces a sequence of indexed variables for use in polynomial
rings.
i9 : x_0 .. x_9
o9 = (x , x , x , x , x , x , x , x , x , x )
0
1
2
3
4
5
6
7
8
9
o9 : Sequence
i10 : x_(t_0) .. x_(t_5)
o10 = (x , x , x , x , x , x )
t
t
t
t
t
t
0
1
2
3
4
5
o10 : Sequence
i11 : x_a .. x_e
o11 = (x , x , x , x , x )
a
b
c
d
e
o11 : Sequence
This operator can be used with sequences or lists to produce rectangular intervals.
i12 : (0,0)..(1,3)
o12 = ((0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2 ...
o12 : Sequence
i13 : p_(0,a) .. p_(1,c)
o13 = (p
, p
, p
, p
, p
, p
)
0,a
0,b
0,c
1,a
1,b
1,c
o13 : Sequence
This operator may be used as a binary operator in an expression like x .. y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X .. Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol .. is a member of the class Symbol [III.21.10].
Methods for .. :
(...) .. (...)
IndexedVariable .. IndexedVariable
546
24. MISCELLANEOUS DOCUMENTATION
Symbol .. Symbol
Thing .. Thing
{...} .. {...}
24.24. .?
x.?k – the same as x#?(global k), tells whether a value is available with x.k.
See also:
. [V.24.22] – access to elements whose key is a symbol
#? [V.24.8] – check for presence of elements
24.25. /
x / y – a binary operator usually used for division, yielding a fraction, or for
quotients (ring by ideal, etc.).
See also:
// [V.24.26] – a binary operator, usually used for quotient
This operator may be used as a binary operator in an expression like x / y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X / Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol / is a member of the class Symbol [III.21.10].
Methods for / :
CC / CC
CC / QQ
CC / RR
CC / ZZ
CoherentSheaf / CoherentSheaf [III.21.5.4.2.3] – quotient of coherent
sheaves
EngineRing / Ideal
Expression / Expression
Expression / Holder
Expression / OneExpression
Expression / Thing
Holder / Expression
Holder / Holder
Holder / OneExpression
Ideal / Ideal [III.11.6] – quotient module
InfiniteNumber / InfiniteNumber
Module / (...)
Module / Ideal [III.11.7] – quotient module by an ideal
Module / Module [III.13.9] – quotient module
Module / RingElement
Module / Vector
Module / {...}
QQ / CC
QQ / RingElement
RR / CC
Ring / (...)
Ring / Ideal [III.10.1.4.1] – quotient ring
24.27. ///
547
Ring / Module
Ring / RingElement
Ring / ZZ
Ring / {...}
RingElement / QQ
RingElement / RingElement
RingElement / ZZ
Thing / Expression
VisibleList / Function [III.18.5] – apply a function to each member of
a list
ZZ / CC
ZZ / RingElement
{...} / Function
{...} / MarkUpType
{...} / SelfInitializingType
{...} / Thing
24.26. //
x // y – a binary operator used for quotients in the same ring (with a possible
remainder).
See also:
/ [V.24.25] – a binary operator, usually used for division
This operator may be used as a binary operator in an expression like x // y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X // Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol // is a member of the class Symbol [III.21.10].
Methods for // :
Matrix // GroebnerBasis
Matrix // Matrix [III.12.8] – factor a map through another
Matrix // RingElement [III.12.45] – factor a map through a multiplication map
Matrix // ZZ
QQ // RingElement
RingElement // GroebnerBasis
RingElement // Matrix
RingElement // QQ
RingElement // RingElement
RingElement // ZZ
ZZ // Matrix
ZZ // RingElement
24.27. ///
/// a string /// – a string.
This method for entering a string involves no escape characters, so it can be
used for easily inserting large chunks of text into a string without treating the
characters \ and " specially.
548
24. MISCELLANEOUS DOCUMENTATION
i1 : /// \ " ///
o1 =
\ "
o1 : String
i2 : ascii oo
o2 = {32, 92, 32, 34, 32}
o2 : List
See also:
String [III.21.6.1] – the class of all strings
24.28. /^
This operator may be used as a binary operator in an expression like x /^ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X /^ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol /^ is a member of the class Symbol [III.21.10].
Methods for /^ :
Thing /^ ZZ [III.21.11.8] – divided power
24.29. :
This operator may be used as a binary operator in an expression like x : y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X : Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol : is a member of the class Symbol [III.21.10].
Methods for : :
Ideal : Ideal [III.11.3] – ideal quotient for
Ideal : RingElement
Module : Ideal
Module : Module
Module : RingElement
MonomialIdeal : MonomialIdeal
ZZ : Thing [III.21.11.9] – repeat an item
24.30. :=
x := e – assign the value e to the new local variable x
f X := (x) -> ( ... ) – install a method for the method function f acting on
an argument of class X.
X * Y := (x,y) -> ( ... ) – install a method for the operator * applied to
arguments of classes X and Y. Many other operators are allowed: see operators
[I.5.2].
This operator is slightly schizophrenic in its function, as the installation of a
method has global effect if the classes involved are globally known, as is typically
24.34. <<
549
the case, whereas the assignment of a value to a local variable is never globally
known.
24.31. ;
(e;f;...;g;h) – the semicolon can be used for evaluating a sequence of expressions. The value of the sequence is the value of its last expression, unless it is
omitted, in which case the value is null [V.24.440].
i1 : (3;4;5)
o1 = 5
i2 : (3;4;5;)
24.32. <
x < y – yields true [V.24.631] or false [V.24.286] depending on whether x < y.
Calls upon ? [V.24.46] to perform the comparison, if necessary.
The symbol symbol < is a member of the class Symbol [III.21.10].
Methods for < :
Thing < Thing
24.33. <x <- y
– assigns the value of y to x, but x is evaluated, too.
If the value of x is a symbol, then the value of y is assigned as the value of that
symbol. If the value of x is a hash table, then the value of y must be one, too, and
the contents of y bodily replace the contents of x. If the value of x is a list, then
the value of y must be a list, and the contents of y replace the contents of x.
Warning: if y is a class with instances, these instances will NOT become instances of x. If instances of x are created later, then they will not be compatible
with the instances of y. One should try to avoid using <- [V.24.33] in this case.
The value of the expression x <- y is x, with its new contents.
See also:
= [V.24.37] – assignment
The symbol symbol <- is a member of the class Symbol [III.21.10].
24.34. <<
x << y – a binary operator usually used for file output.
<< y – a unary operator usually used for output to stdout.
This operator may be used as a binary operator in an expression like x << y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X << Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
This operator may be used as a prefix unary operator in an expression like << y.
The user may install a method for handling such expressions with code such as
<< Y := (y) -> ...
550
24. MISCELLANEOUS DOCUMENTATION
where Y is the class of y.
The symbol symbol << is a member of the class Symbol [III.21.10].
Methods for << :
<< Thing [V.24.35] – print to a file
File << Manipulator
File << Net
File << String
File << Symbol
File << Thing [III.20.1] – pirnt something to a file
Nothing << Manipulator
Nothing << Thing [III.21.7.1] – dummy file output
String << Thing [III.20.2] – print to a file
ZZ << ZZ [III.21.11.10] – shift bits leftward
{...} << Manipulator
{...} << Thing
24.35. << Thing
<< x – prints the expression x on the standard output file stdio [V.24.568].
i1 : << "abcdefghij" << endl
abcdefghij
o1 = stdio
o1 : File
See also:
<< [V.24.34]
Synopsis of use:
Operator: << [V.24.34]
Class of argument 1: Thing [III.21]
Code:
-- ../m2/setup.m2:5
<< Thing := x -> stdio << x
24.36. <=
x <= y – yields true [V.24.631] or false [V.24.286] depending on whether x <=
y.
Calls upon ? [V.24.46] to perform the comparison, if necessary.
The symbol symbol <= is a member of the class Symbol [III.21.10].
Methods for <= :
Thing <= Thing
24.37. =
x = e – assigns the value e to the variable x.
x#i = e – assigns the value e to the i-th member of the array x. Here i must be a
nonnegative integer.
x#k = e – assigns the value e to the key k in the hash table x. Here k can be any
expression.
See also:
HashTable [III.21.5] – the class of all hash tables
24.39. ==
551
:= [V.24.30] – assignment to a new local variable
GlobalReleaseHook [V.24.86]
GlobalAssignHook [V.24.85] – hook for assignment to global variables
24.38. =!=
x =!= y – returns true or false depending on whether the expressions x and y
are strictly unequal.
See === [V.24.40] for details.
The symbol symbol =!= is a member of the class Symbol [III.21.10].
Methods for =!= :
Thing =!= Thing
24.39. ==
x == y – a binary operator for testing mathematical equality.
A test for mathematical equality will typically involve doing a computation
to see whether two representations of the same mathematical object are being
compared. For example, an ideal in a ring is represented by giving its generators,
and checking whether two sets of generators produce the same ideal involves a
computation with Groebner bases.
It may happen that for certain types of objects, there is no method installed
for testing mathematical equality, in which strict equality will be tested with the
operator === [V.24.40]. If a test for mathematical equality is installed later, your
results may change.
Warning: whether this comparison operator returns true is not necessarily
related to whether the comparison operator ? [V.24.46] returns symbol ==.
See also:
!= [V.24.3] – inequality
This operator may be used as a binary operator in an expression like x == y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X == Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol == is a member of the class Symbol [III.21.10].
Methods for == :
(...) == (...)
CC == QQ
CC == RR
CC == ZZ
ChainComplex == ChainComplex
ChainComplex == ZZ
ChainComplexMap == ChainComplexMap
ChainComplexMap == RingElement
ChainComplexMap == ZZ
Equation == Equation
Equation == Expression
Equation == Holder
Expression == Equation
Expression == Expression
Expression == Thing
552
24. MISCELLANEOUS DOCUMENTATION
GradedModule == GradedModule
GradedModuleMap == GradedModuleMap
GradedModuleMap == RingElement
GradedModuleMap == ZZ
GroebnerBasis == GroebnerBasis
Holder == Equation
Holder == Holder
Ideal == Ideal
Ideal == Module
Ideal == Ring
Ideal == ZZ
InfiniteNumber == Thing
Matrix == Matrix
Matrix == RingElement
Matrix == ZZ
Module == Ideal
Module == Module [III.13.15] – equality
Module == ZZ
MonomialIdeal == MonomialIdeal
MonomialIdeal == ZZ
Net == Net
Net == String
ProjectiveHilbertPolynomial == ProjectiveHilbertPolynomial
QQ == CC
QQ == RR
QQ == ZZ
RR == CC
RR == QQ
RR == ZZ
Ring == Ideal
RingElement == ChainComplexMap
RingElement == GradedModuleMap
RingElement == Matrix
RingElement == RingElement
RingElement == ZZ
String == Net
Thing == Expression
Thing == InfiniteNumber
Vector == Vector
Vector == ZZ
ZZ == CC
ZZ == ChainComplex
ZZ == ChainComplexMap
ZZ == GradedModuleMap
ZZ == Ideal
ZZ == Matrix
ZZ == Module
ZZ == MonomialIdeal
24.41. ==>
ZZ ==
ZZ ==
ZZ ==
ZZ ==
{...}
553
QQ
RR
RingElement
Vector
== {...}
24.40. ===
x === y – returns true or false depending on whether the expressions x and y
are strictly equal.
Strictly equal expressions have the same type, so 0===0. and 0===0/1 are false;
the three types involved here are ZZ [III.21.11], RR [III.21.9], and QQ [III.21.8].
If x and y are mutable [V.24.427] then they are strictly equal only if they are
identical (i.e., at the same address in memory). For details about why strict equality
cannot depend on the contents of mutable hash tables, see hashing [V.24.335]. On
the other hand, if x and y are non-mutable, then they are strictly equal if and only
if all their contents are strictly equal.
i1 : {1,2,3} === {1,2,3}
o1 = true
i2 : {1,2,3} === {2,1,3}
o2 = false
In the current implementation, matrices are mutable objects, so === will yield
false more often than you might expect. We hope to change this in the future.
i3 : matrix {{2}} === matrix {{2}}
o3 = false
i4 : matrix {{2}} == matrix {{2}}
o4 = true
i5 : matrix {{2}} == matrix {{3}}
o5 = false
See also:
== [V.24.39] – equality
=!= [V.24.38] – strict inequality
The symbol symbol === is a member of the class Symbol [III.21.10].
Methods for === :
Thing === Thing
24.41. ==>
This operator is right associative.
New methods must be installed with installMethod [V.24.359], because the
parsing precedence is so low! This will be fixed eventually.
This operator may be used as a binary operator in an expression like x ==> y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X ==> Y := (x,y) -> ...
554
24. MISCELLANEOUS DOCUMENTATION
where X is the class of x and Y is the class of y.
The symbol symbol ==> is a member of the class Symbol [III.21.10].
Methods for ==> :
OptionTable ==> Function [III.18.1] – declare option names and default
values
{...} ==> Function [III.18.2] – declare option names and default values
24.42. =>
x => y – a binary operator which produces a type of list called an Option
[III.21.1.10].
The symbol symbol => is a member of the class Symbol [III.21.10].
Methods for => :
Thing => Thing
24.43. >
x > y – yields true [V.24.631] or false [V.24.286] depending on whether x > y.
Calls upon ? [V.24.46] to perform the comparison, if necessary.
The symbol symbol > is a member of the class Symbol [III.21.10].
Methods for > :
Thing > Thing
24.44. >=
x >= y – yields true [V.24.631] or false [V.24.286] depending on whether x >=
y.
Calls upon ? [V.24.46] to perform the comparison, if necessary.
The symbol symbol >= is a member of the class Symbol [III.21.10].
Methods for >= :
Thing >= Thing
24.45. >>
i >> j – shifts the bits in the integer i rightward j places.
This operator may be used as a binary operator in an expression like x >> y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X >> Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol >> is a member of the class Symbol [III.21.10].
Methods for >> :
ZZ >> ZZ [III.21.11.6] – shift bits rightward
24.46. ?
x ? y – compares x and y, returning symbol <, symbol >, symbol ==, or incomparable [V.24.349].
The user may install additional binary method [V.24.190] for this operator
with code such as
X ? Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
24.47. @
555
i1 : 3 ? 4
o1 = <
o1 : Symbol
i2 : "book" ? "boolean"
o2 = <
o2 : Symbol
i3 : 3 ? 3.
o3 = ==
o3 : Symbol
i4 : 3 ? "a"
o4 = >
o4 : Symbol
It would be nice to implement an operator like this one for everything in such
a way that the set of all things in the language would be totally ordered, so that it
could be used in the implementation of efficient hash tables, but we haven’t done
this. The methods which have been installed for this operator are fairly primitive,
and in the end often amount to simply comparing hash codes.
This operator may be used as a binary operator in an expression like x ? y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X ? Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol ? is a member of the class Symbol [III.21.10].
Methods for ? :
(...) ? (...)
BasicList ? BasicList
IndexedVariable ? IndexedVariable
InfiniteNumber ? InfiniteNumber
InfiniteNumber ? Thing
RingElement ? RingElement
Symbol ? IndexedVariable
Tally ? Tally [III.21.5.8.5] – comparison of tallies
Thing ? InfiniteNumber
Thing ? Thing
Type ? Type
24.47. @
This operator is right associative.
This operator may be used as a binary operator in an expression like x @ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X @ Y := (x,y) -> ...
556
24. MISCELLANEOUS DOCUMENTATION
where X is the class of x and Y is the class of y.
The symbol symbol @ is a member of the class Symbol [III.21.10].
24.48. @@
This operator may be used as a binary operator in an expression like x @@ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X @@ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol @@ is a member of the class Symbol [III.21.10].
Methods for @@ :
Function @@ Function
24.49. AfterEval
Applied at top level to the result of an evaluation, whose
result replaces the original for storing in the output variable
and
for printing.
See also:
Print [V.24.117] – top level method for printing results
The symbol AfterEval is a member of the class Symbol [III.21.10].
Methods for AfterEval :
AfterEval Command
24.50. AfterNoPrint
Applied at top level to the result of an evalution when printing of the result
has been suppressed by a semicolon.
See also:
Print [V.24.117] – top level method for printing results
The symbol AfterNoPrint is a member of the class Symbol [III.21.10].
Methods for AfterNoPrint :
AfterNoPrint Ideal
AfterNoPrint Matrix
AfterNoPrint RingMap
24.51. AfterPrint
Applied at top level to the result of an evaluation after printing.
See also:
Print [V.24.117] – top level method for printing results
The symbol AfterPrint is a member of the class Symbol [III.21.10].
Methods for AfterPrint :
AfterPrint Boolean
AfterPrint Expression
AfterPrint Holder
AfterPrint Ideal
AfterPrint Matrix
AfterPrint Module
AfterPrint RingMap
AfterPrint Thing
24.57. BEFOREPRINT
557
AfterPrint ZZ
24.52. Algorithm
See also:
Strategy [V.24.130] – specify a computational strategy
24.53. Ascending
Ascending – a symbol used as a value for optional arguments DegreeOrder
[V.24.67] and MonomialOrder [III.10.1.3.2.1].
The symbol Ascending is a member of the class Symbol [III.21.10].
24.54. Associative
The symbol Associative is a member of the class Symbol [III.21.10].
Functions with optional argument named Associative :
method(..., Associative => ...) [V.24.408] – allows associative methods
to be created
24.55. BasisElementLimit
BasisElementLimit – keyword for an optional argument used with gb [III.15.2],
pushForward [V.24.494], pushForward1 [V.24.497], and syz [V.24.599], which
can be used to specify that the computation should stop after a certain number of
Groebner basis elements have been discovered.
See also:
computing Groebner bases [I.3.35]
The symbol BasisElementLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named BasisElementLimit :
gb(..., BasisElementLimit => ...)
pushForward(..., BasisElementLimit => ...)
pushForward1(..., BasisElementLimit => ...)
syz(..., BasisElementLimit => ...)
24.56. Bayer
Strategy => Bayer – an option value for saturate [V.24.534] which indicates
that the method of Bayer’s thesis should be used.
The method is to compute saturate(I,f) for I and f homogeneous, add a new
variable z, compute a groebner basis of (I,f-z) in reverse lex order, divide by z, and
finally replace z by f.
The symbol Bayer is a member of the class Symbol [III.21.10].
24.57. BeforePrint
Applied at top level to the result of an evaluation,
whose result supplants the original for printing.
See also:
Print [V.24.117] – top level method for printing results
The symbol BeforePrint is a member of the class Symbol [III.21.10].
558
24. MISCELLANEOUS DOCUMENTATION
24.58. BinaryPowerMethod
BinaryPowerMethod(x,n) – computes x^n using successive squaring
The technique depends in a standard way on the binary expansion of n, hence
the name.
See also:
SimplePowerMethod [V.24.123] – compute powers by multiplying
The function BinaryPowerMethod is a member of the class Function [III.18].
24.59. ChangeMatrix
ChangeMatrix – a keyword for optional arguments to certain functions which
concern a change of basis matrix.
The symbol ChangeMatrix is a member of the class Symbol [III.21.10].
Functions with optional argument named ChangeMatrix :
forceGB(..., ChangeMatrix => ...) [V.24.296] – set the change of basis
matrix
gb(..., ChangeMatrix => ...) [V.24.303] – whether to produce the change
of basis matrix
syz(..., ChangeMatrix => ...) [V.24.600] – whether to produce the
change of basis matrix
24.60. CodimensionLimit
CodimensionLimit => n – keyword for an optional argument used with certain
functions which specifies that the computation should stop when the codimension
of the zero set of the ideal (or submodule) generated by the leading terms of the
Groebner basis elements found so far reaches a certain limit.
This option has not been implemented yet.
Eventually the codimension of the ideal of leading terms is the codimension of
the original ideal.
gb(..., CodimensionLimit => ...) [V.24.60.1] – stop when this codimension is reached
syz(..., CodimensionLimit => ...) [V.24.60.2] – stop when this codimension is reached
The symbol CodimensionLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named CodimensionLimit :
gb(..., CodimensionLimit => ...) [V.24.60.1] – stop when this codimension is reached
syz(..., CodimensionLimit => ...) [V.24.60.2] – stop when this codimension is reached
24.60.1. gb(..., CodimensionLimit => ...)
CodimensionLimit => n – keyword for an optional argument used with gb
[III.15.2] which specifies that the computation should stop when the codimension
of the zero set of the ideal (or submodule) generated by the leading terms of the
Groebner basis elements found so far reaches a certain limit.
This option has not been implemented yet.
Eventually the codimension of the ideal of leading terms is the codimension of
the original ideal.
24.64. CONVERTTOEXPRESSION
559
See also:
Default value: infinity [V.24.356]
Function: gb [III.15.2]
Option name: CodimensionLimit [V.24.60]
24.60.2. syz(..., CodimensionLimit => ...)
CodimensionLimit => n – keyword for an optional argument used with syz
[V.24.599] which specifies that the computation should stop when the codimension
of the zero set of the ideal (or submodule) generated by the leading terms of the
Groebner basis elements found so far reaches a certain limit.
This option has not been implemented yet.
Eventually the codimension of the ideal of leading terms is the codimension of
the original ideal.
See also:
Default value: infinity [V.24.356]
Function: syz [V.24.599]
Option name: CodimensionLimit [V.24.60]
24.61. CompleteIntersection
CompleteIntersection => J – an option to radical [V.24.507] which indicates that the ideal I provided by the user is unmixed, and that J is an ideal in I
which is a complete intersection of the same codimension.
Providing this option allows a separate, often faster, algorithm to be used to
compute the radical. This option should only be used if J is nice in some way. For
example, if J is randomly generated, but I is relatively sparse, then this will most
likely run slower than just giving the Unmixed [V.24.143] option.
The symbol CompleteIntersection is a member of the class Symbol [III.21.10].
Functions with optional argument named CompleteIntersection :
radical(..., CompleteIntersection => ...)
24.62. ConversionFormat
ConversionFormat – a method consulted to provide an engine conversion format.
See also:
convert [IV.22.1.9] – convert to engine format
pop [V.24.475] – pop a value from the engine’s stack
The symbol ConversionFormat is a member of the class Symbol [III.21.10].
24.63. ConvertInteger
A format item for communication with the engine that corresponds to an integer. See transmitting an integer [IV.22.1.2].
The symbol ConvertInteger is a member of the class Symbol [III.21.10].
24.64. ConvertToExpression
ConvertToExpression – a key for classes under which a conversion format is
stored.
See convert [IV.22.1.9].
560
24. MISCELLANEOUS DOCUMENTATION
The symbol ConvertToExpression is a member of the class Symbol [III.21.10].
24.65. Degree
Degree => d – an optional argument to matrix [V.24.401] that specifies that
the degree of the map created should be d.
The degree may be an integer or a list of integers (multidegree). The length of
the list should be the same as the length of a degree for the ring, see degreeLength
[V.24.241].
i1 : R = ZZ/101[x]
o1 = R
o1 : PolynomialRing
i2 : p = map(R^1, R^1, {{x^4}})
o2 = {0} | x4 |
1
1
o2 : Matrix R <--- R
i3 : isHomogeneous p
o3 = false
i4 : q = map(R^1, R^1, {{x^4}}, Degree => 4)
o4 = {0} | x4 |
1
1
o4 : Matrix R <--- R
i5 : isHomogeneous q
o5 = true
See also:
map [V.24.399] – make a map
matrix [V.24.401] – make a matrix
inducedMap(..., Degree => ...) [V.24.355] – specify the degree of a map
The symbol Degree is a member of the class Symbol [III.21.10].
Functions with optional argument named Degree :
cohomology(..., Degree => ...)
inducedMap(..., Degree => ...) [V.24.355] – specify the degree of a map
map(..., Degree => ...)
matrix(..., Degree => ...)
24.66. DegreeLimit
DegreeLimit => n – keyword for an optional argument used with various functions which specifies that the computation should halt after dealing with degree n.
The symbol DegreeLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named DegreeLimit :
gb(..., DegreeLimit => ...) [V.24.304] – compute up to a certain degree
pushForward(..., DegreeLimit => ...)
24.73. END
561
pushForward1(..., DegreeLimit => ...) [V.24.498] – compute only up
to this degree
resolution(..., DegreeLimit => ...) [V.24.518] – compute only up to this
degree
saturate(..., DegreeLimit => ...) [V.24.535] – compute up to a certain
degree
syz(..., DegreeLimit => ...)
24.67. DegreeOrder
DegreeOrder – an optional argument for use with certain functions, used to
specify sort order.
The symbol DegreeOrder is a member of the class Symbol [III.21.10].
Functions with optional argument named DegreeOrder :
sortColumns(..., DegreeOrder => ...) [V.24.558] – sort primarily by
degree
24.68. Descending
Descending – a symbol used as a value for optional arguments DegreeOrder
[V.24.67] and MonomialOrder [III.10.1.3.2.1].
The symbol Descending is a member of the class Symbol [III.21.10].
24.69. Documentation
24.70. DownArrow
DownArrow – an entity used in hypertext to represent an downward pointing
arrow.
The entity DownArrow is a member of the class Entity [III.21.5.1].
24.71. Elimination
Strategy => Elimination – an option value for saturate [V.24.534] which
indicates that the saturation of (I:f) should be computed by eliminating z from
(I,f*z-1), where z is a new variable.
The symbol Elimination is a member of the class Symbol [III.21.10].
24.72. EliminationOrder
EliminationOrder – a value for the MonomialOrder [III.10.1.3.2.1] option
to pushForward1 [V.24.497] which specifies the natural elimination order be used.
The symbol EliminationOrder is a member of the class Symbol [III.21.10].
24.73. End
End M – constructs the module of endomorphisms of M.
The function End is a member of the class Function [III.18].
Code:
-- code for End:
-- ../m2/modules.m2:426
End = (M) -> Hom(M,M)
562
24. MISCELLANEOUS DOCUMENTATION
24.74. Engine
Engine – a key for rings which yields the value true if this ring is supported
by the engine [IV.22].
The symbol Engine is a member of the class Symbol [III.21.10].
24.75. Ext
Ext^i(M,N) – compute the Ext module of two modules M, N.
Ext(M,N) – compute the total Ext module of two modules M, N.
If M or N is an ideal or ring, it is regarded as a module in the evident way.
The computation of the total Ext module is possible for modules over the
ring R of a complete intersection, according the algorithm of Shamash-EisenbudAvramov-Buchweitz. The result is provided as a finitely presented module over a
new ring with one additional variable for each equation of R. The variables in this
new ring have degree length 2; we would have liked to arrange for the degree i–
part of Ext^d(M,N) to appear as the degree {i,-d} part of E = Ext(M,N), but for
technical and hopefully temporary reasons, this wasn’t possible. So meanwhile, we
provide a function E.adjust in the result returned by Ext which can be used to
convert {i,-d} into the degree actually used. This adjusted multi-degree can be
used with basis [V.24.187], as in the example below.
i1 : R = ZZ/101[x,y]/ideal(x^3,y^2);
i2 : N = cokernel random (R^1, R^{-2,-2})
o2 = cokernel {0} | 42x2-50xy 39x2+9xy |
1
o2 : R - module, quotient of R
i3 : E = Ext(N,N)
o3 = cokernel {2,
{1,
{1,
{1,
{1,
{0,
2}
1}
1}
1}
1}
0}
|
|
|
|
|
|
0
0
0
y
0
0
0
0
0
0
y
0
0
0
y
0
0
0
0
y
0
0
0
0
0
0
0
x
0
0
0
x
0
0
0
0
0
0
x
0
0
0
0
0
0
0
x
0
0
0
0
0
0
y2
0
0
0
0
0
xy
0
0
0
0
0
x2
y
0
0
0
0
0
x
0
0
0
0
0
0
$X_1
0
0
0
0
0
0
$X_
0
0
0
...
...
...
...
...
...
ZZ
...
o3 : --- [$X , $X , x, y, Degrees => {{1, 2}, {2, 2}, {1, 0} ...
101
0
1
...
i4 : rank source basis( E.adjust {-3,-2}, E)
o4 = 1
i5 : rank source basis( {-3}, Ext^2(N,N) )
o5 = 1
See also:
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
adjust [V.24.159] – adjust the degree in a total Ext module
The scripted functor Ext is a member of the class ScriptedFunctor [III.21.5.4.10].
Functions installed in Ext :
24.78. FANO
563
Ext(Module,Module)
Ext(ZZ,Ideal,Ideal)
Ext(ZZ,Ideal,Module)
Ext(ZZ,Ideal,Ring)
Ext(ZZ,Matrix,Ideal)
Ext(ZZ,Matrix,Module)
Ext(ZZ,Matrix,Ring)
Ext(ZZ,Module,Ideal)
Ext(ZZ,Module,Matrix)
Ext(ZZ,Module,Module)
Ext(ZZ,Module,Ring)
Ext(ZZ,Ring,Ideal)
Ext(ZZ,Ring,Module)
Ext(ZZ,Ring,Ring)
24.76. Factorization and characteristic sets library
With the kind permission of the author, Michael Messollen, University of
Saarbruecken, Macaulay 2 incorporates a library of routines which provides factorization of multivariate polynomials over finite fields and computation of the
minimal associated primes of ideals via characteristic sets. That library is copyright 1996 by Michael Messollen. We provide a copy of the license in the file
Macaulay2/licenses/libfac.lic.
See also:
factor [V.24.285] – factor a ring element
gcd [V.24.311] – greatest common divisor
decompose [V.24.238] – irreducible components of an ideal
irreducibleCharacteristicSeries [V.24.363] – compute the irreducible
characteristic series
24.77. Factory library
With the kind permission of the authors of Singular, G.-M. Greuel, G. Pfister,
H. Schoenemann and R. Stobbe, University of Kaiserslautern, Macaulay 2 incorporates ’Factory’, a Singular library of polynomial routines which provides for factorization of polynomials. That library is copyright 1996 by Gert-Martin Greuel and
Ruediger Stobbe. We provide a copy of the license in the file Macaulay2/licenses/factory.lic.
See also:
factor [V.24.285] – factor a ring element
gcd [V.24.311] – greatest common divisor
24.78. Fano
Fano(k,I,GR) or Fano(k,I) – computes the ideal of a Fano scheme in the
Grassmannian.
Given an ideal I representing a projective variety X in P^r, a positive integer
k<r, and optionally a ring GR with (exactly) r+1 choose k+1 variables, representing
the ambient space of the Grassmannian of k-planes in P^r, this routine returns
the ideal in GR of the Fano scheme that parametrizes the k-planes lying on X. If
the optional third argument is not present, the routine fabricates its own ring, and
returns an ideal in it.
564
24. MISCELLANEOUS DOCUMENTATION
The function Fano is a member of the class Function [III.18].
Ways to use Fano :
Fano(ZZ,Ideal)
Fano(ZZ,Ideal,Ring)
24.79. FindOne
FindOne – a value for the option PrimitiveElement [V.24.116] to GF [V.24.83]
which specifies that GF [V.24.83] should search for a primitive element.
The symbol FindOne is a member of the class Symbol [III.21.10].
24.80. Function \ {...}
Synopsis of use:
Operator: \ [V.24.147]
Class of argument 1: Function [III.18]
Class of argument 2: List [III.19.2]
Next more general method: Function \ VisibleList [III.18.4] – apply a
function to each member of a list
Code:
-- ../m2/classes.m2:64
Function \ VisibleList := VisibleList => (f,v) -> apply(v,f)
24.81. GBtype
GBtype – a key used in a Groebner basis, under which is stored a list, recording
the type of Groebner basis computation done.
The symbol GBtype is a member of the class Symbol [III.21.10].
24.82. GC garbage collector
Macaulay 2 uses the excellent garbage collector ’GC’ written by Hans-J. Boehm
and Alan J. Demers and generously provided to the publinc. The copyright is contained in its README file which we provide in the file Macaulay2/licenses/gc.lic.
See also:
collectGarbage [V.24.214] – collect the garbage in memory
gcDump [V.24.310] – the status of the memory allocator
24.83. GF
The function GF is a member of the class Function [III.18].
Ways to use GF :
GF Ring [III.10.1.2.1] – make a finite field from a ring
GF ZZ [III.10.1.2.2] – make a finite field of a given order
GF(ZZ,ZZ) [III.10.1.2.3] – make a finite field of a given prime power order
Optional arguments :
GF(..., PrimitiveElement => ...)
GF(..., Variable => ...)
24.86. GLOBALRELEASEHOOK
565
24.84. GNU MP
The GNU MP library provides routines for arbitrary precision integer and
floating point arithmetic. Version 2.0 of the library is provided to us under the
GNU LIBRARY GENERAL PUBLIC LICENSE, a copy of which is provided to you
as part of the Macaulay 2 package in the file Macaulay2/licenses/gnulib.lic.
Macaulay 2 contains no derivative of GNU MP, and works with it by being linked
with it, and hence the Macaulay2 executable is covered by section 6 of the GNU
license. We fulfill the terms of its license by offering you the source code of the
program, available at our web site and our anonymous ftp site.
See also:
How to get this program [I.1.1]
24.85. GlobalAssignHook
GlobalAssignHook – a method name which is consulted when an assignment
to a global variable occurs.
The method should be a function of two variables: the symbol to which a value
is being assigned, and the value being assigned. The method should be stored under
then name GlobalAssignHook in the class of the value. It will be executed just
before the assignment occurs.
This method is used for instances of Type [III.21.5.4.11] and Ring [III.10] to
arrange for the name of the type or ring to be set to the name of the global variable
to which it is first assigned. The functions globalAssignFunction [V.24.326] and
globalReleaseFunction [V.24.327] may installed as methods for this purpose.
i1 : RR.GlobalAssignHook = (sym,val) -> <<"assigning " <<val ...
i2 : a=4.5
assigning 4.5 to a
o2 = 4.5
o2 : RR
See also:
GlobalReleaseHook [V.24.86]
The symbol GlobalAssignHook is a member of the class Symbol [III.21.10].
Methods for GlobalAssignHook :
GlobalAssignHook Command
GlobalAssignHook Function
GlobalAssignHook Manipulator
GlobalAssignHook MarkUpType
GlobalAssignHook ScriptedFunctor
GlobalAssignHook Type
24.86. GlobalReleaseHook
GlobalReleaseHook – a method name which is consulted when an assignment
to a global variable is about to occur.
The method should be a function of two variables: the symbol to which a value
is being assigned, and the old value about to be overwritten. The method should
be stored under the name GlobalReleaseHook in the class of the old value. It is
566
24. MISCELLANEOUS DOCUMENTATION
executed before the assignment occurs, and before the execution of GlobalAssignHook [V.24.85].
i1 : RR.GlobalReleaseHook = (sym,val) -> << concatenate (
"assigning ", toString val, " to ", toString sym
) << endl
o1 = --Function[stdio:1:3]-o1 : Function
i2 : a=4.5
o2 = 4.5
o2 : RR
i3 : a=5.4
assigning 4.5 to a
o3 = 5.4
o3 : RR
See also:
GlobalAssignHook [V.24.85] – hook for assignment to global variables
The symbol GlobalReleaseHook is a member of the class Symbol [III.21.10].
Methods for GlobalReleaseHook :
GlobalReleaseHook Command
GlobalReleaseHook Function
GlobalReleaseHook Manipulator
GlobalReleaseHook ScriptedFunctor
GlobalReleaseHook Type
24.87. Grassmannian
Grassmannian(k,r) – Grassmannian of k-planes in P^r
Grassmanian(k,r,R)
Given natural numbers k <= r, and optionally a ring R with at least binomial(r+1,k+1)
variables, the routine finds the ideal of the Grassmannian of projective k-planes in
P^r, using the first binomial(r+1,k+1) variables of R. If R is not given, the routine
makes and uses ZZ/31991[vars(0..binomial(r+1,k+1)-1].
For example, the Grassmannian of projective lines in P^3:
i1 : J = Grassmannian(1,3)
o1 = ideal(c*d - b*e + a*f)
ZZ
o1 : Ideal of ----- [a, b, c, d, e, f]
31991
i2 : R = QQ[a..f];
i3 : J = Grassmannian(1,3,R)
o3 = ideal(c*d - b*e + a*f)
24.90. HOM
567
o3 : Ideal of R
Caveat: currently, this ideal is constructed using relations on minors of a generic
matrix. It should really use the Plucker equations
The function Grassmannian is a member of the class Function [III.18].
Ways to use Grassmannian :
Grassmannian(ZZ,ZZ)
Grassmannian(ZZ,ZZ,Ring)
24.88. HH
HH is a ScriptedFunctor [III.21.5.4.10] which serves as an interface to the
methods for homology [V.24.341] and cohomology [V.24.210], in the sense that,
HH_i(M) is an abbreviation for homology(i,M) and HH^i(M) is an abbreviation for
cohomology(i,M). A second argument and optional arguments may be added.
The scripted functor HH is a member of the class ScriptedFunctor [III.21.5.4.10].
24.89. HardDegreeLimit
HardDegreeLimit – keyword for an optional argument which specifies that
information above a specified degree is to be discarded.
The symbol HardDegreeLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named HardDegreeLimit :
resolution(..., HardDegreeLimit => ...) [V.24.519] – compute only up
to this degree
24.90. Hom
Hom(M,N) – constructs the module of homomorphisms from M to N.
Implemented with a method of the same name.
Use homomorphism [V.24.342] to convert an element of the module of homomorphisms to a matrix.
The function Hom is a member of the class Function [III.18].
Ways to use Hom :
Hom(ChainComplex,Module) [III.13.14] – Hom
Hom(ChainComplexMap,Module)
Hom(Ideal,Ideal)
Hom(Ideal,Module)
Hom(Ideal,Ring)
Hom(Matrix,Module)
Hom(Module,ChainComplex)
Hom(Module,ChainComplexMap)
Hom(Module,Ideal)
Hom(Module,Matrix)
Hom(Module,Module)
Hom(Module,Ring)
Hom(Ring,Ideal)
Hom(Ring,Module)
568
24. MISCELLANEOUS DOCUMENTATION
24.91. Homogeneous
Homogeneous – a strategy used with the keyword Strategy [V.24.130].
This is an alternate Groebner basis algorithm which can be used if the submodule is homogeneous, and the ring is a (quotient of) a polynomial ring over a
field.
The symbol Homogeneous is a member of the class Symbol [III.21.10].
24.92. Inhomogeneous
Inhomogeneous – a strategy used with the keyword Strategy [V.24.130].
This is the default Groebner basis algorithm used if the submodule is inhomogeneous, and the ring is a (quotient of) a polynomial ring over a field.
The symbol Inhomogeneous is a member of the class Symbol [III.21.10].
24.93. InverseMethod
InverseMethod – a key used under which is stored a method for computing
multiplicative inverses.
Internal routines for computing powers call upon that method when the exponent is negative.
The symbol InverseMethod is a member of the class Symbol [III.21.10].
Methods for InverseMethod :
InverseMethod CC
InverseMethod Matrix
InverseMethod QQ
InverseMethod RR
InverseMethod ZZ
24.94. Iterate
Strategy => Iterate – an option value for saturate [V.24.534] which indicates that successive ideal or module quotients should be used.
This value is the default.
The symbol Iterate is a member of the class Symbol [III.21.10].
24.95. LengthLimit
The symbol LengthLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named LengthLimit :
resolution(..., LengthLimit => ...) [V.24.520] – stop when the resolution
reaches this length
24.96. Limit
Limit => n – an optional argument for pfaffians [V.24.469] of for minors
[V.24.415] specifying that the computation should stop after n more elements are
computed.
The symbol Limit is a member of the class Symbol [III.21.10].
Functions with optional argument named Limit :
minors(..., Limit => ...)
pfaffians(..., Limit => ...)
24.100. MINIMALGENERATORS
569
24.97. Linear
Strategy => Linear – an option value for saturate [V.24.534] which indicates
that the reverse lex order should be used to compute the saturation.
This presumes that J is a single, linear polynomial, and that I is homogeneous.
This is also an option value for pushForward1 [V.24.497].
The symbol Linear is a member of the class Symbol [III.21.10].
24.98. LongPolynomial
LongPolynomial – a strategy used with the keyword Strategy [V.24.130].
Indicates that during computation of a Groebner basis, the reduction routine
will be replaced by one which will handle long polynomials more efficiently using
”geobuckets”, which accomodate the terms in buckets of geometrically increasing
length. This method was first used successfully by Thomas Yan, graduate student
in CS at Cornell.
The symbol LongPolynomial is a member of the class Symbol [III.21.10].
24.99. Macaulay 2
Macaulay 2 is a software system devoted to supporting research in algebraic
geometry and commutative algebra. The current version is 0.8.60. The program is
still under development, but most of the main features are working. We are eager
to help new users get started with it.
User’s Guide [I]
Mathematical Vignettes [II]
Reference Manual [III]
Developer’s Corner [IV]
24.100. MinimalGenerators
MinimalGenerators => true – an option for certain functions which specifies
whether to compute minimal generators for the result.
quotient(..., MinimalGenerators => ...) [V.24.100.1]
saturate(..., MinimalGenerators => ...) [V.24.100.2]
The default value is true.
The symbol MinimalGenerators is a member of the class Symbol [III.21.10].
Functions with optional argument named MinimalGenerators :
quotient(..., MinimalGenerators => ...) [V.24.100.1]
saturate(..., MinimalGenerators => ...) [V.24.100.2]
24.100.1. quotient(..., MinimalGenerators => ...)
MinimalGenerators => true – an option for quotient [V.24.505] which specifies whether to compute minimal generators for the result.
The default value is true.
See also:
Default value: true [V.24.631]
Function: quotient [V.24.505]
Option name: MinimalGenerators [V.24.100]
570
24. MISCELLANEOUS DOCUMENTATION
24.100.2. saturate(..., MinimalGenerators => ...)
MinimalGenerators => true – an option for saturate [V.24.534] which specifies whether to compute minimal generators for the result.
The default value is true.
See also:
Default value: true [V.24.631]
Function: saturate [V.24.534]
Option name: MinimalGenerators [V.24.100]
24.101. MinimalMatrix
MinimalMatrix => g – an option for forceGB [III.15.1] which specifies that
the columns of g are minimal generators for the submodule generated by the Groebner basis.
The symbol MinimalMatrix is a member of the class Symbol [III.21.10].
Functions with optional argument named MinimalMatrix :
forceGB(..., MinimalMatrix => ...)
24.102. Module : Module
Synopsis of use:
Operator: : [V.24.29]
Class of argument 1: Module [III.13]
Class of argument 2: Module [III.13]
Class of typical returned value: Ideal [III.11]
Code:
-- ../m2/colon.m2:178
Module : Module := Ideal => (M,N) -> quotient(M,N)
24.103. Monomials
Monomials – an option for status [V.24.566] which specifies whether to display
the number of monomials.
The symbol Monomials is a member of the class Symbol [III.21.10].
Functions with optional argument named Monomials :
status(..., Monomials => ...)
24.104. NewFromMethod
NewFromMethod – a symbol used as a method name in conjuction with the new
[V.24.432] operator.
Intended for internal use only.
The symbol NewFromMethod is a member of the class Symbol [III.21.10].
Methods for NewFromMethod :
new Command from Function
new Command from String
new Eliminate from ZZ
new EngineRing from (...)
new EngineRing from Handle
new EngineRing from Ring
new EngineRing from String
new EngineRing from {...}
24.109. NONLINEAR
571
new HashTable from {...} [III.19.2.9] – make a hash table from a list
new Manipulator from Function
new Module from Ring
new SEQ from {...}
new Set from {...}
new Vector from {...}
24.105. NewMethod
NewMethod – a symbol used as a method name in conjuction with the new
[V.24.432] operator.
Intended for internal use only.
The symbol NewMethod is a member of the class Symbol [III.21.10].
Methods for NewMethod :
new ChainComplex [III.16.10] – make a new chain complex from scratch
new MarkUpType
new Vector
new ZZ
24.106. NewOfFromMethod
NewOfFromMethod – a symbol used as a method name in conjuction with the
new [V.24.432] operator.
Intended for internal use only.
The symbol NewOfFromMethod is a member of the class Symbol [III.21.10].
24.107. NewOfMethod
NewOfMethod – a symbol used as a method name in conjuction with the new
[V.24.432] operator.
Intended for internal use only.
The symbol NewOfMethod is a member of the class Symbol [III.21.10].
24.108. NoPrint
Applied at top level to a result suppression of whose printing has been indicated
by a semicolon. The code for the default NoPrint method will apply the AfterEval
[V.24.49] method to r if there one, and replace r by the result. It will then apply
the appropriate AfterNoPrint [V.24.50] method to r, which is normally used to
provide auxiliary information to the user about the result.
See also:
Print [V.24.117] – top level method for printing results
The symbol NoPrint is a member of the class Symbol [III.21.10].
Methods for NoPrint :
NoPrint Thing
24.109. NonLinear
Strategy => NonLinear – an option value for the Strategy [V.24.130] option
to pushForward1 [V.24.497].
The symbol NonLinear is a member of the class Symbol [III.21.10].
572
24. MISCELLANEOUS DOCUMENTATION
24.110. OO
OO_X – produce the structure sheaf on a variety X.
The scripted functor OO is a member of the class ScriptedFunctor [III.21.5.4.10].
24.111. Options
Options – an option used with method [I.4.31.1] to specify names of optional
arguments and their default values.
f = method(Options => w) – creates a method which accepts optional arguments.
Here ’w’ is a list {A=>a,B=>b,...} of optional argument names A,B,... and corresponding default values a,b,...
The methods installed for this method function should be written in the form
opts -> args -> (...). The argument args will be assigned a hash table of type
OptionTable [III.21.5.5] containing the optional argument names and their values.
The default table can be recovered with the function options [III.21.5.5.1].
i1 : f = method(Options => {Slope => 1, Intercept => 1})
o1 = f
o1 : Function
i2 : f RR := o -> x -> o.Slope * x + o.Intercept
o2 = --Function[stdio:2:2]-o2 : Function
i3 : f(5.,Slope=>100)
o3 = 501.
o3 : RR
i4 : options f
o4 = OptionTable{Intercept => 1}
Slope => 1
o4 : OptionTable
See also:
method [I.4.31.1] – make a new method function
The symbol Options is a member of the class Symbol [III.21.10].
Functions with optional argument named Options :
method(..., Options => ...)
24.112. Order
Order – an optional argument used with hilbertSeries [V.24.339] to specify
the order of the series requested.
The symbol Order is a member of the class Symbol [III.21.10].
Functions with optional argument named Order :
hilbertSeries(..., Order => ...)
24.117. PRINT
573
24.113. PairLimit
PairLimit – keyword for an optional argument used with certain functions
which specifies that the computation should be stopped after a certain number of
S-pairs have been reduced.
The symbol PairLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named PairLimit :
gb(..., PairLimit => ...) [V.24.305] – stop when this number of pairs is
handled
pushForward(..., PairLimit => ...)
pushForward1(..., PairLimit => ...) [V.24.500] – stop when this number
of pairs is handled
resolution(..., PairLimit => ...) [V.24.521] – stop when this number of
pairs are handled
syz(..., PairLimit => ...)
24.114. PairsRemaining
PairsRemaining – an option for status [V.24.566] which specifies whether to
display number of S-pairs remaining.
The symbol PairsRemaining is a member of the class Symbol [III.21.10].
Functions with optional argument named PairsRemaining :
status(..., PairsRemaining => ...)
24.115. Primary
Primary – a strategy used with the keyword Strategy [V.24.130].
This is a new Groebner basis algorithm, that works in the homogeneous and
inhomogeneous cases, and is often faster than the default algorithms. This feature
is currently under development.
The symbol Primary is a member of the class Symbol [III.21.10].
24.116. PrimitiveElement
PrimitiveElement => g – an option used with GF [V.24.83].
The value can be a ring element providing a primitive element, or the symbol
FindOne [V.24.79] (the default) which specifies that GF [V.24.83] should search
for a primitive element.
The symbol PrimitiveElement is a member of the class Symbol [III.21.10].
Functions with optional argument named PrimitiveElement :
GF(..., PrimitiveElement => ...)
24.117. Print
Applied at top level to print the result, r, of an evaluation. The code for the
default Print method will apply the AfterEval [V.24.49] method to r if there one,
and replace r by the result. Then it applies BeforePrint [V.24.57] method, if
there is one, to r, and prints its result instead. The actual printing will be done
with << [V.24.34]. It will then apply the appropriate AfterPrint [V.24.51] method
to r, which is normally used to provide auxiliary information to the user about the
result.
See also:
574
24. MISCELLANEOUS DOCUMENTATION
NoPrint [V.24.108] – top level method for non-printing results
The symbol Print is a member of the class Symbol [III.21.10].
Methods for Print :
Print Thing
24.118. Proj
Proj R – create a projective variety or scheme from the graded ring R.
i1 : R = QQ[x,y];
i2 : Proj R
o2 = Proj R
o2 : ProjectiveVariety
The function Proj is a member of the class Function [III.18].
Ways to use Proj :
Proj Ring
24.119. Projective
Projective => true – an option to hilbertPolynomial [III.21.5.6.3] which
specifies that the Hilbert polynomial produced should be expressed in terms of the
Hilbert polynomials of projective spaces. This is the default.
Projective => false – an option to hilbertPolynomial [III.21.5.6.3] which specifies that the Hilbert polynomial produced should be expressed as a polynomial in
the degree.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : S = image map(R, R, {a^4, a^3*b, a*b^3, b^4})
o2 = S
o2 : QuotientRing
i3 : presentation S
o3 = {0} | c3-bd2 ac2-b2d bc-ad b3-a2c |
1
4
o3 : Matrix R <--- R
i4 : h = hilbertPolynomial S
o4 = - 3*P + 4*P
0
1
o4 : ProjectiveHilbertPolynomial
The rational quartic curve in P^3 is therefore ’like’ 4 copies of P^1, with three
points missing. One can see this by noticing that there is a deformation of the
24.122. SCHUR
575
rational quartic to the union of 4 lines, or ’sticks’, which intersect in three successive
points.
These Hilbert polynomials can serve as Hilbert functions, too.
i5 : h 3
o5 = 13
i6 : basis(3,S)
o6 = {0} | a3 a2b a2c a2d ab2 abd acd ad2 b2d bd2 c2d cd2 d3 ...
1
13
o6 : Matrix S <--- S
i7 : rank source basis(3,S)
o7 = 13
Note that the Hilbert polynomial of P^i is z |–> binomial(z + i, i).
See also:
ProjectiveHilbertPolynomial [III.21.5.6] – the class of all Hilbert polynomials
The symbol Projective is a member of the class Symbol [III.21.10].
Functions with optional argument named Projective :
hilbertPolynomial(..., Projective => ...)
24.120. RightArrow
RightArrow – an entity used in hypertext to represent an rightward pointing
arrow.
The entity RightArrow is a member of the class Entity [III.21.5.1].
24.121. SEEALSO
SEEALSO {a, b, ...} – inserts, into a documentation page, a sentence instructing the reader to see some other topics.
The topics may have the special forms used with TO [III.21.1.6.46].
See also:
document [V.24.257] – install documentation
The function SEEALSO is a member of the class Function [III.18].
Code:
-- code for SEEALSO:
-- ../m2/document.m2:724-726
SEEALSO = v -> (
if class v =!= List then v = {v};
if #v > 0 then SEQ { PARA{}, "See also:", SHIELD MENU ( ...
24.122. Schur
Schur n – creates a Schur ring of degree n.
This is the representation ring for the general linear group of n by n matrices.
See also:
SchurRing [III.10.1.5] – the class of all Schur rings
The function Schur is a member of the class Function [III.18].
Ways to use Schur :
576
24. MISCELLANEOUS DOCUMENTATION
Schur ZZ
Optional arguments :
24.123. SimplePowerMethod
SimplePowerMethod(x,n) – computes x^n using repeated multiplication
See also:
BinaryPowerMethod [V.24.58] – compute powers by squaring
The function SimplePowerMethod is a member of the class Function [III.18].
24.124. SingleArgumentDispatch
SingleArgumentDispatch=>true – an option to method [I.4.31.1] which specifies whether the method function should treat several arguments as a single argument, i.e., as a sequence.
This allows the user to install a method for handling sequences, whereas normally, the types of up to the three arguments are considered.
i1 : f = method ( SingleArgumentDispatch => true )
o1 = f
o1 : Function
i2 : f Sequence := print
o2 = print
o2 : Function
i3 : f (1,2,3)
(1, 2, 3)
The symbol SingleArgumentDispatch is a member of the class Symbol [III.21.10].
Functions with optional argument named SingleArgumentDispatch :
method(..., SingleArgumentDispatch => ...)
24.125. Sort
Sort – a strategy used with the keyword Strategy [V.24.130].
Indicates that the Groebner basis should be sorted by lead term; usually this
is a bad idea. Normally the basis is sorted only by degree. The running time can
change either for the good or bad.
The symbol Sort is a member of the class Symbol [III.21.10].
24.126. SortStrategy
SortStrategy – an keyword for an optional argument which specifies the strategy to be used for sorting S-pairs.
The symbol SortStrategy is a member of the class Symbol [III.21.10].
Functions with optional argument named SortStrategy :
resolution(..., SortStrategy => ...) [V.24.522] – specify a strategy for
sorting S-pairs
24.129. STOPWITHMINIMALGENERATORS
577
24.127. Spec
Spec R – create an affine variety or scheme from the ring R.
i1 : R = QQ[x,y];
i2 : Spec R
o2 = Spec R
o2 : AffineVariety
The function Spec is a member of the class Function [III.18].
Ways to use Spec :
Spec Ring
24.128. StopBeforeComputation
StopBeforeComputation – an option used certain functions to cause the computation to be initialized but not begun.
The symbol StopBeforeComputation is a member of the class Symbol [III.21.10].
Functions with optional argument named StopBeforeComputation :
gb(..., StopBeforeComputation => ...) [V.24.306] – whether to stop
the computation immediately
pushForward(..., StopBeforeComputation => ...) [V.24.495] – initialize but do not begin the computation
pushForward1(..., StopBeforeComputation => ...) [V.24.501] – initialize but do not begin the computation
resolution(..., StopBeforeComputation => ...) [V.24.523] – whether
to stop the computation immediately
syz(..., StopBeforeComputation => ...) [V.24.601] – whether to stop
the computation immediately
24.129. StopWithMinimalGenerators
StopWithMinimalGenerators – an option used with certain functions to specify
that the computation should stop as soon as a complete list of minimal generators
for the submodule or ideal has been determined.
gb(..., StopWithMinimalGenerators => ...) [V.24.129.1] – stop when
minimal generators have been determined
pushForward(..., StopWithMinimalGenerators => ...) [V.24.129.2]
– stop when minimal generators have been determined
pushForward1(..., StopWithMinimalGenerators => ...) [V.24.129.3]
– stop when minimal generators have been determined
syz(..., StopWithMinimalGenerators => ...) [V.24.129.4] – stop when
minimal generators have been determined
The symbol StopWithMinimalGenerators is a member of the class Symbol
[III.21.10].
Functions with optional argument named StopWithMinimalGenerators :
gb(..., StopWithMinimalGenerators => ...) [V.24.129.1] – stop when
minimal generators have been determined
pushForward(..., StopWithMinimalGenerators => ...) [V.24.129.2]
– stop when minimal generators have been determined
578
24. MISCELLANEOUS DOCUMENTATION
pushForward1(..., StopWithMinimalGenerators => ...) [V.24.129.3]
– stop when minimal generators have been determined
syz(..., StopWithMinimalGenerators => ...) [V.24.129.4] – stop when
minimal generators have been determined
24.129.1. gb(..., StopWithMinimalGenerators => ...)
StopWithMinimalGenerators – keyword for an optional argument used with
gb [III.15.2], which, if the value provided is true indicates that the computation
should stop as soon as a complete list of minimal generators for the submodule
or ideal has been determined, even if the entire Groebner basis has not yet been
determined.
Currently this option is implemented by stopping the computation as soon as
the S-polynomials and generators of the same degree as the generator of highest
degree have been processed.
This option is for internal use only. Use mingens [V.24.413] instead.
See also:
Default value: false [V.24.286]
Function: gb [III.15.2]
Option name: StopWithMinimalGenerators [V.24.129]
24.129.2. pushForward(..., StopWithMinimalGenerators => ...)
StopWithMinimalGenerators => true – an option for pushForward [V.24.494]
that specifies that the computation should stop as soon as a complete list of minimal
generators for the submodule or ideal has been determined.
The value provided is simply passed on to gb [III.15.2]: see gb(..., StopWithMinimalGenerators => ...) [V.24.129.1] for details.
See also:
Default value: false [V.24.286]
Function: pushForward [V.24.494]
Option name: StopWithMinimalGenerators [V.24.129]
24.129.3. pushForward1(..., StopWithMinimalGenerators => ...)
StopWithMinimalGenerators => true – an option for pushForward1 [V.24.497]
that specifies that the computation should stop as soon as a complete list of minimal
generators for the submodule or ideal has been determined.
The value provided is simply passed on to gb [III.15.2]: see gb(..., StopWithMinimalGenerators => ...) [V.24.129.1] for details.
See also:
Default value: false [V.24.286]
Function: pushForward1 [V.24.497]
Option name: StopWithMinimalGenerators [V.24.129]
24.129.4. syz(..., StopWithMinimalGenerators => ...)
StopWithMinimalGenerators => true – an optional argument used with syz
[V.24.599] that specifies that the computation should stop as soon as a complete
list of minimal generators for the submodule or ideal has been determined.
The value provided is simply passed on to gb [III.15.2]: see gb(..., StopWithMinimalGenerators => ...) [V.24.129.1] for details.
24.132. SUBRINGLIMIT
579
See also:
Default value: false [V.24.286]
Function: syz [V.24.599]
Option name: StopWithMinimalGenerators [V.24.129]
24.130. Strategy
Strategy => v – an optional argument used with various routines to suggest
a strategy for efficient computation.
The symbol Strategy is a member of the class Symbol [III.21.10].
Functions with optional argument named Strategy :
gb(..., Strategy => ...) [V.24.307] – specify the strategy used to compute
Groebner bases
pushForward(..., Strategy => ...) [V.24.496] – specify a computational
strategy
pushForward1(..., Strategy => ...) [V.24.502] – specify which algorithm
to use in the computation
quotient(..., Strategy => ...) [V.24.506] – specify a computational strategy
resolution(..., Strategy => ...) [V.24.524] – specify a computational
strategy
saturate(..., Strategy => ...) [V.24.536] – specify a computational strategy
syz(..., Strategy => ...) [V.24.602] – specify the strategy used to compute
the Groebner basis
24.131. String | String
Synopsis of use:
Operator: | [V.24.655]
Class of argument 1: String [III.21.6.1]
Class of argument 2: String [III.21.6.1]
Class of typical returned value: String [III.21.6.1]
Next more general method: Net | Net [III.21.6.3] – join strings or nets
24.132. SubringLimit
SubringLimit – an option for kernel [V.24.375] and gb [III.15.2] which can
stop the computation after a certain number of basis elements in a subring have
been found.
See also:
computing Groebner bases [I.3.35]
The symbol SubringLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named SubringLimit :
gb(..., SubringLimit => ...)
kernel(..., SubringLimit => ...) [V.24.376] – stop after finding enough
elements of a subring
syz(..., SubringLimit => ...)
580
24. MISCELLANEOUS DOCUMENTATION
24.133. Syzygies
Syzygies – keyword for an optional argument used with gb [III.15.2] and syz
[V.24.599], which indicates whether the syzygies should be computed.
This option is for internal use only.
The symbol Syzygies is a member of the class Symbol [III.21.10].
Functions with optional argument named Syzygies :
gb(..., Syzygies => ...)
syz(..., Syzygies => ...)
24.134. SyzygyLimit
SyzygyLimit – keyword for an optional argument which specifies that the computation should stop after a certain number of syzygies have computed.
The symbol SyzygyLimit is a member of the class Symbol [III.21.10].
Functions with optional argument named SyzygyLimit :
gb(..., SyzygyLimit => ...) [V.24.308] – stop when this number of syzygies is obtained
resolution(..., SyzygyLimit => ...) [V.24.525] – stop when this number
of syzygies are obtained
syz(..., SyzygyLimit => ...)
24.135. SyzygyMatrix
SyzygyMatrix => h – an option for forceGB [III.15.1] which specifies that
the columns of h are the syzygies for the Groebner basis.
The symbol SyzygyMatrix is a member of the class Symbol [III.21.10].
Functions with optional argument named SyzygyMatrix :
forceGB(..., SyzygyMatrix => ...)
24.136. SyzygyRows
SyzygyRows – keyword for an optional argument used with gb [III.15.2] and
syz [V.24.599], which specifies how many rows of the syzygy matrix to retain.
This option is for internal use only.
The symbol SyzygyRows is a member of the class Symbol [III.21.10].
Functions with optional argument named SyzygyRows :
gb(..., SyzygyRows => ...)
syz(..., SyzygyRows => ...)
24.137. TEST
TEST s – writes the string s to a new test file. The commands in that file can
be run later as a test.
Intended for internal use only.
The function TEST is a member of the class Function [III.18].
24.138. TOH
24.139. TeX
TeX x – convert x to TeX format, and display it on the screen.
The code for this function is Unix dependent at the moment.
24.145. VARIABLE
581
See also:
tex [III.21.6.1.3] – convert to TeX
The function TeX is a member of the class Function [III.18].
24.140. Tor
Tor_i(M,N) – compute the Tor module of two modules M, N.
See also:
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
The scripted functor Tor is a member of the class ScriptedFunctor [III.21.5.4.10].
Functions installed in Tor :
Tor(ZZ,Module,Module)
24.141. TotalPairs
TotalPairs – an option for status [V.24.566] which specifies whether to display
the total number of S-pairs.
The symbol TotalPairs is a member of the class Symbol [III.21.10].
Functions with optional argument named TotalPairs :
status(..., TotalPairs => ...)
24.142. TypicalValue
The symbol TypicalValue is a member of the class Symbol [III.21.10].
Functions with optional argument named TypicalValue :
method(..., TypicalValue => ...) [V.24.409] – specify return value type
24.143. Unmixed
Unmixed => true – an option to radical [V.24.507] which asserts that the
ideal provided by the user is known to be unmixed.
An ideal is said to be unmixed if all associated primes of R/I have the same
dimension. In this case the algorithm tends to be much faster.
The symbol Unmixed is a member of the class Symbol [III.21.10].
Functions with optional argument named Unmixed :
radical(..., Unmixed => ...)
24.144. UseHilbertFunction
UseHilbertFunction – an option for pushForward1 [V.24.497].
The symbol UseHilbertFunction is a member of the class Symbol [III.21.10].
Functions with optional argument named UseHilbertFunction :
pushForward(..., UseHilbertFunction => ...)
pushForward1(..., UseHilbertFunction => ...) [V.24.503] – whether
to use knowledge of the Hilbert function
24.145. Variable
Variable => x – an option used with GF [V.24.83], to specify a symbol to be
used as a name for the generator of the Galois field.
The symbol Variable is a member of the class Symbol [III.21.10].
Functions with optional argument named Variable :
GF(..., Variable => ...)
582
24. MISCELLANEOUS DOCUMENTATION
24.146. Verify
Verify – an option that can be used to request verification that a map is well
defined.
inducedMap(..., Verify => ...) [V.24.146.1] – verify that a map is welldefined
The symbol Verify is a member of the class Symbol [III.21.10].
Functions with optional argument named Verify :
inducedMap(..., Verify => ...) [V.24.146.1] – verify that a map is welldefined
24.146.1. inducedMap(..., Verify => ...)
Verify => true – an option for inducedMap [V.24.354] which requests verification that the induced map produced is well defined.
See also:
Default value: true [V.24.631]
Function: inducedMap [V.24.354]
Option name: Verify [V.24.146]
24.147. \
This operator may be used as a binary operator in an expression like x \ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X \ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol \ is a member of the class Symbol [III.21.10].
Methods for \ :
Function \ VisibleList [III.18.4] – apply a function to each member of a
list
MarkUpType \ {...}
SelfInitializingType \ {...}
24.148. \\
This operator may be used as a binary operator in an expression like x \\ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X \\ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol \\ is a member of the class Symbol [III.21.10].
24.149. ^
x ^ y – a binary operator used for powers and raising nets.
When computing powers, one of the following methods is used.
SimplePowerMethod [V.24.123] – compute powers by multiplying
BinaryPowerMethod [V.24.58] – compute powers by squaring
In addition, if n is 0, then the unit element (class x)#1 is returned. If n is
negative, then the method named InverseMethod [V.24.93] will be called.
This operator may be used as a binary operator in an expression like x ^ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
24.150. ^^
583
X ^ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol ^ is a member of the class Symbol [III.21.10].
Methods for ^ :
CC ^ ZZ
ChainComplex ^ ZZ
ChainComplex ^ [...]
ChainComplexMap ^ ZZ
ChainComplexMap ^ [...]
Expression ^ Expression
Expression ^ Holder
Expression ^ OneExpression
Expression ^ Thing
Expression ^ ZeroExpression
GradedModuleMap ^ ZZ
GradedModuleMap ^ [...]
Holder ^ Expression
Holder ^ Holder
Holder ^ OneExpression
Holder ^ ZeroExpression
Ideal ^ ZZ [III.11.4] – power of an ideal
MarkUpList ^ MarkUpList
Matrix ^ ZZ
Matrix ^ [...] [III.12.9] – select some rows of blocks
Matrix ^ {...} [III.12.10] – select some rows of a matrix
Module ^ ZZ
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Module ^ {...} [III.12.16] – projection map from a free module
MonomialIdeal ^ ZZ
Net ^ ZZ [III.21.6.2] – raise a net
Ring ^ ZZ [III.10.8] – make a free module
Ring ^ {...} [III.10.9] – make a free module
RingElement ^ ZZ
ScriptedFunctor ^ Thing
String ^ (...)
String ^ ZZ
Thing ^ Expression
Thing ^ QQ
ZeroExpression ^ Expression
ZeroExpression ^ Holder
ZeroExpression ^ ZeroExpression
24.150. ^^
This operator may be used as a binary operator in an expression like x ^^ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X ^^ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
584
24. MISCELLANEOUS DOCUMENTATION
The symbol symbol ^^ is a member of the class Symbol [III.21.10].
24.151. _
A binary operator which is used for various mathematical operations that are
customarily written with subscripts.
This operator may be used as a binary operator in an expression like x _ y. The
user may install binary method [V.24.190] for handling such expressions with
code such as
X _ Y := (x,y) -> ...
where X is the class of x and Y is the class of y.
The symbol symbol _ is a member of the class Symbol [III.21.10].
Methods for _ :
(...) _ ZZ [III.19.3.2] – get element from list
(...) _ {...}
ChainComplex _ ZZ [III.13.1] – get component
ChainComplex _ [...]
ChainComplexMap _ ZZ [III.12.1] – get component
ChainComplexMap _ [...]
EngineRing _ ZZ
Function _ Thing
GradedModule _ ZZ
GradedModuleMap _ ZZ
GradedModuleMap _ [...]
Ideal _ ZZ
IndexedVariableTable _ Thing
MarkUpList _ MarkUpList
Matrix _ (...) [III.12.46] – get an entry
Matrix _ ZZ [III.12.47] – get a column from a matrix
Matrix _ [...] [III.12.11] – select some columns of blocks
Matrix _ {...} [III.12.12] – get some columns from a matrix
Module _ ZZ [III.13.17] – get a generator
Module _ [...] [III.12.17] – get inclusion map into direct sum
Module _ {...} [III.12.18] – map from free module to some generators
Monoid _ ZZ [III.21.1.8.1] – get a generator of a monoid
Monoid _ {...}
PolynomialRing _ {...}
QuotientRing _ String
Ring _ String [III.10.10] – get a variable by name
Ring _ ZZ [III.10.11] – get a variable by number
Ring _ {...} [III.10.12] – make a monomial from a list of exponents
RingElement _ MonoidElement
RingElement _ RingElement [III.21.5.4.9.1] – get a coefficient
RingElement _ ZZ
SchurRing _ {...} [III.10.1.5.1] – make an element of a Schur ring
ScriptedFunctor _ Thing
String _ (...)
String _ ZZ
Symbol _ Thing
Tally _ Thing [III.21.5.8.6] – get a count from a tally
24.155. ADDENDFUNCTION
585
Vector _ ZZ [III.21.5.4.12.1] – get a component
ZZ _ EngineRing
ZZ _ Module
ZZ _ Monoid [III.21.1.8.2] – get unit element
ZZ _ Ring [III.10.13]
{...} _ ZZ [III.19.2.13] – get element from list
{...} _ {...} [III.19.2.6] – get some entries of a list
24.152. abs
abs x – computes the absolute value of x.
The function abs is a member of the class Function [III.18].
24.153. accumulate
See also:
fold [V.24.295] – apply binary operator repeatedly
The function accumulate is a member of the class Function [III.18].
Ways to use accumulate :
accumulate(Function,Thing,VisibleList) [III.18.6] – apply binary operator repeatedly
accumulate(Function,VisibleList) [III.18.7] – apply binary operator repeatedly
accumulate(VisibleList,Function) [III.18.8] – apply binary operator repeatedly
accumulate(VisibleList,Thing,Function) [III.18.9] – apply binary operator repeatedly
24.154. acos
acos x – computes the arccosine of x.
The function acos is a member of the class Function [III.18].
Ways to use acos :
acos RR
acos ZZ
24.155. addEndFunction
addEndFunction (() -> ...) – record a function for later execution, when
the program is exited.
Warning: in the current implementation, the function will be run only if the
program is explicitly exited with exit [V.24.280], and not if it encounters end of
file.
See also:
runEndFunctions [V.24.531] – run the ending functions
The function addEndFunction is a member of the class Function [III.18].
Code:
-- code for addEndFunction:
-- ../m2/classes.m2:91-93
addEndFunction = g -> (
endFunctions = append(endFunctions,g);
g)
586
24. MISCELLANEOUS DOCUMENTATION
24.156. addStartFunction
addStartFunction (() -> ...) – record a function for later execution, when
the program is restarted after loading dumped data.
See also:
runStartFunctions [V.24.532] – run the start up functions
The function addStartFunction is a member of the class Function [III.18].
Code:
-- code for addStartFunction:
-- ../m2/setup.m2:229-231
addStartFunction = g -> (
startFunctions = append(startFunctions,g);
g)
24.157. adjoint
adjoint (f,F,G) – if f is a homomorphism of free modules of the form F **
G -> H, then produce the adjoint homomorphism of the form F -> (dual G) ** H.
See also:
adjoint1 [V.24.158] – the adjoint map
The function adjoint is a member of the class Function [III.18].
Code:
-- code for adjoint:
-- ../m2/matrix1.m2:307
adjoint = (m,F,G) -> reshape((dual G) ** (target m), F, m)
24.158. adjoint1
adjoint1 (f,G,H) – if f is a homomorphism of free modules of the form F ->
G ** H, then produce the adjoint homomorphism of the form F ** (dual G) -> H.
See also:
adjoint [V.24.157] – the adjoint map
The function adjoint1 is a member of the class Function [III.18].
Code:
-- code for adjoint1:
-- ../m2/matrix1.m2:305
adjoint1 = (m,G,H) -> reshape(H, (source m) ** (dual G), m)
24.159. adjust
adjust – a symbol used as a key under which to store a degree adjustment
function used by Ext [V.24.75].
This use of this symbol will eventually not be needed.
The symbol adjust is a member of the class Symbol [III.21.10].
24.160. alarm
alarm n – arrange for an interrupt to occur in n seconds, cancelling any previously set alarm.
If n is zero, then no alarm is scheduled, and any previously scheduled alarm is
cancelled.
The value returned is the number of seconds remaining until any previously
scheduled alarm was due to be delivered, or zero if there was no previously scheduled
alarm.
24.162. AMBIENT
587
This command could be used in concert with try [V.24.633] in order to abandon
a computation that is taking too long.
This command may interfere with time [V.24.613] on some systems, causing it
to provide incorrect answers.
The function alarm is a member of the class Function [III.18].
24.161. all
all(v,f) – whether each element x of a list or hash table v has f(x) true.
Returns the value true if all elements v#i of the list v yield the value true when
the function f is applied, otherwise returns false. For hash tables, the function is
applied to all its key/value pairs (k,v), just as with any [V.24.167].
See also:
scan [V.24.537] – apply a function to each element
apply [V.24.169] – apply a function to each element
select [V.24.541] – select elements from a list or hash table
any [V.24.167] – whether an element satisfies a condition
member [V.24.404] – test membership in a list
The function all is a member of the class Function [III.18].
Code:
-- code for all:
-- ../m2/lists.m2:40
all = (x,p) -> not any(x, i -> not p i)
24.162. ambient
ambient M – yields the ambient free module for the module M.
ambient R – yields the ambient ring of the quotient ring R. For a Galois field it
yields the ring it was constructed from.
i1 : ambient(ZZ/101[a,b]/b^3/a^3)
ZZ
--- [a, b]
101
o1 = ---------3
b
o1 : QuotientRing
See also:
cover [V.24.234] – get the covering free module
super [V.24.576] – get the ambient module
The function ambient is a member of the class Function [III.18].
Ways to use ambient :
ambient GaloisField
ambient GradedModule
ambient Module
ambient PolynomialRing
ambient QuotientRing
ambient Ring
588
24. MISCELLANEOUS DOCUMENTATION
24.163. ancestor
ancestor(x,y) – tells whether y is an ancestor of x.
The ancestors of x are x, parent x, parent parent x, and so on.
See also:
classes [I.5.1]
The function ancestor is a member of the class Function [III.18].
Ways to use ancestor :
ancestor(Type,Type)
24.164. and
t and u – returns true if t is true and u is true.
If t is false, then the code in u is not evaluated.
See also:
or [V.24.459] – disjunction
not [V.24.437] – negation
24.165. ann
24.166. annihilator
annihilator M – produce the annihilator ideal of a module, ideal, ring element,
or coherent sheaf.
For an abbreviation, use ann [V.24.165].
The function annihilator is a member of the class Function [III.18].
Ways to use annihilator :
annihilator CoherentSheaf
annihilator Ideal
annihilator Module
annihilator RingElement
24.167. any
any(v,f) – yields the value true or false depending on whether any element
v#i of v yields the value true when the predicate f is applied.
Works when v is a list, sequence, or hash table, but when v is an hash table, f
is applied to each pair (k,x) consisting of a key k and a value x from v.
See also:
scan [V.24.537] – apply a function to each element
apply [V.24.169] – apply a function to each element
select [V.24.541] – select elements from a list or hash table
all [V.24.161] – whether all elements satisfy a condition
member [V.24.404] – test membership in a list
The function any is a member of the class Function [III.18].
Ways to use any :
any(BasicList,Function)
any(HashTable,Function)
24.168. append
append(v,x) – yields the list obtained by appending x to the list v. Similarly
if v is a sequence.
24.170. APPLYKEYS
589
i1 : append( {a,b,c}, x )
o1 = {a, b, c, x}
o1 : List
See also:
prepend [V.24.479] – add to the beginning of a list
join [V.24.373] – join lists
The function append is a member of the class Function [III.18].
Ways to use append :
append(BasicList,Thing)
24.169. apply
See also:
scan [V.24.537] – apply a function to each element
select [V.24.541] – select elements from a list or hash table
any [V.24.167] – whether an element satisfies a condition
all [V.24.161] – whether all elements satisfy a condition
member [V.24.404] – test membership in a list
The function apply is a member of the class Function [III.18].
Ways to use apply :
apply(BasicList,BasicList,Function) [III.18.10] – apply function to elements in pairs
apply(BasicList,Function) [III.18.11] – apply function to each element
apply(HashTable,Function) [III.18.12] – apply function to each value
apply(ZZ,Function) [III.18.13] – apply function to 0 .. n-1
24.170. applyKeys
applyKeys(x,f) – applies f to each key k in the hash table x to produce a new
hash table.
Thus f should be a function of one variable k which returns a new key k’ for
the value v in y.
It is an error for the function f to return the same key twice.
i1 : x = new HashTable from {1 => a, 2 => b, 3 => c}
o1 = HashTable{1 => a}
2 => b
3 => c
o1 : HashTable
i2 : applyKeys(x, k -> k + 100)
o2 = HashTable{101 => a}
102 => b
103 => c
o2 : HashTable
See also:
applyValues [V.24.173] – apply a function to each value
590
24. MISCELLANEOUS DOCUMENTATION
applyPairs [V.24.171] – apply a function to pairs in a hash table
The function applyKeys is a member of the class Function [III.18].
Ways to use applyKeys :
applyKeys(HashTable,Function)
24.171. applyPairs
applyPairs(x,f) – applies f to each pair (k,v) in the hash table x to produce
a new hash table.
It produces a new hash table y from a hash table x by applying the function f
to the pair (k,v) for each key k, where v is the value stored in x as x#k. Thus f
should be a function of two variables which returns either a pair (kk,vv) which is
placed into y, or it returns null, which signifies that no action be performed.
It is an error for the function f to return two pairs with the same key.
In this example, we show how to produce the hash table corresponding to the
inverse of a function.
i1 : x = new HashTable from {1 => a, 2 => b, 3 => c}
o1 = HashTable{1 => a}
2 => b
3 => c
o1 : HashTable
i2 : y = applyPairs(x, (k,v) -> (v,k))
o2 = HashTable{a => 1}
b => 2
c => 3
o2 : HashTable
i3 : x#2
o3 = b
o3 : Symbol
i4 : y#b
o4 = 2
See also:
applyValues [V.24.173] – apply a function to each value
applyKeys [V.24.170] – apply a function to each key in a hash table
scanPairs [V.24.539] – apply a function to pairs in a hash table
The function applyPairs is a member of the class Function [III.18].
Ways to use applyPairs :
applyPairs(HashTable,Function)
24.172. applyTable
applyTable(m,f) – applies the function f to each element of the table m.
It yields a table of the same shape as m containing the resulting values.
See also table [V.24.604].
24.174. APROPOS
591
The function applyTable is a member of the class Function [III.18].
Code:
-- code for applyTable:
-- ../m2/tables.m2:5
applyTable = (m,f) -> apply(m, v -> apply(v,f))
24.173. applyValues
applyValues(x,f) – applies f to each value v in the hash table x to produce
a new hash table.
Thus f should be a function of one variable v which returns a new value v’ for
the key k in the resulting hash table.
i1 : x = new HashTable from {a => 1, b => 2, c => 3}
o1 = HashTable{a => 1}
b => 2
c => 3
o1 : HashTable
i2 : applyValues(x, v -> v + 100)
o2 = HashTable{a => 101}
b => 102
c => 103
o2 : HashTable
See also:
applyPairs [V.24.171] – apply a function to pairs in a hash table
applyKeys [V.24.170] – apply a function to each key in a hash table
The function applyValues is a member of the class Function [III.18].
Ways to use applyValues :
applyValues(HashTable,Function)
24.174. apropos
apropos s – displays a list of global symbols which match the pattern specified
by the string s.
The pattern may contain ’*’s as wild card characters.
i1 : apropos "scan"
o1 = {scan, scanKeys, scanPairs, scanValues}
o1 : List
The function apropos is a member of the class Function [III.18].
Code:
-- code for apropos:
-- ../m2/document.m2:396-398
apropos = (pattern) -> (
mat := "*" | toString pattern | "*";
sort select( keys symbolTable(), i -> match(i,mat)))
592
24. MISCELLANEOUS DOCUMENTATION
24.175. argument
argument – a key used in scripted functors under which is stored the function
that accepts the arguments.
See also:
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
The symbol argument is a member of the class Symbol [III.21.10].
24.176. ascii
ascii s – convert a string to a list of ascii codes.
ascii v – convert a list of ascii codes to a string.
i1 : ascii "abcdef"
o1 = {97, 98, 99, 100, 101, 102}
o1 : List
i2 : ascii oo
o2 = abcdef
o2 : String
See also:
String [III.21.6.1] – the class of all strings
The function ascii is a member of the class Function [III.18].
Ways to use ascii :
ascii String
ascii {...}
24.177. asin
asin x – computes the arcsine of x.
The function asin is a member of the class Function [III.18].
Ways to use asin :
asin RR
asin ZZ
24.178. assert
assert x – prints an error message if x isn’t true.
The function assert is a member of the class Function [III.18].
Code:
-- code for assert:
-- ../m2/debugging.m2:37
assert = x -> if not x then error "assertion failed"
24.179. assign
assign(x,v) – assigns v as the value of x.
If the value of x is a symbol or indexed variable, then it can be assigned the
value v with
assign(x,v)
24.183. BACKTRACE
593
When the value of x is an indexed variable y_i then what happens is that the i-th
element of the list y is replaced by v.
Differs from x=v in that here x is evaluated.
Note: it would be better if we could arrange for
x <- v
to work with indexed variables. See <- [V.24.33].
The function assign is a member of the class Function [III.18].
Ways to use assign :
assign(IndexedVariable,Thing)
assign(Symbol,Thing)
24.180. atEndOfFile
atEndOfFile f – tells whether an input file f is at the end.
See also:
File [III.20] – the class of all files
The function atEndOfFile is a member of the class Function [III.18].
Ways to use atEndOfFile :
atEndOfFile File
24.181. atan
atan x – computes the arctangent of x.
atan(x,y) – computes the angle formed with the x-axis by the ray from the origin
{0,0} to the point {x,y}.
The function atan is a member of the class Function [III.18].
Ways to use atan :
atan RR
atan ZZ
24.182. autoload
autoload(f,"x") – arranges for a function f to be automatically loaded from
the file named x the first time it is used.
The function autoload is a member of the class Function [III.18].
Ways to use autoload :
autoload(Function,String)
autoload(Symbol,String)
24.183. backtrace
backtrace() – after an error, returns a list representing the steps in the computation that led to the error.
The elements in the list are expressions that can be examined, or reevaluated
with value [III.21.1.3.1], or are references to positions in the source code.
Bug: some of the expressions are reconstructed from the local variables of the
function returning an error, so the parameters passed to the routine may have been
replaced by new values.
See also:
Expression [III.21.1.3] – the class of all expressions
Position [III.21.1.12] – the class of all file positions
The function backtrace is a member of the class Function [III.18].
594
24. MISCELLANEOUS DOCUMENTATION
24.184. baseName
baseName x – returns the variable or symbol upon which a generator of a
monoid or polynomial ring is based.
The function baseName is a member of the class Function [III.18].
Ways to use baseName :
baseName IndexedVariable
baseName IndexedVariableTable
baseName RingElement
baseName Symbol
24.185. baseRings
baseRings – a symbol used as a key in a ring R under which is stored a list of
base rings for R.
A base ring A of R is one of the rings involved in the construction of R. The
natural ring homomorphism from A to R is implemented with promote [V.24.490].
The base rings are presented in chronological order.
The symbol baseRings is a member of the class Symbol [III.21.10].
24.186. basictype
basictype x – yields the class representing the basic type of x.
Every thing has basic type which tells what sort of thing it really is, internally.
It is not possible for the user to create new basic types.
The parent of a basic type is Thing [III.21], and this property characterizes
the basic types.
i1 : select(values symbolTable(), i -> parent value i === Th ...
o1 = {Nothing, Function, Net, File, Symbol, BasicList, QQ, R ...
o1 : List
See also:
Thing [III.21] – the class of all things
The function basictype is a member of the class Function [III.18].
Ways to use basictype :
basictype Thing
24.187. basis
basis(i,M) – produce a map from a free module to M whose image is the degree
i part of the module (or ring) M.
basis M – produce a map from a free module to M whose image is the finite dimensional module (or ring) M.
The degree i may be a multi-degree, represented as a list of integers.
i1 : R = ZZ/101[a..c];
i2 : basis(2, R)
o2 = {0} | a2 ab ac b2 bc c2 |
24.187. BASIS
595
1
6
o2 : Matrix R <--- R
i3 : basis(2, ideal(a,b,c)/ideal(a^2,b^2,c^2))
o3 = {1} | b c 0 |
{1} | 0 0 c |
{1} | 0 0 0 |
o3 : Matrix
i4 : basis(R/(a^2-a*b, b^2-c^2, b*c))
o4 = {0} | 1 a ab ac ac2 b c c2 |
R
1
R ...
o4 : Matrix (------------------------) <--- (-------------- ...
2
2
2
2
2 ...
(a - a*b, b - c , b*c)
(a - a*b, b
...
i5 : S = ZZ/101[x,y,z,Degrees=>{{1,3},{1,4},{1,-1}}];
i6 : basis({7,24}, S)
o6 = {0, 0} | x4y3 |
1
1
o6 : Matrix S <--- S
i7 : R = ZZ/101[a..d];
i8 : f = basis(3, ideal(a^2, b^2))
o8 = {2} | a b c d 0 0 0 0 |
{2} | 0 0 0 0 a b c d |
o8 : Matrix
Notice that the matrix of f is expressed in terms of the generators of the ideal.
The reason is that the ideal is the target of f, and matrices are always expressed
in terms of the generators of the target.
i9 : target f
o9 = image {0} | a2 b2 |
1
o9 : R - module, submodule of R
The command super [V.24.576] is useful for getting around this.
i10 : super f
o10 = {0} | a3 a2b a2c a2d ab2 b3 b2c b2d |
1
8
o10 : Matrix R <--- R
The function basis is a member of the class Function [III.18].
Ways to use basis :
basis Ideal
596
24. MISCELLANEOUS DOCUMENTATION
basis Module
basis Ring
basis(ZZ,Ideal)
basis(ZZ,Module)
basis(ZZ,Ring)
basis({...},Ideal)
basis({...},Module)
basis({...},Ring)
24.188. benchmark
benchmark s – produce an accurate timing for the code contained in the string
s. The value returned is the number of seconds.
The snippet of code provided will be run enough times to register meaningfully
on the clock, and the garbage collector will be called beforehand.
The function benchmark is a member of the class Function [III.18].
24.189. between
between(m,v) – inserts m between each pair of elements of the list or sequence
v, returning a list.
i1 : between(55,{a,b,c,d})
o1 = {a, 55, b, 55, c, 55, d}
o1 : List
The function between is a member of the class Function [III.18].
Code:
-- code for between:
-- ../m2/classes.m2:102
between = (m,v) -> mingle(v,#v-1:m)
24.190. binary method
The method for computing a sum x+y depends on the types of x and y. For
example, the method for adding an integer x and a polynomial y differs from the
method for adding two integers modulo 111. Because both the type of x and the
type of y must enter into the selection of the method, we refer to these methods as
binary methods. Each binary method is a function of two variables, and is stored
either in the class of x or in the class of y. See also lookup [V.24.397].
Let’s assume that X is the class (or type) of x, and that Y is the class of y. The
way to install a method for the addition of an instance x of class X to an instance
y of class Y is with a statement of the form
X + Y := (x,y) -> ( ... )
where ( ... ) represents the body of the function, consisting of suitable code for
the operation at hand.
The method installed by the code above is automatically inherited by subclass
[V.24.569]es of X and Y. Here is a brief description of the way this works. Suppose X
is the parent [V.24.465] of P and Y is the parent of X. When a sum p+q is evaluated
where the class of p is P and the class of q is Q, then the binary method for P+Q is
applied, unless there isn’t one, in which case the binary method for P+Y is applied,
unless there isn’t one, in which case the binary method for X+Q is applied, unless
24.192. BOREL
597
there isn’t one, in which case the binary method for P+Q is applied. In general this
search for a binary method continues all the way up the chain of parents to the
topmost ancestor of everything, which is called Thing [III.21].
As an extreme example of inheritance, the code
Thing + Thing := (x,y) -> ( ... )
will install a binary method for adding any two things, which will take effect as a
last resort whenever more a specifically defined method isn’t found.
The new [V.24.432] function also uses a ternary lookup table to find the initialization function for the new thing, and should be thought of as a ternary operator.
The initialization function for a new expression created by
new Z of x from y
is obtained as
lookup(NewMethod,Z,X,Y)
Here X is class x, and Y is class y. The initialization function can be installed
with
new Z of X from Y := (z,y) -> ...
where z denotes the new hash table of class Z and parent x provided to the routine
by the system.
24.191. binomial
binomial(n,i) – returns the binomial coefficient, the coefficient of x^i in
(1+x)^i.
i1 : binomial(13,6)
o1 = 1716
The function binomial is a member of the class Function [III.18].
Ways to use binomial :
binomial(ZZ,ZZ)
24.192. borel
borel m – make a Borel fixed submodule
Yields the matrix with the same target as the matrix m, whose columns generate
the smallest Borel fixed submodule containing the lead monomials of the columns
of m.
For example, if R = ZZ/101[a..f], then
i1 : R = ZZ/101[a..e]
o1 = R
o1 : PolynomialRing
i2 : borel matrix {{a*d*e, b^2}}
o2 = {0} | a2 ab b2 ac2 acd ad2 ace ade |
1
8
o2 : Matrix R <--- R
The function borel is a member of the class Function [III.18].
Ways to use borel :
borel Matrix
borel MonomialIdeal
598
24. MISCELLANEOUS DOCUMENTATION
24.193. briefDocumentation
briefDocumentation s – provides the first paragraph of the online documentation for the topic s, in internal hypertext [V.24.343] form, suitable for conversion
to text with text [III.21.6.1.5] or to html with html [III.21.6.1.1].
See also:
documentation [V.24.258] – get documentation, unformatted
The function briefDocumentation is a member of the class Function [III.18].
Code:
-- code for briefDocumentation:
-- ../m2/document.m2:466-469
briefDocumentation = x -> (
if noBriefDocClasses#?(class x) or noBriefDocThings#?x ...
else if headline x =!= null then << endl << headline x ...
)
24.194. browse
browse x – provides an interactive mechanism which allows the user to explore
the hash table or list x.
A menu of numbered items is presented to the user which allow the user to
inspect the class [V.24.199] or parent [V.24.465] of x. For a hash table, the keys
are presented so the user can visit the corresponding values, and for a list, the
entries are presented so the user can visit them. One of the menu items allows the
user to go back to re-examine the previous item.
The function browse is a member of the class Function [III.18].
Code:
-- code for browse:
-- ../m2/browse.m2:130-132
browse = x -> (
s := (x,null);
while null =!= (s = menu s) do ( ))
24.195. ceiling
ceiling x – provides the largest integer greater than or equal to the number
x.
The function ceiling is a member of the class Function [III.18].
Code:
-- code for ceiling:
-- ../m2/integers.m2:76
ceiling = x -> - floor(-x)
24.196. chainComplex
chainComplex – a method for creating chain complexes.
The function chainComplex is a member of the class Function [III.18].
Ways to use chainComplex :
chainComplex (...) [III.16.6] – make a chain complex
chainComplex GradedModule [III.16.7] – make a chain complex from
a graded module
chainComplex Matrix [III.12.48] – make a small chain complex
chainComplex {...}
24.201. CLEARECHO
599
24.197. char
char F – returns the characteristic of the ring F.
The key char [V.24.197] is used to store the characteristic in F after it has
been computed.
The function char is a member of the class Function [III.18].
Ways to use char :
char PolynomialRing
char QuotientRing
char Ring
24.198. characters
characters s – produces a list of the characters in the string s.
The characters are represented by strings of length 1.
i1 : characters "asdf"
o1 = {a, s, d, f}
o1 : List
See also:
String [III.21.6.1] – the class of all strings
The function characters is a member of the class Function [III.18].
Ways to use characters :
characters String
24.199. class
class x – yields the class of x.
See also:
classes [I.5.1]
The function class is a member of the class Function [III.18].
Ways to use class :
class Thing
24.200. clearAll
clearAll – a command which attempts to release memory by clearing the
values retained by the output line symbols and all the user symbols.
See also:
userSymbols [V.24.640] – a list of the user’s symbols
clearOutput [V.24.202] – forget output values
The command clearAll is a member of the class Command [III.21.1.2].
24.201. clearEcho
clearEcho stdio – turn off echoing of characters typed to the standard input.
The function clearEcho is a member of the class Function [III.18].
600
24. MISCELLANEOUS DOCUMENTATION
24.202. clearOutput
clearOutput – a command which attempts to release memory by clearing the
values retained by the output line symbols.
See also:
clearAll [V.24.200] – forget evertything
The command clearOutput is a member of the class Command [III.21.1.2].
24.203. close
f << close – closes the file f.
close f – closes the file f.
In the case of an output file, any buffered output is first written to the file, and
the return value is an integer, normally 0, or -1 on error, or the return status of the
child process in case the the file was a pipe.
If the file was open for both input and output, both directions are closed.
If the file is a pipe to another process, i.e., the filename began with the character
!, we will wait for the process to terminate. If you don’t want to wait for the
process to terminate, open the file with openInOut [V.24.456], and if necessary,
use closeIn [V.24.204] to close it, to indicate that it has received all its input.
If the file is stdio then it is left open, and no error is signaled.
The manipulator close is a member of the class Manipulator [III.21.1.5].
24.204. closeIn
f << closeIn – closes the input file f.
closeIn f – closes the input file f.
If the file was open only for input, then close [V.24.203] is easier to use and
has the same effect.
If the file was open for both input and output, it remains open for output.
The manipulator closeIn is a member of the class Manipulator [III.21.1.5].
24.205. closeOut
f << closeOut – closes the output file f.
closeOut f – closes the output file f.
Any buffered output is first written to the file, and the return value is an integer,
normally 0, or -1 on error, or the return status of the child process in case the the
file was a pipe.
If the file was open only for output, then close [V.24.203] is easier to use and
has the same effect.
If the file was open for both input and output, it remains open for input.
The manipulator closeOut is a member of the class Manipulator [III.21.1.5].
24.206. code
code f – prints out the source code of the function f.
code(f,X) – prints out the source code of the particular method that would be
applied if f were applied to an argument of class X.
code(f,X,Y) – prints out the source code of the particular method that would be
applied if f were applied to arguments of classes X and Y.
code(f,X,Y,Z) – prints out the source code of the particular method that would
24.207. CODIM
601
be applied if f were applied to arguments of classes X, Y, and Z.
code {v,w,...} – prints out the source code for each of the items listed.
i1 : code methods use
o1 = -- ../../methods.m2:138-140
use HashTable := x -> (
if x.?use then x.use x;
x)
-- ../../enginering.m2:155-160
use Ring := R -> (
if R.?ring then use R.ring;
try generators R;
if R.?generators and R.?generatorSymbols then scan ...
if R.?use then R.use R;
R)
-- ../../expressions.m2:1113
use Entity := x -> if x.?use then x.use x else x
o1 : Net
See also:
methods [V.24.410] – list methods
The function code is a member of the class Function [III.18].
Ways to use code :
code (...)
code Command
code Function
code Nothing
code Symbol
code {...}
24.207. codim
codim M – calculate the codimension of the support of a module M.
codim I – calculate the codimension of the quotient ring R/I.
If M is an R-module, then the number return by this routine is dim R - dim
M. This does not agree with the usual definition of codimension unless Spec R is
irreducible.
i1 : R = QQ[x,y]/(ideal(x,y) * ideal(x-1))
o1 = R
o1 : QuotientRing
i2 : codim (R^1/(x,y))
o2 = 1
Warning: over the integers, the computation effectively tensors first with the
rational numbers, yielding the wrong answer in some cases.
Warning: we don’t really compute the codimension when the ring has components of different dimension!
The function codim is a member of the class Function [III.18].
Ways to use codim :
codim CoherentSheaf [III.21.5.4.2.9] – codimension of support
602
24. MISCELLANEOUS DOCUMENTATION
codim
codim
codim
codim
codim
Ideal
Module
MonomialIdeal
PolynomialRing
QuotientRing
24.208. coefficientRing
coefficientRing R – yields the coefficient ring of the ring R.
If R is a polynomial ring, then the coefficient ring is the base ring from which
the coefficients are drawn. If R is constructed from a polynomial ring as a quotient
ring or a fraction ring or a sequence of such operatinos, then the original coefficient
ring is returned.
i1 : coefficientRing(ZZ/101[a][b])
ZZ
o1 = --- [a]
101
o1 : PolynomialRing
i2 : ultimate(coefficientRing,ZZ/101[a][b])
ZZ
o2 = --101
o2 : QuotientRing
The function coefficientRing is a member of the class Function [III.18].
Ways to use coefficientRing :
coefficientRing FractionField
coefficientRing GaloisField
coefficientRing PolynomialRing
coefficientRing QuotientRing
coefficientRing Ring
24.209. coefficients
coefficients({i,j,...},p) – yields the coefficients and monomials of the
polynomial or matrix p with respect to variables numbered i, j, ... . This has to be
completely redone, so I don’t document it further, but it is used in the factoring
code.
coefficients(p) – yields the coefficients and monomials of the polynomial or
matrix p with respect to all of the variables.
The function coefficients is a member of the class Function [III.18].
Ways to use coefficients :
coefficients Matrix
coefficients RingElement
coefficients({...},Matrix)
coefficients({...},RingElement)
24.213. COKERNEL
603
24.210. cohomology
cohomology – a method name available for computing expressions of the forms
HH^i(X) and HH^i(M,N).
If it is intended that i be of class ZZ, M be of class A, and N be of class B, then
the method can be installed with
cohomology(ZZ, A, B) := opts -> (i,M,N) -> ...
See also:
homology [V.24.341] – general homology functor
HH [V.24.88] – general homology and cohomology functor
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
The function cohomology is a member of the class Function [III.18].
Ways to use cohomology :
HH^ZZ (...)
HH^ZZ ChainComplex [III.13.2] – cohomology of a chain complex
HH^ZZ ChainComplexMap [III.12.2] – cohomology of a chain complex
map
HH^ZZ CoherentSheaf [III.13.3] – coherent sheaf cohomology
HH^ZZ Module [III.13.4] – local cohomology
Optional arguments :
cohomology(..., Degree => ...)
24.211. coimage
coimage f – coimage of a map.
The coimage of a map differs slightly from the image, in that the coimage is
a quotient module of the source of the map, but the image is a submodule of the
target of the map. The image and the coimage are isomorphic modules.
See also:
GradedModule [III.21.5.4.3] – the class of all graded modules
The function coimage is a member of the class Function [III.18].
Ways to use coimage :
coimage ChainComplexMap
coimage GradedModuleMap
coimage Matrix
24.212. coker
24.213. cokernel
cokernel f – produces the cokernel of the module homomorphism f
The result will be a quotient module of the target of f. If f is a ring element, it
is interpreted as a one by one matrix.
The generators of the cokernel are provided by the generators of the target of
f. In other words, cover target f and cover cokernel f are equal.
For an abbreviation, use coker [V.24.212].
See also:
kernel [V.24.375] – kernel of a map
cover [V.24.234] – get the covering free module
The function cokernel is a member of the class Function [III.18].
Ways to use cokernel :
cokernel ChainComplexMap
604
24. MISCELLANEOUS DOCUMENTATION
cokernel GradedModuleMap
cokernel Matrix
cokernel RingElement
24.214. collectGarbage
collectGarbage() – attempt a garbage collection.
See also:
GC garbage collector [V.24.82]
The function collectGarbage is a member of the class Function [III.18].
24.215. columnate
columnate(s,w) – arranges the strings in the list s in columns, returning a
Net [III.21.6] suitable for output to a terminal with a linewidth of w.
i1 : columnate(characters ascii (65 .. 90) , 12)
o1 = A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U Z
V
W
X
Y
o1 : Net
The function columnate is a member of the class Function [III.18].
24.216. combinatorial functions
random [V.24.216.1] – get a random element
binomial [V.24.191] – binomial coefficient
subsets [V.24.216.2] – produce all the subsets
tally [V.24.216.3] – tally the elements of a list
partitions [V.24.216.4] – list the partitions of an integer
24.216.1. random
This function can be used to get random elements of various sorts.
The function random is a member of the class Function [III.18].
Ways to use random :
random GaloisField
random QuotientRing
random RR [III.21.9.2] – random real number
random Ring [III.10.19] – random element of a ring
random ZZ [III.21.11.7] – random integer
random(Module,Module) [III.12.40] – make a random module map
random(ZZ,Ring) [III.10.20] – a random ring element of a given degree
random({...},Ring) [III.10.21] – a random ring element of a given degree
24.216.2. subsets
subsets – a function for computing a list of subsets of a set or list.
The function subsets is a member of the class Function [III.18].
Ways to use subsets :
24.216. COMBINATORIAL FUNCTIONS
605
subsets Set [III.21.5.8.1.7] – produce all the subsets
subsets {...} [III.19.2.11] – produce all the subsets
subsets((...),ZZ)
subsets(Set,ZZ) [III.21.5.8.1.8] – produce all the subsets
subsets(ZZ,ZZ) [III.21.11.12] – produce all the subsets
subsets({...},ZZ)
24.216.3. tally
tally x – tallies the frequencies of items in a list x.
It produces an hash table (multiset) y which tallies the frequencies of occurrences of items in the list x, i.e., y_i is the number of times i appears in x, or is 0
if i doesn’t appear in the list.
i1 : y = tally {1,2,3,a,b,1,2,a,1,2,{a,b},{a,b},a}
o1 = Tally{1 => 3
}
2 => 3
3 => 1
a => 3
b => 1
{a, b} => 2
o1 : Tally
i2 : y_{a,b}
o2 = 2
See also:
Tally [III.21.5.8] – the class of all tally results
The function tally is a member of the class Function [III.18].
Ways to use tally :
tally (...)
tally {...}
24.216.4. partitions
partitions n – returns a list of the partitions of the integer n.
partitions(n,k) – returns a list of the partitions of the integer n into terms each
of which does not exceed k.
i1 : partitions 4
o1 = {{4}, {3, 1}, {2, 2}, {2, 1, 1}, {1, 1, 1, 1}}
o1 : List
i2 : partitions(4,2)
o2 = {{2, 2}, {2, 1, 1}, {1, 1, 1, 1}}
o2 : List
The function partitions is a member of the class Function [III.18].
Ways to use partitions :
partitions ZZ
partitions(ZZ,ZZ)
606
24. MISCELLANEOUS DOCUMENTATION
24.217. combine
combine(x,y,f,g,h) – yields the result of combining hash tables x and y,
using f to combine keys, g for values, and h for collisions.
The objects are assumed to have the same class, and the result will have the
class of one of them. The combined object will contain f(p,q) => g(b,c) when x
contains p => b and y contains q => c. The function h is used to combine values
when key collisions occur in the result, as with merge [V.24.406]. The function h
should be a function of two arguments; it may assume that its first argument will
be the value accumulated so far, and its second argument will be the result g(b,c)
from a single pair of values. Normally h will be an associative and commutative
function.
The result is mutable if and only if x or y is.
This function can be used for multiplying polynomials, where it will be used in
code like this.
combine(x, y, monomialTimes, coeffTimes, coeffPlus)
The function combine is a member of the class Function [III.18].
24.218. commandLine
A constant whose value is the list of arguments passed to the interpreter, including argument 0, the name of the program.
24.219. compactMatrixForm
24.220. complement
complement f – for a matrix f, return a map g with the same target whose
columns are minimal generators for the cokernel of f.
The map f must be homogeneous.
The function complement is a member of the class Function [III.18].
Ways to use complement :
complement Matrix
24.221. complete
complete C – completely fills out the chain complex C by calling upon the
engine to provide the maps and modules computed by resolution [V.24.517].
This is mainly intended for developers of new routines for chain complexes
which have to make use of their internal structure. Before running this routine, it
is not possible to determine which spots in a chain complex are actually occupied
by modules or maps.
The function complete is a member of the class Function [III.18].
Ways to use complete :
complete ChainComplex [III.16.8] – complete the internal parts
complete ChainComplexMap
complete GradedModule
24.222. component example
The following simple example illustrates the use of removeLowestDimension
[V.24.513],top [V.24.621],radical [V.24.507], and decompose [V.24.238].
24.223. COMPONENTS
607
i1 : R = ZZ/32003[a..d];
i2 : I = monomialCurve(R,{1,3,4})
3
o2 = ideal (b*c - a*d, c
2
2
2
3
2
- b*d , a*c - b d, b - a c)
o2 : Ideal of R
i3 : J = ideal(a^3,b^3,c^3-d^3)
3
3
3
3
o3 = ideal (a , b , c - d )
o3 : Ideal of R
i4 : I = intersect(I,J)
4
3
3
3
4
3
3
...
o4 = ideal (b - a d, a*b - a c, b*c - a*c d - b*c*d + a* ...
o4 : Ideal of R
i5 : removeLowestDimension I
3
2
2
2
3
2
- b*d , a*c - b d, b - a c)
3
2
2
2
3
2
- b*d , a*c - b d, b - a c)
o5 = ideal (b*c - a*d, c
o5 : Ideal of R
i6 : top I
o6 = ideal (b*c - a*d, c
o6 : Ideal of R
i7 : radical I
2
o7 = ideal (b*c - a*d, a*c
2
3
2
6
3 3
2 ...
- b d, b - a c, c - c d - b d ...
o7 : Ideal of R
i8 : decompose I
2
2
...
o8 = {ideal (a, b, - c + d), ideal (a, b, c + c*d + d ), id ...
o8 : List
24.223. components
components x – produces a list of the components of an element of a free
module.
components M – the list of components for a module M which was formed as a direct
sum, or {M} if M was not formed as a direct sum. Works also for homomorphism,
chain complexes, and graded modules.
608
24. MISCELLANEOUS DOCUMENTATION
components ChainComplex [III.16.14] – list the components of a direct
sum
See also:
vector [V.24.644] – make a vector
directSum [V.24.254] – direct sum of modules or maps
++ [V.24.17] – a binary operator, usually used for direct sum
The function components is a member of the class Function [III.18].
Ways to use components :
components ChainComplex [III.16.14] – list the components of a direct
sum
components ChainComplexMap
components GradedModule
components GradedModuleMap
components Matrix
components Module
components Vector
24.224. compress
compress m – provides the matrix obtained from the matrix m by removing the
columns which are zero.
The function compress is a member of the class Function [III.18].
Ways to use compress :
compress Matrix
24.225. concatenate
concatenate(s,t,...,u) – yields the concatenation of the strings s,t,...,u.
The arguments may also be lists or sequences of strings and symbols, in which
case they are concatenated recursively. Additionally, an integer may be used to
represent a number of spaces.
i1 : concatenate {"a",("s",3,"d"),"f"}
o1 = as
df
o1 : String
See also:
String [III.21.6.1] – the class of all strings
The function concatenate is a member of the class Function [III.18].
Ways to use concatenate :
concatenate {...}
24.226. cone
cone f – produce the mapping cone of a map f of chain complexes
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
24.226. CONE
i2 : m = image vars R
o2 = image {0} | x y z |
1
o2 : R - module, submodule of R
i3 : m2 = image symmetricPower(2,vars R)
o3 = image {0} | x2 xy xz y2 yz z2 |
1
o3 : R - module, submodule of R
i4 : M = R^1/m2
o4 = cokernel {0} | x2 xy xz y2 yz z2 |
1
o4 : R - module, quotient of R
i5 : N = R^1/m
o5 = cokernel {0} | x y z |
1
o5 : R - module, quotient of R
i6 : C = cone extend(resolution N,resolution M,id_(R^1))
1
4
9
9
3
o6 = R <-- R <-- R <-- R <-- R
0
1
2
3
4
o6 : ChainComplex
Let’s check that the homology is correct. HH_0 should be 0.
i7 : prune HH_0 C
o7 = 0
o7 : R - module
HH_1 should be isomorphic to m/m2.
i8 : prune HH_1 C
o8 = cokernel {1} | z 0 0 y 0 0 x 0 0 |
{1} | 0 z 0 0 y 0 0 x 0 |
{1} | 0 0 z 0 0 y 0 0 x |
3
o8 : R - module, quotient of R
i9 : prune (m/m2)
o9 = cokernel {1} | 0 0 z 0 0 y 0 0 x |
{1} | 0 z 0 0 y 0 0 x 0 |
{1} | z 0 0 y 0 0 x 0 0 |
609
610
24. MISCELLANEOUS DOCUMENTATION
3
o9 : R - module, quotient of R
The function cone is a member of the class Function [III.18].
Ways to use cone :
cone ChainComplexMap
24.227. connectionCount
connectionCount f – returns the number of connections accepted by the listener f so far.
The function connectionCount is a member of the class Function [III.18].
24.228. content
content f – returns the content of a matrix or polynomial.
The content is the ideal of the base ring generated by the coefficients.
The function content is a member of the class Function [III.18].
Ways to use content :
content Matrix
content RingElement
24.229. contract
The function contract is a member of the class Function [III.18].
Ways to use contract :
contract(Matrix,Matrix) [III.12.19] – contract one matrix by another
contract(Matrix,RingElement)
contract(Matrix,Vector)
contract(RingElement,Matrix)
contract(RingElement,RingElement)
contract(RingElement,Vector)
contract(Vector,Matrix)
contract(Vector,RingElement)
contract(Vector,Vector)
24.230. copy
copy x – yields a copy of x.
If x is an hash table, array, list or sequence, then the elements are placed into
a new copy. If x is a hash table, the copy is mutable if and only if x is.
It is not advisable to copy such things as modules and rings, for the operations
which have already been installed for them will return values in the original object,
rather than in the copy.
See also:
newClass [V.24.433] – copy an object, changing the class
The function copy is a member of the class Function [III.18].
24.237. DD
611
24.231. cos
cos x – computes the cosine of x.
The function cos is a member of the class Function [III.18].
Ways to use cos :
cos RR
cos ZZ
24.232. cosh
cosh x – computes the hyperbolic cosine of x.
The function cosh is a member of the class Function [III.18].
Ways to use cosh :
cosh RR
cosh ZZ
24.233. cotangentSheaf
The function cotangentSheaf is a member of the class Function [III.18].
Ways to use cotangentSheaf :
cotangentSheaf ProjectiveVariety [III.17.2.1] – make the cotangent
sheaf
cotangentSheaf(ZZ,ProjectiveVariety) [III.17.2.2] – make an exterior
power of the cotangent sheaf
24.234. cover
cover M – yields the free module whose basis elements correspond to the generators of M.
See also:
ambient [V.24.162] – ambient free module or ring
super [V.24.576] – get the ambient module
The function cover is a member of the class Function [III.18].
Ways to use cover :
cover GradedModule
cover Matrix
cover Module
24.235. currentDirectory
currentDirectory() – returns the name of the current directory.
The function currentDirectory is a member of the class Function [III.18].
24.236. currentFile
24.237. dd
dd – a symbol used as a key in a chain complex, under which are stored the
differentials.
The differentials are stored as the members in a chain complex map of degree
-1. The map C.dd_i is the one whose source is the module C_i, and it is arranged
to be zero if no map has been stored in that spot.
i1 : R = ZZ/101[a,b];
612
24. MISCELLANEOUS DOCUMENTATION
i2 : C = resolution cokernel vars R
1
2
1
o2 = R <-- R <-- R
0
1
2
o2 : ChainComplex
i3 : C.dd
1
o3 = -1 : 0 <----- R : 0
0
1
2
0 : R <--------------- R : 1
{0} | a b |
2
1
1 : R <-------------- R : 2
{1} | -b |
{1} | a |
o3 : ChainComplexMap
i4 : C.dd_2
o4 = {1} | -b |
{1} | a |
2
1
o4 : Matrix R <--- R
See also:
ChainComplex [III.16] – the class of all chain complexes
The symbol dd is a member of the class Symbol [III.21.10].
24.238. decompose
decompose I – compute the ideals of the irreducible components of the subvariety defined by the ideal I.
This code uses irreducibleCharacteristicSeries [V.24.363]. See also pseudoRemainder [V.24.493].
At the moment, cases that involve factorization over extensions of prime fields
are not handled, and a warning message is issued. The message is: ’Factorisation
over algebraic function field required!’. The user should take this as an indication
that the factorization is not complete.
The function decompose is a member of the class Function [III.18].
Ways to use decompose :
decompose Ideal
24.239. deepSplice
deepSplice v – yields a new list v where any members of v which are sequences
are replaced by their elements, and so on.
24.240. DEGREE
613
Works also for sequences, and leaves other expressions unchanged. Copying the
list v is always done when v is mutable.
i1 : deepSplice { (a,b,(c,d,(e,f))), g, h }
o1 = {a, b, c, d, e, f, g, h}
o1 : List
See also:
splice [V.24.562] – remove subsequences
The function deepSplice is a member of the class Function [III.18].
Ways to use deepSplice :
deepSplice BasicList
24.240. degree
degree X – returns the degree of a polynomial, vector, matrix, monomial, or
module.
The degree may be an integer, or a vector of integers. The length of that
vector is referred to as the ’number of degrees’, and is provided by degreeLength
[V.24.241].
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : degree (x^2+y^2)^5
o2 = {10}
o2 : List
i3 : F = R^{2,3,4}
3
o3 = R
o3 : R - module, free
i4 : v = F_2
o4 = <2>
3
o4 : R
i5 : degree v
o5 = {-4}
o5 : List
The degree of a module of finite length is the same as its length.
i6 : degree cokernel symmetricPower ( 2, vars R )
o6 = 4
614
24. MISCELLANEOUS DOCUMENTATION
Implemented with a method of the same name.
The function degree is a member of the class Function [III.18].
Ways to use degree :
degree ChainComplexMap
degree GradedModuleMap
degree Ideal
degree Matrix
degree Module
degree ProjectiveHilbertPolynomial
degree RingElement
degree Vector
24.241. degreeLength
degreeLength x – returns the number of degrees of x.
Here x may be a ring, in which case it returns the number of degrees (the length
of the degree vector) used in grading the ring.
See also:
degree [V.24.240] – the degree
The function degreeLength is a member of the class Function [III.18].
Ways to use degreeLength :
degreeLength FractionField
degreeLength GeneralOrderedMonoid
degreeLength OrderedMonoid
degreeLength PolynomialRing
degreeLength QuotientRing
degreeLength Ring
24.242. degrees
degrees M – provides a list of multi-degrees for the basis elements of a free
module M.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : E = R^5
5
o2 = R
o2 : R - module, free
i3 : degrees E
o3 = {{0}, {0}, {0}, {0}, {0}}
o3 : List
i4 : F = R^{1,2,3,4}
24.245. DELETE
615
4
o4 = R
o4 : R - module, free
i5 : degrees F
o5 = {{-1}, {-2}, {-3}, {-4}}
o5 : List
The function degrees is a member of the class Function [III.18].
Ways to use degrees :
degrees CoherentSheaf [III.21.5.4.2.10] – get degrees of basis elements
degrees Module
24.243. degreesMonoid
degreesMonoid n – returns the monoid whose elements correspond to the
multi-degrees of monomials in another monoid.
Also used as a key under which to store the result.
The function degreesMonoid is a member of the class Function [III.18].
Ways to use degreesMonoid :
degreesMonoid GeneralOrderedMonoid
degreesMonoid ZZ
24.244. degreesRing
degreesRing n – produce the ring in n variables whose monomials are to be
used to represent degrees in another ring with multi-degrees of length n
degreesRing R – produce the ring in n variables whose monomials are the degrees
of elements of R.
Elements of this ring are used as Poincare polynomials for modules over R.
See also:
poincare [V.24.472] – assemble degrees into polynomial
The function degreesRing is a member of the class Function [III.18].
Ways to use degreesRing :
degreesRing PolynomialRing
degreesRing QuotientRing
degreesRing ZZ
24.245. delete
delete(x,v) – removes any occurrences of the expression x from the list v.
Equality is determined with == [V.24.39] which may do extensive calculations
in certain cases.
i1 : delete(c,{a,b,c,d,e,a,b,c,d,e})
o1 = {a, b, d, e, a, b, d, e}
o1 : List
616
24. MISCELLANEOUS DOCUMENTATION
See also:
member [V.24.404] – test membership in a list
The function delete is a member of the class Function [III.18].
Code:
-- code for delete:
-- ../m2/structure.m2:19
delete = (x,v) -> select(v, i -> i != x)
24.246. demark
demark(s,x) – given a list of strings x and a string s provides the string
obtained by concatenating the elements of x with a copy of x inserted between each
successive pair.
i1 : demark("+",{"a","b","c"})
o1 = a+b+c
o1 : String
The function demark is a member of the class Function [III.18].
Code:
-- code for demark:
-- ../m2/fold.m2:23
demark = (s,v) -> concatenate between(s,v)
24.247. denominator
denominator x – provides the denominator of a fraction.
i1 : denominator (4/6)
o1 = 3
The function denominator is a member of the class Function [III.18].
Ways to use denominator :
denominator Divide
denominator QQ
24.248. depth
depth n – the depth of a net n.
The depth of a net is the number of rows of characters it has below the baseline.
It may be a negative number, but the depth plus the height is always the total
number of rows, which is not negative.
See also:
Net [III.21.6] – the class of all nets and strings
height [V.24.336] – height of a net
The function depth is a member of the class Function [III.18].
Ways to use depth :
depth Net
depth String
24.250. DET
617
24.249. describe
describe x – returns an Expression [III.21.1.3] containing the real description of x, bypassing the feature which causes certain types of things to acquire the
names of global variables to which they are assigned.
i1 : R = ZZ/101[a,b,c_1,c_2];
i2 : R
o2 = R
o2 : PolynomialRing
i3 : describe R
ZZ
o3 = --- [a, b, c , c ]
101
1
2
o3 : Adjacent
i4 : toString describe R
o4 = ZZ/101 [a, b, c_1, c_2]
o4 : String
Currently, this function works by temporarily removing the value stored under
name from the hash table x, which therefore must be mutable.
See also:
toString [III.21.6.1.7] – convert to a string
The function describe is a member of the class Function [III.18].
Ways to use describe :
describe MutableHashTable
describe Thing
24.250. det
det f – returns the determinant of the matrix or table f.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : p = matrix {{a,b},{c,d}}
o2 = {0} | a b |
{0} | c d |
2
2
o2 : Matrix R <--- R
i3 : det p
o3 = - b*c + a*d
618
24. MISCELLANEOUS DOCUMENTATION
o3 : R
The function det is a member of the class Function [III.18].
Ways to use det :
det Matrix
24.251. diff
The function diff is a member of the class Function [III.18].
Ways to use diff :
diff Matrix [III.12.49] – differentiate a matrix
diff ProjectiveHilbertPolynomial [III.21.5.6.1] – differentiate
diff RingElement [III.21.5.4.9.2] – differentiate a ring element
diff(Matrix,Matrix) [III.12.20] – differentiate
diff(Matrix,RingElement)
diff(Matrix,Vector)
diff(ProjectiveHilbertPolynomial,ZZ) [III.21.5.6.2] – differentiate
diff(RingElement,Matrix)
diff(RingElement,RingElement)
diff(RingElement,Vector)
diff(Vector,Matrix)
diff(Vector,RingElement)
diff(Vector,Vector)
24.252. difference
difference(x,y) – returns x-y.
The function difference is a member of the class Function [III.18].
24.253. dim
dim M – calculate the dimension of the support of a module M.
dim R – calculate the dimension of a ring R.
dim I – calculate the dimension of the quotient ring R/I.
dim r – calculate the dimension of the virtual representation corresponding to an
element of a Schur ring.
Warning: over the integers, the computation effectively tensors first with the
rational numbers, yielding the wrong answer in some cases.
See also:
Schur [V.24.122] – make a Schur ring
The function dim is a member of the class Function [III.18].
Ways to use dim :
dim AffineVariety
dim GaloisField
dim Ideal
dim Module
dim PolynomialRing
dim ProjectiveHilbertPolynomial
dim ProjectiveVariety
dim QuotientRing
dim Ring
24.254. DIRECTSUM
619
24.254. directSum
directSum(M,N,...) – forms the direct sum of matrices or modules.
The components can be recovered later with components [V.24.223].
Projection and inclusion maps for direct sums:
Module ^ [...] [III.12.15] – projection onto some factors of a direct sum
module
Module _ [...] [III.12.17] – get inclusion map into direct sum
Matrix ^ {...} [III.12.10] – select some rows of a matrix
Matrix _ {...} [III.12.12] – get some columns from a matrix
It sometimes happens that the user has indices for the components of a direct
sum preferable to the usual consecutive small integers. In this case the preferred
indices can be specified with code like directSum(a=>M,b=>N,...), as in the following example.
i1 : F = directSum(a=>ZZ^1, b=>ZZ^2, c=>ZZ^3)
6
o1 = ZZ
o1 : ZZ - module, free
i2 : F_[b]
o2 = |
|
|
|
|
|
0
1
0
0
0
0
0
0
1
0
0
0
|
|
|
|
|
|
6
2
o2 : Matrix ZZ <--- ZZ
i3 : F^[c]
o3 = | 0 0 0 1 0 0 |
| 0 0 0 0 1 0 |
| 0 0 0 0 0 1 |
3
6
o3 : Matrix ZZ <--- ZZ
Similar syntax works with ++ [V.24.17].
i4 : F = (a => ZZ^1) ++ (b => ZZ^2)
3
o4 = ZZ
o4 : ZZ - module, free
i5 : F_[b]
o5 = | 0 0 |
| 1 0 |
| 0 1 |
3
2
620
24. MISCELLANEOUS DOCUMENTATION
o5 : Matrix ZZ <--- ZZ
See also:
++ [V.24.17] – a binary operator, usually used for direct sum
components [V.24.223] – list the components of a direct sum
indexComponents [V.24.352] – specify keys for components of a direct
sum
indices [V.24.353] – specify keys for components of a direct sum
The function directSum is a member of the class Function [III.18].
Ways to use directSum :
directSum (...)
directSum {...}
24.255. divideByVariable
divideByVariable(m,v) – divide each column of the matrix ’m’ by as high a
power of the variable ’v’ as possible.
divideByVariable(m,v,d) – divide each column of the matrix ’m’ by as high a
power of the variable ’v’ as possible, but divide by no more than v^d.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : m = matrix{{a*b, a^2*c}, {a*b^2, a^4*d}}
o2 = {0} | ab a2c |
{0} | ab2 a4d |
2
2
o2 : Matrix R <--- R
i3 : divideByVariable(m,a)
o3 = {0} | b c
|
{0} | b2 a2d |
2
2
o3 : Matrix R <--- R
i4 : divideByVariable(m,a,1)
o4 = {0} | b ac |
{0} | b2 a3d |
2
2
o4 : Matrix R <--- R
Caveats and limitations: you can only divide by a variable, not a monomial,
and you have little control on what power will be divided. This routine is mostly
used by the saturation commands as a fast internal way of dividing.
We may eliminate this routine.
The function divideByVariable is a member of the class Function [III.18].
Ways to use divideByVariable :
divideByVariable(Matrix,RingElement)
24.258. DOCUMENTATION
621
divideByVariable(Matrix,RingElement,ZZ)
24.256. do
do – a keyword used with while [V.24.649].
24.257. document
document {s, d} – install documentation d for the topic s.
The documentation d should be hypertext [V.24.343]. The topic s may be
one of the special forms useable with TO [III.21.1.6.46]. As a convenience, lists and
sequences in d are converted to SEQ mark up items, and instances of MarkUpType
[III.21.5.4.11.2], such as PARA [III.21.1.6.34] are converted to empty instances of
their type.
See also:
help functions [I.5.7]
The function document is a member of the class Function [III.18].
Ways to use document :
document {...}
24.258. documentation
documentation s – provides the online documention for the topic s, in internal
hypertext [V.24.343] form, suitable for conversion to text with text [III.21.6.1.5]
or to html with html [III.21.6.1.1].
i1 : documentation partitions
o1 = partitions
’partitions n’ -- returns a list of the partitions of the in ...
’partitions(n,k)’ -- returns a list of the partitions of the ...
into terms each of which does not exce ...
in = partitions 4
in = partitions(4,2)
The object ’partitions’ is a member of each of the following ...
classes, most specific first:
...
"partitions ZZ"
"partitions(ZZ,ZZ)"
o1 : SEQ
The function documentation is a member of the class Function [III.18].
Ways to use documentation :
documentation (...)
documentation Function
documentation HashTable
documentation Option
documentation String
documentation Symbol
documentation Thing
documentation Type
622
24. MISCELLANEOUS DOCUMENTATION
24.259. drop
See also:
take [V.24.605] – take some elements from a list
The function drop is a member of the class Function [III.18].
Ways to use drop :
drop(BasicList,ZZ) [III.21.1.15] – drop some elements
drop(BasicList,{...}) [III.19.2.8] – drop some elements
24.260. dual
dual M – the dual.
For details, see one of the following.
dual ChainComplex [III.16.9] – dual
dual Matrix [III.12.21] – dual of a map
dual Module [III.13.10] – dual module
The function dual is a member of the class Function [III.18].
Ways to use dual :
dual ChainComplex [III.16.9] – dual
dual ChainComplexMap
dual Matrix [III.12.21] – dual of a map
dual Module [III.13.10] – dual module
24.261. dumpdata
dumpdata s – dump all data segments for the current process to the file whose
name is stored in the string s.
This effectively saves the entire state of the system, except that the input buffer
for the file stdio [V.24.568] appears to have been emptied, and care is taken so that
the environment and the command line arguments maintain their new values when
the data is reloaded later with loaddata [V.24.393].
The function dumpdata is a member of the class Function [III.18].
24.262. echoOff
echoOff f – turns off echoing for the file f.
The function echoOff is a member of the class Function [III.18].
Ways to use echoOff :
echoOff File
24.263. echoOn
echoOn f – turns on echoing for the file f.
The function echoOn is a member of the class Function [III.18].
Ways to use echoOn :
echoOn File
24.264. edit
edit – a command which starts the text editor
edit f – starts the text editor at the source code of the function f.
edit(f,X) – edits the source code of the particular method that would be applied
if f were applied to an argument of class X.
24.265. EDITING MACAULAY 2 CODE WITH EMACS
623
edit(f,X,Y) – edits the source code of the particular method that would be applied
if f were applied to arguments of classes X and Y.
edit(f,X,Y,Z) – edits the source code of the particular method that would be
applied if f were applied to arguments of classes X, Y, and Z.
The name of the user’s preferred editor is take from the environment variable
EDITOR. If X is running and the editor is not emacs, then the editor is started in a
new xterm window.
For an interactive example, try edit(dim,Module).
The value returned is the exit code returned by the editor, as with run [V.24.530],
usually zero.
The command edit is a member of the class Command [III.21.1.2].
24.265. editing Macaulay 2 code with emacs
In this section we learn how to use emacs to edit Macaulay 2 code. Assuming
you have set up your emacs init file as described in running Macaulay 2 in
emacs [V.24.267.1] when you visit a file whose name ends with .m2 you will see
on the mode line the name Macaulay 2 in parentheses, indicating that the file is
being edited in Macaulay 2 mode. (Make sure that the file emacs/M2-mode.el is
on your load-path.)
To see how electric parentheses, electric semicolons, and indentation work, move
to a blank line of this file and type the following text.
f = () -> (
a := 4;
b := {6,7};
a+b)
Observe carefully how matching left parentheses are indicated briefly when a
right parenthesis is typed.
Now position your cursor in between the 6 and 7. Notice how pressing M-C-u
moves you up out of the list to its left. Do it again. Experiment with M-C-f and
M-C-b to move forward and back over complete parenthesized expressions. (In the
emacs manual a complete parenthesized expression is referred to as an sexp, which
is an abbreviation for S-expression.) Try out C-U 2 M-C-@ as a way of marking the
next two complete parenthesized expression, and see how to use C-W to kill them
and C-Y to yank them back. Experiment with M-C-K to kill the next complete
parenthesized expression.
Position your cursor on the 4 and observe how M-; will start a comment for
you with two hyphens, and position the cursor at the point where commentary may
be entered.
Type res somewhere and then press C-C TAB to bring up the possible completions of the word to documented Macaulay 2 symbols.
Notice how C-H m will display the keystrokes peculiar to the mode in a help
window.
Assuming you have installed the w3 [V.24.646] emacs web browser, you may
explore the documentation by positioning the cursor near a documented word such
as List and pressing C-C d. Alternatively, when the prompt appears, you can type
the key whose documentation should be found.
624
24. MISCELLANEOUS DOCUMENTATION
24.266. else
else – a keyword used with if [V.24.346].
24.267. emacs
The best way to edit Macaulay 2 code or to run Macaulay 2 is with GNU emacs,
a versatile text editor written by Richard Stallman which runs well under most
UNIX systems. Its web page is http://www.gnu.org/software/emacs/emacs.html
and the software can be obtained from one of the ftp sites listed at http://www.gnu.org/order/ftp.html;
the primary ftp site is ftp://ftp.gnu.org/pub/gnu.
There is a version of emacs for Windows NT and Windows 95 called NTemacs.
See http://www.cs.washington.edu/homes/voelker/ntemacs.html for details about
how to get it, as well as information about how to swap your caps lock and control
keys.
running Macaulay 2 in emacs [V.24.267.1]
editing Macaulay 2 code with emacs [V.24.265]
24.267.1. running Macaulay 2 in emacs
Because some answers can be very wide, it is a good idea to run Macaulay 2
in a window which does not wrap output lines and allows the user to scroll horizontally to see the rest of the output. We provide a package for emacs [V.24.267]
which implements this, in emacs/M2.el. It also provides for dynamic completion
of symbols in the language.
There is an ASCII version of this section of the documentation distributed in
the file emacs/emacs.hlp. It might be useful for you to visit that file with emacs
now, thereby avoiding having to cut and paste bits of text into emacs buffers for
the deomonstrations below.
If you are a newcomer to emacs, start up emacs with the command emacs and
then start up the emacs tutorial with the keystrokes C-H t. (The notation C-H
indicates that you should type Control-H, by holding down the control key, and
pressing H.) The emacs tutorial will introduce you to the basic keystrokes useful
with emacs. After running through that you will want to examine the online emacs
manual which can be read with info mode; you may enter or re-enter that mode
with the keystrokes C-H i. You may also want to purchase (or print out) the emacs
manual. It is cheap, comprehensive and informative. Once you have spent an hour
with the emacs tutorial and manual, come back and continue from this point.
Edit your .emacs initialization file, located in your home directory, creating one
if necessary. (Under Windows, this file is called _emacs.) Insert into it the following
lines of emacs-lisp code (which can also be found in the file emacs/emacs-hlp.txt,
or obtained by running help "running Macaulay 2 in emacs" in Macaulay 2).
(setq auto-mode-alist (append auto-mode-alist ’(("\\.m2$" .
(autoload ’M2-mode "M2-mode.el" "Macaulay 2 editing mode" t)
(global-set-key "\^Cm" ’M2) (global-set-key [ f12 ] ’M2)
(global-set-key "\^Cm" ’M2) (global-set-key [ SunF37 ] ’M2)
(autoload ’M2 "M2.el" "Run Macaulay 2 in a buffer." t)
(setq load-path (cons "/usr/local/Macaulay2/emacs" load-path
(make-variable-buffer-local ’transient-mark-mode)
(add-hook ’M2-mode-hook ’(lambda () (setq transient-mark-mod
(add-hook ’comint-M2-hook ’(lambda () (setq transient-mark-m
...
...
...
...
24.267. EMACS
625
(defvar M2HOME "/home/dan/src/M2/Macaulay2")
The first two lines cause emacs to enter a special mode for editing Macaulay 2
code whenever a file whose name has the form *.m2 is encountered. The next three
lines provide a special mode for running Macaulay 2 in an emacs buffer. The sixth
line tells emacs where to find the emacs-lisp files provided in the Macaulay 2 emacs
directory - you must edit the string in that line to indicate the correct path on your
system to the Macaulay 2 emacs directory. The files needed from that directory
are M2-mode.el, M2-symbols.el, and M2.el. The seventh line sets the variable
transient-mark-mode so that it can have a different value in each buffer. The
eighth and ninth lines set hooks so that transient-mark-mode will be set to t in
M2 buffers. The effect of this is that the mark is only active occasionally, and then
emacs functions which act on a region of text will refuse to proceed unless the mark
is active. The set-mark function or the exchange-point-and-mark function will
activate the mark, and it will remain active until some change occurs to the buffer.
The only reason we recommend the use of this mode is so the same key can be used
to evaluate a line or a region of code, depending on whether the region is active.
The tenth line tells emacs where to find the directory in which the Macaulay2 files
have been installed - you should change this to the appropriate directory for your
installation, so emacs can find the Macaulay 2 documentation.
Exit and restart emacs with your new initialization file. If you are reading this
file with emacs, then use the keystrokes C-x 2 to divide the buffer containing this
file into two windows. Then press the F12 function key to start up Macaulay 2 in
a buffer named *M2*.
If this doesn’t start up Macaulay 2, one reason may be that your function keys
are not operable. In that case press C-C m instead. (The notation C-C is standard
emacs notation for Control-C.) Another reason may be that you have not installed
Macaulay 2 properly - the startup script (M2 or M2.bat) should be on your path. A
third reason may be that you are in Windows-98 and are using anti-virus software
such as Dr. Solomon’s, which can interfere with emacs when it tries to run a
subprocess.
You may use C-x o freely to switch from one window to the other. Verify that
Macaulay 2 is running by entering a command such as 2+2. Now paste the following
text into a buffer, unless you have the ASCII version of this documentation in an
emacs buffer already, position the cursor on the first line of code, and press the F11
function key (or C-C s) repeatedly to present each line to Macaulay 2.
i1 = R = ZZ/101[x,y,z]
i2 = f = symmetricPower(2,vars R)
i3 = M = cokernel f
i4 = C = resolution M
i5 = betti C
Notice that the input prompts are not submitted to Macaulay 2.
Here is a way to conduct a demo of Macaulay 2 in which the code to be
submitted is not visible on the screen. Paste the following text into an emacs
buffer.
20!
4 + 5 2^20
-- that’s all folks!
626
24. MISCELLANEOUS DOCUMENTATION
Press M-F11 with your cursor in this buffer to designate it as the source for the
Macaulay 2 commands. (The notation M-F11 means that while holding the Meta
key down, you should press the F11 key. The Meta key is the Alt key on some
keyboards, or it can be simulated by pressing Escape (just once) and following that
with the key you wanted to press while the meta key was held down.) Then position
your cursor (and thus the emacs point) within the line containing 20!. Now press
M-F12 to open up a new frame called DEMO for the *M2* window with a large font
suitable for use with a projector, and with your cursor in that frame, press F11
a few times to conduct the demo. (If the font or frame is the wrong size, you
may have to create a copy of the file M2.el with a version of the function M2-demo
modified to fit your screen.)
One press of F11 brings the next line of code forward into the *M2* buffer, and
the next press executes it. Use C-x 5 0 when you want the demo frame to go away.
There is a way to send a region of text to Macaulay 2: simply select a region
of text, making sure the mark is active (as described above) and press F11. Try
that on the list below; put it into an emacs buffer, move your cursor to the start of
the list, press M-C-@ or M-C-space to mark the list, and then press F11 to send it
to Macaulay 2. (The notation M-C-@ means: while holding down the Meta key and
the Control key press the @ key, for which you’ll also need the shift key.)
{a,b,c,d,e,f,
g,h,i,j,k,l,
m,n}
We have developed a system for incorporating Macaulay 2 interactions into
TeX files. Here is an example of how that looks. Paste the following text into an
emacs buffer.
The answer, 4, is displayed after the output label ‘‘{\tt o1 ...
Multiplication is indicated with the traditional {\tt *}.
<<<1*2*3*4>>>
Powers are obtained as follows.
<<<2^100>>>
The bits in brackets can be submitted to Macaulay 2 easily. Position your
cursor at the top of the buffer and press F10. The cursor will move just past the
first <<<, and the emacs mark will be positioned just before the >>>. Thus 1*2*3*4
is the region, and it will even be highlighted if you have set the emacs variable
transient-mark-mode to t for this buffer. Pressing F11 will send 1*2*3*4 to
Macaulay 2 for execution: try it now. A sequence of such Macaulay 2 commands
can be executed by alternately pressing F10 and F11. You may also use M-F10 to
move backward to the previous bracketed expression.
Now let’s see how we can handle wide and tall Macaulay 2 output. Execute
the following line of code.
random(R^20,R^{6:-2})
Notice that the long lines in the Macaulay 2 window, instead of being wrapped
around to the next line, simply disappear off the right side of the screen, as indicated
by the dollar signs in the rightmost column. Switch to the other window and
practice scrolling up and down with M-v and C-v, and scrolling left and right with
the function key F3 (or C-C <) and the function key F4 (or C-C >). Notice how the
use of C-E to go to the end of the line sends the cursor to the dollar sign at the
right hand side of the screen; that’s where the cursor will appear whenever you go
24.270. ENTRIES
627
to a position off the screen to the right. Then use the F2 function key (or C-C .) to
scroll the text so the cursor appears at the center of the screen. Use C-A to move
to the beginning of the line and then the F2 function key (or C-C .) to bring the
left margin back into view.
You may use the F5 function key or (or C-C ?) to toggle whether long lines are
truncated or wrapped; initially they are truncated.
Now go to the very end of the *M2* buffer with M-> and experiment with
keyword completion. Type reso and then press the TAB key. Notice how the word
is completed to resolution for you. Delete the word with M-DEL, type res and
then press the TAB key. The possible completions are displayed in a window. Switch
to it with the F8 key, move to the desired completion, select it with the RETURN key,
and then return to the *M2* buffer with C-X o. Alternatively, if you have a mouse,
use the middle button to select the desired completion.
Experiment with command line history in the *M2* buffer. Position your cursor
at the end of the buffer, and then use M-p and M-n to move to the previous and
next line of input remembered in the history. When you get to one you’d like to run
again, simply press return to do so. Or edit it slightly to change it before pressing
return.
Assuming you have installed the w3 [V.24.646] emacs web browser, you may
explore the documentation by positioning the cursor near a documented word such
as List and pressing C-C d. Alternatively, when the prompt appears, you can type
the key whose documentation should be found.
24.268. end
end – a symbol which causes loading of a file to be stopped.
See also:
needs [V.24.430] – read Macaulay 2 commands if necessary
load [V.24.392] – read Macaulay 2 commands
input [V.24.358] – read Macaulay 2 commands and echo
The symbol end is a member of the class Symbol [III.21.10].
24.269. endl
f << endl – ends the line currently being put out to the file f.
It is an essential portable programming practice to use endl always, for writing newline characters (see newline [V.24.435]) to a file will not terminate a line
containing nets properly, and it will not flush the output buffer.
The manipulator endl is a member of the class Manipulator [III.21.1.5].
24.270. entries
entries f – produces the matrix of the homomorphism f as a doubly nested
list of ring elements.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : p = matrix {{x^2,y^2},{x*y*z, x^3-y^3}}
628
24. MISCELLANEOUS DOCUMENTATION
o2 = {0} | x2 y2
|
{0} | xyz x3-y3 |
2
2
o2 : Matrix R <--- R
i3 : entries p
2
2
3
3
o3 = {{x , y }, {x*y*z, x - y }}
o3 : List
The function entries is a member of the class Function [III.18].
Ways to use entries :
entries Matrix
24.271. environment
A constant whose value is the list containing the environment strings for the
process.
24.272. erase
erase s – removes the global symbol s from the symbol table.
The function erase is a member of the class Function [III.18].
24.273. error
error s – causes an error message s to be displayed.
The error message s (which should be a string or a sequence of things which
can be converted to strings and concatenated) is printed. Execution of the code is
interrupted, and control is returned to top level.
Eventually we will have a means of ensuring that the line number printed out
with the error message will have more significance, but currently it is the location
in the code of the error expression itself.
The function error is a member of the class Function [III.18].
Code:
-- code for error:
-- ../m2/debugging.m2:5-7
error = args -> olderror apply(
sequence args, x -> if class x === String then x else t ...
)
24.274. errorDepth
errorDepth i – sets the error depth to i, which should be a small integer,
returning the old value.
During the backtrace after an error message, a position in interpreted code
is displayed only if the value of reloaded [V.24.511] was at least as large as the
error depth is now. Typically, the error depth is set to 1 so that messages from
code pre-interpreted and reloaded with loaddata [V.24.393] will not appear in the
backtrace.
The function errorDepth is a member of the class Function [III.18].
24.279. EXEC
629
24.275. euler
euler M – provide a list of the successive sectional Euler characteristics of a
module, ring, or ideal.
The i-th one in the list is the Euler characteristic of the i-th hyperplane section
of M.
The function euler is a member of the class Function [III.18].
Ways to use euler :
euler Ideal
euler Module
euler ProjectiveHilbertPolynomial
euler Ring
24.276. even
even x – returns true or false, tells whether x is an even integer.
See also odd [V.24.446].
The function even is a member of the class Function [III.18].
Code:
-- code for even:
-- ../m2/numbers.m2:5
even = x -> 0 === x%2
24.277. examine
examine () – list the sequence numbers for the scopes corresponding to the
frames currently in use.
examine f – display internal information about an interpreted function f.
examine x – display internal information about a symbol x.
This function is intended for debugging the interpreter itself.
See also:
debugging [I.5.5]
The function examine is a member of the class Function [III.18].
24.278. examples
examples f – returns a list of strings containing examples of code using the
function f provided in the documentation of f.
See also:
document [V.24.257] – install documentation
printExamples [V.24.483] – print examples of use from documentation
The function examples is a member of the class Function [III.18].
Code:
-- code for examples:
-- ../m2/document.m2:386
examples = x -> getExampleInputs documentation x
24.279. exec
exec argv – uses the ’exec’ operating system call to start up another program,
replacing the current Macaulay 2 process. Here argv is a string, or a sequence or
list of strings to be passed as arguments to the new process. The first string is the
name of the executable file.
630
24. MISCELLANEOUS DOCUMENTATION
The function exec is a member of the class Function [III.18].
24.280. exit
exit n – terminates the program and returns n as return code.
exit – terminates the program and returns 0 as return code.
Files are flushed and closed. Another way to exit is to type the end of file
character, which is typically set to Control-D in unix systems, and is Control-Z
under MS-DOS.
See also:
quit [V.24.504] – quit the program
The command exit is a member of the class Command [III.21.1.2].
24.281. exp
exp x – computes the exponential of x.
The function exp is a member of the class Function [III.18].
Ways to use exp :
exp RR
exp ZZ
24.282. exponents
exponents m – for a monomial m provides the list of exponents.
exponents f – for a polynomial f provides a list whose elements are the lists of
exponents of the terms of f.
i1 : R = ZZ/101[x,y,z];
i2 : exponents (f = x^2 - 7 + x*y*z^11 + y)
o2 = {{1, 1, 11}, {2, 0, 0}, {0, 1, 0}, {0, 0, 0}}
o2 : List
i3 : leadMonomial f
11
o3 = x*y*z
o3 : [x, y, z]
i4 : exponents leadMonomial f
o4 = {1, 1, 11}
o4 : List
The function exponents is a member of the class Function [III.18].
Ways to use exponents :
exponents MonoidElement
exponents RingElement
24.283. extend
extend(D,C,f0) – produces a lifting of a map f0 : D_0 <--- C_0 to a map
f: D <--- C of chain complexes of degree 0.
24.285. FACTOR
631
The function extend is a member of the class Function [III.18].
Ways to use extend :
extend(ChainComplex,ChainComplex,Matrix)
24.284. exteriorPower
exteriorPower(i,M) – the i-th exterior power of a module M.
exteriorPower(i,f) – the i-th exterior power of a matrix f.
The rows and columns are indexed in the same order as that used by subsets
[V.24.216.2] when listing the subsets of a set.
When i is 1, then the result is equal to M.
When M is not a free module, then the generators used for the result will be
wedges of the generators of M. In other words, the modules cover exteriorPower(i,M)
and exteriorPower(i,cover M) will be equal.
See also:
minors [V.24.415] – ideal generated by minors
det [V.24.250] – determinant of a matrix
wedgeProduct [V.24.648] – the exterior multiplication map
The function exteriorPower is a member of the class Function [III.18].
Ways to use exteriorPower :
exteriorPower(ZZ,CoherentSheaf ) [III.21.5.4.2.7] – exterior power
exteriorPower(ZZ,Matrix)
exteriorPower(ZZ,Module)
24.285. factor
factor x – factors x.
The result is a Product [III.21.1.3.4.2] each of whose factors is a Power
[III.21.1.3.13] whose base is one of the factors found and whose exponent is an
integer.
i1 : y = (2^15-4)/(2^15-5)
32764
o1 = ----32763
o1 : QQ
i2 : x = factor y
2
2 8191
o2 = -------3*67*163
o2 : Divide
i3 : value x
32764
o3 = ----32763
o3 : QQ
632
24. MISCELLANEOUS DOCUMENTATION
We may peek [III.21.6.8] inside x to a high depth to see its true structure as
Expression [III.21.1.3].
i4 : peek2(x,100)
o4 = Divide{Product{Power{2,2},Power{8191,1}},Product{Power{ ...
o4 : Net
For small integers factorization is done by trial division. Eventually we will have
code for large integers. For multivariate polynomials the factorization is done with
code of Michael Messollen (see Factorization and characteristic sets library
[V.24.76]). For univariate polynomials the factorization is in turn done with code
of Gert-Martin Greuel and Ruediger Stobbe (see Factory library [V.24.77]).
i5 : R = ZZ/101[u]
o5 = R
o5 : PolynomialRing
i6 : factor (u^3-1)
2
o6 = (u + u + 1)(u - 1)(1)
o6 : Product
The constant term is provided as the last factor.
i7 : F = frac(ZZ/101[t])
o7 = F
o7 : FractionField
i8 : factor ((t^3-1)/(t^3+1))
2
(t + t + 1)(t - 1)(1)
o8 = ---------------------2
(t - t + 1)(t + 1)(1)
o8 : Divide
The code for factoring in a fraction field is easy to read:
i9 : code(factor,F)
o9 = -- ../../enginering.m2:106
factor F := options -> f -> factor numerator
o9 : Net
The function factor is a member of the class Function [III.18].
Ways to use factor :
factor QQ
factor ZZ
Optional arguments :
...
24.290. FLAG
633
24.286. false
false – a value indicating falsity.
The boolean value false is a member of the class Boolean [III.21.2].
24.287. first
first v – yields the first element of the list v.
See also last [V.24.380].
The function first is a member of the class Function [III.18].
Code:
-- code for first:
-- ../m2/structure.m2:3
first = x -> x#0
24.288. firstkey
firstkey f – return the first key available in the database file f.
Returns null if none.
See also:
Database [III.21.3] – the class of all database files
The function firstkey is a member of the class Function [III.18].
24.289. fittingIdeal
fittingIdeal(i,M) – the i-th Fitting ideal of the module M
i1 : R = ZZ/101[x];
i2 : k = coker vars R
o2 = cokernel {0} | x |
1
o2 : R - module, quotient of R
i3 : M = R^3 ++ k^5;
i4 : fittingIdeal(3,M)
5
o4 = ideal x
o4 : Ideal of R
i5 : fittingIdeal(8,M)
o5 = ideal 1
o5 : Ideal of R
The function fittingIdeal is a member of the class Function [III.18].
Ways to use fittingIdeal :
fittingIdeal(ZZ,Module)
24.290. flag
flag x – arranges for each subsequent reference to a symbol x to be flagged
with a warning message.
634
24. MISCELLANEOUS DOCUMENTATION
The function flag is a member of the class Function [III.18].
24.291. flatten
flatten m – produces a new list from m by effectively removing the braces
surrounding the elements of any elements of m which happen to be lists. Also
works for matrices.
i1 : flatten {{2,3,4},{{5}},6}
o1 = {2, 3, 4, {5}, 6}
o1 : List
The function flatten is a member of the class Function [III.18].
Ways to use flatten :
flatten Matrix
flatten VisibleList
24.292. flip
The function flip is a member of the class Function [III.18].
Ways to use flip :
flip(Module,Module) [III.12.22] – matrix of commutativity of tensor
product
24.293. floor
floor x – provides the largest integer less than or equal to the number x.
The function floor is a member of the class Function [III.18].
Ways to use floor :
floor RR
24.294. flush
f << flush – writes out any buffered output for the output file f.
The manipulator flush is a member of the class Manipulator [III.21.1.5].
24.295. fold
See also:
accumulate [V.24.153] – apply binary operator repeatedly
The function fold is a member of the class Function [III.18].
Ways to use fold :
fold(Function,Thing,VisibleList) [III.18.14] – apply binary operator repeatedly
fold(Function,VisibleList) [III.18.15] – apply binary operator repeatedly
fold(VisibleList,Function) [III.18.16] – apply binary operator repeatedly
fold(VisibleList,Thing,Function) [III.18.17] – apply binary operator repeatedly
24.302. FUNCTIONS
635
24.296. forceGB(..., ChangeMatrix => ...)
ChangeMatrix => p – an optional argument for forceGB [III.15.1] which which
specifies that the change of basis matrix is p.
See also:
Default value: null [V.24.440]
Function: forceGB [III.15.1]
Option name: ChangeMatrix [V.24.59]
24.297. fork
fork() – forks the process, returning the process id of the child in the parent,
and returning 0 in the child.
The function fork is a member of the class Function [III.18].
24.298. format
format s – prepare a string s for output by converting nonprintable characters
to printable ones, or to escape sequences.
The function format is a member of the class Function [III.18].
24.299. fraction
fraction(f,g) – manufactures the fraction f/g in the fraction field of the ring
containing f and g without reducing it to lowest terms.
The function fraction is a member of the class Function [III.18].
24.300. from
from – a keyword used with new [V.24.432].
24.301. fromDual
fromDual f – given a 1 by n matrix f over a polynomial ring R, computes g so
that Hom(R/image g, E) corresponds to f, where E is the injective envelope of the
coefficient field of R.
This function mimics the script <l_from_dual of Macaulay, and is probably
going to be changed substantially.
See also:
toDual [V.24.617]
The function fromDual is a member of the class Function [III.18].
24.302. functions
There are two types of functions, those functions built in to the system, and
those created by the user, but in practice the user has no way of distinguishing the
two types. The user creates new functions with the -> [V.24.21] operator.
See also:
Function [III.18] – the class of all functions
636
24. MISCELLANEOUS DOCUMENTATION
24.303. gb(..., ChangeMatrix => ...)
ChangeMatrix => true – an optional argument for gb [III.15.2] which specifies whether to compute the change of basis matrix from the basis to the original
generators.
Intended for internal use only.
See also:
Default value: false [V.24.286]
Function: gb [III.15.2]
Option name: ChangeMatrix [V.24.59]
24.304. gb(..., DegreeLimit => ...)
DegreeLimit => n – keyword for an optional argument used with gb [III.15.2]
which specifies that the computation should halt after dealing S-polynomials up to
degree n.
This option is relevant only for homogeneous matrices.
For an example, see computing Groebner bases [I.3.35].
See also:
Default value: {} [V.24.654]
Function: gb [III.15.2]
Option name: DegreeLimit [V.24.66]
24.305. gb(..., PairLimit => ...)
PairLimit – keyword for an optional argument used with gb [III.15.2] which
specifies that the computation should be stopped after a certain number of S-pairs
have been reduced.
i1 : R = QQ[x,y,z,w]
o1 = R
o1 : PolynomialRing
i2 : I = ideal(x*y-z,y^2-w-1,w^4-3)
2
o2 = ideal (x*y - z, y
4
- w - 1, w
o2 : Ideal of R
i3 : gb(I, PairLimit => 1)
o3 = {0} | y2-1w-1 |
o3 : GroebnerBasis
i4 : gb(I, PairLimit => 2)
o4 = {0} | y2-1w-1 xy-1z |
o4 : GroebnerBasis
i5 : gb(I, PairLimit => 3)
- 3)
24.308. GB(..., SYZYGYLIMIT => ...)
637
o5 = {0} | -1/-1yz+1/-1xw+1/-1x y2-1w-1 xy-1z |
o5 : GroebnerBasis
See also:
Default value: infinity [V.24.356]
Function: gb [III.15.2]
Option name: PairLimit [V.24.113]
24.306. gb(..., StopBeforeComputation => ...)
StopBeforeComputation => true – an optional argument used with gb [III.15.2].
Tells whether not to start the computation, with the default value being false.
This can be useful when you want to obtain the partially computed Groebner basis
contained in an interrupted computation.
See also:
Default value: false [V.24.286]
Function: gb [III.15.2]
Option name: StopBeforeComputation [V.24.128]
24.307. gb(..., Strategy => ...)
gb(f,Strategy => v) – an option for gb [III.15.2] which can be used to specify
the strategy to be used in the computation.
The strategy option value v should be one of the following.
Primary [V.24.115]
Homogeneous [V.24.91]
Inhomogeneous [V.24.92]
LongPolynomial [V.24.98]
Sort [V.24.125]
See also:
Default value: {} [V.24.654]
Function: gb [III.15.2]
Option name: Strategy [V.24.130]
24.308. gb(..., SyzygyLimit => ...)
SyzygyLimit – keyword for an optional argument used with gb [III.15.2] which
specifies that the computation should stop after a certain number of syzygies have
computed.
This option is relevant only if Syzygies => true has been specified.
i1 : R = ZZ/101[x,y,z,w]
o1 = R
o1 : PolynomialRing
i2 : I = ideal(x*y-z^2,y^2-w^2,w^4)
2
2
2
4
o2 = ideal (x*y - z , y - w , w )
o2 : Ideal of R
638
24. MISCELLANEOUS DOCUMENTATION
i3 : gb(I,SyzygyLimit => 1, Syzygies => true)
o3 = {0} | y2-w2 xy-z2 yz2-xw2 |
o3 : GroebnerBasis
i4 : syz oo
o4 = {2} | -y2+w2 |
{2} | xy-z2 |
{4} | 0
|
3
1
o4 : Matrix R <--- R
i5 : gb(I,SyzygyLimit => 2, Syzygies => true)
o5 = {0} | y2-w2 xy-z2 yz2-xw2 z4-x2w2 w4 |
o5 : GroebnerBasis
i6 : syz oo
o6 = {2} | -y2+w2 -xy2+xw2 |
{2} | xy-z2 x2y-xz2 |
{4} | 0
0
|
3
2
o6 : Matrix R <--- R
i7 : gb(I,SyzygyLimit => infinity, Syzygies => true)
o7 = {0} | y2-w2 xy-z2 yz2-xw2 z4-x2w2 w4 |
o7 : GroebnerBasis
i8 : syz oo
o8 = {2} | -y2+w2 -xy2+xw2 0
-w4
yw4
xyw4+z2w4 |
{2} | xy-z2 x2y-xz2 -w4
0
-xw4
-x2w4
|
{4} | 0
0
y2-w2 xy-z2 yz2-xw2 z4-x2w2
|
3
6
o8 : Matrix R <--- R
See also:
Default value: infinity [V.24.356]
Function: gb [III.15.2]
Option name: SyzygyLimit [V.24.134]
24.309. gbTrace
gbTrace n – set the tracing level for the engine [IV.22] to level n. Meaningful
values for the user n are 0, 1, 2, and 3.
The notations used in tracing are :
g - a generator reduced to something nonzero and has been added to the
basis.
24.312. GCDCOEFFICIENTS
639
m - an S-pair reduced to something nonzero and has been added to the
basis.
z - an S-pair reduced to zero, and a syzygy has been recorded.
u - an S-pair reduced to zero, but the syzygy need not be recorded.
o - an S-pair or generator reduced to zero, but no new syzygy occurred.
r - an S-pair has been removed.
{2} - beginning to reduce the S-pairs of multi-degree {2}.
(7) - 7 more S-pairs among basis elements need to be reduced.
(8,9) - there are 8 S-pairs to do in this degree, and 9 more in higher degrees.
. - a minor has been computed, or something has happened while computing a resolution.
The value returned is the old tracing level.
The function gbTrace is a member of the class Function [III.18].
Code:
-- code for gbTrace:
-- ../m2/gb.m2:10-14
gbTrace = (n) -> (
if class n === ZZ then (
sendgg(ggINT, gg n, ggtracing);
eePopInt())
else error "expected an integer" )
24.310. gcDump
gcDump() – produces a dump of the status of the garbage collector.
Users will normally not want to use this function. It calls the function GC_dump
in the garbage collector, and the output can be used to debug problems with memory allocation.
See also:
GC garbage collector [V.24.82]
The function gcDump is a member of the class Function [III.18].
24.311. gcd
gcd(x,y) – yields the greatest common divisor of x and y.
See also:
gcdCoefficients [V.24.312] – gcd with coefficients
The function gcd is a member of the class Function [III.18].
Ways to use gcd :
gcd(RingElement,RingElement)
gcd(ZZ,ZZ)
24.312. gcdCoefficients
gcdCoefficients(a,b) – returns {r,s} so that a*r + b*s is the greatest
common divisor of a and b.
Works for integers or elements of polynomial rings.
See also:
gcd [V.24.311] – greatest common divisor
The function gcdCoefficients is a member of the class Function [III.18].
Ways to use gcdCoefficients :
gcdCoefficients(RingElement,RingElement)
640
24. MISCELLANEOUS DOCUMENTATION
gcdCoefficients(ZZ,ZZ)
24.313. genera
genera M – provide a list of the successive sectional arithmetic genera of a
module, ring, or ideal.
The i-th one in the list is the arithmetic genus of the i-th hyperplane section
of M.
The function genera is a member of the class Function [III.18].
Ways to use genera :
genera Ideal
genera Module
genera Ring
24.314. generatorExpressions
generatorExpressions – a key used in a Monoid [III.21.5.4.11.3] under which
is stored a list of the generators for the monoid.
The symbol generatorExpressions is a member of the class Symbol [III.21.10].
24.315. generatorSymbols
generatorSymbols – a key used in a Monoid [III.21.5.4.11.3] under which is
stored a list of the symbols used as generators for the monoid.
The symbol generatorSymbols is a member of the class Symbol [III.21.10].
24.316. genericMatrix
genericMatrix(R,x,m,n) – produce an m by n matrix of variables drawn from
the ring R, starting with variable x.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : genericMatrix(R,a,2,2)
o2 = {0} | a c |
{0} | b d |
2
2
o2 : Matrix R <--- R
The function genericMatrix is a member of the class Function [III.18].
24.317. genericSkewMatrix
genericSkewMatrix(R,x,n) – make a skew symmetric n by n matrix whose
entries above the diagonal are the variables of R, starting with the variable x.
The function genericSkewMatrix is a member of the class Function [III.18].
24.320. GET
641
24.318. genericSymmetricMatrix
genericSymmetricMatrix(R,x,n) – make a symmetric n by n matrix whose
entries on and above the diagonal are the variables of R, starting with the variable
x.
The function genericSymmetricMatrix is a member of the class Function
[III.18].
Code:
-- code for genericSymmetricMatrix:
-- ../m2/genmat.m2:29-36
genericSymmetricMatrix = (R,first,n) -> (
first = getIndex(R,first);
vars := new MutableHashTable;
nextvar := first;
scan(0..n-1, i -> scan(i..n-1, j -> (
vars#(i,j) = R_nextvar;
nextvar = nextvar+1)));
matrix table(n,n, (i,j) -> if i>j then vars#(j,i) else ...
24.319. gens
See generators [III.13.12.1].
24.320. get
get "f" – yields a string containing the contents of the file whose name is f.
get "!f" – yields a string containing the output from the shell command ”f”.
get "$hostname:service" – yields a string containing the input from the socket
obtained by connecting to the specified host at the port appropriate for the specified
service. Warning: if the process providing the service expects interaction, it will not
get it, and this command will hang. This feature is not available on Sun computers,
because Sun doesn’t provide static versions of crucial libraries dealing with network
communications.
get f – yields a string containing the rest of the input from the file f.
i1 : "junk" << "hi there" << close
o1 = junk
o1 : File
i2 : get "junk"
o2 = hi there
o2 : String
i3 : get "!date"
o3 = Fri Mar 10 14:23:32 CST 2000
o3 : String
See also:
File [III.20] – the class of all files
read [V.24.509] – read from a file
642
24. MISCELLANEOUS DOCUMENTATION
The function get is a member of the class Function [III.18].
Ways to use get :
get File
get String
24.321. getChangeMatrix
getChangeMatrix G – for a Groebner basis G, return the change of basis matrix
from the Groebner basis to another generating set, usually a minimal, or original,
generating set.
The option ChangeMatrix [V.24.59] can be used with gb [III.15.2] to enable
the computation of the change of basis matrix.
The function getChangeMatrix is a member of the class Function [III.18].
Ways to use getChangeMatrix :
getChangeMatrix GroebnerBasis
getChangeMatrix(ZZ,Resolution)
24.322. getWWW
getWWW URL – obtain the contents of the web page addressed by URL from an
http server.
getWWW(URL,TEXT) – obtain the contents of the web page addressed by URL from
an http server, using the POST method, provided with TEXT.
This doesn’t work under Solaris because Sun doesn’t provide sockets or name
service to statically linked programs like this one.
Accessing a secure web site (whose URL begins with https:) depends on your
having installed openssl on your system.
The function getWWW is a member of the class Function [III.18].
Ways to use getWWW :
getWWW String
getWWW(String,Nothing)
getWWW(String,String)
24.323. getc
getc f – obtains one byte from the input file f and provides it as a string of
length 1. On end of file an empty string of is returned.
See also:
File [III.20] – the class of all files
Bug: the name is cryptic and should be changed.
The function getc is a member of the class Function [III.18].
Ways to use getc :
getc File
24.324. getenv
getenv s – yields the value associated with the string s in the environment.
i1 : getenv "HOME"
o1 = /home/dan
o1 : String
24.326. GLOBALASSIGNFUNCTION
643
The function getenv is a member of the class Function [III.18].
Ways to use getenv :
getenv String
24.325. global
global s – provides the global symbol s, even if s currently has a value.
i1 : num
o1 = num
o1 : Symbol
i2 : num = 5
o2 = 5
i3 : num
o3 = 5
i4 : global num
o4 = num
o4 : Symbol
See also:
local [V.24.394] – get a local symbol
symbol [V.24.578] – get a symbol
24.326. globalAssignFunction
globalAssignFunction – the standard function which can be used as a method
for GlobalAssignHook [V.24.85] so that certain types of mutable hash tables X,
when assigned to a global variable, will acquire the name of the global variable as
their name. The companion function globalReleaseFunction [V.24.327] is used
to release the name when the global variable gets reassigned.
The current way this function works is by storing the string used for printing
under X.name and storing the global variable under X.Symbol.
Another thing done by this function is to apply use [V.24.639] to the thing.
This is used for polynomial rings to assign values to the symbols representing the
variables (indeterminates) in the ring.
i1 : X = new Type of MutableHashTable
o1 = X
o1 : Type
i2 : x = new X
o2 = X{...}
o2 : X
i3 : X.GlobalAssignHook = globalAssignFunction
644
24. MISCELLANEOUS DOCUMENTATION
o3 = globalAssignFunction
o3 : Function
i4 : X.GlobalReleaseHook = globalReleaseFunction
o4 = globalReleaseFunction
o4 : Function
i5 : x’ = new X
o5 = x’
o5 : X
i6 : t = {x,x’}
o6 = {X{...}, x’}
o6 : List
i7 : x = x’ = 44
o7 = 44
i8 : t
o8 = {X{...}, X{...}}
o8 : List
i9 : code globalAssignFunction
o9 = -- code for globalAssignFunction:
-- ../../classes.m2:47-53
globalAssignFunction = (X,x) -> (
if not x#?(symbol name) then (
x.Symbol = X;
x.name = string X;
);
use x;
)
o9 : Net
See also:
name [V.24.429] – store the name of a hash table
symbol [V.24.578] – get a symbol
SelfInitializingType [III.21.5.4.11.4] – the class of all self initializing
types
The function globalAssignFunction is a member of the class Function [III.18].
Code:
-- code for globalAssignFunction:
-- ../m2/classes.m2:70-76
globalAssignFunction = (X,x) -> (
if not x#?(symbol name) then (
x.Symbol = X;
x.name = string X;
24.330. GRAPHIDEAL
645
);
use x;
)
24.327. globalReleaseFunction
globalReleaseFunction – the standard function which can be used as a method
for GlobalReleaseHook [V.24.86] so that certain types of things, which have acquired as their name the name of a global variable to which they have been assigned,
will lose that name when a different value is assigned to the variable.
See also:
globalAssignFunction [V.24.326] – the standard method for the global
assignment hook
The function globalReleaseFunction is a member of the class Function
[III.18].
Code:
-- code for globalReleaseFunction:
-- ../m2/classes.m2:78-84
globalReleaseFunction = (X,x) -> (
if x.?Symbol and X === x.Symbol
then (
remove(x,symbol name);
remove(x,symbol symbol);
)
)
24.328. gradedModule
gradedModule – a method for creating graded modules.
The function gradedModule is a member of the class Function [III.18].
Ways to use gradedModule :
gradedModule (...)
gradedModule ChainComplex
gradedModule Module
gradedModule {...}
24.329. gradedModuleMap
gradedModuleMap – a method for creating maps of graded modules.
The function gradedModuleMap is a member of the class Function [III.18].
Ways to use gradedModuleMap :
gradedModuleMap (...)
gradedModuleMap ModuleMap
gradedModuleMap {...}
24.330. graphIdeal
graphIdeal f – provides the ideal of the graph of the map associated to the
ring map f.
See also:
graphRing [V.24.331] – the ring of the graph of a ring map
The function graphIdeal is a member of the class Function [III.18].
Ways to use graphIdeal :
graphIdeal RingMap
646
24. MISCELLANEOUS DOCUMENTATION
Optional arguments :
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
graphIdeal(...,
Degrees => ...)
Inverses => ...)
MonomialOrder => ...)
MonomialSize => ...)
SkewCommutative => ...)
VariableBaseName => ...)
VariableOrder => ...)
Variables => ...)
Weights => ...)
WeylAlgebra => ...)
24.331. graphRing
graphRing f – provides the ring of the graph of the map associated to the ring
map f.
See also:
graphIdeal [V.24.330] – the ideal of the graph of a ring map
The function graphRing is a member of the class Function [III.18].
Ways to use graphRing :
graphRing RingMap
Optional arguments :
graphRing(..., Degrees => ...)
graphRing(..., Inverses => ...)
graphRing(..., MonomialOrder => ...)
graphRing(..., MonomialSize => ...)
graphRing(..., SkewCommutative => ...)
graphRing(..., VariableBaseName => ...)
graphRing(..., VariableOrder => ...)
graphRing(..., Variables => ...)
graphRing(..., Weights => ...)
graphRing(..., WeylAlgebra => ...)
24.332. group
group R
– yields the underlying group of a group ring.
group [a,b,c] – makes a free ordered commutative group on the variables listed.
group [a,b,c,Degrees=>{2,3,4}] – makes a free ordered commutative group on
the variables listed, with degrees 2, 3, and 4, respectively.
group [a,b,c,Degrees=>{{1,2},{3,-3},{0,4}}] – makes a free ordered commutative group on the variables listed, with multi-degrees as listed.
group [a,b,c,Degrees=>{{},{},{}}] – makes a free ordered commutative group
on the variables listed, ungraded.
The class of all groups created this way is GeneralOrderedGroup [III.21.5.4.11.3.1.1.1].
See also:
Degrees [III.10.1.3.2.3] – specify the degrees
OrderedMonoid [III.21.5.4.11.3.1] – the class of all ordered monoids
monoid [V.24.424] – make a monoid
The function group is a member of the class Function [III.18].
Ways to use group :
24.335. HASHING
647
group Ring
group [...]
24.333. hash
hash x – returns the hash code of x.
The hash code of x is an integer produced in a deterministic way from x, and
perhaps from the hash codes of the contents of x. See hashing [V.24.335] for a
discussion of the requirements that the hash codes used here are designed to satisfy.
The function hash is a member of the class Function [III.18].
24.334. hashTable
hashTable v – produce a hash table from a list v of key-value pairs.
The pairs may be of the form a=>b, {a,b}, or (a,b).
Missing entries in the list, represented by null [V.24.440], will be silently ignored.
i1 : x = hashTable {a=>b, c=>d, }
o1 = HashTable{a => b}
c => d
o1 : HashTable
i2 : x#a
o2 = b
o2 : Symbol
The function hashTable is a member of the class Function [III.18].
Ways to use hashTable :
hashTable {...}
24.335. hashing
A hash table contains a set of key-value pairs. The access functions for hash
tables accept a key and retrieve the corresponding value. Here are the details, together with a discussion of how we designed the hash table system seen in Macaulay
2.
The keys and values are stored in the hash table. The hash table consists of
a certain number of buckets, each of which can hold an arbitrary number of keyvalue pairs. The number of buckets is chosen to be large enough that typically one
may expect each bucket to hold fewer than three key-value pairs. The key is used
as follows to determine in which bucket the key-value pair is to be stored. The
function hash [V.24.333] is applied to the key to produce, in a deterministic way,
an integer called the hash code, and the remainder of the hash code upon division
by the number of buckets tells which bucket will be used.
It is essential that the hash code of a key never change, for otherwise the next
attempt to find the key in the hash table will have an unpredictable result - the
new hash code of the key may or may not lead to the same bucket, and the value
may or may not be located.
648
24. MISCELLANEOUS DOCUMENTATION
Some hash tables and lists are mutable [V.24.427], i.e., their contents can be
altered by assignment statements. As explained above, the hash code of a mutable
thing is not permitted to change when the contents of the thing change. Hence, the
algorithm for computing the hash code may not refer to the contents of a mutable
thing.
The strong comparison operator === [V.24.40] is provided to parrot the equality
testing that occurs implicitly when accessing a key in a hash table. The fundamental
requirement for this strong comparison operator is that things with different hash
codes must also turn out to be different when tested with this comparison operator.
Here we come to a question of design. As discussed above, we must assign hash
codes to mutable things in such a way that the hash codes don’t depend on their
contents. We can do this in various ways.
One way to assign hash codes to mutable things is to give the same hash
code, say 1000000, to every mutable thing. We could then implement a
strong comparison operator for mutable things that would proceed by
examining the contents of the things, so that two mutable things would
be equal if and only if their contents were equal. A disadvantage of this
approach would be that a hash table in which many mutable things
appear as keys would have all of those key-value pairs appearing in the
same bucket, so that access to this hashtable would be slow. (Each
bucket is implemented as a linear list, and searching a long linear list
is slow.)
Another way to assign hash codes to mutable things is to give different
hash codes to each mutable thing; for example, the first mutable thing
could receive hash code 1000000, the second could receive the hash
code 1000001, and so on. (Another choice for such a hash code is the
address in memory of the thing. But this address can change depending
on environmental factors not under the control of the interpreter, and
thus its use as a hash code would lead to unpredictable behavior.) A
disadvantage of this approach is that the strong comparison operator
could not examine the contents of mutable objects! (Remember that
if the hash codes are different, the strong comparison must declare the
things to be different, too.) The offsetting advantage is that a hash
table in which many mutable things appear as keys would typically
have the key-value pairs distributed among the buckets, so that access
to this hashtable would be fast.
In Macaulay 2, we chose the second approach listed above; we expect to have
many mutable things appearing as keys in hash tables, and we need the speed.
A counter with initial value 1000000 is incremented each time a mutable thing is
created, and its value is taken as the hash code of the thing and stored within it.
The strong comparison test cannot depend on the contents of mutable things, and
thus such things appear to be containers with opaque walls. For mutable things,
the test for equality must be the same as equality of the hash codes.
It is essential to have some hash tables for which equality amounts to equality of
the contents. This cannot be achieved for mutable hash tables, but we do achieve it
for non-mutable hash tables – the hash code is computed directly from the contents
of the thing in a deterministic way. This allows us to implement the notion of
24.337. HELP
649
polynomial, say, as a hash table – the keys can be the monomials (necessarily nonmutable) and the values can be the coefficients. The notion of monomial can be
implemented as a hash table where the keys are the variables and the values are
the corresponding exponents.
One further comforting remark: the routines that compute hash codes or strong
equality do not get into infinite loops, despite the existence of circular structures:
any circular structure must come into being by means of changing something, and
so the circular loop in the structure necessarily involves a mutable thing, whose
contents are not examined by the routines. This provides another argument in
favor of taking the second approach listed above.
See also:
HashTable [III.21.5] – the class of all hash tables
24.336. height
height n – the height of a net n.
The height of a net is the number of rows of characters it has above the baseline.
It may be a negative number, but the depth plus the height is always the total
number of rows, which is not negative.
See also:
Net [III.21.6] – the class of all nets and strings
depth [V.24.248] – depth of a net
The function height is a member of the class Function [III.18].
Ways to use height :
height Net
height String
24.337. help
help X – displays the online documentation for X.
help "Macaulay 2" – displays the base of the online documentation tree.
help methods X – displays help messages about the methods usable with things of
type X.
help methods res – displays help messages about the methods usable with the
function res.
help methods symbol ** – displays help messages about the methods usable with
the operator **.
help methods (res, X) – displays help messages about the methods usable with
the function res and a thing of class X.
help methods (symbol **, X) – displays help messages about the methods usable
with the operator ** and a thing of class X.
help methods (X, Y) – displays help messages about the methods usable with a
thing of class X and a thing of class Y.
The function help is a member of the class Function [III.18].
Ways to use help :
help Thing
help {...}
650
24. MISCELLANEOUS DOCUMENTATION
24.338. hilbertFunction
hilbertFunction(d,M) – compute the dimension of the degree d part of the
module, ring, or ideal M
At the moment, the function is computed simply by calling basis [V.24.187]
and extracting the number of basis elements.
See also:
hilbertSeries [V.24.339] – compute Hilbert series
hilbertPolynomial [III.21.5.6.3] – compute Hilbert polynomial
The function hilbertFunction is a member of the class Function [III.18].
Ways to use hilbertFunction :
hilbertFunction(ZZ,Ideal)
hilbertFunction(ZZ,Module)
hilbertFunction(ZZ,Ring)
hilbertFunction({...},Ideal)
hilbertFunction({...},Module)
hilbertFunction({...},Ring)
24.339. hilbertSeries
hilbertSeries M – compute the Hilbert series of the ring or module M.
The Hilbert series is the formal power series in the variables of the degrees ring
whose coefficients are the dimensions of the corresponding graded component. The
series is provided as an Expression [III.21.1.3] representing a rational function
with that series.
If an optional integer argument labelled Order [V.24.112] is used, then the
power series is expanded to that order.
i1 : R = ZZ/101[x, Degrees => {2}];
i2 : hilbertSeries(R/x^2)
3
2
($T + $T + $T + 1)(- $T + 1)
o2 = -----------------------------2
(- $T + 1)
o2 : Divide
i3 : numerator oo
3
2
o3 = ($T + $T + $T + 1)(- $T + 1)
o3 : Product
i4 : value oo
4
o4 = - $T + 1
o4 : ZZ[ZZ^1]
i5 : poincare (R/x^2)
24.340. HOMOGENIZE
651
4
o5 = - $T + 1
o5 : ZZ[ZZ^1]
i6 : hilbertSeries(R/x^2, Order => 12)
2
o6 = $T + 1
o6 : ZZ[ZZ^1]
i7 : R=ZZ/101[x, Degrees => {{1,1}}];
i8 : hilbertSeries (R/x^2)
2 2
- $T $T + 1
0 1
o8 = -------------(- $T $T + 1)
0 1
o8 : Divide
See also:
degreesRing [V.24.244] – the ring of degrees
Order [V.24.112] – specify the order of a Hilbert series required
The function hilbertSeries is a member of the class Function [III.18].
Ways to use hilbertSeries :
hilbertSeries Ideal
hilbertSeries Module
hilbertSeries PolynomialRing
hilbertSeries QuotientRing
Optional arguments :
hilbertSeries(..., Order => ...)
24.340. homogenize
homogenize(m,v) – homogenize the ring element, vector, matrix, or module m
using the variable v in the ring of m.
homogenize(m,v,w) – homogenize m using the variable v, so that the result is
homogeneous with respect to the given list w of integers provided as weights for the
variables.
i1 : R = ZZ/101[x,y,z,Degrees => {1,2,3}]
o1 = R
o1 : PolynomialRing
i2 : f = 1 + y + z^2
2
o2 = z + y + 1
o2 : R
652
24. MISCELLANEOUS DOCUMENTATION
i3 : homogenize(f,x)
6
4
2
o3 = x + x y + z
o3 : R
i4 : homogenize(f,x,{1,0,-1})
2 2
o4 = x z + y + 1
o4 : R
The weights that may be used are limited (roughly) to the range -2^30 .. 2^30.
Caveats and bugs: If the homogenization overflows the monomial, this is not
reported as an error
The function homogenize is a member of the class Function [III.18].
Ways to use homogenize :
homogenize(Ideal,RingElement)
homogenize(Matrix,RingElement)
homogenize(Matrix,RingElement,{...})
homogenize(Module,RingElement)
homogenize(Module,RingElement,{...})
homogenize(RingElement,RingElement)
homogenize(RingElement,RingElement,{...})
homogenize(Vector,RingElement)
homogenize(Vector,RingElement,{...})
24.341. homology
homology(f,g) – computes the homology module (kernel f)/(image g).
homology – a method name available for computing expressions of the forms HH_i(X)
and HH_i(M,N).
If it is intended that i be of class ZZ, M be of class A, and N be of class B, then
the method can be installed with
homology(ZZ, A, B) := opts -> (i,M,N) -> ...
See also:
HH [V.24.88] – general homology and cohomology functor
cohomology [V.24.210] – general cohomology functor
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
The function homology is a member of the class Function [III.18].
Ways to use homology :
HH ChainComplex [III.16.13] – homology of a chain complex
HH ChainComplexMap
HH_Matrix Matrix [III.12.43] – kernel modulo image
HH_ZZ (...)
HH_ZZ ChainComplex [III.13.5] – homology of a chain complex
HH_ZZ ChainComplexMap [III.12.3] – homology of a chain complex
map
Optional arguments :
24.347. II
653
24.342. homomorphism
homomorphism f – finds the matrix M <-- N corresponding to the element f.
This element should be a matrix f : Hom(M,N) <--- R^1, where Hom(M,N)
has been previously computed, and R is the ring of M and N.
When A := Hom(M,N) is computed, enough information is stored in A.Hom to
compute this correspondence.
See also:
Hom [V.24.90] – module of homomorphisms
The function homomorphism is a member of the class Function [III.18].
Ways to use homomorphism :
homomorphism Matrix
24.343. hypertext
All the online documentation for Macaulay 2 is maintained in hypertext form
in a special internal format which can be easily manipulated or examined. The
function html [III.21.6.1.1] can be used to convert it to standard world-wide web
format, suitable for use with a world-wide web server such as netscape. The function
text [III.21.6.1.5] can be used to convert it to straight ascii text, suitable for viewing
on an ascii terminal.
See also:
MarkUpList [III.21.1.6] – the class of mark-up lists used with hypertext
MarkUpType [III.21.5.4.11.2] – the class of mark-up types used with
hypertext
Entity [III.21.5.1] – the class of all entities
24.344. id
id_M – the identity homomorphism from M to M.
The scripted functor id is a member of the class ScriptedFunctor [III.21.5.4.10].
Functions installed in id :
id ChainComplex
id GradedModule
id Module
24.345. identity
identity x – returns x.
This is the identity function.
The function identity is a member of the class Function [III.18].
24.346. if
if p then x else y – computes p, which must yield the value true [V.24.631]
or false [V.24.286]. If true, then the value of x is provided, else the value of y is
provided.
if p then x – computes p, which must yield the value true [V.24.631] or false
[V.24.286]. If true, then the value of x is provided, else null [V.24.440] is provided.
24.347. ii
The complex number ii is a member of the class CC [III.21.1.1].
654
24. MISCELLANEOUS DOCUMENTATION
24.348. image
image h – yields the image of the homomorphism h.
The result will be a submodule of the target of h
If h is a ring element, it is interpreted as a one by one matrix.
The function image is a member of the class Function [III.18].
Ways to use image :
image ChainComplexMap
image GradedModuleMap
image Matrix
image RingElement
image RingMap
24.349. incomparable
incomparable – a symbol which may be returned by ? [V.24.46] when the two
things being compared are incomparable.
The symbol incomparable is a member of the class Symbol [III.21.10].
24.350. indeterminate
indeterminate – a representation of an indeterminate number, such as might
result from multiplying 0 by infinity.
The indeterminate number indeterminate is a member of the class IndeterminateNumber [III.21.5.2].
24.351. index
index v – yields the numeric index of the variable ’v’ in its ring. Variables are
indexed starting at 0, and ending at n-1, where n is the number of variables in the
ring of ’v’.
i1 : R = ZZ/101[a..d,t]
o1 = R
o1 : PolynomialRing
i2 : index a
o2 = 0
i3 : index t
o3 = 4
If the ring element ’v’ is not a variable, an error is generated.
The symbol index is also as a key used in GeneralOrderedMonoid [III.21.5.4.11.3.1.1]
to store a table which is used to map generator names to the position of the generator in the list of generators.
The function index is a member of the class Function [III.18].
Ways to use index :
index RingElement
24.355. INDUCEDMAP(..., DEGREE => ...)
655
24.352. indexComponents
indexComponents – a symbol used as a key in a direct sum under which to
store a hash table in which to register preferred keys used to index the components
of the direct sum.
See also:
directSum [V.24.254] – direct sum of modules or maps
components [V.24.223] – list the components of a direct sum
indices [V.24.353] – specify keys for components of a direct sum
The symbol indexComponents is a member of the class Symbol [III.21.10].
24.353. indices
indices – a symbol used as a key in a direct sum under which to store a list
of the preferred keys used to index the components of the direct sum.
See also:
directSum [V.24.254] – direct sum of modules or maps
components [V.24.223] – list the components of a direct sum
indexComponents [V.24.352] – specify keys for components of a direct
sum
The function indices is a member of the class Function [III.18].
Ways to use indices :
indices MutableHashTable
24.354. inducedMap
inducedMap(M,N,f) – produce the map from N to M induced by f.
Here M should be a subquotient module of the target of f, and N should be a
subquotient module of the source of f.
See also:
inducesWellDefinedMap [III.21.2.5] – whether a map is well defined
The function inducedMap is a member of the class Function [III.18].
Ways to use inducedMap :
inducedMap(Module,Module)
inducedMap(Module,Module,Matrix)
inducedMap(Module,Nothing,Matrix)
inducedMap(Nothing,Module,Matrix)
inducedMap(Nothing,Nothing,Matrix)
Optional arguments :
inducedMap(..., Degree => ...) [V.24.355] – specify the degree of a map
inducedMap(..., Verify => ...) [V.24.146.1] – verify that a map is welldefined
24.355. inducedMap(..., Degree => ...)
Degree => n – an option to inducedMap [V.24.354] that provides the degree
of the map produced.
See also:
Default value: null [V.24.440]
Function: inducedMap [V.24.354]
Option name: Degree [V.24.65]
656
24. MISCELLANEOUS DOCUMENTATION
24.356. infinity
The infinite number infinity is a member of the class InfiniteNumber
[III.21.5.3].
24.357. initialization file
The file init.m2 is loaded automatically when the program is started.
The file is sought in each of the directories of the path [V.24.466], and also in
the home directory of the user. At most one file is loaded.
See also:
load [V.24.392] – read Macaulay 2 commands
24.358. input
input "f" – reads and executes the commands found in the file named f,
echoing the input, printing the values, and incrementing the line number.
The file is sought along the path [V.24.466], unless the name of the file begins
with ’/’ or ’./’ or ’../’ .
If one of the expressions in the file evaluates to the symbol end [V.24.268] the
reading of the file is stopped at that point.
See also:
path [V.24.466] – list of directories to look in
needs [V.24.430] – read Macaulay 2 commands if necessary
load [V.24.392] – read Macaulay 2 commands
The function input is a member of the class Function [III.18].
Code:
-- code for input:
-- ../m2/setup.m2:206-211
input = (filename) -> (
oldnotify := notify;
notify = false;
if not tryload(filename,oldinput) then error ("can’t op ...
notify = oldnotify;
)
24.359. installMethod
Most users will use a different way of installing methods.
installMethod(M,A,f) – installs a function f as a unary method for the class A
under the name M. This is the same as M A := f if M is a function. As currently
implemented, this is also the same as A#M = f.
installMethod(M,A,B,f) – installs a function f as a binary method for classes A
and B under the name M. This is the same as M(A,B) := f if M is a function, or the
same as A M B := f if M is a binary operator. As currently implemented, this is
also the same as Y#(M,A,B) = f, where Y is the younger of A and B.
installMethod(M,A,B,C,f) – installs a function f as a ternary method for classes
A, B, and C under the name M. This is the same as M(A,B,C) := f if f is a function.
As currently implemented, this is also the same as Y#(M,A,B,C) = f, where Y is
the youngest of A, B, and C.
See also:
# [V.24.4] – length, or access to elements
lookup [V.24.397] – look up methods
24.364. ISDIRECTSUM
657
new [V.24.432] – new objects of various types
classes [I.5.1]
The function installMethod is a member of the class Function [III.18].
24.360. instance
instance(x,X) – tells whether x is an instance of the type X.
We say that x is an instance of X if X is the class of x, or a parent of the class
of x, or a grandparent, and so on.
See also:
classes [I.5.1]
class [V.24.199] – class of an object
parent [V.24.465] – parent type of an object
The function instance is a member of the class Function [III.18].
Ways to use instance :
instance(Thing,Type)
24.361. integrate
integrate(f,a,b) – integrate f from a to b numerically, using Gaussian quadrature.
i1 : integrate(sin,0,pi)
o1 = 2.
o1 : RR
The function integrate is a member of the class Function [III.18].
24.362. intersect
intersect(M,N,...) – calculate the intersection of submodules of the same
free module, or of monomial ideals in the same ring.
The function intersect is a member of the class Function [III.18].
Ways to use intersect :
intersect (...)
intersect {...}
24.363. irreducibleCharacteristicSeries
irreducibleCharacteristicSeries I – computes the irreducible characteristic series of the ideal I.
This is an internal routine used by decompose [V.24.238].
The function irreducibleCharacteristicSeries is a member of the class
Function [III.18].
Ways to use irreducibleCharacteristicSeries :
irreducibleCharacteristicSeries Ideal
24.364. isDirectSum
Works for modules, graded modules, etc. The components of the sum can be
recovered with components [V.24.223].
The function isDirectSum is a member of the class Function [III.18].
Ways to use isDirectSum :
658
24. MISCELLANEOUS DOCUMENTATION
isDirectSum ChainComplex
isDirectSum GradedModule
isDirectSum Module
24.365. isInputFile
isInputFile f – whether f is an input file.
The return value is true [V.24.631] or false [V.24.286].
The function isInputFile is a member of the class Function [III.18].
Ways to use isInputFile :
isInputFile File
24.366. isListener
isListener f – whether f is a listener.
The return value is true [V.24.631] or false [V.24.286].
The function isListener is a member of the class Function [III.18].
Ways to use isListener :
isListener File
24.367. isOpenFile
isOpenFile f – whether f is an open file.
An open file is either an input file, an output file, an input output file, or a
listener.
The return value is true [V.24.631] or false [V.24.286].
The function isOpenFile is a member of the class Function [III.18].
Ways to use isOpenFile :
isOpenFile File
24.368. isOutputFile
isOutputFile f – whether f is an output file.
The return value is true [V.24.631] or false [V.24.286].
The function isOutputFile is a member of the class Function [III.18].
Ways to use isOutputFile :
isOutputFile File
24.369. isPrimitive
isPrimitive(f) – Given an element f in a quotient of a polynomial ring R over
a finite field Kwhich is itself a finite field, with the ring being finite dimensional over
the field, determine if f generates the multiplicative group of this field.
i1 : R = ZZ/5[t]/(t^2+t+1);
i2 : isPrimitive t
o2 = false
i3 : isPrimitive (t-1)
o3 = true
24.372. JACOBIAN
659
The function isPrimitive is a member of the class Function [III.18].
Code:
-- code for isPrimitive:
-- ../m2/galois.m2:45-51
isPrimitive = (g) -> (
g != 0 and
unpack(ring g,
(R,p,n,f) -> (
q := p^n;
all(factor (q-1), v -> 1 != g ^ ((q-1)//v#0))
)))
24.370. isReady
The function isReady is a member of the class Function [III.18].
Ways to use isReady :
isReady File
24.371. isTable
Warning: it is not possible to represent a 0-by-k matrix as a list of lists.
i1 : isTable {{1,2,3},{4,5}}
o1 = false
i2 : isTable {{1,2,3},{4,5,6}}
o2 = true
The function isTable is a member of the class Function [III.18].
Code:
-- code for isTable:
-- ../m2/tables.m2:9-12
isTable = m -> (
class m === List and
#m > 0 and
all(m, row -> class row === List and #row === #m#0))
24.372. jacobian
jacobian R – calculates the Jacobian matrix of the ring R
jacobian f – calculates the Jacobian matrix of the matrix f, which will normally
be a matrix with one row.
jacobian I – compute the matrix of derivatives of the generators of I w.r.t. all of
the variables
i1 : R = ZZ/101[a..d];
i2 : I = monomialCurve(R,{1,3,4})
3
o2 = ideal (b*c - a*d, c
o2 : Ideal of R
i3 : A = R/I
o3 = A
2
2
2
3
2
- b*d , a*c - b d, b - a c)
660
24. MISCELLANEOUS DOCUMENTATION
o3 : QuotientRing
i4 : jacobian A
o4 = {1}
{1}
{1}
{1}
|
|
|
|
0
-d2
3c2
-2bd
c2
-2bd
2ac
-b2
-d
c
b
-a
-2ac
3b2
-a2
0
|
|
|
|
4
4
o4 : Matrix A <--- A
For a one row matrix, the derivatives w.r.t. all the variables is given
i5 : R = ZZ/101[a..c]
o5 = R
o5 : PolynomialRing
i6 : p = symmetricPower(2,vars R)
o6 = {0} | a2 ab ac b2 bc c2 |
1
6
o6 : Matrix R <--- R
i7 : jacobian p
o7 = {1} | 2a b c 0 0 0 |
{1} | 0 a 0 2b c 0 |
{1} | 0 0 a 0 b 2c |
3
6
o7 : Matrix R <--- R
Caveat: if a matrix or ideal over a quotient polynomial ring S/J is given, then
only the derivatives of the given elements are computed and NOT the derivatives
of elements of J.
The function jacobian is a member of the class Function [III.18].
Ways to use jacobian :
jacobian Ideal
jacobian Matrix
jacobian Ring
24.373. join
join(u,v,...) – joins the elements of the lists or sequences u, v, ... into a
single list.
The class of the result is the same as the class of the first argument. If there is
just one argument, and it’s mutable, a copy is returned.
i1 : join({1,2,3},{a,b,c},{7,8,9})
o1 = {1, 2, 3, a, b, c, 7, 8, 9}
o1 : List
The operator {...} | {...} [III.19.2.7] can be used as a synonym.
24.378. KILL
661
The function join is a member of the class Function [III.18].
Ways to use join :
join(BasicList,BasicList)
24.374. ker
24.375. kernel
kernel f – produces the kernel of a matrix or ring homomorphism.
If f is a ring element, it will be interpreted as a one by one matrix.
For an abbreviation, use ker [V.24.374].
The function kernel is a member of the class Function [III.18].
Ways to use kernel :
kernel ChainComplexMap
kernel GradedModuleMap
kernel Matrix
kernel RingElement
kernel RingMap
Optional arguments :
kernel(..., SubringLimit => ...) [V.24.376] – stop after finding enough
elements of a subring
24.376. kernel(..., SubringLimit => ...)
SubringLimit => n – an option for kernel [V.24.375] which causes the computation of the kernel of a ring map to stop after n elements have been discovered.
See also:
Default value: infinity [V.24.356]
Function: kernel [V.24.375]
Option name: SubringLimit [V.24.132]
24.377. keys
keys t – yields a list of the keys occurring in the hash table t.
i1 : x = new HashTable from {a => 1, b => 2}
o1 = HashTable{a => 1}
b => 2
o1 : HashTable
i2 : keys x
o2 = {a, b}
o2 : List
The function keys is a member of the class Function [III.18].
Ways to use keys :
keys HashTable
24.378. kill
kill f – kill the process associated with the file f.
The function kill is a member of the class Function [III.18].
662
24. MISCELLANEOUS DOCUMENTATION
Ways to use kill :
kill File
24.379. koszul
koszul(i,f) – provides the i-th differential in the Koszul complex associated
to f.
Here f should be a 1 by n matrix.
The function koszul is a member of the class Function [III.18].
Ways to use koszul :
koszul(ZZ,Matrix)
24.380. last
last v – yields the last element of the list v.
See also first [V.24.287].
The function last is a member of the class Function [III.18].
Code:
-- code for last:
-- ../m2/structure.m2:5
last = x -> x#-1
24.381. leadCoefficient
leadCoefficient f – return the leading coefficient of the polynomial or vector
f.
See also:
leadTerm [V.24.384] – get the leading term
leadMonomial [V.24.383] – the leading monomial
leadComponent [V.24.382] – the leading component of a vector
The function leadCoefficient is a member of the class Function [III.18].
Ways to use leadCoefficient :
leadCoefficient RingElement
leadCoefficient Vector
24.382. leadComponent
leadComponent f – return the leading component of the vector f, i.e., the
integer i so that f_i is the first nonzero component of f.
See also:
leadTerm [V.24.384] – get the leading term
leadCoefficient [V.24.381] – the leading coefficient
leadMonomial [V.24.383] – the leading monomial
The function leadComponent is a member of the class Function [III.18].
Ways to use leadComponent :
leadComponent Vector
24.383. leadMonomial
leadMonomial f – return the leading monomial of the polynomial or vector f.
See also:
leadTerm [V.24.384] – get the leading term
leadCoefficient [V.24.381] – the leading coefficient
24.384. LEADTERM
663
leadCoefficient [V.24.381] – the leading coefficient
The function leadMonomial is a member of the class Function [III.18].
Ways to use leadMonomial :
leadMonomial RingElement
leadMonomial Vector
24.384. leadTerm
leadTerm f – return the leading term of the polynomial or vector f.
leadTerm m – return the matrix of initial forms of the columns of the matrix m.
leadTerm(i,m) – return the matrix of polynomials formed by retaining those monomials of each entry which agree on the first i weight vectors.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : leadTerm (3 + 8*a^2*b + 7*b*c^2)
2
o2 = 8a b
o2 : R
i3 : leadTerm matrix {{a,b},{c,d}}
o3 = {0} | a b |
{0} | 0 0 |
2
2
o3 : Matrix R <--- R
i4 : leadTerm matrix {{c,d},{a,b}}
o4 = {0} | 0 0 |
{0} | a b |
2
2
o4 : Matrix R <--- R
See also:
leadCoefficient [V.24.381] – the leading coefficient
leadMonomial [V.24.383] – the leading monomial
leadComponent [V.24.382] – the leading component of a vector
The function leadTerm is a member of the class Function [III.18].
Ways to use leadTerm :
leadTerm Ideal
leadTerm Matrix
leadTerm RingElement
leadTerm Vector
leadTerm(ZZ,Ideal)
leadTerm(ZZ,Matrix)
leadTerm(ZZ,ZZ,Resolution)
664
24. MISCELLANEOUS DOCUMENTATION
24.385. length
The function length is a member of the class Function [III.18].
Ways to use length :
length ChainComplex [III.16.15] – length of a chain complex or graded
module
length GradedModule [III.21.5.4.3.1] – length of a graded module
24.386. lift
lift(f,R) – promotes a ring element f to the ring R.
The ring R should be one of the base rings associated with the ring of f.
See also:
baseRings [V.24.185] – store the list of base rings of a ring
The function lift is a member of the class Function [III.18].
Ways to use lift :
lift(Ideal,Ring)
lift(Ideal,ZZ)
lift(Matrix,Ring)
lift(Matrix,ZZ)
lift(QQ,QQ)
lift(QQ,Ring)
lift(QQ,ZZ)
lift(RingElement,QQ)
lift(RingElement,Ring)
lift(RingElement,RingElement)
lift(RingElement,ZZ)
lift(ZZ,Ring)
lift(ZZ,ZZ)
24.387. liftable
liftable(f,R) – tells whether a ring element f can be lifted to the ring R.
The ring R should be one of the base rings associated with the ring of f.
i1 : R = ZZ[x]
o1 = R
o1 : PolynomialRing
i2 : liftable ((x-1)*(x+1)-x^2, ZZ)
o2 = true
See also:
lift [V.24.386] – lift to another ring
The function liftable is a member of the class Function [III.18].
Ways to use liftable :
liftable(QQ,Ring)
liftable(RingElement,Ring)
liftable(ZZ,Ring)
24.391. LISTUSERSYMBOLS
665
24.388. lineNumber
lineNumber() – returns the current line number.
lineNumber n – sets the line number to n [V.24.428] and returns the old line
number.
The function lineNumber is a member of the class Function [III.18].
24.389. lines
lines s – yields an array of strings obtained from the string s by breaking it
at newline or return characters.
lines(s,nl) – yields an array of strings obtained from the string s by breaking it
at the newline characters specified by the string nl.
The form lines s is designed to break lines correctly when the file follows
the Unix, MS-DOS, or Macintosh convention and contains no extraneous isolated
newline or return characters. In other words, it will break a line at ”\r\n”, ”\n”,
or ”\r”.
The string nl should be a string of length 1 or 2.
See also:
newline [V.24.435]
The function lines is a member of the class Function [III.18].
Code:
-- code for lines:
-- ../m2/methods.m2:262-264
lines = x -> (
l := separate x;
if l#-1 === "" then drop(l,-1) else l)
24.390. listForm
listForm f – converts a polynomial or monomial to a form represented by
nested lists.
A monomial is represented by the list of its exponents.
A polynomial is represented by lists of pairs (m,c), one for each term, where m
is a list of exponents for monomial, and c is the coefficient.
i1 : R = ZZ/101[x,y,z];
i2 : listForm (x^2 - 7 + x*y*z^11 + y)
o2 = {({1, 1, 11}, 1), ({2, 0, 0}, 1), ({0, 1, 0}, 1), ({0,
...
o2 : List
The function listForm is a member of the class Function [III.18].
Ways to use listForm :
listForm MonoidElement
listForm RingElement
24.391. listUserSymbols
listUserSymbols – a command which returns a display of the variables defined
by the user, along with their types.
listUserSymbols X – limits the list to those variables whose values are instances
of X.
666
24. MISCELLANEOUS DOCUMENTATION
This function is useful after using loaddata [V.24.393] to restore a previous
session.
See also:
userSymbols [V.24.640] – a list of the user’s symbols
The command listUserSymbols is a member of the class Command [III.21.1.2].
24.392. load
load "f" – reads and executes Macaulay 2 expressions found in the file named
f.
The file is sought along the path [V.24.466], unless the name of the file begins with the character(s) in pathSeparator [V.24.467]. The file is read without
echoing the input, printing the values, or incrementing the line number.
See also:
path [V.24.466] – list of directories to look in
needs [V.24.430] – read Macaulay 2 commands if necessary
input [V.24.358] – read Macaulay 2 commands and echo
The function load is a member of the class Function [III.18].
Code:
-- code for load:
-- ../m2/setup.m2:200-202
load = (filename) -> (
if not tryload(filename,oldLoad) then error ("can’t ope ...
)
24.393. loaddata
loaddata s – load all data segments for the current process from the file whose
name is stored in the string s. The file must have been created with dumpdata
[V.24.261] and the same version of Macaulay 2.
The file should have been created with dumpdata [V.24.261]. Everything will
be returned to its former state except:
reloaded [V.24.511]
environment [V.24.271] – the environment variables
commandLine [V.24.218] – the command line arguments
whether the standard input is echoed and prompts to the standard output
are properly flushed, which depends on whether the standard input is
a terminal.
After the data segments have been reloaded, the command line arguments will
be dealt with in the usual way, except that only the arguments after the i-th ’–’
and before the i+1-st ’–’ (if any) will be considered, where i is the current value of
reloaded [V.24.511].
See also:
listUserSymbols [V.24.391] – display the user’s symbols
The function loaddata is a member of the class Function [III.18].
24.394. local
local s – provides the local symbol s, creating a new symbol if necessary. The
initial value of a local symbol is null.
i1 : f = () -> ZZ[local t]
24.397. LOOKUP
667
o1 = f
o1 : Function
i2 : f()
o2 = ZZ [$t]
o2 : PolynomialRing
i3 : t
o3 = t
o3 : Symbol
See also:
global [V.24.325] – get a global symbol
symbol [V.24.578] – get a symbol
24.395. locate
locate f – for a symbol interpreted function f returns a sequence (n,i,j)
describing the location of the definition in the source code. The name of the source
file is n and the code is occupies lines i through j. If the f is compiled, then the
location is not available, and null [V.24.440] is returned.
If f is a sequence, then lookup [V.24.397] is applied first, and then the location
of the resulting function is provided.
If f is null [V.24.440], then null [V.24.440] is returned.
The function locate is a member of the class Function [III.18].
Ways to use locate :
locate (...)
locate Function
locate Nothing
locate Symbol
24.396. log
log x – computes the logarithm of x.
The function log is a member of the class Function [III.18].
Ways to use log :
log RR
log ZZ
24.397. lookup
lookup(M,A) – provides the binary method named M for class A. The first place to
look is A#M. The search proceeds with the parent of A, and so on.
lookup(M,A,B) – provides the binary method named M for (A,B). The first place
to look is Y#(M,A,B) where Y is the younger of A and B. The search proceeds next
with the parent of B, and so on.
lookup(M,A,B,C) – provides the ternary method named M for (A,B,C). The first
place to look is Y#(M,A,B,C) where Y is the youngest of A, B, and C. The search
668
24. MISCELLANEOUS DOCUMENTATION
proceeds with the parent of C, and so on.lookup x – where x is a symbol or function,
returns x.
If no method is found, then null is returned.
See also:
# [V.24.4] – length, or access to elements
classes [I.5.1]
installMethod [V.24.359] – install methods
youngest [V.24.652] – the youngest member of a sequence
The function lookup is a member of the class Function [III.18].
24.398. lookupCount
lookupCount s – the number of times the symbol s has been encountered in
source code presented to the interpreter.
The function lookupCount is a member of the class Function [III.18].
24.399. map
map(Y,X,d) – constructs a map to Y from X defined by data d.
This is intended to be a general mechanism for constructing maps (homomorphisms) between objects in various categories.
The function map is a member of the class Function [III.18].
Ways to use map :
map Ideal
map Matrix [III.12.24] – make a map
map Module [III.12.25] – make a map
map(ChainComplex,ChainComplex)
map(ChainComplex,ChainComplex,ChainComplexMap)
map(ChainComplex,ChainComplex,Function) [III.16.16] – make a
map of chain complexes
map(GradedModule,GradedModule,Function)
map(Ideal,Ideal)
map(Module,Matrix) [III.12.26] – make a map
map(Module,Module) [III.12.27] – make a map
map(Module,Module,Function) [III.12.28] – make a map
map(Module,Module,Matrix) [III.12.29] – make a map
map(Module,Module,RingElement) [III.12.30] – make a map
map(Module,Module,ZZ) [III.12.31] – make a map
map(Module,Module,{...}) [III.12.32] – make a map
map(Module,Nothing,Matrix)
map(Module,Nothing,{...}) [III.12.33] – make a map
map(Module,RingElement) [III.12.34] – make a map
map(Module,ZZ)
map(Module,ZZ,Function) [III.12.35] – make a map
map(Module,ZZ,{...}) [III.12.36] – make a map
map(Ring,Matrix)
map(Ring,Ring)
map(Ring,Ring,Matrix)
map(Ring,Ring,{...}) [III.10.15] – make a ring map
Optional arguments :
24.403. MAXPOSITION
669
map(..., Degree => ...)
24.400. match
match(s,p) – whether the string s matches the pattern p.
The pattern p may contain ’*’s, which serve as wild card characters. This is
provisional - eventually it will provide regular expression matching.
The function match is a member of the class Function [III.18].
Ways to use match :
match(String,String)
24.401. matrix
This function can be used to create a matrix or map (homomorphism) between
modules, but it is complicated because there are many different ways it can be used.
The entries of the matrix can be provided as a list of lists of ring elements, or as
a function which accepts row and column indices. The ring of the matrix can be
provided explicitly, or the source and target modules can be provided. There are
other alternatives.
See also:
map [V.24.399] – make a map
The function matrix is a member of the class Function [III.18].
Ways to use matrix :
matrix Matrix [III.12.37] – make a matrix
matrix {...} [III.12.38] – make a matrix
matrix(Ring,{...}) [III.10.16] – make a matrix
Optional arguments :
matrix(..., Degree => ...)
24.402. max
max x – yields the maximum of the elements in the list or sequence x.
The function max is a member of the class Function [III.18].
Ways to use max :
max (...)
max ChainComplex [III.16.17] – – maximum index in a chain complex
max {...}
24.403. maxPosition
maxPosition x – yields the position of the largest element in the list.
If it occurs more than once, then the first occurrence is used. If x has length
zero an error results.
The function maxPosition is a member of the class Function [III.18].
Code:
-- code for maxPosition:
-- ../m2/lists.m2:20-26
maxPosition = x -> (
if # x === 0 then error "expected a nonempty list"
else (
m := x#0;
pos := 0;
scan(1 .. # x-1, i -> if x#i>m then (m=x#i;pos=i)) ...
670
24. MISCELLANEOUS DOCUMENTATION
pos))
24.404. member
member(e,x) – whether e is an element of the list, set, or sequence x.
i1 : x = {a,b,c,d,e};
i2 : member(c,x)
o2 = true
i3 : member(f,x)
o3 = false
See also:
positions [V.24.477] – which elements of a list satisfy a condition
The function member is a member of the class Function [III.18].
Ways to use member :
member(Thing,Set)
member(Thing,VisibleList)
24.405. memoize
memoize f – produces, from a function f, a new function which behaves the
same as f, but remembers previous answers to be provided the next time the same
arguments are presented.
i1 : fib = n -> if n <= 1 then 1 else fib(n-1) + fib(n-2)
o1 = fib
o1 : Function
i2 : time fib 16
-- used 0.02 seconds
o2 = 1597
i3 : fib = memoize fib
o3 = fib
o3 : Function
i4 : time fib 16
-- used 0. seconds
o4 = 1597
i5 : time fib 16
-- used 0. seconds
o5 = 1597
The function memoize operates by constructing a MutableHashTable [III.21.5.4]
in which the argument sequences are used as keys for accessing the return value of
the function.
24.408. METHOD(..., ASSOCIATIVE => ...)
671
An optional second argument to memoize provides a list of initial values, each
of the form x => v, where v is the value to be provided for the argument x.
Warning: when the value returned by f is null, it will always be recomputed,
even if the same arguments are presented.
Warning: the new function created by memoize will save references to all arguments and values it encounters, and this will often prevent those arguments and
values from being garbage-collected as soon as they might have been. If the arguments are implemented as mutable hash tables (modules, matrices and rings are
implemented this way) then a viable strategy is to stash computed results in the
arugments themselves!
The function memoize is a member of the class Function [III.18].
Ways to use memoize :
memoize Function
memoize(Function,{...})
24.406. merge
merge(x,y,g) – merges hash tables x and y using the function g to combine
the values when the keys collide.
If x and y have the same class and parent, then so will the result. The merged
hash table has as its keys the keys occuring in the arguments. When a key occurs
in both arguments, the corresponding values are combined using the function g,
which should be a function of two arguments.
This function is useful for multiplying monomials or adding polynomials.
See also combine [V.24.217], which is useful for multiplying polynomials.
The function merge is a member of the class Function [III.18].
Ways to use merge :
merge(HashTable,HashTable,Function)
24.407. mergePairs
mergePairs(x,y,f) – merges sorted lists of pairs.
It merges x and y, which should be lists of pairs (k,v) arranged in increasing
order according to the key k. The result will be a list of pairs, also arranged in
increasing order, each of which is either from x or from y, or in the case where
a key k occurs in both, with say (k,v) in x and (k,w) in y, then the result will
contain the pair (k,f(v,w)). Thus the function f is used for combining the values
when the keys collide. The class of the result is taken to be the minimal common
ancestor of the class of x and the class of y.
See also:
merge [V.24.406] – merge hash tables
The function mergePairs is a member of the class Function [III.18].
Ways to use mergePairs :
mergePairs(BasicList,BasicList,Function)
24.408. method(..., Associative => ...)
f = method(Associative=>true) – creates an associative method which will call
upon the appropriate binary methods for its arguments two at a time.
In the following example we install a method which isn’t associative to illustrate
the order of evaluation.
672
24. MISCELLANEOUS DOCUMENTATION
i1 : f = method(Associative => true)
o1 = f
o1 : Function
i2 : f(String,String) := (i,j) -> "(" | i | ")," | j;
i3 : f("a","b","c","d")
o3 = (((a),b),c),d
o3 : String
See also:
Default value: false [V.24.286]
Function: method [I.4.31.1]
Option name: Associative [V.24.54]
24.409. method(..., TypicalValue => ...)
TypicalValue => X – an option to method [I.4.31.1] which specifies that values returned by the method function will typically be of type X.
This information is used only to build documentation automatically, and is
stored in the hash table typicalValues [V.24.634].
See also:
specifying typical values [V.24.561]
See also:
Default value: Thing [III.21]
Function: method [I.4.31.1]
Option name: TypicalValue [V.24.142]
24.410. methods
methods F – produces a list of those methods associated with the function or
type F.
methods symbol ** – produces a list of the methods usable with the operator **.
methods (symbol **, X) – produces a list of the methods usable with the operator
** and a thing of class X.
methods (X, Y) – produces a list of the methods usable with a thing of class X
and a thing of class Y.
This function operates by examining those types which are values of global
symbols for keys which appear to be storing references to methods. Types which
don’t appear as values of global variables will not be examined, so perhaps not all
methods will be found.
i1 : methods drop
o1 = {(drop, BasicList, List), (drop, BasicList, ZZ)}
o1 : List
The function methods is a member of the class Function [III.18].
Ways to use methods :
methods (...)
24.414. MINGLE
673
methods HashTable
methods Thing
24.411. min
min x – yields the minimum of the elements in the list or sequence x.
The function min is a member of the class Function [III.18].
Ways to use min :
min (...)
min ChainComplex [III.16.18] – minimum index in a chain complex
min {...}
24.412. minPosition
minPosition x – yields the position of the smallest element in the list.
If it occurs more than once, then the first occurrence is used. If x has length
zero an error results.
The function minPosition is a member of the class Function [III.18].
Code:
-- code for minPosition:
-- ../m2/lists.m2:29-35
minPosition = x -> (
if # x === 0 then error "expected a nonempty list"
else (
m := x#0;
pos := 0;
scan(1 .. # x-1, i -> if x#i>m then (m=x#i;pos=i)) ...
pos))
24.413. mingens
mingens M – returns a minimal generating set for the module M, represented as
a matrix whose target is the ambient free module of M.
See also:
GroebnerBasis [III.15] – the class of all Groebner bases
The function mingens is a member of the class Function [III.18].
Ways to use mingens :
mingens GroebnerBasis [III.12.39] – – a matrix whose columns are minimal generators of the submodule
mingens Ideal
mingens Module
mingens(ZZ,Resolution)
Optional arguments :
24.414. mingle
mingle {v,w,...} – produces a new list from the lists or sequences v,w,... by
taking the first element from each, then the second, and so on.
mingle (v,w,...) – does the same.
After one of the lists is exhausted, it is silently ignored.
i1 : mingle({1,2,3,4},{a},{F,F,F,F,F,F,F,F,F,F})
o1 = {1, a, F, 2, F, 3, F, 4, F, F, F, F, F, F, F}
674
24. MISCELLANEOUS DOCUMENTATION
o1 : List
i2 : concatenate mingle( {"a","b","c"} , {",",","} )
o2 = a,b,c
o2 : String
It is easy to transpose a nested list (thinking of it as a matrix) using mingle
[V.24.414] and pack [V.24.462].
i3 : pack(2, mingle {{1,2,3,4},{5,6,7,8}})
o3 = {{1, 5}, {2, 6}, {3, 7}, {4, 8}}
o3 : List
The function mingle is a member of the class Function [III.18].
Ways to use mingle :
mingle BasicList
24.415. minors
minors(j,m) – produces the ideal generated by the determinants of the j-by-j
submatrices of the matrix m.
See also:
det [V.24.250] – determinant of a matrix
exteriorPower [V.24.284] – exterior power
MinorsComputation [III.21.1.7] – the class of all minors computations
The function minors is a member of the class Function [III.18].
Ways to use minors :
minors(ZZ,Matrix)
Optional arguments :
minors(..., Limit => ...)
24.416. minprimes
minprimes I – compute the minimal primes of a monomial ideal I.
Not working yet.
The function minprimes is a member of the class Function [III.18].
Ways to use minprimes :
minprimes MonomialIdeal
24.417. minus
minus(x)
– yields -x.
minus(x,y) – yields x-y, but see also difference [V.24.252].
The function minus is a member of the class Function [III.18].
24.418. mod
mod(i,n) – reduce the integer i modulo n.
The result is an element of ZZ/n.
The function mod is a member of the class Function [III.18].
Code:
-- code for mod:
24.424. MONOID
675
-- ../m2/quotient.m2:16
mod = (i,n) -> i * 1_(ZZ/n)
24.419. modifyRing
modifyRing(R,options) – yields a ring similar to R, with certain features
changed.
Bug: doesn’t work yet.
The function modifyRing is a member of the class Function [III.18].
Ways to use modifyRing :
modifyRing Ring
Optional arguments :
modifyRing(..., Degrees => ...)
modifyRing(..., Inverses => ...)
modifyRing(..., MonomialOrder => ...)
modifyRing(..., MonomialSize => ...)
modifyRing(..., SkewCommutative => ...)
modifyRing(..., VariableBaseName => ...)
modifyRing(..., VariableOrder => ...)
modifyRing(..., Variables => ...)
modifyRing(..., Weights => ...)
modifyRing(..., WeylAlgebra => ...)
24.420. module
24.421. modules
24.422. modulo
modulo(f,g) - given homomorphisms f and g of free modules with the same
target, produces a homomorphism of free modules whose target is the source of f,
and whose image is the pre-image (under f) of the image of g.
If f is null, then it’s taken to be the identity. If g is null, it’s taken to be zero.
The function modulo is a member of the class Function [III.18].
Ways to use modulo :
modulo(Matrix,Matrix)
modulo(Matrix,Nothing)
modulo(Nothing,Matrix)
24.423. modulus
modulus – a key used in quotient rings of the form ZZ/n to store the number
n.
This may go away when more general quotient rings are working.
The symbol modulus is a member of the class Symbol [III.21.10].
24.424. monoid
monoid [a,b,c,Degrees=>{2,3,4}] – makes a free ordered commutative monoid
on the variables listed, with degrees 2, 3, and 4, respectively.
monoid [a,b,c,Degrees=>{{1,2},{3,-3},{0,4}}] – makes a free ordered commutative monoid on the variables listed, with multi-degrees as listed.
676
24. MISCELLANEOUS DOCUMENTATION
monoid [a,b,c,Degrees=>{{},{},{}}] – makes a free ordered commutative monoid
on the variables listed, ungraded.
The variables listed may be symbols or indexed variables. The values assigned
to these variables (with assign [V.24.179]) are the corresponding monoid generators. The function baseName [V.24.184] may be used to recover the original
symbol or indexed variable.
The class of all monoids created this way is GeneralOrderedMonoid [III.21.5.4.11.3.1.1].
See also:
OrderedMonoid [III.21.5.4.11.3.1] – the class of all ordered monoids
IndexedVariable [III.21.1.4] – the class of all indexed variables
Symbol [III.21.10] – the class of all symbols
The function monoid is a member of the class Function [III.18].
Ways to use monoid :
monoid QuotientRing
monoid Ring [III.10.17] – get the monoid from a monoid ring
monoid [...] [III.19.1.1] – make a polynomial ring or monoid ring
24.425. monomialCurve
monomialCurve(R,a) – yields the defining ideal of the projective curve given
parametrically on an affine piece by t |—> (t^a1, ..., t^an).
The ideal is defined in the polynomial ring R, which must have at least n+1
variables, preferably all of equal degree. The first n+1 variables in the ring are
usedFor example, the following defines a plane quintic curve of genus 6.
i1 : R = ZZ/101[a..f]
o1 = R
o1 : PolynomialRing
i2 : monomialCurve(R,{3,5})
5
2 3
o2 = ideal(b - a c )
o2 : Ideal of R
Here is a genus 2 curve with one singular point.
i3 : monomialCurve(R,{3,4,5})
2
2
2
3
o3 = ideal (c - b*d, b c - a*d , b - a*c*d)
o3 : Ideal of R
Here is one with two singular points, genus 7.
i4 : monomialCurve(R,{6,7,8,9,11})
2
o4 = ideal (d*e - b*f, e
2
- c*f, c*d - b*e, d
o4 : Ideal of R
Finally, here is the smooth rational quartic in P^3.
2
...
- c*e, c - b ...
24.429. NAME
677
i5 : monomialCurve(R,{1,3,4})
3
o5 = ideal (b*c - a*d, c
2
2
2
3
2
- b*d , a*c - b d, b - a c)
o5 : Ideal of R
The function monomialCurve is a member of the class Function [III.18].
24.426. monomialIdeal
The function monomialIdeal is a member of the class Function [III.18].
Ways to use monomialIdeal :
monomialIdeal Matrix [III.12.50] – make a monomial ideal
monomialIdeal MonomialIdeal [III.21.5.4.7.1] – make a monomial ideal
monomialIdeal(ZZ,Matrix) [III.12.51] – make a monomial ideal
24.427. mutable
mutable x – returns true or false, depending on whether x is mutable.
If x is a hash table, list, or database, then it’s mutable if its contents can be
destructively altered.
If x is a symbol, then it’s mutable if a value can be assigned to it. (See protect
[V.24.491].)
If x is anything else, then it isn’t mutable.
The contents of a mutable hash table do not participate in strong comparison
with === [V.24.40] or in hashing [V.24.335].
See also:
MutableList [III.21.1.9] – the class of all mutable lists
MutableHashTable [III.21.5.4] – the class of all mutable hash tables
The function mutable is a member of the class Function [III.18].
Ways to use mutable :
mutable Thing
24.428. n
24.429. name
name – a key under which string giving the preferred name of a hash table can
be stored.
The system takes care of storing names under this key for the major algebraic
types, so the user usually doesn’t have to bother.
i1 : x = new MutableHashTable
o1 = MutableHashTable{...}
o1 : MutableHashTable
i2 : x.name = "x"
o2 = x
o2 : String
678
24. MISCELLANEOUS DOCUMENTATION
i3 : x
o3 = x
o3 : MutableHashTable
A obsolete function called name [V.24.429] has been replaced by toExternalString [III.21.6.1.6] and toString [III.21.6.1.7].
See also:
describe [V.24.249] – real description
The symbol name is a member of the class Symbol [III.21.10].
24.430. needs
needs "f" – loads the file named f if it hasn’t been loaded yet.
See also:
load [V.24.392] – read Macaulay 2 commands
The function needs is a member of the class Function [III.18].
Code:
-- code for needs:
-- ../m2/setup.m2:213
needs = s -> if not loaded#?s then load s
24.431. netRows
netRows x – produces a list of strings, each containing the characters in one
row of the Net x.
The orginal net, adjusted so its height is 1, may be recovered with stack
[III.21.6.10]. The individual strings will have all trailing spaces removed, unless
this would make all of them narrower than the original net, in which case the first
string retains its trailing spaces.
The function netRows is a member of the class Function [III.18].
Ways to use netRows :
netRows Net
24.432. new
new A of b from c – make a hash table of class A and parent b initialized
from c.
new A of b – make a hash table of class A and parent b.
new A from c – make a new instance of class A initialized from c.
new A – makes a new instance n of class A.
new A of b from c – make a hash table n of Here A and b are hash tables, and c
is any expression. Let b be an instance of B, c be an instance of C, and let AA be
an ancestor of A. Then use
new AA of B from C := (A,b,c) -> ...
to install the corresponding optional creation routine – the value it returns will be
converted so its class is A and its parent is b; this will involve copying unless the
returned value is mutable and objects of class A are mutable.
If no installation routine has been installed, then c should be a hash table or a
list, and it will be converted directly.
24.433. NEWCLASS
679
The class A should be a type of type, which means that Type is an ancestor of
A and of the class of A.
new A of b – make a hash table of class A and parent b.
Same as above, except c is missing. Use
new AA of B := (A,b) -> ...
to install the initialization routine.
The class A should be a type of type, which means that Type is an ancestor of
A and of the class of A.
new A from c – make a hash table or list n of class A initialized from c.
The same as above except b is missing. Use
new AA from C := (A,c) -> ...
to install the corresponding initialization routine.
Since no parent b has been provided, the value returned by the initialization
routine will not have its parent reset. If there is no initialization routine the parent
will be set to Nothing.
The class A should be a type, which means that Type is an ancestor of the class
of A.
new A – make a new instance n of class A.
Same as above, except b and c are missing. Use new AA := A -> ... to
install the initialization routine.
Since no parent b has been provided, the value returned by the initialization
routine will not have its parent reset. If there is no initialization routine the parent
will be set to Nothing.
The class A should be a type, which means that Type is an ancestor of the class
of A.
Note that if the of option is not used, then the class A need not consist of hash
tables or lists. We are using this feature by installing a method so that new ZZ
returns an integer popped from the top of the engine’s stack.
The symbols NewMethod [V.24.105], NewOfMethod [V.24.107], NewFromMethod [V.24.104], and NewOfFromMethod [V.24.106] are used internally for
installation of the initialization routines.
See also:
classes [I.5.1]
24.433. newClass
newClass(N,m) – makes a copy of m with N as the new class
newClass(N,M,m) – makes a copy of m with N as class and M as parent
If m is a list, then BasicList should be an ancestor of N. If m is a hash table,
then HashTable should be an ancestor of N.
If m is mutable, and instances of class N are also mutable, then copying is not
required, and is not done.
See also:
copy [V.24.230] – copy an object
toList [V.24.619] – list of elements
The function newClass is a member of the class Function [III.18].
680
24. MISCELLANEOUS DOCUMENTATION
24.434. newCoordinateSystem
newCoordinateSystem(S,m) – takes a one-rowed matrix m of independent linear forms over a ring R and returns a list {f,g}, where f is a ring map given by
some linear change of coordinates from R to S which sends the last variables of R
to the forms in m, and g is the inverse of f.
The ring S should have the same number of variables as S.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : S = ZZ/101[p..s]
o2 = S
o2 : PolynomialRing
i3 : newCoordinateSystem(S,matrix{{a+2*b,3*c-d}})
o3 = {map(S,R,{q, s, p + 2q, 3r - s}), map(R,S,{- 2a + c, a, ...
o3 : List
The function newCoordinateSystem is a member of the class Function [III.18].
Ways to use newCoordinateSystem :
newCoordinateSystem(PolynomialRing,Matrix)
24.435. newline
24.436. nextkey
nextkey f – return the next key available in the database file f.
Returns null if none.
See also:
Database [III.21.3] – the class of all database files
The function nextkey is a member of the class Function [III.18].
24.437. not
not x – yields the negation of x, which must be true or false.
See also:
and [V.24.164] – conjunction
or [V.24.459] – disjunction
24.438. not documented yet
We haven’t documented yet the way to replace this Macaulay function or script.
24.439. notImplemented
notImplemented() – print an error message that says ”not implemented yet”.
The function notImplemented is a member of the class Function [III.18].
Code:
-- code for notImplemented:
-- ../m2/debugging.m2:39
24.441. NULLHOMOTOPY
681
notImplemented = x -> error "not implemented yet"
24.440. null
When it is the value of an expression entered into the interpreter, the output
line doesn’t appear. Empty spots in a list are represented by it.
It is the only member of the class Nothing [III.21.7], which strictly speaking,
ought to have no members at all.
An if [V.24.346] expression with no else [V.24.266] clause returns null [V.24.440]
when the predicate is false.
Various routines that prepare data for printing convert null [V.24.440] to an
empty string.
i1 : x = {2,3,,4}
o1 = {2, 3, , 4}
o1 : List
i2 : net x
o2 = {2, 3, , 4}
o2 : Net
i3 : toString x#2
o3 = null
o3 : String
i4 : peek x
o4 = {2,3,null,4}
o4 : Net
The object null is a member of the class Nothing [III.21.7].
24.441. nullhomotopy
nullhomotopy f – produce a nullhomotopy for a map f of chain complexes.
Whether f is null homotopic is not checked.
Here is part of an example provided by Luchezar Avramov. We construct a
random module over a complete intersection, resolve it over the polynomial ring,
and produce a null homotopy for the map which is multiplication by one of the
defining equations for the complete intersection.
i1 : A = ZZ/101[x,y];
i2 : M = cokernel random(A^3, A^{-2,-2})
o2 = cokernel {0} | 42x2-50xy+39y2 -39x2+30xy+19y2 |
{0} | 9x2-15xy-22y2 -38x2+2xy-4y2
|
{0} | 50x2+45xy-29y2 -36x2-16xy-6y2 |
3
o2 : A - module, quotient of A
682
24. MISCELLANEOUS DOCUMENTATION
i3 : R = cokernel matrix {{x^3,y^4}}
o3 = cokernel {0} | x3 y4 |
1
o3 : A - module, quotient of A
i4 : N = prune (M**R)
o4 = cokernel {0} | -41x2-26xy+17y2 -50x2-42xy-4y2 x3 x2y-16 ...
{0} | 20xy-5y2
x2+6xy-24y2
0 -12xy2 ...
{0} | x2+21xy-5y2
-25xy-6y2
0 16y3
...
3
o4 : A - module, quotient of A
i5 : C = resolution N
3
8
5
o5 = A <-- A <-- A
0
1
2
o5 : ChainComplex
i6 : d = C.dd
3
o6 = -1 : 0 <----- A : 0
0
3
0 : A <----------------------------------------------{0} | -25xy-6y2
x2+21xy-5y2
0 16y3
{0} | x2+6xy-24y2
20xy-5y2
0 -12xy
{0} | -50x2-42xy-4y2 -41x2-26xy+17y2 x3 x2y-1
...
...
...
...
...
8
1 : A <----------------------------------------------{2} | -3xy2+8y3
43xy2+23y3
3y3
{2} | -7xy2-6y3
36y3
7y3
{3} | 15xy+24y2
-12xy-49y2
-15y2
{3} | -15x2-11xy+43y2 12x2-33xy+35y2 15xy-13y
{3} | 7x2+8xy+37y2
39xy-40y2
-7xy-2y2
{4} | 0
0
x
{4} | 0
0
12y
{4} | 0
0
-40y
...
...
...
...
...
...
...
...
...
...
o6 : ChainComplexMap
i7 : s = nullhomotopy (x^3 * id_C)
8
3
o7 = 1 : A <------------------------ A : 0
{2} | -20y x-6y 0 |
{2} | x-21y 25y 0 |
{3} | 41
50
1 |
{3} | -17
-41 0 |
{3} | 47
38
0 |
24.441. NULLHOMOTOPY
{4} | 0
{4} | 0
{4} | 0
0
0
0
0 |
0 |
0 |
5
2 : A <----------------------------------------------{5} | 9
-50 0 32y
29x+21y xy+50y2
{5} | -19 -19 0 -42x-25y 11x+41y 12y2
x
{5} | 0
0
0 0
0
x2+38y2
4
{5} | 0
0
0 0
0
-12xy+35y2 x
{5} | 0
0
0 0
0
40xy+27y2 2
5
3 : 0 <----- A : 2
0
o7 : ChainComplexMap
i8 : s*d + d*s
3
3
o8 = 0 : A <-------------------- A : 0
{0} | x3 0 0 |
{0} | 0 x3 0 |
{0} | 0 0 x3 |
8
8
1 : A <----------------------------------- A : 1
{2} | x3 0 0 0 0 0 0 0 |
{2} | 0 x3 0 0 0 0 0 0 |
{3} | 0 0 x3 0 0 0 0 0 |
{3} | 0 0 0 x3 0 0 0 0 |
{3} | 0 0 0 0 x3 0 0 0 |
{4} | 0 0 0 0 0 x3 0 0 |
{4} | 0 0 0 0 0 0 x3 0 |
{4} | 0 0 0 0 0 0 0 x3 |
5
5
2 : A <-------------------------- A : 2
{5} | x3 0 0 0 0 |
{5} | 0 x3 0 0 0 |
{5} | 0 0 x3 0 0 |
{5} | 0 0 0 x3 0 |
{5} | 0 0 0 0 x3 |
o8 : ChainComplexMap
i9 : s^2
5
3
o9 = 2 : A <----- A : 0
0
8
3 : 0 <----- A : 1
0
5
4 : 0 <----- A : 2
0
683
...
...
...
...
...
...
...
684
24. MISCELLANEOUS DOCUMENTATION
o9 : ChainComplexMap
The function nullhomotopy is a member of the class Function [III.18].
Ways to use nullhomotopy :
nullhomotopy ChainComplexMap
24.442. number
number(x,f) – the number of elements e of the list x for which f(e) is true.
See also:
positions [V.24.477] – which elements of a list satisfy a condition
select [V.24.541] – select elements from a list or hash table
The function number is a member of the class Function [III.18].
Code:
-- code for number:
-- ../m2/lists.m2:38
number = x -> # select x
24.443. numerator
numerator x – provides the numerator of a fraction.
i1 : numerator (4/6)
o1 = 2
The function numerator is a member of the class Function [III.18].
Ways to use numerator :
numerator Divide
numerator QQ
24.444. numeric
numeric x – yields the expression obtained from x by converting the integers
and rational numbers within to double precision floating point numbers.
i1 : numeric {1,2,3}
o1 = {1., 2., 3.}
o1 : List
See also RR [III.21.9].
The function numeric is a member of the class Function [III.18].
Code:
-- code for numeric:
-- ../m2/numbers.m2:7-12
numeric = x -> (
if basictype x === ZZ or basictype x === QQ
then 0. + x
else if basictype x === BasicList or basictype x === Se ...
then apply(x,numeric)
else x);
24.445. numgens
numgens X – yields the number of generators used to present a module or ring.
24.449. OO
685
For a polynomial ring or quotient of one, this is also the number of variables.
For a free module, this is the same as the rank. For a general module presented as
a subquotient, it is the number of columns in the matrix of generators.
The function numgens is a member of the class Function [III.18].
Ways to use numgens :
numgens EngineRing
numgens FractionField
numgens GeneralOrderedMonoid
numgens Ideal
numgens Module
numgens MonomialIdeal
numgens PolynomialRing
numgens QuotientRing
numgens Ring
24.446. odd
odd x – returns true or false, tells whether x is an odd integer.
See also even [V.24.276].
The function odd is a member of the class Function [III.18].
Code:
-- code for odd:
-- ../m2/numbers.m2:3
odd = x -> 1 === x%2
24.447. of
of – a keyword used with new [V.24.432].
24.448. on
f = on f – replaces the function f by a version which will print out its arguments and return value each time it’s called, together with a sequence number so
the two reports can be connected.
This function is of only limited utility because it cannot be used with writeprotected system functions.
The reason we write f = on f and not something like f = on(x -> ...) is
so the function handed to on [V.24.448] will know its name. The name will appear
in the display.
The function on is a member of the class Function [III.18].
Optional arguments :
on(..., CallLimit => ...)
24.449. oo
oo – denotes the value of the expression on the previous output line.
See also:
oo [V.24.449] – the last output value
ooo [V.24.450] – the next to the last output value
oooo [V.24.451] – the third to the last output value
The symbol oo is a member of the class Symbol [III.21.10].
686
24. MISCELLANEOUS DOCUMENTATION
24.450. ooo
ooo – denotes the value of the expression on the output line two lines above.
See also:
oo [V.24.449] – the last output value
oooo [V.24.451] – the third to the last output value
The symbol ooo is a member of the class Symbol [III.21.10].
24.451. oooo
oooo – denotes the value of the expression on the output line three lines above.
See also:
oo [V.24.449] – the last output value
ooo [V.24.450] – the next to the last output value
The symbol oooo is a member of the class Symbol [III.21.10].
24.452. openDatabase
openDatabase "filename" – open a database file with the given file name.
The function openDatabase is a member of the class Function [III.18].
Ways to use openDatabase :
openDatabase String
24.453. openDatabaseOut
openDatabaseOut "filename" – open a database file with the given file name,
and allow changes to be made to it.
The function openDatabaseOut is a member of the class Function [III.18].
Ways to use openDatabaseOut :
openDatabaseOut String
24.454. openFiles
openFiles() – produces a list of all currently open files.
See also:
File [III.20] – the class of all files
The function openFiles is a member of the class Function [III.18].
24.455. openIn
openIn "fff" – opens an input file whose filename is fff.
Other options are available. For details, see openInOut [V.24.456].
The function openIn is a member of the class Function [III.18].
Ways to use openIn :
openIn String
24.456. openInOut
openInOut "fff" – opens an input output file whose filename is fff.
openInOut "!cmd" – opens an input output file which corresponds to a pipe receiving the output from the shell command cmd.
openInOut "$hostname:service" – opens an input output file by connecting to
the specified service port at the specified host.
openInOut "$:service" – opens an input output file by listening to the specified
24.459. OR
687
service port on the local host, and waiting for an incoming connection.
openInOut "$hostname" – opens an input output file by connecting to the Macaulay2
service port (2500) at the specified host.
openInOut "$" – opens an input output file by listening to the Macaulay2 service
port (2500) on the local host, and waiting for an incoming connection.
openInOut f – opens an input output file by accepting a connection to the listener
f, previously created with openListener [V.24.457].
In order to open a socket successfully, there must be a process accepting connections for the desired service on the specified host.
Socket connections are not available on Sun computers, because Sun doesn’t
provide static versions of crucial libraries dealing with network communications, or
the static version doesn’t provide network name service for looking up hostnames.
The various forms listed above can be used also with openIn [V.24.455] and
openOut [V.24.458], with data transfer possible only in the direction specified.
The only subtlety is that with openIn "!foo" the standard input of the command
foo is closed, but with openOut "!foo" the standard output of the command foo
is connected to the standard output of the parent Macaulay 2 process.
The function openInOut is a member of the class Function [III.18].
Ways to use openInOut :
openInOut String
24.457. openListener
f = openListener "$:service" – opens a listener on the local host at the
specified service port.
f = openListener "$" – opens a listener on the local host at the Macaulay2 port
(2500).
Use openInOut f to accept an incoming connection on the listener, returning
a new input output file which serves as the connection.
The function openListener is a member of the class Function [III.18].
Ways to use openListener :
openListener String
24.458. openOut
openOut "fff" – opens an output file whose filename is fff.
Other options are available. For details, see openInOut [V.24.456].
The function openOut is a member of the class Function [III.18].
Ways to use openOut :
openOut String
24.459. or
t or u – returns true if t is true or u is true.
If t is true, then the code in u is not evaluated.
See also:
and [V.24.164] – conjunction
not [V.24.437] – negation
688
24. MISCELLANEOUS DOCUMENTATION
24.460. order
order – used as a key inside finite fields under which is stored the number of
elements in the field. Intended for internal use only
See also:
GaloisField [III.10.1.2] – the class of all Galois fields
The symbol order is a member of the class Symbol [III.21.10].
24.461. override
override(defaults,args) – overrides default values for optional arguments
present in the argument sequence args.
The argument defaults should be an immutable hash table ( usually of type
OptionTable [III.21.5.5]), and args should be a sequence of arguments, some of
which are optional arguments of the form x => v. Each such optional argument
is removed from args, and the value in defaults corresponding to the key x is
replaced by v. The value returned is the modified pair (defaults, args).
This function is intended for internal use only, and is used in the processing of
optional arguments for method functions which accept them.
i1 : defs = new HashTable from { a => 1, b => 2 };
i2 : override(defs, (4,b=>6,5))
o2 = (HashTable{a => 1}, (4, 5))
b => 6
o2 : Sequence
The function override is a member of the class Function [III.18].
24.462. pack
pack(n,v) – packs the elements of the list or sequence v into a table n at a
time.
It produces, from a list v, a list of lists formed by packing the elements of v into
lists n at a time. The last of the lists produced may have fewer than n elements.
i1 : pack(3,{a,b,c,d,e,f,g,h,i,j,k})
o1 = {{a, b, c}, {d, e, f}, {g, h, i}, {j, k}}
o1 : List
The function pack is a member of the class Function [III.18].
Ways to use pack :
pack(BasicList,ZZ)
pack(ZZ,BasicList)
24.463. pad
pad(s,n) – pads the string s to length n with spaces on the right.
pad(n,s) – pads the string s to length n with spaces on the left.
The function pad is a member of the class Function [III.18].
Ways to use pad :
pad(String,ZZ)
24.466. PATH
689
pad(ZZ,String)
24.464. pairs
pairs x – makes a list of all key/value pairs (k,v) in a hash table x.
i1 : x = new HashTable from {a => 1, b => 2, c => 3}
o1 = HashTable{a => 1}
b => 2
c => 3
o1 : HashTable
i2 : pairs x
o2 = {(a, 1), (b, 2), (c, 3)}
o2 : List
The function pairs is a member of the class Function [III.18].
Ways to use pairs :
pairs HashTable
24.465. parent
parent X – yields the parent P of X.
Methods for the instance [V.24.360] of X which are not found in X itself are
sought in P, and its parent, and so on.
The mathematical notion of a set z and a subset y can modeled in this way,
with z being the parent of y.
Things which don’t have instances have the empty class, called Nothing [III.21.7]
as their parent.
The parent of Thing [III.21] is Thing [III.21] itself (because every thing is a
thing).
See also:
classes [I.5.1]
The function parent is a member of the class Function [III.18].
Ways to use parent :
parent Thing
24.466. path
A list of strings containing names of directories in which load [V.24.392] and
input [V.24.358] should seek files.
i1 : path
o1 = {., /home/dan/src/M2/Macaulay2/packages}
o1 : List
i2 : path = append(path, getenv "HOME" | pathSeparator | "re ...
o2 = {., /home/dan/src/M2/Macaulay2/packages, /home/dan/reso ...
o2 : List
690
24. MISCELLANEOUS DOCUMENTATION
24.467. pathSeparator
24.468. pdim
pdim M – calculate the projective dimension of a module M.
For now, the method is to measure the length of a projective resolution.
The function pdim is a member of the class Function [III.18].
Ways to use pdim :
pdim Module
24.469. pfaffians
pfaffians(n,f) – given a skew symmetric matrix f, produce the ideal generated by its n by n Pfaffians.
i1 : R=ZZ/101[a..f]
o1 = R
o1 : PolynomialRing
i2 : m=genericSkewMatrix(R,a,4)
o2 = {0}
{0}
{0}
{0}
|
|
|
|
0
-a
-b
-c
a
0
-d
-e
b
d
0
-f
c
e
f
0
|
|
|
|
4
4
o2 : Matrix R <--- R
i3 : pfaffians(2,m)
o3 = ideal (a, b, d, c, e, f)
o3 : Ideal of R
i4 : pfaffians(4,m)
o4 = ideal(c*d - b*e + a*f)
o4 : Ideal of R
See also:
PfaffiansComputation [III.21.1.11] – the class of all Pfaffians computations
The function pfaffians is a member of the class Function [III.18].
Ways to use pfaffians :
pfaffians(ZZ,Matrix)
Optional arguments :
pfaffians(..., Limit => ...)
24.470. phase
24.471. plus
plus(x,y,...) – yields the sum of its arguments.
24.472. POINCARE
691
If the arguments are strings, they are concatenated. If there are no arguments,
the answer is the integer 0.
The function plus is a member of the class Function [III.18].
24.472. poincare
poincare C – encodes information about the degrees of basis elements of a free
chain complex in a polynomial.
poincare M – the same information about the free resolution of a module M.
The polynomial has a term (-1)^i T_0^(d_0) ... T_(n-1)^(d_(n-1)) in it for each
basis element of C_i with multi-degree {d_0,...,d_(n-1)}. When the multi-degree
has a single component, the term is (-1)^i T^(d_0).
The variable T is defined in a hidden local scope, so will print out as $T and
not be directly accessible.
i1 : R = ZZ/101[x_0 .. x_3,y_0 .. y_3]
o1 = R
o1 : PolynomialRing
i2 : m = matrix table (2, 2, (i,j) -> x_(i+2*j))
o2 = {0} | x_0 x_2 |
{0} | x_1 x_3 |
2
2
o2 : Matrix R <--- R
i3 : n = matrix table (2, 2, (i,j) -> y_(i+2*j))
o3 = {0} | y_0 y_2 |
{0} | y_1 y_3 |
2
2
o3 : Matrix R <--- R
i4 : f = flatten (m*n - n*m)
o4 = {0} | x_2y_1-x_1y_2 x_1y_0-x_0y_1+x_3y_1-x_1y_3 -x_2y_0 ...
1
4
o4 : Matrix R <--- R
i5 : poincare cokernel f
3
2
o5 = 2$T - 3$T + 1
o5 : ZZ[ZZ^1]
(cokernel f).poincare = p – inform the system that the Poincare polynomial of the cokernel of f is p. This can speed the computation of a Groebner basis
of f. For details, see computing Groebner bases [I.3.35].
The function poincare is a member of the class Function [III.18].
Ways to use poincare :
poincare ChainComplex
poincare Ideal
692
24. MISCELLANEOUS DOCUMENTATION
poincare Module
poincare MonomialIdeal
poincare Ring
24.473. poincareComputation
poincareComputation – a key used in a module or monomial ideal to store a
computation of Poincare polynomial.
See also:
poincare [V.24.472] – assemble degrees into polynomial
The symbol poincareComputation is a member of the class Symbol [III.21.10].
24.474. poincareN
poincareN C – encodes information about the degrees of basis elements of a
free chain complex in a polynomial.
The polynomial has a term S^i T_0^(d_0) ... T_(n-1)^(d_(n-1)) in it for each
basis element of C_i with multi-degree {d_0,...,d_(n-1)}.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : poincareN resolution cokernel vars R
4 4
3 3
2 2
o2 = $S $T + 4$S $T + 6$S $T + 4$S*$T + 1
0
0
0
0
o2 : ZZ [$S, $T , Inverses => true]
0
The function poincareN is a member of the class Function [III.18].
Ways to use poincareN :
poincareN ChainComplex
24.475. pop
pop – used as a key. If X is a class, then X.pop will contain a routine which
uses convert [IV.22.1.9] to pop the top item off the engine’s stack and return it.
See also:
engine communication protocol [IV.22.1]
The symbol pop is a member of the class Symbol [III.21.10].
Methods for pop :
pop QQ
pop ZZ
24.476. position
position(v,f) – returns the index of the first element of v satisfying the
condition f, or null if there is none.
The function position is a member of the class Function [III.18].
Code:
-- code for position:
24.480. PRESENTATION
693
-- ../m2/structure.m2:11-17
position = (v,f) -> (
ret := null;
select(
1,
apply(#v, i -> (i,v#i)),
(i,x) -> f(x) and (ret = i; true));
ret)
24.477. positions
positions(v,f) – yields a list of integers giving the positions of the elements
of the list v which yield the value true when the function f is applied.
The function positions is a member of the class Function [III.18].
Code:
-- code for positions:
-- ../m2/structure.m2:7-9
positions = (v,f) -> (
apply(select(pack(2, mingle{v,0 .. #v-1}), p -> f p#0), ...
)
24.478. power
power(x,n) – yields the n-th power of x.
See also:
^ [V.24.149] – a binary operator, usually used for exponents
The function power is a member of the class Function [III.18].
24.479. prepend
prepend(x,v) – yields the list obtained by prepending x to the list v. Similarly
if v is a sequence.
i1 : prepend( x, {a,b,c} )
o1 = {x, a, b, c}
o1 : List
See also:
append [V.24.168] – add to the end of a list
join [V.24.373] – join lists
The function prepend is a member of the class Function [III.18].
Ways to use prepend :
prepend(Thing,BasicList)
24.480. presentation
presentation M – produce a presentation of the module M.
presentation R – produce a presentation of the quotient ring R.
presentation(R,S) – produce a presentation of the quotient ring S over R.
A presentation of M is a map p so that coker p is isomorphic to M. The presentation obtained is expressed in terms of the given generators, i.e., the modules cover
M and target p are identical. The isomorphism can be obtained as map(M,coker
p,1).
694
24. MISCELLANEOUS DOCUMENTATION
Since a module M may be described as a submodule or a subquotient module of
a free module, some computation may be required to produce a presentation. See
also prune [III.13.12.3] which does a bit more work to try to eliminate redundant
generators.
For a quotient ring R, the result is a matrix over the ultimate ambient polynomial ring, whose image is the ideal defining R. The entries of the matrix form a
Groebner basis.
See also:
cover [V.24.234] – get the covering free module
The function presentation is a member of the class Function [III.18].
Ways to use presentation :
presentation Module
presentation PolynomialRing
presentation QuotientRing
presentation(PolynomialRing,PolynomialRing)
presentation(PolynomialRing,QuotientRing)
presentation(QuotientRing,PolynomialRing)
presentation(QuotientRing,QuotientRing)
24.481. print
print x – prints x on the standard output followed by a new line
The return value is null [V.24.440].
The function print is a member of the class Function [III.18].
Code:
-- code for print:
-- ../m2/expressions.m2:1029
print = x -> (<< net x << endl; null)
24.482. print C.dd
24.483. printExamples
printExamples f – prints out the examples of code using the function f provided in the documentation for f.
i1 : printExamples partition
See also:
examples [V.24.278] – list the examples in documentation
document [V.24.257] – install documentation
The function printExamples is a member of the class Function [III.18].
Code:
-- code for printExamples:
-- ../m2/document.m2:387
printExamples = f -> scan(examples f, i -> << i << endl)
24.484. printString
printString(o,s) – send the string s to the output file o.
This function is intended for internal use only.
The argument s may also be a sequence or list, in which case its elements are
printed. If an integer is encountered, then it specifies a number of spaces to be
24.488. PROFILESUMMARY
695
printed. If a symbol or indeterminate is encountered, its name is printed. If null
is encountered, nothing is printed.
i1 : printString(stdio, (a,10,"b",20,c))
a
b
c
o1 = stdio
o1 : File
The function printString is a member of the class Function [III.18].
24.485. processID
processID() – returns the process identifier of the current Macaulay 2 process.
The function processID is a member of the class Function [III.18].
24.486. product
product – provides the product of the members of a list or set, optionally with
a function applied to each one.
The function product is a member of the class Function [III.18].
Ways to use product :
product Set [III.21.5.8.1.6] – product of elements
product Tally [III.21.5.8.7] – product of elements
product {...} [III.19.2.10] – product of elements
product((...),(...),Function)
product((...),Function)
product((...),{...},Function)
product(ZZ,Function) [III.18.19] – product of consecutive values of a
function
product({...},(...),Function)
product({...},Function) [III.18.20] – product of values of a function
product({...},{...},Function) [III.18.21] – product of results of applying
a function pairwise
24.487. profile
f = profile f – replace a global function f by a profiled version.
The new function is the same as the old one, except that when the new function
is run, it will record the number of times it is called and the total execution time.
Use profileSummary [V.24.488] to display the data recorded so far.
The function profile is a member of the class Function [III.18].
Ways to use profile :
profile Function
profile(String,Function)
24.488. profileSummary
profileSummary – a command which will display the data accumulated by
running functions produced with profile [V.24.487].
The command profileSummary is a member of the class Command [III.21.1.2].
696
24. MISCELLANEOUS DOCUMENTATION
24.489. projectiveHilbertPolynomial
projectiveHilbertPolynomial n – produces the projective Hilbert polynomial corresponding to projective space of dimension n.
projectiveHilbertPolynomial(n,d) – produces the projective Hilbert polynomial corresponding to the graded ring of projective space of dimension n, but with
its generator in degree -d.
See also:
ProjectiveHilbertPolynomial [III.21.5.6] – the class of all Hilbert polynomials
The function projectiveHilbertPolynomial is a member of the class Function [III.18].
Ways to use projectiveHilbertPolynomial :
projectiveHilbertPolynomial ZZ
projectiveHilbertPolynomial(ZZ,ZZ)
24.490. promote
promote(f,R) – promotes a ring element f to the ring R.
The element f should be an element of some base ring of R.
A special feature is that if f is rational, and R is not an algebra over QQ, then
an element of R is provided by attempting the evident division.
See also:
baseRings [V.24.185] – store the list of base rings of a ring
The function promote is a member of the class Function [III.18].
Ways to use promote :
promote(Matrix,QQ)
promote(Matrix,ZZ)
promote(MonoidElement,Ring)
promote(MonoidElement,RingElement)
promote(QQ,QQ)
promote(QQ,Ring)
promote(QQ,RingElement)
promote(RingElement,Ring)
promote(RingElement,RingElement)
promote(ZZ,EngineRing)
promote(ZZ,QQ)
promote(ZZ,Ring)
promote(ZZ,RingElement)
promote(ZZ,ZZ)
24.491. protect
protect s – protects the symbol s from having its value changed.
There is no unprotect function, because we want to allow the compiler to take
advantage of the unchangeability.
The documentation function document [V.24.257] protects the symbols it documents.
The function protect is a member of the class Function [III.18].
24.495. PUSHFORWARD(..., STOPBEFORECOMPUTATION => ...)
697
24.492. pruningMap
pruningMap – the key under which is stored the isomorphism to a module M
from the module prune M.
This map exists only after N = prune M has been executed at least once, and
then the map can be obtained with N.pruningMap.
See also:
prune [III.13.12.3] – prune generators and relations
The symbol pruningMap is a member of the class Symbol [III.21.10].
24.493. pseudoRemainder
pseudoRemainder(f,g) – computes the pseudo-remainder for f divided by g.
This is an internal experimental routine.
The function pseudoRemainder is a member of the class Function [III.18].
Ways to use pseudoRemainder :
pseudoRemainder(RingElement,RingElement)
24.494. pushForward
pushForward(f,M) – yields an R-presentation of the S-module M, where f:R
--> S is a ring map, and M is considered as an R-module via f.
If M is not finitely generated over R, then an error is raised.
Currently, R and S must both be polynomial rings over the same base field.
The function pushForward is a member of the class Function [III.18].
Ways to use pushForward :
pushForward(RingMap,Module)
Optional arguments :
pushForward(..., BasisElementLimit => ...)
pushForward(..., DegreeLimit => ...)
pushForward(..., MonomialOrder => ...)
pushForward(..., PairLimit => ...)
pushForward(..., StopBeforeComputation => ...) [V.24.495] – initialize but do not begin the computation
pushForward(..., StopWithMinimalGenerators => ...) [V.24.129.2]
– stop when minimal generators have been determined
pushForward(..., Strategy => ...) [V.24.496] – specify a computational
strategy
pushForward(..., UseHilbertFunction => ...)
24.495. pushForward(..., StopBeforeComputation => ...)
StopBeforeComputation => false – an optional argument used with pushForward [V.24.494].
Tells whether to start the computation, with the default value being true.
See also:
Default value: false [V.24.286]
Function: pushForward [V.24.494]
Option name: StopBeforeComputation [V.24.128]
698
24. MISCELLANEOUS DOCUMENTATION
24.496. pushForward(..., Strategy => ...)
pushForward(f,M,Strategy => v) – an option for pushForward [V.24.494]
which can be used to specify the strategy to be used in the computation.
The strategy option value v should be one of the following.
NonLinear [V.24.109] – use the algorithm which doesn’t assume that the
ring map is linear
Linear [V.24.97] – use the reverse lex order
See also:
Default value: NonLinear [V.24.109]
Function: pushForward [V.24.494]
Option name: Strategy [V.24.130]
24.497. pushForward1
pushForward1(f,M,options) – Given a ring map f : R –> S, and an S-module
M, yields a presentation matrix of the R-submodule of M generated by the given
(S-module) generators of M.
Warning: this function will be removed, and its function incorporated into that
of image [V.24.348] and prune [III.13.12.3].
This is a very basic operation, and is used by several other functions. See, for
example, pushForward [V.24.494]. Therefore we intend to eliminate it, and merge
its function into image [V.24.348] after introducing generalized module homomorphisms which map an R-module to an S-module.
As an example, the following fragment computes the ideal of the rational normal
curve. This could also be done using monomialCurve [V.24.425].
i1 : R = ZZ/101[a..d];
i2 : S = ZZ/101[s,t];
i3 : f = map(S,R,matrix{{s^4, s^3*t, s*t^3, t^4}})
4
3
3
4
o3 = map(S,R,{s , s t, s*t , t })
o3 : RingMap S <--- R
i4 : pushForward1(f,S^1)
o4 = {0} | bc-ad c3-bd2 ac2-b2d b3-a2c |
1
4
o4 : Matrix R <--- R
The following code performs the Groebner computation using a product order
rather than the default elimination order.
i5 : pushForward1(f,S^1,MonomialOrder=>ProductOrder)
o5 = {0} | bc-ad c3-bd2 ac2-b2d b3-a2c |
1
4
o5 : Matrix R <--- R
24.498. PUSHFORWARD1(..., DEGREELIMIT => ...)
699
The computation is stashed inside the ring map, until the computation has
finished completely. This means that you may interrupt this command, and later
restart it. You may alo obtain partial results, as follows.
i6 : f = map(S,R,matrix{{s^4, s^3*t, s*t^3, t^4}})
4
3
3
4
o6 = map(S,R,{s , s t, s*t , t })
o6 : RingMap S <--- R
i7 : pushForward1(f,S^1,DegreeLimit=>4)
o7 = 0
1
o7 : Matrix R <--- 0
After interrupting a computation (using control-C), you may view the equations
so far obtained by using the PairLimit option to prevent any further work from
being done.
i8 : pushForward1(f,S^1,PairLimit=>0)
o8 = {0} | bc-ad c3-bd2 ac2-b2d b3-a2c |
1
4
o8 : Matrix R <--- R
The type PushforwardComputation [III.21.1.13] is used internally by our
current implementation.
The function pushForward1 is a member of the class Function [III.18].
Ways to use pushForward1 :
pushForward1(RingMap,Module)
Optional arguments :
pushForward1(..., BasisElementLimit => ...)
pushForward1(..., DegreeLimit => ...) [V.24.498] – compute only up
to this degree
pushForward1(..., MonomialOrder => ...) [V.24.499] – specify the
elimination order to use in pushForward1
pushForward1(..., PairLimit => ...) [V.24.500] – stop when this number
of pairs is handled
pushForward1(..., StopBeforeComputation => ...) [V.24.501] – initialize but do not begin the computation
pushForward1(..., StopWithMinimalGenerators => ...) [V.24.129.3]
– stop when minimal generators have been determined
pushForward1(..., Strategy => ...) [V.24.502] – specify which algorithm
to use in the computation
pushForward1(..., UseHilbertFunction => ...) [V.24.503] – whether
to use knowledge of the Hilbert function
24.498. pushForward1(..., DegreeLimit => ...)
DegreeLimit => n – keyword for an optional argument used with pushForward1 [V.24.497] which specifies that the computation should halt after dealing
with degree n.
700
24. MISCELLANEOUS DOCUMENTATION
This option is relevant only for homogeneous matrices.
The maximum degree to which to compute is computed in terms of the degrees
of the ring map, f. For example, if f consists of cubics, then to find a quadratic relation, this option should be set to at least 6, by specifying, for example, DegreeLimit
=> 6. The default is infinity.
See also:
pushForward1 [V.24.497] – the main computational component of pushForward
DegreeLimit [V.24.66] – compute up to a certain degree
See also:
Default value: {} [V.24.654]
Function: pushForward1 [V.24.497]
Option name: DegreeLimit [V.24.66]
24.499. pushForward1(..., MonomialOrder => ...)
MonomialOrder => x – a keyword for an optional argument to pushForward1
[V.24.497] which tells which monomial order to use for the Groebner basis computation involved.
Possible values:
MonomialOrder => EliminationOrder – use the natural elimination order
(the default)
MonomialOrder => ProductOrder – use the product order
MonomialOrder => LexOrder – use lexical order
See also:
EliminationOrder [V.24.72] – use the natural elmination order in a pushForward1 computation
See also:
Default value: EliminationOrder [V.24.72]
Function: pushForward1 [V.24.497]
Option name: MonomialOrder [III.10.1.3.2.1]
24.500. pushForward1(..., PairLimit => ...)
PairLimit => n – keyword for an optional argument used with pushForward1 [V.24.497], which specifies that the computation should be stopped after a
certain number of S-pairs have been reduced.
See also:
Default value: infinity [V.24.356]
Function: pushForward1 [V.24.497]
Option name: PairLimit [V.24.113]
24.501. pushForward1(..., StopBeforeComputation => ...)
StopBeforeComputation – keyword for an optional argument used with pushForward1 [V.24.497].
Tells whether to start the computation, with the default value being true.
See also:
Default value: false [V.24.286]
Function: pushForward1 [V.24.497]
Option name: StopBeforeComputation [V.24.128]
24.505. QUOTIENT
701
24.502. pushForward1(..., Strategy => ...)
pushForward1(f,M,Strategy => v) – an option for pushForward1 [V.24.497]
which can be used to specify the strategy to be used in the computation.
The strategy option value v should be one of the following.
NonLinear [V.24.109] – use the algorithm which doesn’t assume that the
ring map is linear
Linear [V.24.97] – use the reverse lex order
The default is for the code to select the best strategy heuristically.
See also:
Default value: NonLinear [V.24.109]
Function: pushForward1 [V.24.497]
Option name: Strategy [V.24.130]
24.503. pushForward1(..., UseHilbertFunction => ...)
UseHilbertFunction => true – a keyword for an optional argument to pushForward1 [V.24.497] which specifies whether to use the Hilbert function, if one has
previously been computed.
The default is to use it if possible.
See also:
Default value: true [V.24.631]
Function: pushForward1 [V.24.497]
Option name: UseHilbertFunction [V.24.144]
24.504. quit
quit – terminates the program and returns 0 as return code.
Files are flushed and closed. Another way to exit is to type the end of file
character, which is typically set to Control-D in unix systems, and is Control-Z
under MS-DOS.
See also:
exit [V.24.280] – exit the program
The command quit is a member of the class Command [III.21.1.2].
24.505. quotient
quotient(I,J) – computes the ideal or submodule quotient (I:J).
The arguments should be ideals in the same ring, or submodules of the same
module. If J is a ring element, then the principal ideal generated by J is used.
The operator : [V.24.29] can be used as an abbreviation, but without optional
arguments; see Module : Module [V.24.102].
For ideals, the quotient is the set of ring elements r such that rJ is contained
in I. If I is a submodule of a module M, and J is an ideal, the quotient is the set of
elements m of M such that Jm is contained in I. Finally, if I and J are submodules
of the same module M, then the result is the set of ring elements r such that rJ is
contained in I.
i1 : R = ZZ/32003[a..d];
i2 : J = monomialCurve(R,{1,4,7})
702
24. MISCELLANEOUS DOCUMENTATION
2
3
3
4
3
o2 = ideal (c - b*d, b c - a d, b - a c)
o2 : Ideal of R
i3 : I = ideal(J_1-a^2*J_0,J_2-d*c*J_0)
3
2 2
3
2
4
3
3
...
o3 = ideal (b c - a c - a d + a b*d, b - a c - c d + b*c*d ...
o3 : Ideal of R
i4 : I : J
3
2
2
3
2
2
o4 = ideal (b - a c + c*d , a - a b + c d)
o4 : Ideal of R
The computation is currently not stored anywhere: this means that the computation cannot be continued after an interrupt. This will be changed in a later
version.
The function quotient is a member of the class Function [III.18].
Ways to use quotient :
quotient(Ideal,Ideal)
quotient(Ideal,RingElement)
quotient(Module,Ideal)
quotient(Module,Module)
quotient(Module,RingElement)
Optional arguments :
quotient(..., MinimalGenerators => ...) [V.24.100.1]
quotient(..., Strategy => ...) [V.24.506] – specify a computational strategy
24.506. quotient(..., Strategy => ...)
quotient(I,J,Strategy => v) – an option which can be used to specify the
strategy to be used in the computation.
The strategy option value v should be one of the following.
Iterate [V.24.94] – use successive ideal quotients (the default)
Linear [V.24.97] – use the reverse lex order
See also:
Default value: null [V.24.440]
Function: quotient [V.24.505]
Option name: Strategy [V.24.130]
24.507. radical
radical I – the radical of the ideal I
If I is an ideal in an affine ring (i.e. a quotient of a polynomial ring over a
field), and if the characteristic of this field is large enough (see below), then this
routine yields the radical of the ideal I.
The method used is the Eisenbud-Huneke-Vasconcelos algorithm. See their
paper in Inventiones Mathematicae, 1993, for more details on the algorithm.
24.508. RANK
703
For an example, see component example [V.24.222].
The algorithms used generally require that the characteristic of the ground field
is larger than the degree of each primary component. In practice, this means that
if the characteristic is something like 32003, rather than e.g. 5, the methods used
will produce the radical of I. Of course, you may do the computation over QQ, but
it will often run much slower. In general, this routine still needs to be tuned for
speed.
See also:
top [V.24.621] – compute the top dimensional components
removeLowestDimension [V.24.513] – remove components of lower dimension
saturate [V.24.534] – saturation of ideal or submodule
quotient [V.24.505] – ideal or submodule quotient
The function radical is a member of the class Function [III.18].
Ways to use radical :
radical Ideal
radical MonomialIdeal
Optional arguments :
radical(..., CompleteIntersection => ...)
radical(..., Unmixed => ...)
24.508. rank
rank M – computes the rank of the module M.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : p = vars R;
1
3
o2 : Matrix R <--- R
i3 : rank kernel p
o3 = 2
i4 : rank cokernel p
o4 = 0
The function rank is a member of the class Function [III.18].
Ways to use rank :
rank ChainComplex
rank CoherentSheaf [III.21.5.4.2.11] – the rank of a coherent sheaf
rank GradedModule
rank Matrix
rank Module
704
24. MISCELLANEOUS DOCUMENTATION
24.509. read
read f – yields a string obtained by reading bytes from the input file f.
read () – reads from stdio, getting input from the user.
read s – reads from stdio, getting input from the user, prompting with the string
s.
Input files are buffered, so the current contents of the buffer are returned if the
buffer is not empty, otherwise reading from the file is attempted first.
i1 : f = openInOut "!cat"
o1 = !cat
o1 : File
i2 : isReady f
o2 = false
i3 : f << "hi there" << flush;
i4 : isReady f
o4 = false
i5 : read f
o5 = hi there
o5 : String
i6 : isReady f
o6 = false
See also:
isReady [V.24.370] – whether a file has data available for reading
get [V.24.320] – get an entire file
The function read is a member of the class Function [III.18].
Ways to use read :
read (...)
read File
read String
24.510. regularity
regularity M – computes the regularity of a module or chain complex C.
For a free chain complex C, the regularity r is the smallest number so that each
basis element of C_i has degree at most i+r. For a module M, the regularity is the
regularity of a free minimal resolution of M.
The function regularity is a member of the class Function [III.18].
Ways to use regularity :
regularity ChainComplex
regularity Module
24.514. REORGANIZE
705
24.511. reloaded
24.512. remove
remove(x,k) – removes the entry stored in the hash table x under the key k.
i1 : x = new MutableHashTable from {a => 1, b => 2}
o1 = MutableHashTable{...}
o1 : MutableHashTable
i2 : remove(x,a)
i3 : x
o3 = MutableHashTable{...}
o3 : MutableHashTable
The function remove is a member of the class Function [III.18].
Ways to use remove :
remove(HashTable,Thing)
24.513. removeLowestDimension
removeLowestDimension I – removes the components of I of lower dimension
Yields the intersection of the primary components of I, excepting those of
lowest dimension (and thus returns the ambient free module of I (or unit ideal), if
I is pure dimensional).
For an example, see also component example [V.24.222].
Computes one free resolution, and some homology groups, but no projections
or determinants are used. For a very brief description of the method used, see
top-method [V.24.623].
See also:
top [V.24.621] – compute the top dimensional components
saturate [V.24.534] – saturation of ideal or submodule
quotient [V.24.505] – ideal or submodule quotient
radical [V.24.507] – compute the radical of an ideal
decompose [V.24.238] – irreducible components of an ideal
The function removeLowestDimension is a member of the class Function
[III.18].
Ways to use removeLowestDimension :
removeLowestDimension Ideal
removeLowestDimension Module
24.514. reorganize
reorganize x – reorganize the database file x, compactifying it.
See also:
Database [III.21.3] – the class of all database files
The function reorganize is a member of the class Function [III.18].
706
24. MISCELLANEOUS DOCUMENTATION
24.515. res
24.516. reshape
reshape(F,G,m) – reshapes the matrix m to give a map from G to F.
It yields the matrix obtained from m of shape F <— G, by taking elements from
the first row of m, then the second, and so on, filling them into the result row by
row. Currently, it is assumed that m and the result both have the same number of
entries. The resulting map is always of degree zero.
The function reshape is a member of the class Function [III.18].
Code:
-- code for reshape:
-- ../m2/matrix1.m2:297-301
reshape = (F, G, m) -> (
if not isFreeModule F or not isFreeModule G
then error "expected source and target to be free modul ...
sendgg(ggPush m, ggPush F, ggPush G, ggreshape);
getMatrix ring m)
24.517. resolution
The function resolution is a member of the class Function [III.18].
Ways to use resolution :
resolution Ideal [III.11.9] – make a projective resolution
resolution Matrix [III.12.52] – make a projective resolution
resolution Module [III.13.18] – make a projective resolution
Optional arguments :
resolution(..., DegreeLimit => ...) [V.24.518] – compute only up to this
degree
resolution(..., HardDegreeLimit => ...) [V.24.519] – compute only up
to this degree
resolution(..., LengthLimit => ...) [V.24.520] – stop when the resolution
reaches this length
resolution(..., PairLimit => ...) [V.24.521] – stop when this number of
pairs are handled
resolution(..., SortStrategy => ...) [V.24.522] – specify a strategy for
sorting S-pairs
resolution(..., StopBeforeComputation => ...) [V.24.523] – whether
to stop the computation immediately
resolution(..., Strategy => ...) [V.24.524] – specify a computational
strategy
resolution(..., SyzygyLimit => ...) [V.24.525] – stop when this number
of syzygies are obtained
24.518. resolution(..., DegreeLimit => ...)
DegreeLimit => n – keyword for an optional argument used with resolution
[V.24.517] which specifies that the computation should halt after dealing with degree n.
This option is relevant only for homogeneous modules.
One might get some matrix entries of slightly higher degree than requested.
i1 : R = ZZ/101[x,y,z,w];
24.520. RESOLUTION(..., LENGTHLIMIT => ...)
707
i2 : M = cokernel matrix {{x*y-z^2,y^2-w^2}}
o2 = cokernel {0} | xy-z2 y2-w2 |
1
o2 : R - module, quotient of R
i3 : res(M,DegreeLimit => 1)
1
2
o3 = R <-- R
0
1
o3 : ChainComplex
i4 : res(M,DegreeLimit => 2)
1
2
1
o4 = R <-- R <-- R
0
1
2
o4 : ChainComplex
See also:
Default value: null [V.24.440]
Function: resolution [V.24.517]
Option name: DegreeLimit [V.24.66]
24.519. resolution(..., HardDegreeLimit => ...)
HardDegreeLimit – keyword for an optional argument used with resolution
[V.24.517].
The default value is {}.
Information above the specified degree is discarded.
See also:
Default value: {} [V.24.654]
Function: resolution [V.24.517]
Option name: HardDegreeLimit [V.24.89]
24.520. resolution(..., LengthLimit => ...)
LengthLimit – keyword for an optional argument used with resolution [V.24.517]
which indicates how long a resolution to make.
For polynomial rings over a field or over the integers, the length is taken to be
the dimension of the ring, so the complete resolution will be obtained. For quotient
rings of such rings, the same number is used, so the complete resolution may not
be obtained.
In the current version, asking for a second and longer resolution of the same
module involves recomputing the resolution from scratch. Eventually the previous
work will be used and the recomputation will go quicker.
The resolution returned may actually be one step longer than requested. The
extra differential is not guaranteed to be minimal.
See also:
708
24. MISCELLANEOUS DOCUMENTATION
Default value: infinity [V.24.356]
Function: resolution [V.24.517]
Option name: LengthLimit [V.24.95]
24.521. resolution(..., PairLimit => ...)
PairLimit – keyword for an optional argument used with resolution [V.24.517],
which specifies that the computation should be stopped after a certain number of
S-pairs have been reduced.
i1 : R = QQ[x,y,z,w]
o1 = R
o1 : PolynomialRing
i2 : M = cokernel matrix {{x*y-z,y^2-w-1,w^4-3}}
o2 = cokernel {0} | xy-1z y2-1w-1 w4-3 |
1
o2 : R - module, quotient of R
i3 : res(M, PairLimit => 1)
1
1
o3 = R <-- R
0
1
o3 : ChainComplex
i4 : res(M, PairLimit => 10)
1
4
2
o4 = R <-- R <-- R
0
1
2
o4 : ChainComplex
i5 : res(M, PairLimit => 20)
1
6
8
2
o5 = R <-- R <-- R <-- R
0
1
2
3
o5 : ChainComplex
See also:
Default value: infinity [V.24.356]
Function: resolution [V.24.517]
Option name: PairLimit [V.24.113]
24.522. resolution(..., SortStrategy => ...)
SortStrategy => n – an option for resolution [V.24.517] which specifies the
strategy to be used for sorting S-pairs.
24.525. RESOLUTION(..., SYZYGYLIMIT => ...)
709
Not implemented yet.
See also:
Default value: 0
Function: resolution [V.24.517]
Option name: SortStrategy [V.24.126]
24.523. resolution(..., StopBeforeComputation => ...)
StopBeforeComputation – keyword for an optional argument used with resolution [V.24.517].
Tells whether to start the computation, with the default value being true. This
can be useful when you want to obtain the partially computed resolution contained
in an interrupted computation.
See also:
Default value: false [V.24.286]
Function: resolution [V.24.517]
Option name: StopBeforeComputation [V.24.128]
24.524. resolution(..., Strategy => ...)
Strategy => n – an option for resolution [V.24.517] which specifies which
algorithm to use. Strategies are specified by number and the algorithms available
are
Strategy => 0 – Compute syzygies on the Groebner bases of each syzygy
module. The algorithm uses important speedups due to R. La Scala.
This algorithm appears to be on the average the fastest.
Strategy => 1 – An older version of algorithm 0, which doesn’t allow as
much experimentation, but can sometimes be marginally faster.
Strategy => 2 – Compute syzygies on the minimal generators of each
matrix in the resolution. Over quotient rings, it’s preferred.
Strategy => 3 – Same as algorithm 2, but compute those Hilbert functions
which allow removal of S-pairs (a la Robbiano, et al.). Sometimes this
improvement can be very dramatic.
All algorithms use induced monomial orders (Schreyer orders), since this makes
an enormous improvement to the efficiency of the algorithm.
See also:
Default value: null [V.24.440]
Function: resolution [V.24.517]
Option name: Strategy [V.24.130]
24.525. resolution(..., SyzygyLimit => ...)
SyzygyLimit – keyword for an optional argument used with resolution [V.24.517],
which specifies that the computation should stop after a certain number of syzygies
have computed.
i1 : R = ZZ/101[x,y,z,w];
i2 : M = cokernel matrix {{x*y-z^2,y^2-w^2,w^4}}
o2 = cokernel {0} | xy-z2 y2-w2 w4 |
710
24. MISCELLANEOUS DOCUMENTATION
1
o2 : R - module, quotient of R
i3 : res(M,SyzygyLimit => 1)
1
1
o3 = R <-- R
0
1
o3 : ChainComplex
i4 : res(M,SyzygyLimit => 2)
1
2
o4 = R <-- R
0
1
o4 : ChainComplex
i5 : res(M,SyzygyLimit => infinity)
1
3
3
1
o5 = R <-- R <-- R <-- R
0
1
2
3
o5 : ChainComplex
See also:
Default value: infinity [V.24.356]
Function: resolution [V.24.517]
Option name: SyzygyLimit [V.24.134]
24.526. restart
restart – restart Macaulay 2 from the beginning.
Functions previously registered with addEndFunction [V.24.155] will be called
first.
The command restart is a member of the class Command [III.21.1.2].
24.527. returnCode
returnCode – a key for a GroebnerBasis [III.15] under which is stored the
return code from the engine for the computation.
The symbol returnCode is a member of the class Symbol [III.21.10].
24.528. reverse
reverse v – yields a list containing the elements of the list v in reverse order.
i1 : reverse {a,b,c,d}
o1 = {d, c, b, a}
o1 : List
24.532. RUNSTARTFUNCTIONS
711
The function reverse is a member of the class Function [III.18].
Ways to use reverse :
reverse BasicList
24.529. rsort
rsort v – produces a reverse sorted version of the list v.
The rsort function uses <= [V.24.36] to compare elements of the list, which in
turn calls upon ? [V.24.46].
i1 : rsort {g,d,w,s,c,a,r}
o1 = {a, c, d, g, r, s, w}
o1 : List
i2 : rsort {4,2,3,1}
o2 = {4, 3, 2, 1}
o2 : List
See also:
sort [V.24.556] – sort a list
<= [V.24.36] – less than or equal
? [V.24.46] – comparison operator
The function rsort is a member of the class Function [III.18].
24.530. run
run s – runs the command string s by passing it to the operating system.
The return value is the exit status of the command, a small integer which is
usually zero.
The function run is a member of the class Function [III.18].
24.531. runEndFunctions
runEndFunctions() – call all the functions previously recorded by addEndFunction [V.24.155].
This function is intended for internal use only.
The funuctions are called with no arguments.
The function runEndFunctions is a member of the class Function [III.18].
Code:
-- code for runEndFunctions:
-- ../m2/classes.m2:94
runEndFunctions = () -> scan(endFunctions, f -> f())
24.532. runStartFunctions
runStartFunctions() – call all the functions previously recorded by addStartFunction [V.24.156].
This function is intended for internal use only.
The funuctions are called with no arguments.
The function runStartFunctions is a member of the class Function [III.18].
Code:
-- code for runStartFunctions:
712
24. MISCELLANEOUS DOCUMENTATION
-- ../m2/setup.m2:232
runStartFunctions = () -> scan(startFunctions, f -> f())
24.533. same
same v – whether every element of the list v is the same. The comparison is
done with == [V.24.39].
The function same is a member of the class Function [III.18].
24.534. saturate
saturate(I,J,options) – computes the saturation (I : J^*) of I with respect to J. If J is not given, the ideal J is taken to be the ideal generated by the
variables of the ring R of I.
If I is either an ideal or a submodule of a module M, the saturation (I : J^*)
is defined to be the set of elements f in the ring (first case) or in M (second case)
such that J^N * f is contained in I, for some N large enough.
For example, one way to homogenize an ideal is to homogenize the generators
and then saturate with respect to the homogenizing variable.
i1 : R = ZZ/32003[a..d];
i2 : I = ideal(a^3-b, a^4-c)
3
4
o2 = ideal (a - b, a - c)
o2 : Ideal of R
i3 : Ih = homogenize(I,d)
3
2
4
3
o3 = ideal (a - b*d , a - c*d )
o3 : Ideal of R
i4 : saturate(Ih,d)
2
2
3
2
3
2
o4 = ideal (a*b - c*d, a c - b d, b - a*c , a - b*d )
o4 : Ideal of R
We can use this command to remove graded submodules of finite length.
i5 : m = ideal vars R
o5 = ideal (a, b, c, d)
o5 : Ideal of R
i6 : M = R^1 / (a * m^2)
o6 = cokernel {0} | a3 a2b a2c a2d ab2 abc abd ac2 acd ad2 |
1
o6 : R - module, quotient of R
i7 : M / saturate 0_M
24.537. SCAN
713
o7 = cokernel {0} | a a3 a2b a2c a2d ab2 abc abd ac2 acd ad2 ...
1
o7 : R - module, quotient of R
The computation is currently not stored anywhere: this means that the computation cannot be continued after an interrupt. This will be changed in a later
version.
The function saturate is a member of the class Function [III.18].
Ways to use saturate :
saturate Ideal
saturate Module
saturate Vector
saturate(Ideal,Ideal)
saturate(Ideal,RingElement)
saturate(Module,Ideal)
saturate(Module,RingElement)
saturate(MonomialIdeal,MonomialIdeal)
Optional arguments :
saturate(..., DegreeLimit => ...) [V.24.535] – compute up to a certain
degree
saturate(..., MinimalGenerators => ...) [V.24.100.2]
saturate(..., Strategy => ...) [V.24.536] – specify a computational strategy
24.535. saturate(..., DegreeLimit => ...)
DegreeLimit => n – keyword for an optional argument used with saturate
[V.24.534] which specifies that the computation should halt after dealing with degree n.
See also:
Default value: {} [V.24.654]
Function: saturate [V.24.534]
Option name: DegreeLimit [V.24.66]
24.536. saturate(..., Strategy => ...)
The strategy option value should be one of the following:
Linear [V.24.97] – use the reverse lex order
Iterate [V.24.94] – use successive ideal quotients (the default)
Bayer [V.24.56] – use the method in Bayer’s thesis
Elimination [V.24.71] – compute the saturation by elimination
See also:
Default value: null [V.24.440]
Function: saturate [V.24.534]
Option name: Strategy [V.24.130]
24.537. scan
See also:
select [V.24.541] – select elements from a list or hash table
any [V.24.167] – whether an element satisfies a condition
714
24. MISCELLANEOUS DOCUMENTATION
all [V.24.161] – whether all elements satisfy a condition
member [V.24.404] – test membership in a list
The function scan is a member of the class Function [III.18].
Ways to use scan :
scan(BasicList,Function) [III.18.22] – apply a function to each element
of a list
scan(ZZ,Function) [III.18.23] – apply a function to 0 .. n-1
24.538. scanKeys
scanKeys(x,f) – apply the function f to each key used in the hash table or
database x.
This function requires an immutable hash table. To scan the keys in a mutable
hash table, use scan(keys x, f).
The function scanKeys is a member of the class Function [III.18].
Ways to use scanKeys :
scanKeys(Database,Function)
scanKeys(HashTable,Function)
24.539. scanPairs
The function scanPairs is a member of the class Function [III.18].
Ways to use scanPairs :
scanPairs(HashTable,Function) [III.18.24] – apply a function to pairs
in a hash table
24.540. scanValues
scanValues(x,f) – apply the function f to each value appearing in the hash
table x.
This function requires an immutable hash table. To scan the values in a mutable
hash table, use scan(values x, f).
The function scanValues is a member of the class Function [III.18].
Ways to use scanValues :
scanValues(HashTable,Function)
24.541. select
See also:
scan [V.24.537] – apply a function to each element
apply [V.24.169] – apply a function to each element
any [V.24.167] – whether an element satisfies a condition
all [V.24.161] – whether all elements satisfy a condition
member [V.24.404] – test membership in a list
mutable [V.24.427] – whether something may be modified
The function select is a member of the class Function [III.18].
Ways to use select :
select(BasicList,Function) [III.18.25] – select elements from a list
select(HashTable,Function) [III.18.26] – select from a hash table
select(ZZ,BasicList,Function) [III.18.27] – select elements from a list
select(ZZ,HashTable,Function) [III.18.28] – select from a hash table
24.543. SEQUENCE
715
24.542. selectInSubring
selectInSubring(i,m) – Form the submatrix of the matrix ’m’ consisting
of those columns which lie in the subring generated by the first ’i’ parts of the
monomial order.
For example, consider the graded lexicographic order
i1 : R = ZZ/101[a..d,MonomialOrder=>Lex]
o1 = R
o1 : PolynomialRing
i2 : m = matrix{{b^2-c^2, a^2 - b^2, c*d}}
o2 = {0} | b2-c2 a2-b2 cd |
1
3
o2 : Matrix R <--- R
i3 : selectInSubring(1,m)
o3 = {0} | b2-c2 cd |
1
2
o3 : Matrix R <--- R
i4 : selectInSubring(2,m)
o4 = {0} | cd |
1
1
o4 : Matrix R <--- R
i5 : selectInSubring(3,m)
o5 = 0
1
o5 : Matrix R <--- 0
Caveats: this routine doesn’t do what one would expect for graded orders such
as ’GLex’. There, the first part of the monomial order is the degree, which is usually
not zero. This routine should detect and correct this.
The function selectInSubring is a member of the class Function [III.18].
Ways to use selectInSubring :
selectInSubring(ZZ,Matrix)
24.543. sequence
sequence v – returns v if v is a sequence, otherwise makes a sequence of length
one containing v.
i1 : sequence 4
o1 = singleton 4
o1 : Sequence
716
24. MISCELLANEOUS DOCUMENTATION
i2 : sequence {4,5}
o2 = singleton {4, 5}
o2 : Sequence
i3 : sequence (4,5)
o3 = (4, 5)
o3 : Sequence
See also:
singleton [III.19.3.1] – make a sequence of length one
sequences [I.4.16]
The function sequence is a member of the class Function [III.18].
Ways to use sequence :
sequence Thing
24.544. set
set v – yields the set whose elements are the members of the list v.
See also:
Set [III.21.5.8.1] – the class of all sets
The function set is a member of the class Function [III.18].
Ways to use set :
set (...)
set {...}
24.545. setEcho
setEcho stdio – turn on echoing of characters typed to the standard input.
The function setEcho is a member of the class Function [III.18].
24.546. setrecursionlimit
setrecursionlimit n – sets the recursion limit to n.
It returns the old value. The recursion limit governs the nesting level permissible for calls to functions.
The function setrecursionlimit is a member of the class Function [III.18].
24.547. shield
shield x – executes the expression x, temporarily ignoring interrupts.
24.548. showStructure
showStructure – a command which displays the structure of types assigned to
global variables.
showStructure (X,Y,...) – a command which displays the structure of the types
specified.
Each such type is displayed to the right of its parent.
A type is an instance Type [III.21.5.4.11].
24.550. SIN
717
i1 : showStructure {List, Array, Sequence, MutableHashTable, ...
o1 = Thing : BasicList : VisibleList : Array
List
Sequence
HashTable : MutableHashTable : Type : Monoid
Ring
ZZ
o1 : Net
See also:
showUserStructure [V.24.549] – show relationship between types defined
by user
parent [V.24.465] – parent type of an object
The command showStructure is a member of the class Command [III.21.1.2].
24.549. showUserStructure
showUserStructure – a command which displays the structure of types defined
by the user and assigned to global variables.
Each such class is displayed to the right of its parent.
A type is an instance of the class Type [III.21.5.4.11].
i1 : X = new Type of List
o1 = X
o1 : Type
i2 : Y = new Type of X
o2 = Y
o2 : Type
i3 : Z = new Type of X
o3 = Z
o3 : Type
i4 : showUserStructure
o4 = Thing : BasicList : VisibleList : List : X : Y
Z
o4 : Net
See also:
showStructure [V.24.548] – show relationship between types
parent [V.24.465] – parent type of an object
The command showUserStructure is a member of the class Command [III.21.1.2].
24.550. sin
sin x – computes the sine of x.
The function sin is a member of the class Function [III.18].
718
24. MISCELLANEOUS DOCUMENTATION
Ways to use sin :
sin RR
sin ZZ
24.551. singularLocus
singularLocus R – produce the singular locus of a ring, which is assumed to
be integral and defined by a homogeneous ideal.
Can also be applied to an ideal, in which case the singular locus of the quotient
ring is returned.
The function singularLocus is a member of the class Function [III.18].
Ways to use singularLocus :
singularLocus Ideal
singularLocus ProjectiveVariety
singularLocus Ring
24.552. sinh
sinh x – computes the hyperbolic sine of x.
The function sinh is a member of the class Function [III.18].
Ways to use sinh :
sinh RR
sinh ZZ
24.553. size
size x – returns the size of x which usually gives a rough indication of memory
space required to store the object x.
For a polynomial, the size is the number of terms.
This function should be replaced by something more generally useful.
The function size is a member of the class Function [III.18].
Ways to use size :
size RingElement
24.554. sleep
sleep n – sleeps for n seconds.
The function sleep is a member of the class Function [III.18].
24.555. someTerms
someTerms(f,i,n) – select n terms from the polynomial f, starting with the
i-th one, and return the resulting polynomial.
The function someTerms is a member of the class Function [III.18].
Ways to use someTerms :
someTerms(RingElement,ZZ,ZZ)
24.556. sort
sort v – produces a sorted version of the list v.
The sort function uses <= [V.24.36] to compare elements of the list, which in
turn calls upon ? [V.24.46].
24.557. SORTCOLUMNS
719
i1 : sort {c,e,a,f,b,f}
o1 = {f, f, e, c, b, a}
o1 : List
i2 : sort {4,2,6,3,8,2}
o2 = {2, 2, 3, 4, 6, 8}
o2 : List
See also:
rsort [V.24.529] – sort a list in reverse order
<= [V.24.36] – less than or equal
? [V.24.46] – comparison operator
The function sort is a member of the class Function [III.18].
24.557. sortColumns
sortColumns f – sorts the columns of a matrix, returning a list of integers
describing the resulting permutation.
The sort ordering used is by degree first, and then by monomial order. Optional
arguments may be given to specify whether the ordering is ascending, descending,
or ignored. The default ordering is ascending.
i1 : R = ZZ/101[a..c];
i2 : f = matrix{{1,a,a^2,b^2,b,c,c^2,a*b,b*c,a*c}}
o2 = {0} | 1 a a2 b2 b c c2 ab bc ac |
1
10
o2 : Matrix R <--- R
i3 : s = sortColumns f
o3 = {0, 5, 4, 1, 6, 8, 9, 3, 7, 2}
o3 : List
i4 : f_s
o4 = {0} | 1 c b a c2 bc ac b2 ab a2 |
1
10
o4 : Matrix R <--- R
i5 : s = sortColumns(f,DegreeOrder => Descending)
o5 = {6, 8, 9, 3, 7, 2, 5, 4, 1, 0}
o5 : List
i6 : f_s
o6 = {0} | c2 bc ac b2 ab a2 c b a 1 |
1
10
720
24. MISCELLANEOUS DOCUMENTATION
o6 : Matrix R <--- R
The function sortColumns is a member of the class Function [III.18].
Ways to use sortColumns :
sortColumns Matrix
Optional arguments :
sortColumns(..., DegreeOrder => ...) [V.24.558] – sort primarily by
degree
sortColumns(..., MonomialOrder => ...) [V.24.559] – specify Ascending or Descending sort order
24.558. sortColumns(..., DegreeOrder => ...)
DegreeOrder => x – an optional argument for use with the function sortColumns [V.24.557].
The possible values for x are Ascending [V.24.53], Descending [V.24.68], and
null [V.24.440].
See also:
Default value: Ascending [V.24.53]
Function: sortColumns [V.24.557]
Option name: DegreeOrder [V.24.67]
24.559. sortColumns(..., MonomialOrder => ...)
MonomialOrder => x – an optional argument for use with the function sortColumns [V.24.557].
The possible values for x are Ascending [V.24.53] (the default value) and
Descending [V.24.68].
See also:
Default value: Ascending [V.24.53]
Function: sortColumns [V.24.557]
Option name: MonomialOrder [III.10.1.3.2.1]
24.560. source
source h – the source of a morphism h.
The function source is a member of the class Function [III.18].
Code:
-- code for source:
-- ../m2/methods.m2:180-183
source = (h) -> (
if h#?(symbol source) then h.source
else if (class h)#?(symbol source) then (class h)#?(sym ...
else error ( toString h, " of class ", toString class h ...
24.561. specifying typical values
For the purpose of construction good documentation automatically, it is useful
to specify the type of value typically returned by a function or method. For example,
the function isModule [III.21.2.15] returns a boolean value, and this is specified
when creating the method function with the option TypicalValue [V.24.142] as
follows.
isModule = method(TypicalValue => Boolean)
24.562. SPLICE
721
Other functions, such as prune [III.13.12.3], return values of various types,
depending on the type of the arguments provided. To install a function f as the
handler for prune applied to a matrix, we would normally use the following statement.
prune Matrix := f
To specify that the value typically returned is a matrix (of class Matrix), we replace
f by Matrix => f, as follows.
prune Matrix := Matrix => f
Here is the way our code looks.
i1 : code(prune, Matrix)
o1 = -- ../../modules2.m2:387-392
prune(Matrix) := Matrix => (m) -> (
M := source m;
if not M.?pruningMap then m = m * (prune M).prunin ...
N := target m;
if not N.?pruningMap then m = (prune N).pruningMap ...
m)
o1 : Net
The information is stored in the hash table typicalValues [V.24.634], and can
be recovered like this.
i2 : typicalValues#(prune,Matrix)
o2 = Matrix
o2 : Type
-- the class of all matrices
Warning: don’t imagine that a definition of the form
f = t -> (...)
can be replaced with a declaration of the following form.
f = X => t -> (...)
The difference here is that here we are using simple assignment, rather than installing a method. To document the return type is X in this case, make an entry in
typicalValues directly.
f = t -> (...)
typicalValues#f = X
24.562. splice
splice v – yields a new list v where any members of v which are sequences
are replaced by their elements.
Works also for sequences, and leaves other expressions unchanged. Copying
the list v is always done when v is mutable. Certain functions always splice their
arguments or their argument lists for the sake of convenience.
i1 : splice ((a,b),c,(d,(e,f)))
o1 = (a, b, c, d, (e, f))
o1 : Sequence
i2 : splice [(a,b),c,(d,(e,f))]
o2 = [a, b, c, d, (e, f)]
722
24. MISCELLANEOUS DOCUMENTATION
o2 : Array
See also:
deepSplice [V.24.239] – remove subsequences
The function splice is a member of the class Function [III.18].
Ways to use splice :
splice BasicList
24.563. sqrt
sqrt x – provides the square root of the number x.
The function sqrt is a member of the class Function [III.18].
Ways to use sqrt :
sqrt RR
sqrt ZZ
24.564. standardForm
standardForm f – converts a polynomial or monomial to a form involving hash
tables.
A polynomial is represented by hash tables in which the keys are hash tables
representing the monomials and the values are the coefficients.
The monomials themselves are represented by hash tables in which the keys
are the variables and the values are the corresponding exponents.
i1 : R = ZZ/101[x,y,z];
i2 : standardForm (x^2 - 7 + x*y*z^11 + y)
o2 = HashTable{HashTable{0
1
2
HashTable{0
HashTable{1
HashTable{}
=>
=>
=>
=>
=>
=>
1 } => 1}
1
11
2} => 1
1} => 1
-7
o2 : HashTable
The function standardForm is a member of the class Function [III.18].
Ways to use standardForm :
standardForm MonoidElement
standardForm RingElement
24.565. stats
stats g – describe the status of a Groebner basis computation or of a resolution
computation.
i1 : ZZ/101[a..f]
ZZ
o1 = --- [a, b, c, d, e, f]
101
o1 : PolynomialRing
24.568. STDIO
723
i2 : stats gb matrix {{a*b, b*c},{a^3*f, b^3*e}}
o2 =
o2 : String
See also:
GroebnerBasis [III.15] – the class of all Groebner bases
Resolution [III.21.5.4.8] – the class of all resolution computations
The function stats is a member of the class Function [III.18].
Ways to use stats :
stats GeneralOrderedMonoid
stats GroebnerBasis [III.15.3] – – display some statistics about the computation
24.566. status
status C – displays the status of the computation of a chain complex C constructed by resolution [V.24.517]. The display has the same shape as the display
produced by betti [III.21.6.5], but the number(s) displayed in each degree differ.
Options:
TotalPairs [V.24.141] – display the total number of S-pairs, default value
true
PairsRemaining [V.24.114] – display the number of S-pairs remaining,
default value false
Monomials [V.24.103] – display the number of monomials, default value
false
The function status is a member of the class Function [III.18].
Ways to use status :
status ChainComplex
status Resolution
Optional arguments :
status(..., Monomials => ...)
status(..., PairsRemaining => ...)
status(..., TotalPairs => ...)
24.567. stderr
stderr – the standard error output file.
Use this file to display error messages on the user’s screen.
The file stderr is a member of the class File [III.20].
24.568. stdio
stdio – the standard input output file.
Use this file to get input from the terminal, or to display information on the
user’s screen. This is the file always used by print [V.24.481] and used << [V.24.34]
if it is not explicitly given a file.
The file stdio is a member of the class File [III.20].
724
24. MISCELLANEOUS DOCUMENTATION
24.569. subclass
We say that a class X is a subclass of a class P if P is X, or P is the parent
[V.24.465] of X, or P is the parent of the parent of X, and so on. See also classes
[I.5.1].
24.570. submatrix
submatrix(m, rows, cols) – yields a submatrix of the matrix m.
submatrix(m, cols) – yields a submatrix of the matrix m.
Yields an r by c matrix, where r is the length of the list of integers rows, and c is
the length of the list of integers cols. The (i,j)-th entry of the result is m_(rows_i,
cols_j). If necessary, any sequences in the lists are spliced into the list.
i1 : R = ZZ/101[a .. o]
o1 = R
o1 : PolynomialRing
i2 : m = genericMatrix(R, a, 3, 5)
o2 = {0} | a d g j m |
{0} | b e h k n |
{0} | c f i l o |
3
5
o2 : Matrix R <--- R
i3 : submatrix(m, {1,2,0}, {0..2, 4})
o3 = {0} | b e h n |
{0} | c f i o |
{0} | a d g m |
3
4
o3 : Matrix R <--- R
If rows or cols is omitted, all the indices are used.
i4 : submatrix(m, {1,2}, )
o4 = {0} | b e h k n |
{0} | c f i l o |
2
5
o4 : Matrix R <--- R
It is an error if any element of rows or cols is out of range.
The function submatrix is a member of the class Function [III.18].
Ways to use submatrix :
submatrix(Matrix,(...),(...))
submatrix(Matrix,(...),{...})
submatrix(Matrix,Nothing,{...})
submatrix(Matrix,{...})
submatrix(Matrix,{...},(...))
submatrix(Matrix,{...},Nothing)
submatrix(Matrix,{...},{...})
24.572. SUBSTITUTE
725
24.571. subscript
subscript – a key used in scripted functors under which is stored the function
of one variable that accepts the subscript and returns a scripted functor that accepts
the arguments.
See also:
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
The symbol subscript is a member of the class Symbol [III.21.10].
24.572. substitute
substitute(f,v) – substitute values for the variables in the matrix, module,
vector, polynomial, or monomial f as specified by v.
If f is a matrix over R, and v is a 1 by k matrix over another ring S, then the
result is obtained by substituting the entries in v for the variables in R.
If f is a module over R, then substitution amounts to substitution in the matrices
of generators and relations defining the module. This is not the same as tensor
product!
If v is a ring, then the result is obtained by substituting the variables of v for
the variables of R with the same name. The substitution extends to the coefficient
ring of R, and so on.
If v is a list of options {a => f, b => g, ...} then the variable a is replaced
by the polynomial f, etc.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing
i2 : f = x+2*y+3*z
o2 = x + 2y + 3z
o2 : R
i3 : substitute(f,{x=>x^3, y=>y^3})
3
3
o3 = x + 2y + 3z
o3 : R
i4 : S = ZZ/101[z,y,x]
o4 = S
o4 : PolynomialRing
i5 : substitute(f,S)
o5 = 3z + 2y + x
o5 : S
The function substitute is a member of the class Function [III.18].
Ways to use substitute :
726
24. MISCELLANEOUS DOCUMENTATION
substitute(Ideal,Matrix)
substitute(Ideal,Option)
substitute(Ideal,Ring)
substitute(Ideal,{...})
substitute(Matrix,Matrix)
substitute(Matrix,Option)
substitute(Matrix,Ring)
substitute(Matrix,ZZ)
substitute(Matrix,{...})
substitute(Module,Matrix)
substitute(Module,Option)
substitute(Module,Ring)
substitute(Module,{...})
substitute(RingElement,Matrix)
substitute(RingElement,Option)
substitute(RingElement,Ring)
substitute(RingElement,{...})
substitute(Vector,Matrix)
substitute(Vector,Option)
substitute(Vector,Ring)
substitute(Vector,{...})
24.573. substring
substring(s,i,n) – yields the substring of the string s starting at position i
with length n.
substring(s,i) – yields the substring of s starting at position i and continuing
to the end of s.
Positions are numbered starting at 0.
Requests for character positions out of bounds are silently ignored.
The function substring is a member of the class Function [III.18].
Ways to use substring :
substring(String,ZZ)
substring(String,ZZ,ZZ)
24.574. subtable
subtable(u,v,m) – yields the subtable of the table m obtained from the list u
of row numbers and the list v of column numbers.
i1 : m = table(5,5,identity)
o1 = {{(0, 0), (0, 1), (0, 2), (0, 3), (0, 4)}, {(1, 0), (1, ...
o1 : List
i2 : subtable({1,3,4},toList(2..4), m)
o2 = {{(1, 2), (1, 3), (1, 4)}, {(3, 2), (3, 3), (3, 4)}, {( ...
o2 : List
24.577. SUPERSCRIPT
727
The function subtable is a member of the class Function [III.18].
Code:
-- code for subtable:
-- ../m2/tables.m2:7
subtable = (u,v,m) -> table(u, v, (i,j)->m_i_j)
24.575. sum
sum – provides the sum of the members of a list, set, or chain complex, optionally with a function applied to each one.
The function sum is a member of the class Function [III.18].
Ways to use sum :
sum ChainComplex [III.13.13] – direct sum of the components of a chain
complex
sum ChainComplexMap [III.12.41] – direct sum of the components of
a chain map
sum Set [III.21.5.8.1.9] – sum of elements
sum Tally [III.21.5.8.8] – sum of elements
sum {...} [III.19.2.12] – sum the elements of a list
sum((...),(...),Function)
sum((...),Function)
sum((...),{...},Function)
sum(ZZ,Function) [III.18.29] – sum consecutive values of a function
sum({...},(...),Function)
sum({...},Function) [III.18.30] – sum results of applying a function
sum({...},{...},Function) [III.18.31] – sum results of applying a function
pairwise
24.576. super
super M – yields the module which the module M is a submodule of.
super f – if f is a map whose target is a submodule of M, yields the composite of
f with the inclusion into M.
See also:
cover [V.24.234] – get the covering free module
ambient [V.24.162] – ambient free module or ring
The function super is a member of the class Function [III.18].
Ways to use super :
super GradedModule
super Matrix
super Module
24.577. superscript
superscript – a key used in scripted functors under which is stored the function of one variable that accepts the superscript and returns a scripted functor that
accepts the arguments.
See also:
ScriptedFunctor [III.21.5.4.10] – the class of all scripted functors
The symbol superscript is a member of the class Symbol [III.21.10].
728
24. MISCELLANEOUS DOCUMENTATION
24.578. symbol
symbol s – provides the symbol s, even if s currently has a value.
i1 : num
o1 = num
o1 : Symbol
i2 : num = 5
o2 = 5
i3 : num
o3 = 5
i4 : symbol num
o4 = num
o4 : Symbol
If s is an operator, then the corresponding symbol is provided. This symbol is
used by the interpreter in constructing keys for methods associated to the symbol.
i5 : symbol +
o5 = +
o5 : Symbol
See also:
local [V.24.394] – get a local symbol
global [V.24.325] – get a global symbol
value [III.21.1.3.1] – evaluate
24.579. symbol Documentation
Documentation – a hash table which is used to store pointers to documentation
of functions, symbols, and methods.
This hash table is used by the routines that display documentation, is intended
for internal use only, and its format may change.
The documentation is stored both in a hash table in memory, and in a database
file.
See also:
Symbols [???]
:= [V.24.30] – assignment to a new local variable
The symbol symbol Documentation is a member of the class Symbol [III.21.10].
24.580. symbol Resolution
A key used in a ChainComplex [III.16] to store the resolution it comes from.
The symbol symbol Resolution is a member of the class Symbol [III.21.10].
24.586. SYMBOL DIRECTSUM
729
24.581. symbol Symbols
Symbols – a hash table which can be used to obtain the global symbol with a
particular value.
This is useful internally for getting the name of a function, for example.
The symbol symbol Symbols is a member of the class Symbol [III.21.10].
24.582. symbol ann
ann – a synonym for annihilator [V.24.166].
The symbol symbol ann is a member of the class Symbol [III.21.10].
24.583. symbol coker
An abbreviation for cokernel [V.24.213].
The symbol symbol coker is a member of the class Symbol [III.21.10].
24.584. symbol compactMatrixForm
compactMatrixForm – a global flag which specifies whether to display matrices
in compact form.
The default value is true. The compact form is the form used by Macaulay,
in which the multiplication and exponentiation operators are suppressed from the
notation.
i1 : R = ZZ[x,y];
i2 : f = random(R^{2},R^2)
o2 = {-2} | xy+5y2 2x2-9xy-9y2 |
1
2
o2 : Matrix R <--- R
i3 : compactMatrixForm = false;
i4 : f
|
2
o4 = | x*y + 5y
2
2 |
2x - 9x*y - 9y |
1
2
o4 : Matrix R <--- R
The symbol symbol compactMatrixForm is a member of the class Symbol
[III.21.10].
24.585. symbol currentFile
currentFile – a variable whose value is the name of the current source file.
The symbol symbol currentFile is a member of the class Symbol [III.21.10].
24.586. symbol directSum
See also:
directSum [V.24.254] – direct sum of modules or maps
The symbol symbol directSum is a member of the class Symbol [III.21.10].
Methods for directSum :
730
24. MISCELLANEOUS DOCUMENTATION
directSum
directSum
directSum
directSum
directSum
ChainComplex
GradedModule
Matrix
Module
Option
24.587. symbol frac
A symbol used as a key under which is stored the fraction field of a ring.
The symbol symbol frac is a member of the class Symbol [III.21.10].
24.588. symbol ker
See kernel [V.24.375].
The symbol symbol ker is a member of the class Symbol [III.21.10].
24.589. symbol newline
newline – a string containing the character or sequence of characters which
represents the end of a line. To end an output line, you should use endl [V.24.269]
instead, because there is more to ending an output line than emitting the characters
in newline, especially when nets are being used.
This string depends on what your operating system is: on Unix systems it is the
ascii character 10; on Macintoshes it is the ascii character 13, and under MS-DOS
and Windows 95 it is a string of length 2 containing ascii characters 13 and 10.
Try to avoid confusing the newline string described here with the ASCII character called newline. That character can be incorporated into a string with the
escape sequence \n, and it always has ASCII code 10.
i1 : ascii "\n"
o1 = {10}
o1 : List
See also:
Net [III.21.6] – the class of all nets and strings
The symbol symbol newline is a member of the class Symbol [III.21.10].
24.590. symbol pathSeparator
pathSeparator – the character used under the current operating system to
separate the component directory names in a file path.
Under unix it is "/", and on a Macintosh it is ":".
The symbol symbol pathSeparator is a member of the class Symbol [III.21.10].
24.591. symbol phase
phase – an internal variable indicating which phase of compilation we are in.
The value 0 indicates that we are running as an interpreter, as usual. The value
1 indicates that we are loading setup.m2 and will dump data afterward. The value
2 indicates that we are loading setup.m2, creating a preliminary version of the help
file whose name is Macaulay2-pre, and creating example input files. The value 3
indicates that we are running an example input file, and referring to Macaulay2.pre.
The value 4 indicates that we are loading setup.m2, reading the example output
24.597. SYMMETRICALGEBRA
731
files, and creating the final version of the help file, called Macaulay2-doc. The value
5 indicates that we are running the interpreter as usual, but reading the example
output files when document [V.24.257] is used.
The symbol symbol phase is a member of the class Symbol [III.21.10].
24.592. symbol pi
pi – the numerical value of the arithmetic quantity pi.
The symbol symbol pi is a member of the class Symbol [III.21.10].
24.593. symbol reloaded
reloaded – a constant whose value is the number of times loaddata [V.24.393]
has been executed by the current process. Since loaddata completely resets the state
of the system, something like this is needed.
The symbol symbol reloaded is a member of the class Symbol [III.21.10].
24.594. symbol res
See resolution [V.24.517], of which res is a synonym.
The symbol symbol res is a member of the class Symbol [III.21.10].
24.595. symbol typicalValues
A hash table used to store information about the type of values typically returned by functions and methods.
This information is used only to build documentation automatically.
i1 : typicalValues#isRing
o1 = Boolean
o1 : Type
-- the class of Boolean values
See also:
specifying typical values [V.24.561]
The symbol symbol typicalValues is a member of the class Symbol [III.21.10].
24.596. symbolTable
symbolTable() – constructs an hash table containing the global symbol table.
Each key is a string containing the name of a symbol, and the corresponding
value is the symbol itself.
See also:
SymbolTable [III.21.5.7] – the class of all symbol tables
The function symbolTable is a member of the class Function [III.18].
24.597. symmetricAlgebra
symmetricAlgebra M – produces the symmetric algebra of a module M.
Bugs: uses symbols from the beginning of the alphabet as variables in the new
ring; makes a quotient ring when it doesn’t have to.
The function symmetricAlgebra is a member of the class Function [III.18].
Ways to use symmetricAlgebra :
732
24. MISCELLANEOUS DOCUMENTATION
symmetricAlgebra Module
Optional arguments :
symmetricAlgebra(..., Degrees => ...)
symmetricAlgebra(..., Inverses => ...)
symmetricAlgebra(..., MonomialOrder => ...)
symmetricAlgebra(..., MonomialSize => ...)
symmetricAlgebra(..., SkewCommutative => ...)
symmetricAlgebra(..., VariableBaseName => ...)
symmetricAlgebra(..., VariableOrder => ...)
symmetricAlgebra(..., Variables => ...)
symmetricAlgebra(..., Weights => ...)
symmetricAlgebra(..., WeylAlgebra => ...)
24.598. symmetricPower
symmetricPower(i,f) – provides the i-th symmetric power of the matrix f.
Here f should be a 1 by n matrix.
The function symmetricPower is a member of the class Function [III.18].
Ways to use symmetricPower :
symmetricPower(ZZ,Matrix)
24.599. syz
syz f – compute minimal generators for the module of syzygies for the Matrix
[III.12] f.
syz G – retrieve the Matrix [III.12] of syzygies from the Groebner basis G. The
result may be empty if syzygies were not to be retained during the calculation, or
if the computation was not continued to a high enough degree.
This function takes the same optional arguments as gb.
See also:
GroebnerBasis [III.15] – the class of all Groebner bases
The function syz is a member of the class Function [III.18].
Ways to use syz :
syz GroebnerBasis [III.12.42] – – a matrix whose columns are the syzygies on the columns of the original matrix
syz Matrix
Optional arguments :
syz(..., BasisElementLimit => ...)
syz(..., ChangeMatrix => ...) [V.24.600] – whether to produce the
change of basis matrix
syz(..., CodimensionLimit => ...) [V.24.60.2] – stop when this codimension is reached
syz(..., DegreeLimit => ...)
syz(..., PairLimit => ...)
syz(..., StopBeforeComputation => ...) [V.24.601] – whether to stop
the computation immediately
syz(..., StopWithMinimalGenerators => ...) [V.24.129.4] – stop when
minimal generators have been determined
syz(..., Strategy => ...) [V.24.602] – specify the strategy used to compute
the Groebner basis
24.604. TABLE
syz(...,
syz(...,
syz(...,
syz(...,
733
SubringLimit => ...)
Syzygies => ...)
SyzygyLimit => ...)
SyzygyRows => ...)
24.600. syz(..., ChangeMatrix => ...)
ChangeMatrix => true – an optional argument for syz [V.24.599] which specifies whether to compute the change of basis matrix.
See also:
Default value: false [V.24.286]
Function: syz [V.24.599]
Option name: ChangeMatrix [V.24.59]
24.601. syz(..., StopBeforeComputation => ...)
StopBeforeComputation => true – an optional argument used with gb [III.15.2].
Tells whether not to start the computation, with the default value being false.
This can be useful when you want to obtain the partially computed Groebner basis
contained in an interrupted computation.
See also:
Default value: false [V.24.286]
Function: syz [V.24.599]
Option name: StopBeforeComputation [V.24.128]
24.602. syz(..., Strategy => ...)
syz(f,Strategy => v) – an option for syz [V.24.599] which can be used to
specify the strategy to be used in the computation.
The value of the option is simply passed to gb [III.15.2], so see the documentation there for details.
See also:
Default value: {} [V.24.654]
Function: syz [V.24.599]
Option name: Strategy [V.24.130]
24.603. syzygyScheme
syzygyScheme(C,i,v) – produce the syzygy scheme from a map v : R^j --->
C_i which selects some syzygies from a resolution C.
The function syzygyScheme is a member of the class Function [III.18].
24.604. table
table(u,v,f) – yields a table m in which m_i_j is f(u_i,v_j).
A table is a list of lists, all of the same length. The entry m_i_j is computed
as f(u_i,v_j).
table(m,n,f) – yields, when m and n are integers, a table of size m by n whose
entries are obtained by evaluating f() repeatedly.
See also isTable [V.24.371], and subtable [V.24.574].
The function table is a member of the class Function [III.18].
Code:
-- code for table:
734
24. MISCELLANEOUS DOCUMENTATION
-- ../m2/tables.m2:3
table = (rows,cols,f) -> apply(rows,i->apply(cols,j->f(i,j)) ...
24.605. take
take(v,n)
– yields a list containing the first n elements of the list v.
take(v,-n) – yields a list containing the last n elements of the list v.
take(v,{m,n}) – yields a list containing the elements of the list v in positions m
through n.
i1 : take({a,b,c,d,e,f},3)
o1 = {a, b, c}
o1 : List
i2 : take({a,b,c,d,e,f},-3)
o2 = {d, e, f}
o2 : List
i3 : take({a,b,c,d,e,f},{2,4})
o3 = {c, d, e}
o3 : List
See also:
drop [V.24.259] – drop some elements
The function take is a member of the class Function [III.18].
Ways to use take :
take(BasicList,ZZ)
take(BasicList,{...})
24.606. tan
tan x – computes the tangent of x.
The function tan is a member of the class Function [III.18].
Ways to use tan :
tan RR
tan ZZ
24.607. tanh
tanh x – computes the hyperbolic tangent of x.
The function tanh is a member of the class Function [III.18].
Ways to use tanh :
tanh RR
tanh ZZ
24.608. target
target h – the target of a morphism h or Groebner basis.
The function target is a member of the class Function [III.18].
24.609. TENSOR
735
24.609. tensor
tensor(M,N) – tensor product of rings or monoids.
This method allows all of the options available for monoids, see monoid
[V.24.424] for details. This routine essentially combines the variables of M and
N into one monoid.
For rings, the rings should be quotient rings of polynomial rings over the same
base ring.
Here is an example with monoids.
i1 : M = monoid[a..d, MonomialOrder => Eliminate 1]
o1 = M
o1 : GeneralOrderedMonoid
i2 : N = monoid[e,f,g, Degrees => {1,2,3}]
o2 = N
o2 : GeneralOrderedMonoid
i3 : P = tensor(M,N,MonomialOrder => GRevLex)
o3 = P
o3 : GeneralOrderedMonoid
i4 : describe P
o4 = [a, b, c, d, e, f, g, Degrees => {{1}, {1}, {1}, {1}, { ...
o4 : Array
i5 : tensor(M,M,Variables => {t_0 .. t_7}, MonomialOrder =>
...
o5 = [t , t , t , t , t , t , t , t , MonomialOrder => Produ ...
0
1
2
3
4
5
6
7
o5 : GeneralOrderedMonoid
i6 : describe oo
o6 = [t , t , t , t , t , t , t , t , MonomialOrder => Produ ...
0
1
2
3
4
5
6
7
o6 : Net
Here is a similar example with rings.
i7 : tensor(ZZ/101[x,y], ZZ/101[r,s], MonomialOrder => Elimi ...
ZZ
o7 = --- [x, y, r, s, MonomialOrder => Eliminate 2]
101
o7 : PolynomialRing
See also:
** [V.24.15] – a binary operator, usually used for tensor product
736
24. MISCELLANEOUS DOCUMENTATION
The function tensor is a member of the class Function [III.18].
Ways to use tensor :
tensor(Monoid,Monoid)
tensor(PolynomialRing,PolynomialRing)
tensor(PolynomialRing,QuotientRing)
tensor(QuotientRing,PolynomialRing)
tensor(QuotientRing,QuotientRing)
tensor(Ring,Ring)
Optional arguments :
tensor(..., Degrees => ...)
tensor(..., Inverses => ...)
tensor(..., MonomialOrder => ...)
tensor(..., MonomialSize => ...)
tensor(..., SkewCommutative => ...)
tensor(..., VariableBaseName => ...)
tensor(..., VariableOrder => ...)
tensor(..., Variables => ...)
tensor(..., Weights => ...)
tensor(..., WeylAlgebra => ...)
24.610. tensorAssociativity
tensorAssociativity(A,B,C) – produces the isomorphism from A**(B**C)
to (A**B)**C.
Currently implemented for modules, graded modules, and chain complexes.
See also:
ChainComplex [III.16] – the class of all chain complexes
Module [III.13] – the class of all modules
The function tensorAssociativity is a member of the class Function [III.18].
Ways to use tensorAssociativity :
tensorAssociativity(ChainComplex,ChainComplex,ChainComplex)
tensorAssociativity(GradedModule,GradedModule,GradedModule)
tensorAssociativity(Module,Module,Module)
24.611. terms
terms f – provide a list of terms of a polynomial.
i1 : R = QQ[x,y]
o1 = R
o1 : PolynomialRing
i2 : terms (x+2*y-1)^2
2
2
o2 = {x , 4x*y, 4y , -2x, -4y, 1}
o2 : List
See also:
coefficients [V.24.209] – the coefficients
The function terms is a member of the class Function [III.18].
24.616. TMPNAME
737
Ways to use terms :
terms RingElement
24.612. then
then – a keyword used with if [V.24.346].
24.613. time
time e – evaluates e, prints the amount of cpu time used, and returns the value
of e.
i1 : time 3^30
-- used 0. seconds
o1 = 205891132094649
See also:
timing [V.24.615] – time a computation
24.614. times
times(x,y,...) – yields the product of its arguments.
If there are no arguments, the value is the integer 1.
The function times is a member of the class Function [III.18].
24.615. timing
timing e – evaluates e and returns a list of type Time [III.21.1.14] of the form
{t,v}, where t is the number of seconds of cpu timing used, and v is the value of
the the expression.
The default method for printing such timing results is to display the timing
separately in a comment below the computed value.
i1 : timing 3^30
o1 = 205891132094649
-- 0. seconds
o1 : Time
i2 : peek oo
o2 = Time{0.,205891132094649}
o2 : Net
See also:
Time [III.21.1.14] – the class of all timing results
24.616. tmpname
tmpname x – create a temporary file name based on the string x unique to this
process.
The code for this function is Unix dependent at the moment.
The routine doesn’t actually check to see whether file exists.
The function tmpname is a member of the class Function [III.18].
Code:
738
24. MISCELLANEOUS DOCUMENTATION
-- code for tmpname:
-- ../m2/files.m2:3
tmpname = (x) -> "/tmp/" | string processID() | x
24.617. toDual
toDual(d,f) – given a 1 by n matrix f over a polynomial ring R and an
integer d such that the d-th power of each variable is in the image of f, computes
Hom(R/image f, E), where E is the injective envelope of the coefficient field of R.
This function mimics the script <l_to_dual of Macaulay, and is probably going
to be changed substantially.
See also:
fromDual [V.24.301]
The function toDual is a member of the class Function [III.18].
Code:
-- code for toDual:
-- ../m2/duals.m2:15-21
toDual = (d, f) -> (
R := ring f;
g := product apply(generators R, v -> v^d);
box := matrix table (1, numgens R, (i,j) -> R_j^(d+1));
contract(
transpose mingens image (generators (image box : im ...
matrix{{g}}))
24.618. toHandle
toHandle i – convert the integer i to a Handle [III.21.4].
No checking is done to ensure that the integer i actually has been assigned by
the engine [IV.22] to one of its objects.
The function toHandle is a member of the class Function [III.18].
Ways to use toHandle :
toHandle ZZ
24.619. toList
The function toList is a member of the class Function [III.18].
Ways to use toList :
toList BasicList [III.19.2.1] – list of elements
toList HashTable [III.19.2.2] – convert to list
toList Set [III.19.2.3] – list of elements
toList {...}
24.620. toSequence
toSequence x – yields the elements of a list x as a sequence.
If x is a sequence, then x is returned.
i1 : toSequence {1,2,3}
o1 = (1, 2, 3)
o1 : Sequence
24.623. TOP-METHOD
739
i2 : toSequence (1,2,3)
o2 = (1, 2, 3)
o2 : Sequence
The function toSequence is a member of the class Function [III.18].
Ways to use toSequence :
toSequence BasicList
24.621. top
top I – yields the intersection of top dimensional primary components of the
module or ideal I.
For an example, see also component example [V.24.222].
If I is a submodule of (a quotient module) M, then a possibly larger submodule
of M is returned. The method used is that of Eisenbud-Huneke-Vasconcelos, in their
1993 Inventiones Mathematicae paper. For a very brief description of the method
used, see top-method [V.24.623].
See also:
removeLowestDimension [V.24.513] – remove components of lower dimension
saturate [V.24.534] – saturation of ideal or submodule
quotient [V.24.505] – ideal or submodule quotient
radical [V.24.507] – compute the radical of an ideal
The function top is a member of the class Function [III.18].
Ways to use top :
top Ideal
top Module
24.622. top level loop
The top level evaluation loop of the interpreter contains hooks so the user
can control how printing of the results of evaluation is done. If the result is null
[V.24.440] then nothing is printed. Otherwise, the appropriate method associated
with the symbol Print [V.24.117] is applied to perform the printing, unless the
printing is to be suppressed, as indicated by a semicolon at the end of the statement,
in which case the NoPrint [V.24.108] method is applied.
AfterEval [V.24.49] – top level method applied before printing results
AfterPrint [V.24.51] – top level method applied after printing
AfterNoPrint [V.24.50] – top level method applied after not printing
NoPrint [V.24.108] – top level method for non-printing results
Print [V.24.117] – top level method for printing results
24.623. top-method
If M is a module in a polynomial ring R, then the implementations of top
[V.24.621] and removeLowestDimension [V.24.513] are based on the following
observations:
codim Ext^d(M,R) >= d, for all d (if the module is non-zero)
740
24. MISCELLANEOUS DOCUMENTATION
If P is an associated prime of M of codimension d := codim P > codim
M, then codim Ext^d(M,R) = d and the annihilator of Ext^d(M,R) is
contained in P
If codim Ext^d(M,R) = d, then there really is an associated prime of codimension d.
If M is R/I, then top(I) = ann Ext^c(R/I,R), where c = codim I
24.624. topCoefficients
topCoefficients m – for a matrix m, for each column, returns the coefficients
of the highest power of the variable with the lowest index.
Beware: the greatest variable is usually the first variable.
The value returned is a list {monoms, coeff}. Let x_i be the smallest index
variable that occurs in the j-th column of m. Then the j-th column of coeff contains
the (vector) coefficient of the highest power of this variable, and the j-th element
of monoms is the highest power x_i^n.
The function topCoefficients is a member of the class Function [III.18].
Ways to use topCoefficients :
topCoefficients Matrix
24.625. topicList
topicList() – provides a complete list of topics on which help is available.
Intended to be used in programs. Users will prefer to use topics [V.24.626].
See also:
help [V.24.337] – get help
The function topicList is a member of the class Function [III.18].
Code:
-- code for topicList:
-- ../m2/document.m2:377-379
topicList = () -> sort join(
if DocDatabase === null then {} else keys DocDatabase,
keys Documentation)
24.626. topics
topics – displays a list of topics on which help is available.
topics() – Does the same in a function or file.
See also:
help [V.24.337] – get help
The command topics is a member of the class Command [III.21.1.2].
24.627. trace
trace f – returns the trace of the matrix f.
i1 : R = ZZ/101[a..d]
o1 = R
o1 : PolynomialRing
i2 : p = matrix {{a,b},{c,d}}
24.630. TRIM
741
o2 = {0} | a b |
{0} | c d |
2
2
o2 : Matrix R <--- R
i3 : trace p
o3 = a + d
o3 : R
The function trace is a member of the class Function [III.18].
Ways to use trace :
trace Matrix
24.628. transnet
transnet v – takes a list v of integers, and assembles the bytes of the integers,
four at a time, in network order (high order byte first), into a string.
transnet s – takes a string s whose length is a multiple of 4, and assembles its
bytes four at a time into integers, returning the list of assembled integers.
i1 : transnet {1,2,3}
o1 = ΓΓΓ
ΓΓΓΘΓΓΓΛ
o1 : String
See also:
String [III.21.6.1] – the class of all strings
The function transnet is a member of the class Function [III.18].
24.629. transpose
transpose m – yields the transpose n of the table or homomorphism m.
The function transpose is a member of the class Function [III.18].
Ways to use transpose :
transpose ChainComplexMap
transpose Matrix
transpose {...}
24.630. trim
trim M – produce a module isomorphic to the module M obtained by replacing
its generators by a minimal set of generators, and doing the same for the relations.
Also works for rings and ideals.
i1 : R = ZZ/101[x]
o1 = R
o1 : PolynomialRing
742
24. MISCELLANEOUS DOCUMENTATION
i2 : M = subquotient( matrix {{x,x^2,x^3}}, matrix {{x^3,x^4 ...
o2 = subquotient ({0} | x x2 x3 |, {0} | x3 x4 x5 |)
1
o2 : R - module, subquotient of R
i3 : trim M
o3 = subquotient ({0} | x |, {0} | x3 |)
1
o3 : R - module, subquotient of R
The function trim is a member of the class Function [III.18].
Ways to use trim :
trim Ideal
trim Module
trim QuotientRing
trim Ring
Optional arguments :
24.631. true
true – a value indicating truth.
The boolean value true is a member of the class Boolean [III.21.2].
24.632. truncate
truncate (i,M) – yields the submodule of M consisting of all elements of degrees
>= i. If i is a multi-degree, then this yields the submodule generated by all elements
of degree exactly i, together with all generators which have a higher primary degree
than that of i.
The degree i may be a multi-degree, represented as a list of integers. The ring
of M should be a (quotient of a) polynomial ring, where the coefficient ring, k, is a
field.
Caveat: if the degrees of the variables are not all one, then there is currently a
bug in the routine: some generators of higher degree than i may be duplicated in
the generator list
i1 : R = ZZ/101[a..c];
i2 : truncate(2,R^1)
o2 = image {0} | a2 ab ac b2 bc c2 |
1
o2 : R - module, submodule of R
i3 : truncate(2, ideal(a,b,c^3)/ideal(a^2,b^2,c^4))
o3 = subquotient ({0} | c3 bc ab ac |, {0} | a2 b2 c4 |)
1
o3 : R - module, subquotient of R
24.635. ULTIMATE
743
i4 : S = ZZ/101[x,y,z,Degrees=>{{1,3},{1,4},{1,-1}}];
i5 : truncate({7,24}, S^1 ++ S^{{-8,-20}})
o5 = image {0, 0} | x4y3 0 |
{8, 20} | 0
1 |
2
o5 : S - module, submodule of S
The function truncate is a member of the class Function [III.18].
Ways to use truncate :
truncate(ZZ,Ideal)
truncate(ZZ,Module)
truncate({...},Ideal)
truncate({...},Module)
24.633. try
try x else y – returns the value of x unless an error or alarm [V.24.160]
occurs during the evaluation of x, in which case it returns the value of y.
try x – returns the value of x unless an error or alarm [V.24.160] occurs during
the evaluation of x, in which case it returns null [V.24.440].
The behavior of interrupts (other than alarms) is unaffected.
i1 : apply(-3..3,i->try 1/i else infinity)
1
1
1 1
o1 = (--, --, -1, infinity, 1, -, -)
3
2
2 3
o1 : Sequence
We will change the behavior of this function soon so that it will be possible to
catch errors of a particular type. Meanwhile, users are recommended to use this
function sparingly, if at all.
24.634. typicalValues
24.635. ultimate
ultimate(f,x) – yields the value ultimately obtained by applying the function
f to x.
Iteration ceases when an error occurs during application of the function, or the
result is the same. Errors are not reported.
It’s a bad idea to use this function, because unexpected errors will produce
unexpected results silently.
The function ultimate is a member of the class Function [III.18].
Ways to use ultimate :
ultimate(Function,Thing)
744
24. MISCELLANEOUS DOCUMENTATION
24.636. unSingleton
24.637. unhex
unhex s – translates a string provided as the trailing part of a URL by a web
browser.
A web browser sometimes has to put special characters into a URL. So such
characters do not interfere with other things, they are translated into a special form.
For example, each space is replaced by + and various other characters (including /
and %) are replaced by % followed by two hex digits giving the numerical code of
the character in hexadecimal notation.
The purpose of unhex [V.24.637] is to undo such translations, providing the
original string.
i1 : unhex "abcd+efgh%2B"
o1 = abcd efgh+
o1 : String
The function unhex is a member of the class Function [III.18].
24.638. uniform
uniform x – whether all elements of the list x have the same class.
The function uniform is a member of the class Function [III.18].
Code:
-- code for uniform:
-- ../m2/classes.m2:59
uniform = (x) -> same apply(x,class)
24.639. use
use S – installs certain defaults associated with S.
This will install functions or methods which make the use of S the default in
certain contexts. For example, if S is a polynomial ring on the variable x, then it
will set the value of the symbol x to be the corresponding element of the ring S.
Here is another example. If S is a monoid ring, then the product of an element
of the base ring of S and an element of the base monoid of S will be taken to be an
element of S, provided use S has been executed.
The return value is S.
When a ring is assigned to a global variable, this function is automaticall
Download