Re: Enhance a function that involve list
- To: mathgroup at smc.vnet.net
- Subject: [mg36034] Re: [mg36004] Enhance a function that involve list
- From: BobHanlon at aol.com
- Date: Tue, 13 Aug 2002 05:22:57 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 8/12/02 4:43:54 AM, guillerm at usal.es writes:
>I wish to build a function to obtain from a list (i.e.:)
>
>list = {a1, a2, a3, a4};
>
>and output like this:
>
>{{f[a2, a1, a2]},
>{f[a3, a1, a2], f[a3, a2, a3]},
>{f[a4, a1, a2], f[a4, a2, a3], f[a4, a3, a4]}}
>
>This following function work fine
>
>
>function1[tau1_] :=
> Table[Table[
> f[Extract[tau1, j + 1], Extract[tau1, i], Extract[tau1, i + 1]],
>
>{i, 1,
> Length[tau1] - Length[tau1] + j}], {j, 1, Length[tau1] - 1}]
>
>function1[list] // TableForm
>
>
>but I think is not so eleghant. I will appreciate any help to build a
>
>more effecient and eleghant solution
Table[f[list[[i+1]],list[[j]],list[[j+1]]],{i,Length[list]-1},{j,i}]
Bob Hanlon
Chantilly, VA USA