Function Repository Resource:

SimplicialHomologyGroup

Source Notebook

Compute the homology groups of simplicial complexes

Contributed by: Naman Taggar

ResourceFunction["SimplicialHomologyGroup"][sc,n]

computes the nth homology group of sc.

ResourceFunction["SimplicialHomologyGroup"][sc]

computes all homology groups of sc.

ResourceFunction["SimplicialHomologyGroup"][sc,sub,n]

computes the nth homology group of sc relative to sub.

ResourceFunction["SimplicialHomologyGroup"][sc,sub]

computes all homology groups of sc relative to sub.

Details and Options

SimplicialHomologyGroup depends upon the Taggar/SimplicialHomology paclet and installs it when used.
Both sc and sub should be specified by their facets, mesh regions, or using names.
The output is either a group or an association of groups indexed by dimension. The groups are specified as follows: is the additive group of integers; n is the additive group of integers modulo n; is the additive group of rational numbers; and Gn in general is the direct product of n copies of G.
The following named simplicial complexes are offered:
{"Simplex", n}n-dimensional simplex
"Point"point (0-dimensional simplex)
"Line"line (1-dimensional simplex)
"Triangle"triangle (2-dimensional simplex)
"Tetrahedron"tetrahedron (3-dimensional simplex)
{"Circle", n}n-dimensional circle
"Circle"circle (1-dimensional circle)
"Sphere"sphere (2-dimensional circle)
{"CircleWedge", n}wedge product of n circles
"Torus"1-holed (2-dimensional) torus
{"Torus", n}n-dimensional torus
"KleinBottle"Klein bottle
"MobiusStrip"Mobius strip
"RealProjectivePlane"real projective plane
{"RealProjectiveSpace", n}n-dimensional real projective space
"ComplexProjectivePlane"complex projective plane
"QuaternionicProjectivePlane"quaternionic projective plane
"DunceHat"dunce hat given by Hachimori (2016)
"PoincareHomologyThreeSphere"Poincaré homology 3-sphere
"RudinBall"non-shellable ball constructed by Rudin
"ZieglerBall"non-shellable ball constructed by Ziegler
A direct product of groups in the output is represented as G1⊕G2.
The following options can be given:
"Reduced"Truewhether to calculate reduced homology
"Coefficients"Integerscoefficients over which to calculate homology
The value for "Coefficients" can be any of the following:
Integersintegers
Rationalsrational numbers
pelements of finite field p

Examples

Basic Examples (4) 

Calculate a homology group of a space:

In[1]:=
ResourceFunction["SimplicialHomologyGroup"]["Circle", 0]
Out[1]=
In[2]:=
ResourceFunction["SimplicialHomologyGroup"]["Circle", 1]
Out[2]=
In[3]:=
ResourceFunction["SimplicialHomologyGroup"]["Circle", 2]
Out[3]=

0th Homology group of two disjoint points demonstrating the number of connected components:

In[4]:=
ResourceFunction["SimplicialHomologyGroup"][{{1}, {2}}, 0]
Out[4]=

Their reduced homology group:

In[5]:=
ResourceFunction["SimplicialHomologyGroup"][{{1}, {2}}, 0, "Reduced" -> True]
Out[5]=

Calculate homology of a contractible complex:

In[6]:=
ResourceFunction["SimplicialHomologyGroup"]["DunceHat"]
Out[6]=

Examples of spaces whose homology have torsion:

In[7]:=
ResourceFunction["SimplicialHomologyGroup"]["RealProjectivePlane"]
Out[7]=
In[8]:=
ResourceFunction["SimplicialHomologyGroup"]["KleinBottle"]
Out[8]=

Scope (3) 

Calculate all homology groups:

In[9]:=
ResourceFunction["SimplicialHomologyGroup"]["Torus"]
Out[9]=

Calculate the homology groups of D2 relative to its boundary S1:

In[10]:=
ResourceFunction[
 "SimplicialHomologyGroup"][{{1, 2, 3}}, {{1, 2}, {2, 3}, {1, 3}}, 2]
Out[10]=

Compute all groups:

In[11]:=
ResourceFunction[
 "SimplicialHomologyGroup"][{{1, 2, 3}}, {{1, 2}, {2, 3}, {1, 3}}]
Out[11]=

Specify a simplicial complex using mesh region:

In[12]:=
reg = MeshRegion[{{0, 0}, {1, 0}, {2, 1/2}, {2, -1/2}}, {Line[{1, 2}],
    Line[{2, 3}], Line[{3, 4}], Line[{4, 2}]}]
Out[12]=
In[13]:=
ResourceFunction["SimplicialHomologyGroup"][reg]
Out[13]=

Options (4) 

Reduced (2) 

By default, ordinary homology is calculated:

In[14]:=
ResourceFunction["SimplicialHomologyGroup"][{"Circle", 2}]
Out[14]=

Obtain reduced homology:

In[15]:=
ResourceFunction["SimplicialHomologyGroup"][{"Circle", 2}, "Reduced" -> True]
Out[15]=

Coefficients (2) 

By default, homology is computed over the integers:

In[16]:=
ResourceFunction["SimplicialHomologyGroup"]["RealProjectivePlane"]
Out[16]=

Calculate over rationals or elements of a finite field:

In[17]:=
ResourceFunction["SimplicialHomologyGroup"]["RealProjectivePlane", "Coefficients" -> Rationals]
Out[17]=
In[18]:=
ResourceFunction["SimplicialHomologyGroup"]["RealProjectivePlane", "Coefficients" -> 2]
Out[18]=
In[19]:=
ResourceFunction["SimplicialHomologyGroup"]["RealProjectivePlane", "Coefficients" -> 3]
Out[19]=

Applications (1) 

Homology of 8 demonstrating the number of holes in 8:

In[20]:=
eight = DiscretizeGraphics[Text["8"]]
Out[20]=
In[21]:=
ResourceFunction["SimplicialHomologyGroup"][eight]
Out[21]=

Properties and Relations (3) 

The homology groups of a space relative to itself are always zero:

In[22]:=
ResourceFunction["SimplicialHomologyGroup"]["Torus", "Torus"]
Out[22]=

The homology groups of a space relative to empty space are the same as absolute homology groups:

In[23]:=
ResourceFunction["SimplicialHomologyGroup"]["Torus"]
Out[23]=
In[24]:=
ResourceFunction["SimplicialHomologyGroup"]["Torus", {}]
Out[24]=

Homology groups relative to a point are equal to reduced homology groups:

In[25]:=
ResourceFunction["SimplicialHomologyGroup"]["Sphere", {{1}}]
Out[25]=
In[26]:=
ResourceFunction["SimplicialHomologyGroup"]["Sphere", "Reduced" -> True]
Out[26]=

Possible Issues (1) 

A valid subcomplex must be provided:

In[27]:=
ResourceFunction["SimplicialHomologyGroup"][{{1}}, {{2}}]
Out[27]=

Publisher

Naman T.

Version History

  • 1.0.0 – 05 August 2026

Related Resources

License Information