
i1 : needsPackage "BernsteinSato";

i2 : D = QQ[x,y,z,Dx,Dy,Dz, WeylAlgebra => {x=>Dx, y=>Dy, z=>Dz}]

o2 = D

o2 : PolynomialRing, 3 differential variable(s)

i3 : Delta = ideal(Dx,Dy,Dz)

o3 = ideal (Dx, Dy, Dz)

o3 : Ideal of D

i4 : (Dx * x)^2

      2  2
o4 = x Dx  + 3x*Dx + 1

o4 : D

i5 : options D

o5 = OptionTable{Constants => false                              }
                                  1
                 DegreeGroup => ZZ
                 DegreeLift => null
                 DegreeMap => null
                 DegreeRank => 1
                 Degrees => {{1}, {1}, {1}, {1}, {1}, {1}}
                 Global => true
                 Heft => {1}
                 Inverses => false
                 Join => null
                 Local => false
                 MonomialOrder => {MonomialSize => 32           }
                                  {GRevLex => {1, 1, 1, 1, 1, 1}}
                                  {Position => Up               }
                 SkewCommutative => {}
                 Variables => {x, y, z, Dx, Dy, Dz}
                 WeylAlgebra => {{x, Dx}, {y, Dy}, {z, Dz}}

o5 : OptionTable

i6 : DeltaBern = inw(Delta,{1,1,1,1,1,1}) 

o6 = ideal (Dz, Dy, Dx)

o6 : Ideal of QQ[x..z, Dx, Dy, Dz]

i7 : dim DeltaBern 

o7 = 3

i8 : D = QQ[x,y,z,w,Dx,Dy,Dz,Dw, 
            WeylAlgebra => {x=>Dx, y=>Dy, z=>Dz, w=>Dw}];

i9 : f = x^2+y^2+z^2+w^2

      2    2    2    2
o9 = x  + y  + z  + w

o9 : D

i10 : AnnFs(f)

o10 = ideal (w*Dz - z*Dw, w*Dy - y*Dw, z*Dy - y*Dz, w*Dx - x*Dw, z*Dx - x*Dz, y*Dx - x*Dy, x*Dx + y*Dy + z*Dz + w*Dw - 2s)

o10 : Ideal of QQ[x..z, w, Dx, Dy, Dz, Dw, s]

i11 : L=ideal(x,y,Dz,Dw)

o11 = ideal (x, y, Dz, Dw)

o11 : Ideal of D

i12 : AnnIFs(L,f)

o12 = ideal (y, x, w*Dz - z*Dw, z*Dz + w*Dw - 2s)

o12 : Ideal of QQ[x..z, w, Dx, Dy, Dz, Dw, s]

i13 : f

       2    2    2    2
o13 = x  + y  + z  + w

o13 : D

i14 : globalBFunction(f)

       2
o14 = s  + 3s + 2

o14 : QQ[s]

i15 : g=x^3+y^3+z^3+w^3

       3    3    3    3
o15 = x  + y  + z  + w

o15 : D

i16 : factorBFunction globalBFunction(g)

                         4      5      7      8
o16 = (s + 1)(s + 2)(s + -)(s + -)(s + -)(s + -)
                         3      3      3      3

o16 : Expression of class Product

i17 : D1 = QQ[x,Dx,WeylAlgebra => {x=>Dx}];

i18 : I1 = ideal((x*Dx)^2+1)

             2  2
o18 = ideal(x Dx  + x*Dx + 1)

o18 : Ideal of D1

i19 : f1 = x;

i20 : b=globalB(I1, f1)

                                   2
o20 = HashTable{Boperator => - x*Dx  + 2Dx*s + Dx}
                                2
                Bpolynomial => s  + 2s + 2

o20 : HashTable

i21 : use D

o21 = D

o21 : PolynomialRing, 4 differential variable(s)

i22 : R = (D^1/ideal(Dx,Dy,Dz,Dw))

o22 = cokernel | Dx Dy Dz Dw |

                             1
o22 : D-module, quotient of D

i23 : ann2 = relations Dlocalize(R,f)

o23 = | wDz-zDw wDy-yDw zDy-yDz wDx-xDw zDx-xDz yDx-xDy -xDx-yDy-zDz-wDw-4 |

              1      7
o23 : Matrix D  <-- D

i24 : F = matrix{{f}}

o24 = | x2+y2+z2+w2 |

              1      1
o24 : Matrix D  <-- D

i25 : ann1 = gens gb modulo(F,ann2)

o25 = {2} | wDz-zDw wDy-yDw zDy-yDz Dx^2+Dy^2+Dz^2+Dw^2 wDx-xDw zDx-xDz yDx-xDy xDx+yDy+zDz+wDw+2 x2Dw+y2Dw+z2Dw+w2Dw+2w x2Dz+y2Dz+z2Dz+zwDw+2z x2Dy+y2Dy+yzDz+ywDw+2y |

              1      11
o25 : Matrix D  <-- D

i26 : gens gb((ideal ann2) + (ideal F))

o26 = | w z y x |

              1      4
o26 : Matrix D  <-- D

i27 : D = QQ[x,y,z,Dx,Dy,Dz, WeylAlgebra => {x=>Dx, y=>Dy, z=>Dz}];

i28 : Delta = ideal(Dx,Dy,Dz);

o28 : Ideal of D

i29 : f=x^3+y^3+z^3;

i30 : I1=DlocalizeAll(D^1/Delta,f,Strategy=>Oaku)

                                                          2      2     2      2     2      2
o30 = HashTable{annFS => ideal (x*Dx + y*Dy + z*Dz - 3s, z Dy - y Dz, z Dx - x Dz, y Dx - x Dy)                                                                                                                                                                                    }
                                    2            4      5
                Bfunction => (s + 1) (s + 2)(s + -)(s + -)
                                                 3      3
                                    3               4      2  3  2     2  3  2    2  5        3            4         3            3            4         3          4        3          3          4      3 2      3 2       3 2       3        3        3        3       3       3
                Boperator => 2y*z*Dx Dy*Dz - 2y*z*Dy Dz - z Dx Dz  - 3z Dy Dz  + z Dz  + 2y*Dx Dy*s - 2y*Dy s + 2z*Dx Dz*s + 6z*Dy Dz*s - 8z*Dz s + 6y*Dx Dy - 6y*Dy  + 2z*Dx Dz - 6z*Dy Dz - 8z*Dz  + 3Dx s  + 9Dy s  + 18Dz s  + 15Dx s + 33Dy s + 42Dz s + 18Dx  + 18Dy  + 24Dz
                GeneratorPower => -2
                LocMap => | x6+2x3y3+y6+2x3z3+2y3z3+z6 |
                LocModule => cokernel | xDx+yDy+zDz+6 z2Dy-y2Dz z2Dx-x2Dz y2Dx-x2Dy |

o30 : HashTable

i31 : I2=DlocalizeAll(D^1/Delta,f)

o31 = HashTable{GeneratorPower => -2                                                     }
                                         2       2     1      2
                IntegrateBfunction => (s) (s + 1) (s + -)(s + -)
                                                       3      3
                LocMap => | x6+2x3y3+y6+2x3z3+2y3z3+z6 |
                LocModule => cokernel | -xDx-yDy-zDz-6 -z2Dy+y2Dz -z2Dx+x2Dz -y2Dx+x2Dy |

o31 : HashTable

i32 : I1.LocModule

o32 = cokernel | xDx+yDy+zDz+6 z2Dy-y2Dz z2Dx-x2Dz y2Dx-x2Dy |

                             1
o32 : D-module, quotient of D

i33 : D= QQ[x,y,z,u,v,w,Dx,Dy,Dz,Du,Dv,Dw, WeylAlgebra =>
                {x=>Dx, y=>Dy, z=>Dz, u=>Du, v=>Dv, w=>Dw}];

i34 : Delta=ideal(Dx,Dy,Dz,Du,Dv,Dw);

o34 : Ideal of D

i35 : R=D^1/Delta;

i36 : f=x*v-u*y;

i37 : g=x*w-u*z;

i38 : h=y*w-v*z;

i39 : Rf=DlocalizeAll(R,f,Strategy => Oaku)

o39 = HashTable{annFS => ideal (Dw, Dz, x*Du + y*Dv, y*Dy - u*Du, x*Dy + u*Dv, u*Dx + v*Dy, y*Dx + v*Du, x*Dx - v*Dv, u*Du + v*Dv - s)}
                Bfunction => (s + 1)(s + 2)
                Boperator => - Dy*Du + Dx*Dv
                GeneratorPower => -2
                LocMap => | y2u2-2xyuv+x2v2 |
                LocModule => cokernel | Dw Dz xDu+yDv yDy-uDu xDy+uDv uDx+vDy yDx+vDu xDx-vDv uDu+vDv+2 |

o39 : HashTable

i40 : Rfg=DlocalizeAll(Rf.LocModule,g, Strategy => Oaku)

                                                                                                                                                                                                                        2                                                                                                        2
o40 = HashTable{annFS => ideal (Dz*Dv - Dy*Dw, x*Du + y*Dv + z*Dw, z*Dz - u*Du - v*Dv - 2, x*Dz + u*Dw, y*Dy + v*Dv + 2, x*Dy + u*Dv, u*Dx + v*Dy + w*Dz, x*Dx - v*Dv - w*Dw, u*Du + v*Dv + w*Dw - s + 2, u*Du*Dv + v*Dv  - z*Dy*Dw + 3Dv, y*Dx*Dv + v*Du*Dv + z*Dx*Dw + w*Du*Dw + Du, y*u*Dv - x*v*Dv - 2x, v*Dy*Du*Dv - v*Dx*Dv  + z*Dx*Dy*Dw + w*Dy*Du*Dw + Dy*Du - 2Dx*Dv)}
                Bfunction => (s)(s + 1)
                Boperator => - Dz*Du + Dx*Dw
                GeneratorPower => -1
                LocMap => | -zu+xw |
                LocModule => cokernel | DzDv-DyDw xDu+yDv+zDw zDz-uDu-vDv-2 xDz+uDw yDy+vDv+2 xDy+uDv uDx+vDy+wDz xDx-vDv-wDw uDu+vDv+wDw+3 uDuDv+vDv^2-zDyDw+3Dv yDxDv+vDuDv+zDxDw+wDuDw+Du yuDv-xvDv-2x vDyDuDv-vDxDv^2+zDxDyDw+wDyDuDw+DyDu-2DxDv |

o40 : HashTable

i41 : Rfgh=DlocalizeAll(Rfg.LocModule,h, Strategy => Oaku)

                                                                                                                                                                         2                                               2                2          2       2         2                          2                                                           2    2  2                          2                          2                   2       2                   2                       2                                                             2    2                       2                     2        2  2      2                                      2                       2   2   2                       2          2              2 2        2                         2                       2        2
o41 = HashTable{annFS => ideal (x*Du + y*Dv + z*Dw, z*Dz - u*Du - v*Dv - 2, y*Dy - u*Du - w*Dw - 1, u*Dx + v*Dy + w*Dz, x*Dx + u*Du + 3, u*Du + v*Dv + w*Dw - s + 3, u*Du  - y*Dx*Dv - z*Dx*Dw + 3Du, x*v*Dy + x*w*Dz - u Du - 3u, v*Dy*Du  + w*Dz*Du  + y*Dx Dv + z*Dx Dw - Dx*Du, x*y*w*Dz - y*u Du - y*u*v*Dv - z*u*v*Dw + x*v*w*Dw - 3y*u + x*v, y*w*Dz*Du  + y Dx Dv + y*v*Dx*Du*Dv + y*z*Dx Dw + z*v*Dx*Du*Dw + v*w*Du Dw - y*Dx*Du - v*Du , y*z*u Du + y*z*u*v*Dv + y u*w*Dv - x*y*v*w*Dv + z u*v*Dw + y*z*u*w*Dw - x*z*v*w*Dw + 3y*z*u - x*z*v - 2x*y*w, y z*Dx Dv + y*z*v*Dx*Du*Dv + y w*Dx*Du*Dv + y*v*w*Du Dv + y*z Dx Dw + z v*Dx*Du*Dw + y*z*w*Dx*Du*Dw + z*v*w*Du Dw - y*z*Dx*Du - z*v*Du , y z*u Dv - x*y*z*u*v*Dv - x*y u*w*Dv + x y*v*w*Dv + y*z u Dw - x*z u*v*Dw - x*y*z*u*w*Dw + x z*v*w*Dw - 3x*y*z*u + x z*v + 2x y*w)}
                Bfunction => (s - 1)(s + 1)
                Boperator => - Dz*Dv + Dy*Dw
                GeneratorPower => -1
                LocMap => | -zv+yw |
                LocModule => cokernel | xDu+yDv+zDw zDz-uDu-vDv-2 yDy-uDu-wDw-1 uDx+vDy+wDz xDx+uDu+3 uDu+vDv+wDw+4 uDu^2-yDxDv-zDxDw+3Du xvDy+xwDz-u2Du-3u vDyDu^2+wDzDu^2+yDx^2Dv+zDx^2Dw-DxDu xywDz-yu2Du-yuvDv-zuvDw+xvwDw-3yu+xv ywDzDu^2+y2Dx^2Dv+yvDxDuDv+yzDx^2Dw+zvDxDuDw+vwDu^2Dw-yDxDu-vDu^2 yzu2Du+yzuvDv+y2uwDv-xyvwDv+z2uvDw+yzuwDw-xzvwDw+3yzu-xzv-2xyw y2zDx^2Dv+yzvDxDuDv+y2wDxDuDv+yvwDu^2Dv+yz2Dx^2Dw+z2vDxDuDw+yzwDxDuDw+zvwDu^2Dw-yzDxDu-zvDu^2 y2zu2Dv-xyzuvDv-xy2uwDv+x2yvwDv+yz2u2Dw-xz2uvDw-xyzuwDw+x2zvwDw-3xyzu+x2zv+2x2yw |

o41 : HashTable

i42 : Rf.GeneratorPower

o42 = -2

i43 : Jfgh=ideal relations Rfgh.LocModule;

o43 : Ideal of D

i44 : JH3=Jfgh+ideal(f^2,g,h);

o44 : Ideal of D

i45 : JH3gb=gens gb JH3

o45 = | w z uDu+vDv+3 xDu+yDv yDy+vDv+3 xDy+uDv uDx+vDy yDx+vDu xDx-vDv v2 uv yv u2 yu+xv xu y2 xy x2 xvDv+2x vDyDu-vDxDv-2Dx |

              1      20
o45 : Matrix D  <-- D

i46 : testmTorsion = method();

i47 : testmTorsion Ideal := (L) -> (
           LL = ideal generators gb L;
           n = numgens (ring (LL)) // 2;
           LLLL = ideal select(first entries gens LL, f->(
                     l = apply(listForm f, t->drop(t#0,n));
                     all(l, t->t==toList(n:0))       
                     ));
           if dim inw(LLLL,toList(apply(1..2*n,t -> 1))) == n
           then true
           else false);

i48 : testmTorsion(JH3)

o48 = true

i49 : D=QQ[x,y,z,w,Dx,Dy,Dz,Dw,WeylAlgebra => {x=>Dx, y=>Dy, z=>Dz,
      w=>Dw}];

i50 : f=y^2-x*z;

i51 : g=z^2-y*w;

i52 : h=x*w-y*z;

i53 : Delta=ideal(Dx,Dy,Dz,Dw);

o53 : Ideal of D

i54 : R=D^1/Delta;

i55 : Rf=DlocalizeAll(R,f,Strategy => Oaku)  

o55 = HashTable{annFS => ideal (Dw, x*Dy + 2y*Dz, 2y*Dx + z*Dy, x*Dx - z*Dz, y*Dy + 2z*Dz - 2s)}
                                         3
                Bfunction => (s + 1)(s + -)
                                         2
                               2
                Boperator => Dy  - 4Dx*Dz
                GeneratorPower => -1
                LocMap => | y2-xz |
                LocModule => cokernel | Dw xDy+2yDz 2yDx+zDy xDx-zDz yDy+2zDz+2 |

o55 : HashTable

i56 : Rfg=DlocalizeAll(Rf.LocModule,g, Strategy => Oaku);

i57 : Rfgh=DlocalizeAll(Rfg.LocModule,h, Strategy => Oaku);

i58 : Ifgh=ideal relations Rfgh.LocModule;

o58 : Ideal of D

i59 : IH3=Ifgh+ideal(f,g,h);

o59 : Ideal of D

i60 : IH3gb=gens gb IH3

o60 = | 1 |

              1      1
o60 : Matrix D  <-- D

i61 : findSocle = method();

i62 : findSocle(Ideal, RingElement):= (L,P) -> (
           createDpairs(ring(L));
           v=(ring L).dpairVars#0;
           myflag = true;
           while myflag do (
                w = apply(v,temp -> temp*P % L);
                if all(w,temp -> temp == 0) then myflag = false
                else (
                     p = position(w, temp -> temp != 0);
                     P = v#p * P;)
                );
           P);

i63 : D = ring JH3

o63 = D

o63 : PolynomialRing, 6 differential variable(s)

i64 : findSocle(JH3,1_D)

o64 = x*v

o64 : D

i65 : findLength = method();

i66 : findLength Ideal := (I) -> (   
           l = 0;
           while I != ideal 1_(ring I) do (
                l = l + 1;
                s = findSocle(I,1_(ring I));
                I = I + ideal s;);
           l);

i67 : findLength JH3

o67 = 1

i68 : x = symbol x; Dx = symbol Dx;

i70 : D = QQ[x_1..x_5, Dx_1..Dx_5, WeylAlgebra =>
           apply(toList(1..5), i -> x_i => Dx_i)];

i71 : f = x_1^2 + x_2^2 + x_3^2 + x_4^2 +x_5^2;

i72 : g = x_1;

i73 : R = D^1/ideal(Dx_1,Dx_2,Dx_3,Dx_4,Dx_5);

i74 : Rf =DlocalizeAll(R,f,Strategy => Oaku);

i75 : Bf = Rf.Bfunction

                  5
o75 = (s + 1)(s + -)
                  2

o75 : Expression of class Product

i76 : Rfg = DlocalizeAll(Rf.LocModule,g,Strategy => Oaku);

i77 : Bfg = Rfg.Bfunction

o77 = (s + 1)(s + 3)

o77 : Expression of class Product

i78 : Rg = DlocalizeAll(R,g,Strategy => Oaku);

i79 : Bg = Rg.Bfunction

o79 = (s + 1)

o79 : Expression of class Product

i80 : Rgf = DlocalizeAll(Rg.LocModule,f,Strategy => Oaku);

i81 : Bgf = Rgf.Bfunction

                         5
o81 = (s + 1)(s + 2)(s + -)
                         2

o81 : Expression of class Product

i82 : x = symbol x;

i83 : R = QQ[x,y,z];

i84 : f=x^3+y^3+z^3;

i85 : H=deRhamAll(f);

i86 : H.CohomologyGroups

                       1
o86 = HashTable{0 => QQ }
                       1
                1 => QQ
                       2
                2 => QQ
                       2
                3 => QQ

o86 : HashTable

i87 : H.LocalizeMap

o87 = | x_1^6+2x_1^3x_2^3+x_2^6+2x_1^3x_3^3+2x_2^3x_3^3+x_3^6 |

o87 : Matrix

i88 : H.TransferCycles

o88 = HashTable{0 => | 4/3x_1^6+8/3x_1^3x_2^3+4/3x_2^6+8/3x_1^3x_3^3+8/3x_2^3x_3^3+4/3x_3^6 |}
                1 => | 20x_1^5+20x_1^2x_2^3+20x_1^2x_3^3  |
                     | -20x_1^3x_2^2-20x_2^5-20x_2^2x_3^3 |
                     | 20x_1^3x_3^2+20x_2^3x_3^2+20x_3^5  |
                2 => | 48x_1x_2x_3^2 600x_3^4    |
                     | 48x_1x_2^2x_3 600x_2x_3^3 |
                     | 48x_1^2x_2x_3 600x_1x_3^3 |
                3 => | -x_1x_2x_3 -x_3^3 |

o88 : HashTable

i89 : I = gkz(matrix{{1,2}}, {5})

                                2
o89 = ideal (x D  + 2x D  - 5, D  - D )
              1 1     2 2       1    2

o89 : Ideal of QQ[x ..x , D ..D ]
                   1   2   1   2

i90 : PolySols I

        5      3          2
o90 = {x  + 20x x  + 60x x }
        1      1 2      1 2

o90 : List

i91 : 
