Ask Your Question
1

Constructing words or strings using iteration

asked 2021-03-26 09:42:43 +0200

Ingrid gravatar image

updated 2021-03-26 11:06:36 +0200

slelievre gravatar image

It is not allowed to label simplices with numbers or lists, and I want to enter a few thousand simplices. I am therefore trying to do something that naively looks like this:

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet
sage: for i in range(4):
....:     Word(('v', i)) = AbstractSimplex(0)

I have also tried using strings. Does anyone know how to do this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-26 11:10:16 +0200

slelievre gravatar image

Using a dictionary might help here.

Example:

sage: from sage.homology.simplicial_set import AbstractSimplex, SimplicialSet
sage: v = {i: AbstractSimplex(0) for i in range(4)}
sage: v[0]
Delta^0
sage: v[1]
Delta^0
sage: v[2]
Delta^0
sage: v[3]
Delta^0
edit flag offensive delete link more

Comments

Thanks Sam

Ingrid gravatar imageIngrid ( 2021-03-26 11:38:00 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-03-26 09:42:43 +0200

Seen: 36 times

Last updated: Mar 26