MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: On Defining Functions Symmetric wrt Some Indices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34333] RE: [mg34316] On Defining Functions Symmetric wrt Some Indices
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Wed, 15 May 2002 03:35:28 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Here's a first thought, though it seems clumsy:

SetAttribute[fSubordinate,Orderless]
g[a_,b_,c_]:=(fFirstArg=a;fSubordinate[b,c])
fSubordinate[b_,c_]:=f[fFirstArg,b,c]

That is, the "helper" function fSubordinate is Orderless in its
arguments and uses a global variable to get the value that was last
passed to g.

There's a possibility that Update would be needed (in g before the call
to fSubordinate?) to force Mathematica to notice changes to fFirstArg.

Ugly.

A better option might be:

f[a_,b_,c_]/;!OrderQ[b,c]:=f[a,c,b]
f[a_,b_,c_]:=(whatever)

I'm not sure whether this gets you all the benefits of the Orderless
property, but it would make it evaluate the way you want.  In the second
line you'd define it one way, and let the other line take care of the
symmetric case.

Bobby Treat

-----Original Message-----
From: Alexei Akolzin [mailto:akolzine at uiuc.edu] 
To: mathgroup at smc.vnet.net
Subject: [mg34333] [mg34316] On Defining Functions Symmetric wrt Some Indices

Hello,

For the purposes of formula simplification I need to specify that some
function "f" is symmetric upon SOME of its indices. For example,
f[a,b,c] == f[a,c,b] but NOT equal to f[b,a,c]. 

The proposed command SetAttribute[f,Orderless] makes the function
symmetric wrt ALL of its indices, which I want to avoid.

Is there is a way to neatly solve this problem?

Thanks.

Alexei.





  • Prev by Date: how mathematica deals with complex i in output
  • Next by Date: RE: On Defining Functions Symmetric wrt Some Indices
  • Previous by thread: Re: On Defining Functions Symmetric wrt Some Indices
  • Next by thread: RE: On Defining Functions Symmetric wrt Some Indices