Re: How to remove external parentheses from a list
- To: mathgroup at smc.vnet.net
- Subject: [mg131529] Re: How to remove external parentheses from a list
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Sat, 17 Aug 2013 02:09:23 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <kul0bk$rkj$1@smc.vnet.net>
On 16/08/2013 11:53, Samuel Mark Young wrote:
> Hello,
>
> I'm looking for an easy way to remove the external parentheses from a list. The list contains integration variables and their respective limits, it currently looks something like this:
>
> {{x1,a,b},{x2,c,d},...,{xn,y,z}}
>
> However, the Integrate (or NIntegrate function) in Mathematica wants me to write it like this:
>
> {x1,a,b},{x2,c,d},...,{xn,y,z}
> i.e. The external parentheses have been removed
>
> I've looked around online and seen suggestions for replacing the curly brackets "{" with a blank space " ", or using Apply (@@) but can't work out the correct syntax.
>
> Thanks for any help and advice!
>
> Regards,
> Sam
>
>
On 16/08/2013 11:53, Samuel Mark Young wrote:> Hello,
>
> I'm looking for an easy way to remove the external parentheses from a
list. The list contains integration variables and their respective
limits, it currently looks something like this:
>
> {{x1,a,b},{x2,c,d},...,{xn,y,z}}
>
> However, the Integrate (or NIntegrate function) in Mathematica wants
me to write it like this:
>
> {x1,a,b},{x2,c,d},...,{xn,y,z}
> i.e. The external parentheses have been removed
>
> I've looked around online and seen suggestions for replacing the
curly brackets "{" with a blank space " ", or using Apply (@@) but can't
work out the correct syntax.
>
> Thanks for any help and advice!
>
> Regards,
> Sam
>
>
Sequence@@ will remove a layer of parentheses inside another construct
(such as Integrate). For example:
In[1]:= lim = {{x, 1, 10}};
In[2]:= Integrate[x^2, Sequence @@ lim]
Out[2]= 333
David Bailey
http://www.dbaileyconsultancy.co.uk