On Thursday, March 8, 2012 8:56:13 PM UTC-8, Itamar Gal wrote:
>
> Hey, I'm new to sage and a first time poster to sage-support. I've
> just started experimenting with the SimplicialComplex class and I'm
> getting unexpected results in H_0 when computing homology; it seems to
> be returning 0 when it shouldn't be. Here's an example:
>
> ----------------------------------------------------------------------
> | Sage Version 4.7.1, Release Date: 2011-08-11 |
> | Type notebook() for the GUI, and license() for information. |
> ----------------------------------------------------------------------
> sage: S = SimplicialComplex([1,2],[])
> sage: S.homology()
> {0: 0}
> sage: S = SimplicialComplex([1,2,3,4],[[1,2],[1,3],[2,3]])
> sage: S.homology()
> {0: 0, 1: Z}
>
> Shouldn't I be getting {0: 1} as my output in both cases, since there
> are two connected components in each complex?
Look at the documentation for "SimplicialComplex":
The elements of ``vertex_set`` are not automatically in the
simplicial complex: each one is only included if it is a vertex
of at least one of the specified facets.
So if you do
sage: S = SimplicialComplex([1,2,3,4],[[1,2],[1,3],[2,3]])
then S will actually only include the vertices 1, 2, 3, and it will
therefore be connected. If you do
sage: S = SimplicialComplex([1,2,3,4],[[1,2],[1,3],[2,3],[4]])
then S will have two connected components. By the way, note that you can
omit the vertex set completely:
sage: S = SimplicialComplex([[1,2],[1,3],[2,3],[4]])
will do the same thing as the previous example.
--
John
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org