Ask Your Question

DG44's profile - activity

2017-06-06 10:12:29 -0500 received badge  Popular Question (source)
2013-04-10 01:33:13 -0500 answered a question Matrix of vectors

What I would like is to create a matrix M where M(i,j) is a vector, not just a real number!

The code you gave produces a 2x2 matrix just of real numbers I believe. I want vectors to specify the entries M(i,j) of M, not the rows/columns.

2013-04-10 01:04:16 -0500 asked a question Matrix of vectors

Hi.

Suppose that I have a collection of vectors $v_1, \ldots, v_n \in \mathbb{R}^3$ and I wish to compute all cross products $v_i \times v_j \in \mathbb{R}^3$ where $1 \leq i < j \leq n$. Is it possible to store the output in a matrix, i.e. can I form a matrix M in Sage where $M(i,j) = v_i \times v_j$?

2012-11-30 23:55:25 -0500 received badge  Student (source)
2012-11-30 04:41:50 -0500 answered a question Dual Cells and Face Poset

Thank you! Problem solved :). I think it would be helpful to do

sage: K.face_poset(options...)

with options including facade=True in Sage.

2012-11-30 04:40:07 -0500 received badge  Supporter (source)
2012-11-29 22:40:37 -0500 answered a question Dual Cells and Face Poset

This is completely the correct answer! How frustrating for me! When I try to run the example (on my Macbook Pro with Sage 5.4.1 and OS X 10.8.2)

sage: X = simplicial_complexes.Simplex(2)

sage: find_dual_cell(X, Simplex(X.vertices()[0]))

I get the error

sage: Traceback (click to the left of this block for traceback)...

sage: ValueError: The face ((0,), (0, 2), (0, 1, 2)) is not a subset of the vertex set.

I have created a worksheet at http://www.sagenb.org/home/pub/5038 that contains all of the above code (edit: public worksheets are currently disabled) . It still produces the same error!

2012-11-28 22:55:37 -0500 answered a question Dual Cells and Face Poset

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!

2012-11-28 01:51:09 -0500 received badge  Editor (source)
2012-11-28 01:49:45 -0500 asked a question Dual Cells and Face Poset

Hello.

I would like to create a procedure in Sage to find the dual cell of a simplex $\sigma$ in a simplicial complex $K$. The dual cell $D(\sigma, K)$ of $\sigma$ is a subcomplex of the first barycentric subdivision of $K$. The vertex set is given by the barycentres of all cofaces of $\sigma$, and the simplices are joins of barycentres of the form $\widehat{\sigma_0} \widehat{\sigma_1} ... \widehat{\sigma_s}$ with $\sigma \leq \sigma_0 \leq ... \leq \sigma_s$.

My plan of attack is to view K as a poset, then find the maximal increasing chains $[\sigma_0,..., \sigma_s]$ in K which satisfy $\sigma_0 = \sigma$ . These chains would then be the maximal faces of the dual cell $D(\sigma, K)$.

Creating the poset and finding the maximal chains of simplices is fine. However, if I have a maximal chain $[\sigma_0,..., \sigma_s]$ a problem occurs when checking if $\sigma_0 = \sigma$ - Sage sees $\sigma_0$ as just an element of the poset and not as simplex and $\sigma$ as a simplex but not an element of the poset so the equality is never satisfied.

How can I correct this?

Thanks, Chris .