Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to define a matrix conditional to a list of strings

Need a little help. suppose I have the following list :

signs=['=','=','>=','>=','>=','<=','<=','<=','<=','<=']

with this list I need to create in Sagemath a matrix with 10 lines and 18 columns each equality/inequality sign correspond to a line with

'=' gives 1 on the corresponding line the other 17 enters beeing 0
'>=' gives - 1, 1 on the corresponding line the other 16 enters beeing 0
'<=' gives 1, 1 on the corresponding line the other 16 enters beeing 0

and of course there is only one 1 (-1) in each column.

What I want is a fuction. Some one will tell me that I must learn Python (smile) but each of my tentives fails.

Thank by advaance for the help

How to define a matrix conditional to a list of strings

Need a little help. suppose I have the following list :

signs=['=','=','>=','>=','>=','<=','<=','<=','<=','<=']

with this list I need to create in Sagemath a matrix with 10 lines and 18 columns each equality/inequality sign correspond to a line with

'=' gives 1 on the corresponding line the other 17 enters beeing being 0
'>=' gives - 1, 1 on the corresponding line the other 16 enters beeing being 0
'<=' gives 1, 1 on the corresponding line the other 16 enters beeing being 0

and of course course, there is only one 1 (-1) in each column.

What I want is a fuction. Some one function. Someone will tell me that I must learn Python (smile) but each of my tentives tentatives fails.

Thank by advaance in advance for the help