       Re: Symmetrizing function arguments

• To: mathgroup at smc.vnet.net
• Subject: [mg127626] Re: Symmetrizing function arguments
• From: "Nasser M. Abbasi" <nma at 12000.org>
• Date: Wed, 8 Aug 2012 03:16:45 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <jvqem1\$gtt\$1@smc.vnet.net>

```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

```

• Prev by Date: Re: Landau letter, Re: Mathematica as a New Approach...
• Next by Date: how does Rotate in 2D work?
• Previous by thread: Re: Symmetrizing function arguments
• Next by thread: Re: Symmetrizing function arguments