Re: NIntegrate and Sequence
- To: mathgroup at smc.vnet.net
- Subject: [mg63581] Re: NIntegrate and Sequence
- From: Pratik Desai <pdesai1 at umbc.edu>
- Date: Fri, 6 Jan 2006 05:24:24 -0500 (EST)
- References: <200601021049.FAA01309@smc.vnet.net> <43B94E48.8050009@umbc.edu> <dpd6uo$q8t$1@smc.vnet.net> <43BD2B84.9060705@KevinMcCann.com>
- Sender: owner-wri-mathgroup at wolfram.com
Kevin J. McCann wrote:
> Note that the -1447 is multiplied by the 10th derivative. It is not
> clear that this error is "large". You make a speed/accuracy tradeoff
> by choosing different numbers of points. The choice means that you
> have to have some feeling for the problem. Note that 10^-14 times the
> 40th derivative (your last example) may be huge for noisy data even if
> the magnitudes of the points themselves are small.
>
> Kevin
>
>
> Pratik Desai wrote:
>
>> Pratik Desai wrote:
>>
>>
>>> Bob Hanlon wrote:
>>>
>>>
>>>> Nintegrate has the attribute HoldAll.
>>>>
>>>> Attributes[NIntegrate]
>>>>
>>>> {HoldAll,Protected}
>>>>
>>>> Use Evaluate.
>>>>
>>>> NIntegrate[r,Evaluate[{r,14,Sequence@@{16,18},40}]]
>>>>
>>>> 702.
>>>>
>>>>
>>>> Bob Hanlon
>>>>
>>>>
>>>>
>>>>
>>>>> From: Bruce Colletti <vze269bv at verizon.net>
To: mathgroup at smc.vnet.net
>>>>> Date: 2006/01/01 Sun AM 01:16:12 EST
>>>>> Subject: [mg63581] NIntegrate and Sequence
>>>>>
>>>>> 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
>>>>>
>>>>>
>>>>
>>>>
>>> I tried using GaussianQuadrature, why is the error so high for this
>>> interval (see out 49)
>>>
>>>
>>> In[46]:=
>>> <<NumericalMath`GaussianQuadrature`
>>> data1=GaussianQuadratureWeights[5,14,40]
>>> ans=Table[Times@@data1[[r]],{r,1,Length[data1],1}]//Total
>>> GaussianQuadratureError[5,f,14,40]//InputForm
>>>
>>> Out[47]=
>>> {{15.2197,3.08005},{19.9999,6.22217},{
>>> 27.,7.39556},{34.0001,6.22217},{38.7803,3.08005}}
>>>
>>> Out[48]=
>>> 702.
>>>
>>> Out[49]//InputForm=
>>> -1447.938207040937*Derivative[10][f]
>>>
>>>
>>>
>>>
>>
>> I found the problem, had to increase the number of Gauss points
>> GaussianQuadratureError[20, f, 14, 40] // InputForm
>> >>-1.6243254536030502*^-14*Derivative[40][f]
>>
>>
>>
Mathematica documentation reveals that as well
http://documents.wolfram.com/mathematica/Add-onsLinks/StandardPackages/NumericalMath/GaussianQuadrature.html
I was just trying to get a feeling for how some of the more escoteric
errors and options available in NIntegrate work
I was wondering is there some way to look under the hood of NIntegrate
or is it blocked?
Thanks for your input
Pratik
- References:
- Re: NIntegrate and Sequence
- From: Bob Hanlon <hanlonr@cox.net>
- Re: NIntegrate and Sequence