Re: NIntegrate when integral is zero
- To: mathgroup at smc.vnet.net
- Subject: [mg103197] Re: NIntegrate when integral is zero
- From: antononcube <antononcube at gmail.com>
- Date: Thu, 10 Sep 2009 07:21:23 -0400 (EDT)
- References: <h87phe$5h8$1@smc.vnet.net>
Hi,
I think your question is not so much about a Method option value, but
about AccuracyGoal and PrecisionGoal values.
Consider this equal to 0 integral:
In[21]:= NIntegrate[x - 1/2, {x, -1, 2}]
During evaluation of In[21]:= NIntegrate::slwcon:Numerical integration
converging too slowly; suspect one of the following: singularity,
value of the integration is 0, highly oscillatory integrand, or
WorkingPrecision too small. >>
During evaluation of In[21]:= NIntegrate::ncvb:NIntegrate failed to
converge to prescribed accuracy after 9 recursive bisections in x near
{x} = {-0.736375}. NIntegrate obtained -4.33681*10^-17 and
2.5638670873850966`*^-16 for the integral and error estimates. >>
Out[21]= 0``16.362829735502853
We get the messages because the default option values of AccuracyGoal
and PrecisionGoal are Infinity and 6 respectively. Neither can be
satisfied with the global adaptive bisection method of improving the
integral estimates. So we need to decide with what accuracy we get 0:
In[20]:= NIntegrate[x - 1/2, {x, -1, 2}, AccuracyGoal -> 4]
Out[20]= 1.249000902703301*^-16
So your function can be redefined as:
\[CapitalDelta][(\[Delta]_)?NumericQ] := Block[{\[CapitalDelta]},
SpecialPoint = Sign[\[Delta]] - \[Delta];
MeanOfMyDistribution[(\[CapitalDelta]_)?NumericQ] :=
NIntegrate[x*PDF[StudentTDistribution[2],
Tan[(x + \[Delta])*(Pi/2)] - \[CapitalDelta]]*
Sec[(Pi/2)*(x + \[Delta])]^
2*(Pi/2), {x, -1, SpecialPoint, 1},
AccuracyGoal -> 14];
FindRoot[
MeanOfMyDistribution[\[CapitalDelta]] == 0, {\[CapitalDelta],
0}][[1,
2]]];
Then we get:
In[15]:= \[CapitalDelta][0.9]
Out[15]= -0.03390656657860691
In[16]:= MeanOfMyDistribution[%]
Out[16]= 0``16.53594543679524
(I have put value to Method )
Anton Antonov
On Sep 9, 4:38 am, Alexey <lehi... at gmail.com> wrote:
> Hello,
> My goal is to find a value of a parameter of the integrand function
> for which integral becomes equal zero. What a value of "Method" option
> is appropriate in my case?
> Here is the function:
>
> \[CapitalDelta][\[Delta]_?NumericQ] :=
> Block[{\[CapitalDelta]}, SpecialPoint = Sign[\[Delta]] - \[Delta];
> MeanOfMyDistribution[\[CapitalDelta]_?NumericQ] :=
> NIntegrate[(x PDF[
> StudentTDistribution[
> 2], (Tan[(x + \[Delta]) Pi/2] - \[CapitalDelta])] Sec[\[P=
i]/
> 2 (x + \[Delta])]^2 \[Pi]/2), {x, -1, SpecialPoint, 1=
}];
> FindRoot[
> MeanOfMyDistribution[\[CapitalDelta]] == 0, {\[CapitalDelta],
> 0}][[1, 2]]]
> \[CapitalDelta][.9]
>
> (I am using Mathematica 7.01)