Skip to content

Commit fee4e0e

Browse files
Martin-Helmerd-torrance
authored andcommitted
Added affine Euler char to CharacteristicClasses
Added affine Euler characteristic method to CharacteristicClasses package.
1 parent 9ebb549 commit fee4e0e

File tree

1 file changed

+87
-6
lines changed

1 file changed

+87
-6
lines changed

M2/Macaulay2/packages/CharacteristicClasses.m2

Lines changed: 87 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
newPackage(
44
"CharacteristicClasses",
5-
Version =>"2.0",
6-
Date => "October 24, 2015",
5+
Version =>"2.1",
6+
Date => "June 24, 2025",
77
Authors => {{Name => "Martin Helmer",
8-
Email => "martin.helmer@berkeley.edu",
9-
HomePage => "https://math.berkeley.edu/~mhelmer/"},
8+
Email => "martin.helmer@swansea.ac.uk",
9+
HomePage => "http://martin-helmer.com/"},
1010
{Name => "Christine Jost",
1111
Email => "[email protected]"}},
12-
Headline => "CSM and Segre classes and the Euler characteristic for subschemes of smooth complete toric varieties",
12+
Headline => "CSM classes, Segre classes and the Euler characteristic",
1313
Keywords => {"Intersection Theory"},
1414
DebuggingMode => false,
1515
PackageImports => { "Elimination", "PrimaryDecomposition", "NormalToricVarieties"},
@@ -22,6 +22,7 @@ newPackage(
2222
"published article URI" => "https://msp.org/jsag/2015/7-1/p04.xhtml",
2323
"published article DOI" => "10.2140/jsag.2015.7.31",
2424
"published code URI" => "https://msp.org/jsag/2015/7-1/jsag-v7-n1-x04-CharacteristicClasses.m2",
25+
"repository code URI" => "https://github.com/Macaulay2/M2/blob/master/M2/Macaulay2/packages/CharacteristicClasses.m2",
2526
"release at publication" => "82375d8c668f3acf1d825b8ba991081769fba742", -- git commit number in hex
2627
"version at publication" => "1.1",
2728
"volume number" => "7",
@@ -59,9 +60,46 @@ export{"Segre",
5960
"ProjectiveDegree",
6061
"PnResidual",
6162
"bertini",
62-
"bertiniCheck"
63+
"bertiniCheck",
64+
"EulerAffine"
6365
}
6466

67+
euleraffinehyp := (eqn) -> (
68+
S1:=ring eqn;
69+
n:=numgens(S1)-1;
70+
enleqn:=(homogenize(eqn,(entries vars S1)_0_0)*(entries vars S1)_0_0);
71+
cuteqn:=(substitute(enleqn,{(entries vars S1)_0_0=>0}));
72+
if enleqn==0 then enleqn=0_S1;
73+
if cuteqn==0 then cuteqn=0_S1;
74+
enI:=ideal(enleqn);
75+
cuI:=ideal(cuteqn);
76+
tem1:=CSM(enI);
77+
A:=ring tem1;
78+
tem2:=CSM(A,cuI);
79+
tem:=tem1-tem2;
80+
return (tem_(A_0^n))+1;
81+
);
82+
83+
EulerAffine=method(TypicalValue=>ZZ);
84+
EulerAffine (Ideal) := idea -> (
85+
S:=ring idea;
86+
if not (isPolynomialRing S) then error("Sorry, expecting an ideal defined over a polynomial ring");
87+
kk:=coefficientRing S;
88+
n:=numgens S;
89+
z:=getSymbol "zzz";
90+
S=kk[z_0..z_n];
91+
schem:=(map(S,ring idea,{z_1..z_n})) idea;
92+
r:=numgens schem;
93+
gschem:=(entries gens schem)_0;
94+
sset:=new MutableList from {0..r};
95+
psum:=new MutableList from {0..r};
96+
for s from 1 to r do(
97+
sset#s=apply(subsets(gschem,s),eq->euleraffinehyp(product(eq)));
98+
psum#s=sum(sset#s)
99+
);
100+
return sum(1..r,s->-(-1)^s*psum#s);
101+
);
102+
65103
MultiProjCoordRing=method(TypicalValue=>Ring);
66104
MultiProjCoordRing (Symbol,List):=(x,l)->(
67105
kk:=ZZ/32749;
@@ -2474,6 +2512,36 @@ doc ///
24742512
time CSM(U,CheckSmooth=>false)
24752513

24762514
///
2515+
2516+
doc ///
2517+
Key
2518+
EulerAffine
2519+
(EulerAffine,Ideal)
2520+
Headline
2521+
The Euler Characteristic of an affine variety.
2522+
Usage
2523+
EulerAffine I
2524+
Inputs
2525+
I:Ideal
2526+
an ideal in a polynomial ring over a field defining an affine variety.
2527+
Outputs
2528+
:RingElement
2529+
the Euler characteristic
2530+
Description
2531+
Text
2532+
This command computes the Euler characteristic of a complex affine variety.
2533+
Example
2534+
kk=ZZ/32749;
2535+
R=kk[x_1..x_3]
2536+
I=ideal(x_1^2+x_2^2+x_3^2-1)
2537+
time EulerAffine I
2538+
Text
2539+
Observe that the algorithm is a probabilistic algorithm and may give a wrong answer with a small but nonzero probability. Read more under
2540+
@TO "probabilistic algorithm"@.
2541+
///
2542+
2543+
2544+
24772545
--------------------------------------------------------
24782546
-- Tests
24792547
--------------------------------------------------------
@@ -2546,6 +2614,19 @@ TEST ///
25462614
assert(csmH#{0}==Chern(A,ideal(I_0)));
25472615
assert(seg==(V//(1+V)));
25482616
///
2617+
2618+
TEST ///
2619+
-*
2620+
restart
2621+
needsPackage "CharacteristicClasses"
2622+
installPackage "CharacteristicClasses"
2623+
*-
2624+
kk=ZZ/32749;
2625+
R=kk[x_1..x_3];
2626+
I=ideal(x_1^2+x_2^2+x_3^2-1);
2627+
eu=EulerAffine I;
2628+
assert(eu==2);
2629+
///
25492630
-------------------------------------------------------
25502631
-- References
25512632
------------------------------------------------------

0 commit comments

Comments
 (0)