File: DiffOps.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 (49 lines) | stat: -rw-r--r-- 1,989 bytes parent folder | download | duplicates (4)
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
-- Copyright 1999-2002 by Anton Leykin and Harrison Tsai

------------------------------------------------------------------------
-- This function computes the differential operators of order k or less
-- on an affine variety defined by an ideal I in a polynomial ring
------------------------------------------------------------------------
diffOps = method()
diffOps (RingElement, ZZ) := (f, k) -> (diffOps(ideal f, k))

diffOps (Ideal, ZZ) := (I, k) -> (
     R := ring I;
     W := makeWeylAlgebra( R, SetVariables=>false);
     createDpairs W;
     
     -- make coeffs of derivations
     F := gens I;

     -- make Dk
     Dbasis := matrix {flatten apply( toList(0..k-1), i -> (
	       (entries symmetricPower(k-i, matrix{W.dpairVars#1}))#0 ) )};
     xbasis := matrix {flatten apply( toList(0..k-1), i -> (
	       (entries symmetricPower(k-i, vars R))#0 ) )};
     smallxbasis := matrix {flatten apply( toList(0..k-2), i -> (
	       (entries symmetricPower(k-1-i, vars R))#0 ) )};
     
     pInfo(1, "Making the matrix of partial derivatives of elements in I...");
     temp := transpose diff(transpose xbasis, F | 
	       flatten ((transpose smallxbasis)*F) );

     addon := directSum toList(rank target temp:matrix{{F}});
          
     full := temp | addon;
     pInfo(1, "Computing syzygies on an " | rank source full | " by " |
	  rank target full | " matrix...");
     syzy := (syz full)^{0..rank source temp - 1}; 
     pInfo(1, "Reducing matrix of " | rank source syzy | " by " |
	  rank target syzy | " syzygies with respect to I...");
     syzy = gens gb (syzy % I);
     
     hashTable {PolyGens => syzy, BasisElts => Dbasis}
     )

----------------------------------------------------------------
-- Puts Rbasis of diffOps into the Weyl algebra representation
----------------------------------------------------------------
putWeylAlgebra = method()
putWeylAlgebra (HashTable) := (h) -> (
     (h.BasisElts) * substitute(h.PolyGens, ring h.BasisElts)
     )