Re: NIntegrate and Sequence
- To: mathgroup at smc.vnet.net
- Subject: [mg63471] Re: NIntegrate and Sequence
- From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
- Date: Mon, 2 Jan 2006 05:49:05 -0500 (EST)
- Organization: The Open University, Milton Keynes, U.K.
- References: <dp7tic$g42$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Bruce Colletti" <vze269bv at verizon.net> a écrit dans le message de news:
dp7tic$g42$1 at smc.vnet.net...
| Re Mathematica 5.2 under WinXP.
|
| The first command works while the other returns the NIntegrate::nlim
error. Yet {r, 14, Sequence @@ {16, 18}, 40} returns {r,14,16,18,40}.
|
| NIntegrate[r, {r, 14, 16, 18, 40}]
| NIntegrate[r, {r, 14, Sequence @@ {16, 18}, 40}]
|
| What is causing the error?
|
| Thankx.
|
| Bruce
|
Hi Bruce,
*NIntegrate* has the attribute *HoldAll*, therefore its arguments are not
evaluated immediately. Adding an *Evaluate* function around the second
argument will fix the issue:
In[1]:=
Attributes[NIntegrate]
Out[1]=
{HoldAll, Protected}
In[2]:=
NIntegrate[r, Evaluate[{r, 14, Sequence @@ {16, 18}, 40}]]
Out[2]=
702.
Best regards,
/J.M.