Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11255 > unrolled thread
| Started by | Hauke Reddmann <fc3a501@uni-hamburg.de> |
|---|---|
| First post | 2012-08-07 07:04 +0000 |
| Last post | 2012-08-09 01:37 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Symmetrizing function arguments Hauke Reddmann <fc3a501@uni-hamburg.de> - 2012-08-07 07:04 +0000
Re: Symmetrizing function arguments "Nasser M. Abbasi" <nma@12000.org> - 2012-08-08 07:16 +0000
Re: Symmetrizing function arguments Hauke Reddmann <fc3a501@uni-hamburg.de> - 2012-08-09 01:37 +0000
| From | Hauke Reddmann <fc3a501@uni-hamburg.de> |
|---|---|
| Date | 2012-08-07 07:04 +0000 |
| Subject | Symmetrizing function arguments |
| Message-ID | <jvqem1$gtt$1@smc.vnet.net> |
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
[toc] | [next] | [standalone]
| From | "Nasser M. Abbasi" <nma@12000.org> |
|---|---|
| Date | 2012-08-08 07:16 +0000 |
| Message-ID | <jvt3oc$lum$1@smc.vnet.net> |
| In reply to | #11255 |
On 8/7/2012 2:04 AM, Hauke Reddmann wrote:
> 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]];
why not simply use Sort, that is what you are doing above?
You can defined your G to take a list as in {a_,b_,c_} from Sort
or use Sequence to splice the result from Sort before calling G.
Here is one example:
-----------------------
G[{a_, b_, c_}] := Print["a=", a, " b=", b, " c=", c]
g[a_, b_, c_] := G[Sort[{a, b, c}, #1 > #2 &]]
---------------------------
And another using Sequnece, so you do not need to change
G defintion
-----------------------
G[a_, b_, c_] := Print["a=", a, " b=", b, " c=", c]
g[a_, b_, c_] := G[Sequence @@ Sort[{a, b, c}, #1 > #2 &]]
---------------------------
--Nasser
[toc] | [prev] | [next] | [standalone]
| From | Hauke Reddmann <fc3a501@uni-hamburg.de> |
|---|---|
| Date | 2012-08-09 01:37 +0000 |
| Message-ID | <jvv49l$ps8$1@smc.vnet.net> |
| In reply to | #11264 |
Nasser M. Abbasi <nma@12000.org> wrote: > On 8/7/2012 2:04 AM, Hauke Reddmann wrote: >> 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]]; > why not simply use Sort, that is what you are doing above? a) because I am a n00b :-), but more relevant b): these were examples, but the actual 6j symbols are NOT invariant under Sort, just under tetrahedral symmetry! I.e. 6j[a,b,c,d,e,f]=6j[c,d,a,b,e,f] (and likewise for the third pair e,f) and 6j[a,b,c,d,e,f]=6j[a,b,d,c,f,e] (and likewise all other double swaps). So applying Sort correctly is not that trivial. -- Hauke Reddmann <:-EX8 fc3a501@uni-hamburg.de Out on deck the dawn arrived Your grey sweater oversized The rooftops glimmered before our eyes
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web