I wanted to implement in Sage Math some beginning concepts in simplicial complexes for algebraic topology. Sage Math turns out to be very good to use with computing chain complex differentials and homologies. By simply doing the dir command in python, it looks like there is a wealth of modules and functions that needs a lot of examples on usage to be usable, which is where the Sage Math documentation, tutorials, and reference manuals, lack, and of which I ask anyone out there to help in making examples for computation in algebraic topology and sharing them.

The Sage Math file I made with my code snippets is on gist github:

homology.sage

homology.sage

Be sure that the file homology.sage is in your working directory in Sage Math (use pwd to check the current directory, ls -al to check what files are in the current directory, and cd to change directories in Sage Math).

Load the file into Sage Math with

`load(“homology.sage”)`

closedinterval is a closed interval between points, or vertices, ‘a’ and ‘b’.

create_n_simplex_all creates a simplicial complex that includes all possible j-simplexes with j less than or equal to n_fill, with n total vertices.

create_thin_n_polygon creates a polygon with n vertices and only 1-simplices connecting the points “externally” only.

Then I implement Sage Math for use in solving the problems in

https://www.math.hmc.edu/~su/pcmi/projects/simplicial_module/simplicial_pcmi.pdf

One should really look at that pdf and then see how using Sage Math can help in calculating a lot of things in that pdf.

For instance,

`create_thin_n_polygon(2)`

creates the 3 vertex hollow triangle on pp. 2, and

`ascii_art( create_thin_n_polygon(2).chain_complex() )`

gives the augmented chain complex nicely:

` [ 1 1 0]`

[ 0 -1 -1]

[-1 0 1]

0 <-- C_0 <----------- C_1 <-- 0

To get the differential do

`create_thin_n_polygon(2).chain_complex().differential()`

In particular, index for 1 i.e. choose the 1st differential out of that list,

`create_thin_n_polygon(2).chain_complex().differential()[1]`

[ 1 1 0]

[ 0 -1 -1]

[-1 0 1]

Reading off the columns of this matrix, one easily gets the idea of how the 1-differential works on the 2-face to get to the “directed” 1-faces (with arrows)

Also, for instance, the Example on pp. 2, simplicial complex on [5], the chain complex is easily computed by typing into Sage Math and pressing enter:

`hmcExample5.chain_complex().differential()`

`# {0: [],`

#1:

#[ 1 1 0 0 0]

# [ 0 0 0 0 0]

# [ 0 -1 1 1 0]

# [ 0 0 0 -1 -1]

# [-1 0 -1 0 1],

# 2:

# [ 0]

# [ 0]

# [ 1]

# [-1]

# [ 1], 3: []}

Calculating the homology is easy and the message I want to emphasize is to stop doing calculations by hand! Spend more time incisively getting to the concepts and how things work and why and playing around with the computations instead of making things more painful than they should be!

`hmcExample5.homology() # sage: X.homology() # {0: Z, 1: Z, 2: 0}`

This should be the answer for Exercise 1 of that pdf.

You can use create_n_simplex_all to calculate the simplicial complex in Exercise 4 to any order and give a clue that the homologies should all be zero.

Exercise 5,6 are answered quickly, computational wise with these commands in Sage Math and in homology.sage file:

`sage: hmcExercise7_Kleinbottle.homology()`

{0: 0, 1: Z x C2, 2: 0}

sage: hmcExercise7_RP2.homology()

{0: 0, 1: Z x C2, 2: 0}

My questions are the following:

Exercise 8: Is the answer that in this triangulation with only 2 vertices for a torus, it “collapses” into only a closed interval from vertex 1 to vertex 2.

Question 2: Computing out the differentials in matrix form for a chain complex is easy with Sage Math! My question is, how do I get the vectors or the basis vectors out of Sage Math that represents the faces that the differential act on? Or am I not understanding something about the vector spaces that are representing the space of j dimensional faces? (Please someone help clarify this point for me, in reference to the pdf from hmc.edu that I keep referring to)

There is a wealth of functions and modules that someone (maybe an ambitious undergraduate) would find fun to play with, but the reference manual and tutorial pdfs for Sage Math is lacking, and thus ineffective. It’s really very bad. One solution I’m pushing is, and what I’m finding effective, is to tie examples (and teach by example, including myself!) directly with the pdf or developments in textbooks directly.

So my final question would be if there are more functions or modules in Sage Math that could demonstrate and compute out things in algebraic topology that I’ve missed (and this is only a basic first step).

## Conclusion

I implemented in Sage Math some beginning concepts in simplicial complexes for algebraic topology. Sage Math turns out to be very good to use with computing chain complex differentials and homologies. By simply doing the dir command in python, it looks like there is a wealth of modules and functions that needs a lot of examples on usage to be usable, which is where the Sage Math documentation, tutorials, and reference manuals, lack, and of which I ask anyone out there to help in making examples for computation in algebraic topology and sharing them.