[sage-support] Re: substitution in list

2021-12-28 Thread Rogerio
Besides the pure python options pointed above, if your list is filled by symbolic expressions, you can also turn it into a vector and do the substitutions straightforwardly. Given x = list(var('x', n=10)) ep = list(var('epsilon', n=10)) a random sublist my_list = [x[randint(0,8)] for _ in r

[sage-support] Re: substitution in list

2021-12-28 Thread Nils Bruin
That's a python question. See for instance, https://stackoverflow.com/questions/2582138/finding-and-replacing-elements-in-a-list If you scroll down, there are some suggestions there that deal with multiple replacements as well On Tuesday, 28 December 2021 at 06:09:35 UTC-8 cyrille piatecki wrot

[sage-support] substitution in list

2021-12-28 Thread cyrille piatecki
First I have seen that perhaps my question has an answer in AskSagemath but currently it doesn't answer. Suppose I have a list of variables x_1, x_2, x_3,...x_n I have some sub-list of variables say [x_4, x_1, x_6...]. But whenever x_4, x_5,x_6 belong to this list I want the substitution x_4 ->