1 | initial version |

Thank you for your suggestion.

I only actually want to find the dual cells of vertices. I added the code "facade = True" to the existing algorithm which finds the face poset of a simplicial complex K (a warning for below- I have not done much programming before)

def find_face_poset(K):

```
from sage.combinat.posets.posets import Poset
from sage.misc.flatten import flatten
covers = {}
all_cells = flatten([list(f) for f in K.cells().values()])
for C in all_cells:
if C.dimension() >= 0:
covers[tuple(C)] = []
for C in all_cells:
for face in C.faces():
if face.dimension() >= 0:
covers[tuple(face)].append(tuple(C))
return Poset(covers, facade = True)
```

I also created an algorithm to find the cofaces of a simplex $sigma \in K$:

def find_cofaces(K, sigma):

```
m = sigma.dimension()
cofaces = []
cofaces.append(sigma)
for i in range(m+1, K.dimension()+1):
i_faces = K.n_faces(i)
for tau in i_faces:
if sigma.is_face(tau):
if tau.dimension() == i :
cofaces.append(tau)
else:
pass
else:
pass
return cofaces
```

and also an algorithm to find the dual cell of a vertex $\sigma$:

def find_dual_cell(K, sigma):

```
face_poset = find_face_poset(K)
maximal_chains = face_poset.maximal_chains()
dual_cell_vertices = find_cofaces(K, sigma)
dual_cell_facets = []
for tau in maximal_chains:
if sigma.tuple() == tau[0]:
dual_cell_facets.append(tau)
else:
pass
return SimplicialComplex(dual_cell_vertices, dual_cell_facets)
```

I played around with the example

K = simplicial_complexes.Sphere(3)

for sigma in K.n_faces(0): find_dual_cell(K, sigma)

When I get Sage to print dual_cell_vertices and dual_cell_facets (instead of returning SimplicialComplex(dual_cell_vertices, dual_cell_facets)), it seems to produce a correct result. But it never produces the correct simplicial complex! It gives me

Simplicial complex with vertex set (0, 1, 2, 3, 4) and 4 facets

Any help would be very much appreciated!

2 | Change the find_cofaces code slightly |

Thank you for your suggestion.

I only actually want to find the dual cells of vertices. I added the code "facade = True" to the existing algorithm which finds the face poset of a simplicial complex K (a warning for below- I have not done much programming before)

def find_face_poset(K):

```
from sage.combinat.posets.posets import Poset
from sage.misc.flatten import flatten
covers = {}
all_cells = flatten([list(f) for f in K.cells().values()])
for C in all_cells:
if C.dimension() >= 0:
covers[tuple(C)] = []
for C in all_cells:
for face in C.faces():
if face.dimension() >= 0:
covers[tuple(face)].append(tuple(C))
return Poset(covers, facade = True)
```

I also created an algorithm to find the cofaces of a simplex $sigma \in K$:

def find_cofaces(K, sigma):

```
m = sigma.dimension()
cofaces = []
cofaces.append(sigma)
for i in range(m+1, K.dimension()+1):
i_faces = K.n_faces(i)
for tau in i_faces:
if sigma.is_face(tau):
if tau.dimension() == i :
cofaces.append(tau)
else:
pass
else:
pass
return cofaces
```

and also an algorithm to find the dual cell of a vertex $\sigma$:

def find_dual_cell(K, sigma):

```
face_poset = find_face_poset(K)
maximal_chains = face_poset.maximal_chains()
dual_cell_vertices = find_cofaces(K, sigma)
dual_cell_facets = []
for tau in maximal_chains:
if sigma.tuple() == tau[0]:
dual_cell_facets.append(tau)
else:
pass
return SimplicialComplex(dual_cell_vertices, dual_cell_facets)
```

I played around with the example

K = simplicial_complexes.Sphere(3)

for sigma in K.n_faces(0): find_dual_cell(K, sigma)

When I get Sage to print dual_cell_vertices and dual_cell_facets (instead of returning SimplicialComplex(dual_cell_vertices, dual_cell_facets)), it seems to produce a correct result. But it never produces the correct simplicial complex! It gives me

Simplicial complex with vertex set (0, 1, 2, 3, 4) and 4 facets

Any help would be very much appreciated!

3 | Altered the find_cofaces code slightly - produces the same result. |

Thank you for your suggestion.

I only actually want to find the dual cells of vertices. I added the code "facade = True" to the existing algorithm which finds the face poset of a simplicial complex K (a warning for below- I have not done much programming before)

def find_face_poset(K):

```
from sage.combinat.posets.posets import Poset
from sage.misc.flatten import flatten
covers = {}
all_cells = flatten([list(f) for f in K.cells().values()])
for C in all_cells:
if C.dimension() >= 0:
covers[tuple(C)] = []
for C in all_cells:
for face in C.faces():
if face.dimension() >= 0:
covers[tuple(face)].append(tuple(C))
return Poset(covers, facade = True)
```

I also created an algorithm to find the cofaces of a simplex ~~$sigma ~~$\sigma \in K$:

def find_cofaces(K, sigma):

```
m = sigma.dimension()
cofaces = []
cofaces.append(sigma)
for i in range(m+1, K.dimension()+1):
i_faces = K.n_faces(i)
for tau in i_faces:
if sigma.is_face(tau):
if tau.dimension() == i :
cofaces.append(tau)
else:
pass
else:
pass
return cofaces
```

and also an algorithm to find the dual cell of a vertex $\sigma$:

def find_dual_cell(K, sigma):

```
face_poset = find_face_poset(K)
maximal_chains = face_poset.maximal_chains()
dual_cell_vertices = find_cofaces(K, sigma)
dual_cell_facets = []
for tau in maximal_chains:
if sigma.tuple() == tau[0]:
dual_cell_facets.append(tau)
else:
pass
return SimplicialComplex(dual_cell_vertices, dual_cell_facets)
```

I played around with the example

K = simplicial_complexes.Sphere(3)

for sigma in K.n_faces(0): find_dual_cell(K, sigma)

When I get Sage to print dual_cell_vertices and dual_cell_facets (instead of returning SimplicialComplex(dual_cell_vertices, dual_cell_facets)), it seems to produce a correct result. But it never produces the correct simplicial complex! It gives me

Simplicial complex with vertex set (0, 1, 2, 3, 4) and 4 facets

Any help would be very much appreciated!

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.