A question about the zero-th betti number computation with Sage

111 views
Skip to first unread message

Philippe Saade

unread,
Oct 27, 2009, 10:54:04 AM10/27/09
to sage-...@googlegroups.com
Hi all.

There is an example in the official Reference Manual about
SimplicialComplex and Betti Numbers and Euler Characteristic.

S = SimplicialComplex(3, [[0,1], [1,2], [0,2]]) # circle
T = S.product(S) # torus
T

Simplicial complex with 16 vertices and 18 facets


and

T.euler_characteristic()
0

which is correct.

My problem is with the computation of Betti numbers :
T.betti()
{0: 0, 1: 2, 2: 1}

coherent with
T.homology()
{0: 0, 1: Z x Z, 2: Z}


For the torus (correct me if I am wrong), the 0-th Betti number should be 1.
This would agree with the formula given for the Euler Characteristic
in that case : X = B_0 - B_1 + B_2 = 0

Maybe I misunderstood something here...

Thanks for your kind answer...

Best regards
Philippe Saadé


NB : according to the source code of SimplicialComplex, the first
definition should be : S = SimplicialComplex(2, [[0,1], [1,2], [0,2]])
# circle

John H Palmieri

unread,
Oct 27, 2009, 11:04:52 AM10/27/09
to sage-devel
On Oct 27, 7:54 am, Philippe Saade <psa...@gmail.com> wrote:
> Hi all.
>
> There is an example in the official Reference Manual about
> SimplicialComplex and Betti Numbers and Euler Characteristic.
>
> S = SimplicialComplex(3, [[0,1], [1,2], [0,2]]) # circle
> T = S.product(S)  # torus
> T
>
>     Simplicial complex with 16 vertices and 18 facets
>
> and
>
> T.euler_characteristic()
>    0
>
> which is correct.
>
> My problem is with the computation of Betti numbers :
> T.betti()
>   {0: 0, 1: 2, 2: 1}
>
> coherent with
> T.homology()
>    {0: 0, 1: Z x Z, 2: Z}
>
> For the torus (correct me if I am wrong), the 0-th Betti number should be 1.
> This would agree with the formula given for the Euler Characteristic
> in that case : X = B_0 - B_1 + B_2  = 0


The homology is reduced, so H_0 = Z, so the 0th Betti number is 0. I
suppose it should be called the 0th reduced Betti number instead, but
it's just the rank of H_0...


>
> Maybe I misunderstood something here...
>
> Thanks for your kind answer...
>
> Best regards
> Philippe Saadé
>
> NB : according to the source code of SimplicialComplex, the first
> definition should be : S = SimplicialComplex(2, [[0,1], [1,2], [0,2]])

Any vertices which don't appear explicitly in simplices are ignored,
so this is the same as

SimplicialComplex(307, [[0,1], [1,2], [0,2]]) or SimplicialComplex
(98, [[0,1], [1,2], [0,2]])

or all other similar commands. As it says in the reference manual,

The elements of the vertex set are not automatically contained in
the simplicial complex: each one is only included if and only if it
is a vertex of at least one of the specified facets.

John

Philippe Saade

unread,
Oct 27, 2009, 12:57:48 PM10/27/09
to sage-...@googlegroups.com
On Tue, Oct 27, 2009 at 4:04 PM, John H Palmieri <jhpalm...@gmail.com> wrote:
>> For the torus (correct me if I am wrong), the 0-th Betti number should be 1.
>> This would agree with the formula given for the Euler Characteristic
>> in that case : X = B_0 - B_1 + B_2  = 0
>
>
> The homology is reduced, so H_0 = Z, so the 0th Betti number is 0. I
> suppose it should be called the 0th reduced Betti number instead, but
> it's just the rank of H_0...
>
>
Thanks for the answer. That's what I guessed but maybe it should be
mentionned in the documentation of the method betti() because Sage is
also used by students just discovering homology and B_0 is the one
they understand most easily.


>> NB : according to the source code of SimplicialComplex, the first
>> definition should be : S = SimplicialComplex(2, [[0,1], [1,2], [0,2]])
>
> Any vertices which don't appear explicitly in simplices are ignored,
> so this is the same as
>
> SimplicialComplex(307, [[0,1], [1,2], [0,2]])  or   SimplicialComplex
> (98, [[0,1], [1,2], [0,2]])
>
> or all other similar commands.  As it says in the reference manual,
>
>   The elements of the vertex set are not automatically contained in
>   the simplicial complex: each one is only included if and only if it
>   is a vertex of at least one of the specified facets.
>
> John
>

> -

I read that one too. My remark, again, was motivated by the point of
view of a newbie. My idea is that the examples in the docs should be
kept as simple as they can be.
If one reads "3", then one understands that it corresponds to the
"human" number of vertices (i.e. start counting at 1 and not 0).
In fact, here, "3" stands for "Lets take 4 vertices, but use only
3"... Misleading I think.

Lastly,
Sa = SimplicialComplex(3, [[0,1], [1,2], [0,2]]) # circle
Sa
Simplicial complex with vertex set (0, 1, 2, 3) and facets {(1, 2), (0,
2), (0, 1)}

so vertex 3 is still present in the list (from the point of view of __repr__)

But the most important thing I have to say : thanks for the
implementation : great work and it is nice to use it.
My remarks are minor ones...

Phil

John H Palmieri

unread,
Oct 27, 2009, 2:50:29 PM10/27/09
to sage-devel


On Oct 27, 9:57 am, Philippe Saade <psa...@gmail.com> wrote:
> On Tue, Oct 27, 2009 at 4:04 PM, John H Palmieri <jhpalmier...@gmail.com> wrote:>> For the torus (correct me if I am wrong), the 0-th Betti number should be 1.
You can find suggested fixes here: <http://trac.sagemath.org/sage_trac/
ticket/7323>

John

Philippe Saade

unread,
Oct 28, 2009, 5:08:46 AM10/28/09
to sage-...@googlegroups.com
On Tue, Oct 27, 2009 at 7:50 PM, John H Palmieri <jhpalm...@gmail.com> wrote:

>
> You can find suggested fixes here: <http://trac.sagemath.org/sage_trac/
> ticket/7323>
>
>  John
>

Hi John.

Thanks for the patch !
I have an account on trac so i could review it but it would make a
cyclic reference...

By the way, since reduced homology is only supposed to change H_0, and
that if ususal homology group H_0 is of rank r, then the reduced
homology one is of rank r-1, wouldn't it be better to add 1 to the
"reduced Betti number B_0" you compute, so that T.betti() would just
really give all the real Betti numbers ?

Sorry to bother you with my questions...

Phil

John H Palmieri

unread,
Oct 28, 2009, 10:44:33 AM10/28/09
to sage-devel
On Oct 28, 2:08 am, Philippe Saade <psa...@gmai l.com> wrote:
> On Tue, Oct 27, 2009 at 7:50 PM, John H Palmieri <jhpalmier...@gmail.com> wrote:
>
>
>
> > You can find suggested fixes here: <http://trac.sagemath.org/sage_trac/
> > ticket/7323>
>
> >  John
>
> Hi John.
>
> Thanks for the patch !
> I have an account on trac so i could review it but it would make a
> cyclic reference...

No, you can certainly referee it. Otherwise the ticket may languish
there...

> By the way, since reduced homology is only supposed to change H_0, and
> that if ususal homology group H_0 is of rank r, then the reduced
> homology one is of rank r-1, wouldn't it be better to add 1 to the
> "reduced Betti number B_0" you compute, so that T.betti() would just
> really give all the real Betti numbers ?

Okay, that sounds good, I put a new patch up with does this.

John
Reply all
Reply to author
Forward
0 new messages