Ask Your Question
0

How to access the chains of the chain complex of a simplex?

asked 2023-01-26 22:59:44 +0200

anonymous user

Anonymous

updated 2023-01-27 01:38:49 +0200

I have a simplicial complex and I want to get the chains of its chain complex. I have the following code:

S = SimplicialComplex([[1,2],[1,3],[1,4],[2,3],[2,4]])
print(S.chain_complex().homology(generators=True)[1][0][1])

It prints:

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

which is one of the chains of dimension one. It is of type

 <class 'sage.homology.chain_com`enter code here`plex.ChainComplex_class_with_category.element_class'>

How do I access the list of numbers (1, 0, -1, 0, 1) of this chain?

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-01-27 01:51:47 +0200

updated 2023-01-27 01:52:15 +0200

You want the vector method:

sage: S = SimplicialComplex([[1,2],[1,3],[1,4],[2,3],[2,4]])
sage: H = S.chain_complex().homology(generators=True)[1][0][1]
sage: H.vector?
Signature:      H.vector(degree)
Docstring:     
   Return the free module element in "degree".

   EXAMPLES:

      sage: C = ChainComplex({0: matrix(ZZ, 2, 3, [3, 0, 0, 0, 0, 0])})
      sage: c = C({0:vector([1, 2, 3]), 1:vector([4, 5])})
      sage: c.vector(0)
      (1, 2, 3)
      sage: c.vector(1)
      (4, 5)
      sage: c.vector(2)
      ()
Init docstring: Initialize self.  See help(type(self)) for accurate signature.
File:           ~/Desktop/Sage/git/sage/src/sage/homology/chain_complex.py
Type:           method
sage: H.vector(1)
(1, 0, -1, 0, 1)
sage: v = H.vector(1)
sage: type(v)
<class 'sage.modules.vector_integer_dense.Vector_integer_dense'>
edit flag offensive delete link more

Comments

Thank you so much, John. It worked!

Inez gravatar imageInez ( 2023-01-27 19:05:27 +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: 2023-01-26 22:59:44 +0200

Seen: 126 times

Last updated: Jan 27 '23