Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to permute strings from two lists (or vectors)

Suppose I have to vector of variables

NB=vector(var('x', n=3, latex_name='x'))
B=vector(var('y', n=4, latex_name='ϵ'))

I would like to construct a function say BNB(vec1, vec2, pr, pc) such that when applied to B and for legitiamte values --- i.e. : here, NB should be less than 3 and B should be less than 4 ---, permute the correspondant $x$ and $\epsilon from a vector to an other. That is :

BNB(B, NB, 1,2) gives

$B=[\epsilon_0,x_2,\epsilon_3,\epsilon_4]$ and $NB=[x_0,x_1,\epsilon_1,x_3]$

By advance thanks for the help.