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
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