Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

retrieving word for free group with custom set of generators

I would like to define a free group on a custom ordered list of symbols, like say

Frgp=Groups()free([f'a{j}' for j in range (5,10)])

i.e. a5 up to a9 (say). It's important that the list be defined programmatically as above, as the number of generators changes throughout the program run (their labels also need to change).

I would then like to recover elements of the group by evaluating at numbered lists, as in Frgp([1,2]) to get back a5*a6, say, as suggested in the docs. This syntax of Frgp(<numerical list>), however, only works when I define the group via one of the methods

Frgp.<x,y,z> = Groups().free()

or

Frgp=Groups().free(3,'t')

which are not flexible enough to allow me to interpolate strings in variable names (or are they? I have tried all sorts of eval/exec trickery to no avail).

If I define the group as in my preferred style (first code display above), then

sage: Frgp=Groups()free([f'a{j}' for j in range (5,10)])
sage: Frgp([1,2])

results in an error:

TypeError: 'sage.rings.integer.Integer' object is not iterable

retrieving word for free group with custom set of generators

I would like to define a free group on a custom ordered list of symbols, like say

Frgp=Groups()free([f'a{j}' Frgp=Groups().free([f'a{j}' for j in range (5,10)])

i.e. a5 up to a9 (say). It's important that the list be defined programmatically as above, as the number of generators changes throughout the program run (their labels also need to change).

I would then like to recover elements of the group by evaluating at numbered lists, as in Frgp([1,2]) to get back a5*a6, say, as suggested in the docs. This syntax of Frgp(<numerical list>), however, only works when I define the group via one of the methods

Frgp.<x,y,z> = Groups().free()

or

Frgp=Groups().free(3,'t')

which are not flexible enough to allow me to interpolate strings in variable names (or are they? I have tried all sorts of eval/exec trickery to no avail).

If I define the group as in my preferred style (first code display above), then

sage: Frgp=Groups()free([f'a{j}' Frgp=Groups().free([f'a{j}' for j in range (5,10)])
sage: Frgp([1,2])

results in an error:

TypeError: 'sage.rings.integer.Integer' object is not iterable

retrieving word for free group with custom set of generators

I would like to define a free group on a custom ordered list of symbols, like say

Frgp=Groups().free([f'a{j}' for j in range (5,10)])

i.e. a5 up to a9 (say). It's important that the list be defined programmatically as above, as the number of generators changes throughout the program run (their labels also need to change).

I would then like to recover elements of the group by evaluating at numbered lists, as in Frgp([1,2]) to get back a5*a6, say, as suggested in the docs. This syntax of Frgp(<numerical list>), however, only works when I define the group via one of the methods

Frgp.<x,y,z> = Groups().free()

or

Frgp=Groups().free(3,'t')

which are not flexible enough to allow me to interpolate strings in variable names (or are they? I have tried all sorts of eval/exec trickery to no avail).

If I define the group as in my preferred style (first code display above), then

sage: Frgp=Groups().free([f'a{j}' for j in range (5,10)])
sage: Frgp([1,2])

results in an error:

TypeError: 'sage.rings.integer.Integer' object is not iterable

retrieving word for free group with custom set of generators

I would like to define a free group on a custom ordered list of symbols, like say

Frgp=Groups().free([f'a{j}' for j in range (5,10)])

i.e. a5 up to a9 (say). It's important that the list be defined programmatically as above, as the number of generators changes throughout the program run (their labels also need to change).

I would then like to recover elements of the group by evaluating at numbered lists, as in Frgp([1,2]) to get back a5*a6, say, as suggested in the docs. This syntax of Frgp(<numerical list>), however, only works when I define the group via one of the methods

Frgp.<x,y,z> = Groups().free()

or

Frgp=Groups().free(3,'t')

which are not flexible enough to allow me to interpolate strings in variable names (or are they? I have tried all sorts of eval/exec trickery to no avail).

If I define the group as in my preferred style (first code display above), then

sage: Frgp=Groups().free([f'a{j}' for j in range (5,10)])
sage: Frgp([1,2])

results in an error:

TypeError: 'sage.rings.integer.Integer' object is not iterable

Edit:

To clarify, I am aware that the goal I alluded to above can be achieved by other means. For instance, I can do

sage: Frgp=Groups().free(5,'t')
sage: Frgp([1,2])([var(f'a{j}') for j in range (5,10)])
a5*a6

So in other words, I can create a list of symbolic variables and apply a free-group word to that. But this seems like a clumsy workaround. It would be preferable to work in the free group on the desired set of symbolic variables to begin with.

retrieving word for free group with custom set of generators

I would like to define a free group on a custom ordered list of symbols, like say

Frgp=Groups().free([f'a{j}' for j in range (5,10)])

i.e. a5 up to a9 (say). It's important that the list be defined programmatically as above, as the number of generators changes throughout the program run (their labels also need to change).

I would then like to recover elements of the group by evaluating at numbered lists, as in Frgp([1,2]) to get back a5*a6, say, as suggested in the docs. This syntax of Frgp(<numerical list>), however, only works when I define the group via one of the methods

Frgp.<x,y,z> = Groups().free()

or

Frgp=Groups().free(3,'t')

which are not flexible enough to allow me to interpolate strings in variable names (or are they? I have tried all sorts of eval/exec trickery to no avail).

If I define the group as in my preferred style (first code display above), then

sage: Frgp=Groups().free([f'a{j}' for j in range (5,10)])
sage: Frgp([1,2])

results in an error:

TypeError: 'sage.rings.integer.Integer' object is not iterable

Edit:

To clarify, I am aware that the goal I alluded to above can be achieved by other means. For instance, I can do

sage: Frgp=Groups().free(5,'t')
sage: Frgp([1,2])([var(f'a{j}') for j in range (5,10)])
a5*a6

So in other words, I can create a list of symbolic variables and apply a free-group word to that. But this seems like a clumsy workaround. It would be preferable to work in the free group on the desired set of symbolic variables to begin with.

click to hide/show revision 6
retagged

retrieving word for free group with custom set of generators

I would like to define a free group on a custom ordered list of symbols, like say

Frgp=Groups().free([f'a{j}' for j in range (5,10)])

i.e. a5 up to a9 (say). It's important that the list be defined programmatically as above, as the number of generators changes throughout the program run (their labels also need to change).

I would then like to recover elements of the group by evaluating at numbered lists, as in Frgp([1,2]) to get back a5*a6, say, as suggested in the docs. This syntax of Frgp(<numerical list>), however, only works when I define the group via one of the methods

Frgp.<x,y,z> = Groups().free()

or

Frgp=Groups().free(3,'t')

which are not flexible enough to allow me to interpolate strings in variable names (or are they? I have tried all sorts of eval/exec trickery to no avail).

If I define the group in my preferred style (first code display above), then

sage: Frgp=Groups().free([f'a{j}' for j in range (5,10)])
sage: Frgp([1,2])

results in an error:

TypeError: 'sage.rings.integer.Integer' object is not iterable

Edit:

To clarify, I am aware that the goal I alluded to above can be achieved by other means. For instance, I can do

sage: Frgp=Groups().free(5,'t')
sage: Frgp([1,2])([var(f'a{j}') for j in range (5,10)])
a5*a6

So in other words, I can create a list of symbolic variables and apply a free-group word to that. But this seems like a clumsy workaround. It would be preferable to work in the free group on the desired set of symbolic variables to begin with.