       Sequence@@List

• To: mathgroup at smc.vnet.net
• Subject: [mg64644] Sequence@@List
• From: Martin Schoenecker <ms_usenet at gmx.de>
• Date: Sat, 25 Feb 2006 02:53:06 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello,

I want to construct the corresponding variable list to a
CoefficientList[poly, {var1, var2, var3,...}].

The following code does the work:

---------------------------------------------------------
In:=
vl = {x, y, z}
dims = {2, 3, 2}
r = Dimensions[dims]

Out=
{x,y,z}

Out=
{2,3,2}

Out=
{3}

In:=
Table[vl[]^a*vl[]^b*
vl[]^c, {a, 0,
dims[] - 1},
{b, 0, dims[] - 1},
{c, 0, dims[] - 1}]

Out=
\!\({{{1, z}, {y, y\ z}, {y\^2, y\^2\ z}}, {{x, x\
z}, {x\ y, x\ y\ z}, {x\ y\^2, x\ y\^2\ z}}}\)
-----------------------------------------------------------

To do the job automated (so that a different variable list vl can be
used easily, as well as the output of Dimensions[CoefficientList[...]]
can be used as dims, for veriable polynomials and variables) I tried

------------------------------------------------------------
In:=
body = Product[vl[[k]]^i[k],
{k, 1, Dimensions[vl][]}]
iterator = Table[{i[ind], 0,
dims[[ind]] - 1},
{ind, 1, r[]}]
Table[body, Sequence @@ iterator]

Out=
x^i*y^i*z^i

Out=
{{i, 0, 1}, {i, 0, 2},
{i, 0, 1}}

From In:=
Table::"itform":"Argument \!\(Sequence @@ iterator\) at position \!\(2\)
does \
not have the correct form for an iterator. \!\(\*ButtonBox[\"Mehrâ?¦\", \
ButtonData:>\"General::itform\"]\)"
---------------------------------------------------------------

which does not work because in this case, because Sequence does not
strip the outer List brackets, while using it as the only argument to
some function, e.g.

---------------------------------------------------------------
In:=
f[Sequence @@ iterator]

Out=
f[{i, 0, 1}, {i, 0, 2},
{i, 0, 1}]
---------------------------------------------------------------

does work.

Any help regarding using Sequence in a function accepting more than just
one argument is appreciated!

Thank you,
Martin

```

• Prev by Date: Re: Plot -> axes inversion
• Next by Date: Re: Plot -> axes inversion
• Previous by thread: Nonlinear Fit of Complex functions