Re: [Newbie questions] function composition
- To: mathgroup at smc.vnet.net
- Subject: [mg38104] Re: [Newbie questions] function composition
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 3 Dec 2002 04:31:55 -0500 (EST)
- References: <as5pqo$nh0$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Francois,
1) I wonder if b=d should be b = e. If so
f[f[a_,b_,1],1,b_] :=f[f[a,b,1/2],b,1/2];
2) Provided that {c -> 0, a -> 0} will do instead of {a -> 0, c -> 0} then
Partition[Thread[PadRight[lst, 4, lst, -1] -> 0], 2, 1]
{{b -> 0, c -> 0}, {c -> 0, a -> 0}, {a -> 0, b -> 0}}
RotateLeft[Partition[Thread[Append[lst, lst[[1]]] -> 0], 2, 1], 1]
{{b -> 0, c -> 0}, {c -> 0, a -> 0}, {a -> 0, b -> 0}}
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Francois Bernard Lauze" <francois at itu.dk> wrote in message
news:as5pqo$nh0$1 at smc.vnet.net...
> 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
>
>