MathGroup Archive 2002

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

Search the Archive

Re: [Newbie questions] function composition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38141] Re: [Newbie questions] function composition
  • From: Mark Westwood <MarkCWestwood at compuserve.com>
  • Date: Tue, 3 Dec 2002 04:35:18 -0500 (EST)
  • References: <as5pqo$nh0$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Francois

1) The naive answer is simply to include the line

f[f[a_,1,1],1,e] := f[f[a,1,1/2],1,1/2]

in your definition of the function f.  (Note that by your definition
b=c=d=1).  However, I'm not sure I've fully understood your question so
this naive answer may not go far enough.

2)  Again, I'm not entirely sure what you want to do.  But here's one
way of transforming your sample input into your sample output.  First,
load the Combinatorica package, we need the KSubset function:

<<DiscreteMath`Combinatorica`

then simply write:

Map[Rule[#,0]&,KSubsets[{a,b,c},2],{-1}]


Hope these help.

Regards
Mark Westwood


Francois Bernard Lauze wrote:
> 
> Hi,
> 
> Hope I won't be too imprecise, I just started with mathematica
> last Friday.
> 1)
> I want to define a function, say f, with among others the following property
> f[f[a,b,c],d,e] should be evaluated as f[f[a,b,1/2],b,1/2] in case
> b = d and c = d = 1
> 
> 2) from a list, say {a,b,c}, I would like to generate
> {{b->0,c->0},{a->0,c->0},{a->0,b->0}
> I guess I have understood the iterative way of doing that,
> but what about a more functionqal form?
> 
> Thanks a lot,
> Francois
> 
> --
> Francois Lauze
> The IT University of Copenhagen, Glentevej 67
> 2400 Kbh NV, Denmark
> Tel (45) 38 16 89 29


  • Prev by Date: Re: Producing ticks on left axis with axis labels
  • Next by Date: RE: [Newbie questions] function composition
  • Previous by thread: Re: [Newbie questions] function composition
  • Next by thread: RE: [Newbie questions] function composition