Enhance a function that involve list
- To: mathgroup at smc.vnet.net
- Subject: [mg36004] Enhance a function that involve list
- From: "J. Guillermo Sanchez" <guillerm at usal.es>
- Date: Mon, 12 Aug 2002 03:34:21 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear friends
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
Guillermo Sanchez