Ask Your Question
2

Obtaining symbolic generators from homology()

asked 2015-09-26 22:21:07 +0100

mfansler gravatar image

I need to compute the homology of a chain complex whose graded basis is a collection of formal symbols, say {a,b,c,…}. Does Sage have the capability to store a basis of symbols and express a homology class in terms of a symbolic class representative?

I have been able to able to create a ChainComplex instance using matrices for the boundary maps. For example,

TorusComplex = ChainComplex({0: matrix(Z_2,2,1,[0,0],sparse=True),1: matrix(Z_2,1,2,[0,0],sparse=True)})

"Chain complex with at most 3 nonzero terms over Ring of integers modulo 2"

TorusComplex.homology(generators=true)

"{0: (Vector space of dimension 1 over Ring of integers modulo 2, [(1)]), 1: (Vector space of dimension 2 over Ring of integers modulo 2, [(1, 0), (0, 1)]), 2: (Vector space of dimension 1 over Ring of integers modulo 2, [(1)])}"

However, I can't figure out how define symbols so that the resulting generators are symbols. Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-09-27 22:59:18 +0100

tmonteil gravatar image

updated 2015-09-27 23:08:03 +0100

From your question it is not completely clear to me what you expect, since i guess you do not want to play with elements of the symbolic ring (which is what "symbol" usually refers to in Sage), so i suspect you want to give Python names to the elements of your graded basis. Here is a suggestion, please explicit more if it is not satisfactory.

When you write:

sage: H = TorusComplex.homology(generators=true) ; H
{0: [(Vector space of dimension 1 over Ring of integers modulo 2,
   Chain(0:(1)))],
 1: [(Vector space of dimension 1 over Ring of integers modulo 2,
   Chain(1:(1, 0))),
  (Vector space of dimension 1 over Ring of integers modulo 2,
   Chain(1:(0, 1)))],
 2: [(Vector space of dimension 1 over Ring of integers modulo 2,
   Chain(2:(1)))]}

H is a dictionary that maps a dimension (an element of the set {0,1,2}) to a list of 2-uples (vector space, generator). So, you need to recover the list of generators that appear as second projection of the values of this dictionary. Here is a possible way:

sage: D = dict()

sage: for dim in H:
....:     for n in range(len(H[dim])):
....:         D[dim,n] = H[dim][n][1]

sage: D
{(0, 0): Chain(0:(1)),
 (1, 0): Chain(1:(1, 0)),
 (1, 1): Chain(1:(0, 1)),
 (2, 0): Chain(2:(1))}

Now you can easily give Python names to those four chains, that form your graded basis:

sage: a,b,c,d = D[0,0], D[1,0], D[1,1], D[2,0]

Then you can play with them:

sage: a+a
Trivial chain

sage: a+b+a == b
True

sage: a+b
Chain with 2 nonzero terms over Ring of integers modulo 2

sage: b+c
Chain(1:(1, 1))

sage: (a+b+2*c+d)._vec
{0: (1), 1: (1, 0), 2: (1)}

sage: ascii_art(a+b+2*c+d)
   d_2       d_1       d_0       d_-1  
0 <---- [1] <---- [1] <---- [1] <----- 0
                  [0]

As you can see, an element of the homology is stored as dictionary that map each dimension to a vector in the corresponding vector space, which is somehow richer than flat names such as a,b,c,d since it keeps the graded information.

edit flag offensive delete link more

Comments

@tmonteil, thanks for the reply! Actually, it's not the generators that I wish to have symbolic names for, but instead the elements within the generators. For instance, if the torus had a cellular decomposition of a 2-cell u, two 1-cells, a,b and vertex v, I would like to obtain from TorusComplex.homology(generators=true) homology where the generators are [v], [(a,0),(0,b)] and [u], or whatever it should be. I want the generators, which form bases for the vector spaces, to be symbolic expressions. Does that make sense? I don't know how to enter symbolic representations of a chain complex, but only the incidence matrices.

mfansler gravatar imagemfansler ( 2015-09-28 00:18:34 +0100 )edit

Perhaps I do want to "play with the Symbolic Ring" as you say. However, the homology() function says it only works for integer rings and fields. Would that be compatible?

mfansler gravatar imagemfansler ( 2015-09-28 17:56:55 +0100 )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: 2015-09-26 22:21:07 +0100

Seen: 399 times

Last updated: Sep 27 '15