Re: Conversion Function -> List

• To: mathgroup at smc.vnet.net
• Subject: [mg44733] Re: [mg44726] Conversion Function -> List
• From: "Mihajlo Vanevic" <mvanevic at gawab.com>
• Date: Mon, 24 Nov 2003 00:05:21 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Use this simple conversion rule:
(notice that rule applies from left to right)

In[]:=
conv = {Plus -> List, Times -> List};

In[]:=
x y + Sin[x] Cos[y] /. conv

Out[]=
{{x, y}, {Cos[y], Sin[x]}}

In[]:=
Sum[p[i, x] q[i, y], {i, 1, 5}] /. conv

Out[]=
{{p[1, x], q[1, y]}, {p[2, x], q[2, y]}, {p[3, x], q[3, y]}, {p[4, x],
q[4, y]}, {p[5, x], q[5, y]}}

Regards,
Mihajlo Vanevic
http://www.mihajlo.greatnow.com

**************************************************************
*    At 2003-11-22, 02:17:00
*        Vadim Zelenkov, zelenkov at mail333.com  wrote:
**************************************************************
>Hello!
>
>Given a function
>    x y + Sin[x] Cos[y]
>
>I need to convert it into the list
>    {{x,y},{Sin[x],Cos[x]}}
>
>Generally, the purpose to convert a function
>    Sum[p[i,x] q[i[y], {i,1,n}]
>
>into the list
>    {{p[1,x],q[1,y]},...,{p[n,x],q[n,y]}
>
>How to do it using Mathematica?
>
>
>V.Z.
>