Re: Help in defining nearly orderless function
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1981] Re: Help in defining nearly orderless function
- From: Roman Maeder <maeder at inf.ethz.ch>
- Date: Mon, 4 Sep 1995 22:21:59 -0400
- Organization: Computer Science, ETH Zurich
Vlad.Fridkin at manuel.anu.edu.au said: > On the up and up in mathematica I got stuck with trying to define a > function > f[a,b,c,d] > that satisfies the symmetries: > f[a,b,c,d] = f[b,a,c,d] > and > f[a,b,c,d] = f[a,b,d,c] Such symmetries are best realized with conditional rules: In[1]:= f[a_, b_, c_, d_] /; !OrderedQ[{a, b}] := f[b, a, c, d] In[2]:= f[a_, b_, c_, d_] /; !OrderedQ[{c, d}] := f[a, b, d, c] In[4]:= f[x, y, u, v] - f[y, x, v, u] Out[4]= 0 ---- Roman Maeder Theoretical Computer Science ETH Zentrum, IFW 8092 Zurich Switzerland