Re: Building a list of all words of length less than k in a given
- To: mathgroup at smc.vnet.net
- Subject: [mg108377] Re: Building a list of all words of length less than k in a given
- From: dh <dh at metrohm.com>
- Date: Mon, 15 Mar 2010 05:02:36 -0500 (EST)
- References: <hnictj$t18$1@smc.vnet.net>
Hi,
Outer will do what you want.
Note that I defined f0 as Identity:
k = 2;
f0[x_] = x;
alpha = {f0, f1, f2};
Outer[Composition[##][x] &, Sequence @@ Table[alpha, {k}]]
Daniel
On 14.03.2010 11:14, NIUNIU LAO wrote:
> Hello group,
> Is there a standard way to :
> 1)specify an alphabet, here for example the two-letter alphabet {f1,f2}
> 2)generate all words (aka monic monoid polynomials, aka noncommutative
> products) of length less than or equal to N with {f1,f2}
> 3)get results in a list.
> In my case, I f1,f2 are functions and the product is function composition,
> which I want to then evaluate at one, or several values x.
> Consequently I cheated by adding Identity to my alphabet and building all
> Tuples: my solution is:
>
> indices = DeleteDuplicates[Tuples[{f1, f2, Identity}, k]]
> Table[Apply[Composition, indices[[p]]][x], {p, Length[indices]}]
>
> However I guess I am being blundering and suboptimal: if someone knows a
> more standard, better way, thank you for letting me know!
> Thank you.
> Regards,
> LN
>
>
--
Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>