MathGroup Archive 1995

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

Search the Archive

Re: Constructing Expressions from List Elements

  • Subject: [mg2207] Re: Constructing Expressions from List Elements
  • From: ianc (Ian Collier)
  • Date: Mon, 16 Oct 1995 15:53:15 GMT
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: daemon at wri.com ( )

In article <44t3p9$6t5 at ralph.vnet.net>, brianb at dendrite.cs.colorado.edu
(Brian Bonnlander) wrote:

> I have a list of integration limits that I would like to incorporate into
> an NIntegrate[] expression.  I don't know the proper syntax for accomplishing
> this. 
> 
> For example, I would like to integrate f[x,y,z] where the integration limits
> are contained in a list *limits*, expressed perhaps as
> limits = {{x, 0, 1}, {y, -Infinity, Infinity}, {z, 0, 1}}.    
> 
> The statement I would like to construct is 
> 
> NIntegrate[f[x,y,z], {x, 0, 1}, {y, -Infinity, Infinity}, {z, 0, 1}] .
> 
> 
> How do I remove the outer list braces for *limits* so that I can construct
> this statement?
> 
> 
> Thanks in advance,
> 
> --Brian

You can substitute your own function for Sin[ x y z] in the following:

In[12]:=
    limits = {{x, 0, 1}, {y, -Infinity, Infinity}, {z, 0, 1}}
Out[12]=
    {{x, 0, 1}, {y, -Infinity, Infinity}, {z, 0, 1}}

In[13]:=
    Prepend[ limits, Sin[x y z] ]
Out[13]=
    {Sin[x y z], {x, 0, 1}, {y, -Infinity, Infinity}, {z, 0, 1}}

In[14]:=
    Apply[ NIntegrate, %]

Out[14]=
               1429
    -4.89109 10

Alternativesare :

NIntegrate[Sin[x y z], ##]& @@ limits

NIntegrate[Sin[x y z], Sequence @@ limits]

I hope this helps.

--Ian

-----------------------------------------------------------
Ian Collier
Technical Sales Support
Wolfram Research, Inc.
-----------------------------------------------------------
tel:(217)-398-0700     fax:(217)-398-0747      ianc at wri.com
Wolfram Research Home Page:             http://www.wri.com/
-----------------------------------------------------------


  • Prev by Date: Making Mathematica Functions Evaluate Rapidly?
  • Next by Date: Re: Q: ROTATING ANIMATIONS in MMA?
  • Previous by thread: Re: Constructing Expressions from List Elements
  • Next by thread: Re: Constructing Expressions from List Elements