Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 186

String permutation

$
0
0

I have a string "abcd". Is there any way in Mathematica such that when I apply some exchange operator $P^{ab}$ it gives me string "bacd"?

Edit:

After reading answers I felt like I did not ask my question properly.

So, I would like to have something such that I can apply multiple permutations eventually. For example:

$P^{xy}P^{xa}P^{ya}$"xya"="ayx"

$P^{ya}P^{xa}P^{xy}$"xya"="ayx"

and so on.

I am still confused as to how to implement these because the answers sort of do S[1]<>S[2] to change specific ones. Is there a way I can implement these?


Viewing all articles
Browse latest Browse all 186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>