Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Concatenation of list of variables

Suppose I have three varaibles x,y,z. For pratical reason, I want to define :

varx = var('x y')
varl = var('z')

A problem arrise immediately

type(varx)

returns <class 'tuple'>

when

type(varl)

returns <class 'sage.symbolic.expression.Expression'>. As they are not of the same (i can understand why but it seems a little weird) type, it's not possible to concatenate them. What is strange is that

[varl]

is a list, but

list(varl)

is not because varl is not enumerable. Finaly,

list(varx)+[varl]

do what i was expecting (concatenation), but it was after a long time of essais and error. Could some one explain the logic behind this ?

Concatenation of list of variables

Suppose I have three varaibles variables x,y,z. For pratical reason, reasons, I want to define :

varx = var('x y')
varl = var('z')

A problem arrise immediately

type(varx)

returns <class 'tuple'>

when

type(varl)

returns <class 'sage.symbolic.expression.Expression'>. As they are not of the same (i can understand why but it seems a little weird) type, it's not possible to concatenate them. What is strange is that

[varl]

is a list, but

list(varl)

is not because varl is not enumerable. Finaly,Finally,

list(varx)+[varl]

do what i I was expecting (concatenation), but it was after a long time of essais and error. Could some one explain the logic behind this ?