Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a symbolic expression that represents a set of operators. These operators have quite a bit of symmetry to simplify expressions:

A[{1,2},{3,4}]==A[{3,2},{1,4}]==A[{1,4},{3,2}]==A[{3,4},{1,2}]
S[{1},{2}]==S[{2},{1}]

I will use the first term of the series to denote positions.

3->"d"
A[{1,2},{"d",4}]

So for example:

In:
temporary=S[{1}, {2}]*v[{1, 2}, {3, 4}] 
+ S[{2}, {1}]*v[{3, 2}, {1, 4}] 
+ S[{2}, {1}]*v[{3, 4}, {1, 2}]

Out:
3*S[{1},{2}]*A[{1, 4}, {3, 2}]

At current I simply have replacement rules that move indices in a logical way for example:

temporary//.{
x_[{x1_, x2_}, {x3_, x4_}] /; (!condition[x1,x3]) :> v[{x3, x2}, {x1, x4}]
}

(*Condition is a statement that checks the order of indices, for example 
 if x1="b" and x3="a" it would return false and so the expression would be
 reordered so that "a" is now in position 1 and "b" in position 3.*)

It seems if there has to be a better way to do this.

Bonus: Is there a simple way to find the original of a unique value. Say Unique[a]=a$532 unUnique[a$543]=a.

share|improve this question
    
Have you seen this? Admittedly I didn't read your question in detail, but it reminded me of that. Disregard this if it's not helpful. –  Szabolcs Feb 15 '13 at 16:43
    
I did, and in brief test worked great! Unfortunately it would take a rewrite of the entire program to implement. It seems that there would be a simple way to do the above, but I could be wrong. –  Ophion Feb 15 '13 at 16:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.