File: Dbasic.exa.m2

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (110 lines) | stat: -rw-r--r-- 2,111 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
-- 0. Service routines 
R = QQ[x,y,z]
W = makeWA R

-- fill an m-by-n  matrix with elements of W 
-- that have monomials up to degree d  
randomMatrix = (m,n,d,W) -> (
    RW := (coefficientRing W) (monoid [gens W]); 
    toW := map(W,RW,gens W);
    matrix apply(m, i->apply(n,j->(
		sum(d+1, e->toW random(e,RW))
		)))
    )
M = randomMatrix(2,3,1,W)
M = randomMatrix(3,2,1,W)
Dprune M == prune M

-- 1. Basic invariants
-- GKZ of the twisted quartic
A = matrix{{1,1,1,1},{0,1,3,4}}
b = {1,2}
I = gkz(A,b,Vars=>Local)

Ddim I -- check it's holonomic
holonomicRank I  -- holonomic rank
singLocus I -- singular locus
charIdeal I -- characteristic ideal

-- Appell F1
I = AppellF1 ({2,4,-1,3/2}, Vars=>Local)

holonomicRank I
singLocus I
charIdeal I

-- Polynomial annihilator
W = QQ[x,y,z,Dx,Dy,Dz, WeylAlgebra => {x=>Dx, y=>Dy, z=>Dz}]
f = x^3-y^2*z^2
I = PolyAnn f

holonomicRank I
singLocus I
charIdeal I

-- Rational annihilator
W = QQ[x,y,z,Dx,Dy,Dz, WeylAlgebra => {x=>Dx, y=>Dy, z=>Dz}]
f = x^3-y^2*z^2
I = RatAnn f

holonomicRank I
singLocus I
charIdeal I

f = x^2-y^3
g = y-2*z
J = RatAnn (g,f)

holonomicRank J
singLocus J
charIdeal J

-- Module routines
A = matrix{{1,1,1},{0,1,3}}
A' = matrix{{1,1,1},{0,1,4}}
b = {1,2}
b' = {2,3}
I = gkz(A,b,Vars=>Local)
I' = substitute(gkz(A',b',Vars=>Local), ring I)
M = directSum(cokernel gens I, cokernel gens I')

Ddim M
holonomicRank M
singLocus M
charIdeal M

-- 2. initial ideals and gb wrt weight vectors
A = matrix{{1,1,1},{0,2,3}}
b = {1,5}
I = gkz(A,b,Vars=>Local)

-- weight vector of the form (-u,u)
w1 = {-1,-2,-3,1,2,3}
inw(I, w1)
gbw(I, w1)

-- weight vector (u,v) with u+v > 0
w2 = {0,1,2,3,4,5}
inw(I, w2)
gbw(I, w2)

-- weight vector (u,v) with some comp's of u+v > 0, others equal to 0.
w3 = {1,-3,7,-1,4,-5}
inw(I, w3)
gbw(I, w3)

-- matrix versions
m = directSum(gens I, gens I)
w1 = {-1,-2,-3,1,2,3}
w2 = {0,1,2,3,4,5}
inw(m, w1)
gbw(m, w1)
inw(m, w2)
gbw(m, w2)

W = QQ[x, y, Dx, Dy, WeylAlgebra => {x=>Dx, y=>Dy}]
m = matrix{{x*Dx+y*Dy+x^3},{3+y^2+y*Dx+x^2*Dy}}
inw(m, {-1,-2,1,2})
gbw(m, {-1,-2,1,2})
inw(m, {0,0,1,1})
gbw(m, {0,0,1,1})