Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

turn the simplex type into symbol type

I have a list of elements of type simplex. I need them as symbols. I wrote the following:

import sympy as sym
S = SimplicialComplex([[0,1], [1,2], [0,2]])
Chain = S._n_cells_sorted(1)
print(type(Chain[0]))

Chain2 = []
for i in Chain:
    Chain2.append(str(i))
print(Chain2[0], type(Chain2[0]))

Chain3 = [sym.symbols(v) for v  in Chain2]
print(Chain3[0],type(Chain3[0]))

The program prints:

(0, 1) <class 'sage.topology.simplicial_complex.Simplex'>
(0, 1) <class 'str'>
((0, 1)) <class 'tuple'>

I want to turn the type elements of the initial list Chain into symbols but this program turns them into tuples.

I would appreciate any help!