Ask Your Question
0

How to extract coordinate tuples of homology generators from a simplicial complex?

asked 2025-07-22 15:16:07 +0200

Dharm gravatar image

updated 2025-07-22 15:24:46 +0200

I am trying to extract the generators of the homology of a simplicial complex using SageMath. The only way I currently know to do this is to first convert the simplicial complex into a chain complex, and then compute the homology with generators. For example,

K = SimplicialComplex([[0, 1], [1, 2], [2, 0]])
CC = K.chain_complex()
d = CC.homology(generators=True)
print(d)

This returns the output:

{0: [(Z, Chain(0:(0, 1, 0)))], 1: [(Z, Chain(1:(1, -1, 1)))]}

I would like to extract just the coordinate tuple from the generator — for instance, from Chain(1:(1, -1, 1)), I want to extract the tuple (1, -1, 1). I know that the output is a dictionary. Using the following command

d[1][0][1]

I get

Chain(1:(1, -1, 1))

What is the proper way to access or extract this tuple of coefficients from the Chain object? Any help would be appreciated!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2025-07-22 19:29:24 +0200

If you just want homology generators, this works for me:

sage: K = SimplicialComplex([[0, 1], [1, 2], [2, 0]])
sage: K.set_immutable()
sage: K.homology(generators=True)
{0: [], 1: [(Z, (0, 1) - (0, 2) + (1, 2))]}

If you want to use the associated chain complex, the documentation obtained by K.chain_complex? says

The rows and columns of the boundary matrices are indexed by the lists
given by the "_n_cells_sorted()" method, which by default are sorted.

So you should look at

sage: K._n_cells_sorted(1)
[(0, 1), (0, 2), (1, 2)]

The ordered list of coefficients 1, -1, and 1 can be extracted by using:

sage: CC = K.chain_complex()
sage: d = CC.homology(1, generators=True)
sage: c = d[0][1]
sage: c
Chain(1:(1, -1, 1))
sage: c._vec
{1: (1, -1, 1)}
sage: c._vec[1]
(1, -1, 1)
edit flag offensive delete link more

Comments

Thank you very much!

Dharm gravatar imageDharm ( 2025-07-23 03:48:15 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2025-07-22 15:16:07 +0200

Seen: 1,354 times

Last updated: Jul 22