Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

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?
>
>Thanks in advance!
>
>V.Z.
>
>P.S, If possible please duplicate your answers to zelenkov[at]mail333.com
**************************************************************




  • Prev by Date: Re: Conversion Function -> List
  • Next by Date: Re: Calling Mathematica via MathLink multiple times
  • Previous by thread: RE: Conversion Function -> List
  • Next by thread: Re: Conversion Function -> List