turn the simplex type into symbol type

asked 2023-01-25 00:02:46 +0200

anonymous user

Anonymous

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!

edit retag flag offensive close merge delete

Comments

According to the documentation at https://docs.sympy.org/latest/modules..., if you pass a tuple to sym.symbols, it will return a tuple. This seems more like a sympy question than a Sage one.

John Palmieri gravatar imageJohn Palmieri ( 2023-01-25 00:27:51 +0200 )edit