Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11270
| From | "djmpark" <djmpark@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Symmetrizing function arguments |
| Date | 2012-08-08 07:18 +0000 |
| Message-ID | <jvt3rj$m00$1@smc.vnet.net> (permalink) |
| References | <30176350.22535.1344323226826.JavaMail.root@m06> |
| Organization | Time-Warner Telecom |
Do you mean that from F[a,b,c,d,e,f] you want to write a new function fSym
that is invariant to the interchange of any two of its arguments?
Here is how you might do it for a three argument function. Create all the
permutations of the arguments. There are 3! == 6 of them.
Permutations[{a, b, c}]
Length[%]
{{a, b, c}, {a, c, b}, {b, a, c}, {b, c, a}, {c, a, b}, {c, b, a}}
6
Then write the new function as:
fSym[a_, b_, c_] = Total[F @@@ Permutations[{a, b, c}]]/3!
1/6 (F[a, b, c] + F[a, c, b] + F[b, a, c] + F[b, c, a] + F[c, a, b] + F[c,
b, a])
fSym[a, b, c] == fSym[b, a, c]
True
For a six argument function use:
fSym[a_, b_, c_, d_, e_, f_] =
Total[F @@@ Permutations[{a, b, c, d, e, f}]]/6!;
fSym[a, b, c, d, e, f] == fSym[b, a, c, d, e, f]
True
fSym[a, b, c, d, e, f] == fSym[b, a, c, d, f, e]
True
David Park
djmpark@comcast.net
http://home.comcast.net/~djmpark/index.html
From: Hauke Reddmann [mailto:fc3a501@uni-hamburg.de]
I'd like to define a quasi 6j symbol which has tetrahedron symmetry in its 6
arguments. At the moment (I'm a n00b, still :-) I use a cheap hack:
f[a_,b_] := If[a>b,F[a,b],F[b,a]];
Bingo, f now is commutative and sorts by descending arguments, and NOOOOO
endless loops. My, am I proud of myself :-) Needless to say, using this
method to implement the symmetries of h[a_,b_,c_,d_,e_,f] is a royal pain in
the backside, as you see with the hassle needed already for just 3
arguments...
g[a_,b_,c_]:=If[b>c,If[a>c,If[a>b,G[a,b,c],g[b,a,c]],g[c,b,a]],g[a,c,b]];
...especially considering all the subcases needed when two arguments are
equal.
Surely, you can offer a more elegant way? It more or less suffices to bring
the largest value to position 1 and the second-largest to 2 or 3 (assume a,b
and c,d and e,f are the opponent edges of the tetrahedron), but optimal
would be if none of the 24 tetrahedron operations gives a smaller lexicalic
ordering even in the case of equal entries.
P.S. No, the inbuilt 6j symbol is useless - wrong Lie group :-)
--
Hauke Reddmann <:-EX8 fc3a501@uni-hamburg.de
Out on deck the dawn arrived
Your grey sweater oversized
The rooftops glimmered before our eyes
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Symmetrizing function arguments "djmpark" <djmpark@comcast.net> - 2012-08-08 07:18 +0000 Re: Symmetrizing function arguments Hauke Reddmann <fc3a501@uni-hamburg.de> - 2012-08-09 01:32 +0000
csiph-web