       Re: Conversion Function -> List

• To: mathgroup at smc.vnet.net
• Subject: [mg44737] Re: Conversion Function -> List
• From: drbob at bigfoot.com (Bobby R. Treat)
• Date: Mon, 24 Nov 2003 00:05:24 -0500 (EST)
• References: <bpn3e7\$ljo\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```How's this?

rule = {Times -> List, Plus -> List};
x y + Sin[x] Cos[y] /. rule

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

Sum[p[i, x] q[i[y]], {i, 1, 10}] /. rule

{{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]]}, {p[6, x], q[6[y]]}, {
p[7, x], q[7[y]]}, {p[8, x], q[8[y]]}, {
p[9, x], q[9[y]]}, {p[10, x], q[10[y]]}}

Bobby

zelenkov at mail333.com (Vadim Zelenkov) wrote in message news:<bpn3e7\$ljo\$1 at smc.vnet.net>...
> 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?
>