-1
$\begingroup$

How can we permute the indices of a function? Like in my case I have the permutation of three indices and I am using this code but it isn't working. I have to permute the indices of a. Thanks in advance enter image description here

$\endgroup$
  • $\begingroup$ I don't understand the question (the code shown doesn't really make sense). Is Permutations[a[1, 2, 3]] what you want? If not, please clarify by providing an example input and the corresponding desired output. $\endgroup$ – Szabolcs May 14 '18 at 10:27
  • $\begingroup$ Yes, I denote 1,2,3 by i,j,k. I need to permute 1,2,3 in a[1,2,3] $\endgroup$ – Mahnoor May 14 '18 at 10:31
0
$\begingroup$

Maybe this will help you:

l = a[i, j, k];
permutations = Permutations[Range[3]];
l[[permutations[[2]]]]

a[i, k, j]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.