[Date Index]
[Thread Index]
[Author Index]
Re: Precision issues
*To*: mathgroup at smc.vnet.net
*Subject*: [mg73535] Re: Precision issues
*From*: "dimitris" <dimmechan at yahoo.com>
*Date*: Wed, 21 Feb 2007 01:49:23 -0500 (EST)
*References*: <erelv2$7ol$1@smc.vnet.net>
On Feb 20, 1:27 pm, mickey <m... at hotmail.com> wrote:
> Hi,
>
> I am calculating certain integrals numerically and get back a number.
> Now, is it possible to determine how many digits is that answer accurate
> to?
>
> E.g.,
>
> NIntegrate[ Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}, Method ->
> MonteCarlo[24], MaxPoints -> 1000000]
>
> Gives,
>
> 0.791249
>
> How many digits is this answer accurate to?
>
> Thanks,
> -M
First note that the estimation with Method->MonteCarlo is incorrect.
Here is the symbolic answer
Integrate[Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}]//InputForm
N[%]//InputForm
(1/4)*Pi*Erf[10]^2
0.7853981633974483
Here is the estimation using the default settings of NIntegrate
NIntegrate[Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}]//InputForm
0.7853981580827021
By default NIntegrate GaussKronrod for 1D integrals and
MultiDimensional for multidimensional integrals.
NIntegrate[Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}, Method ->
Automatic]//InputForm
0.7853981580827021
NIntegrate[Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}, Method ->
MultiDimensional]//InputForm
0.7853981580827021
Execute the following commands for see information about the Options
of NIntegrate
Options[NIntegrate]
(Information[Evaluate[#1[[1]]]] & ) /@ %;
{AccuracyGoal -> Infinity, Compiled -> True, EvaluationMonitor ->
None, GaussPoints -> Automatic, MaxPoints -> Automatic,
MaxRecursion -> 6, Method -> Automatic, MinRecursion -> 0,
PrecisionGoal -> Automatic, SingularityDepth -> 4,
WorkingPrecision -> MachinePrecision}
"AccuracyGoal is an option for various numerical operations which
specifies how many effective digits of accuracy should be
sought in the final result."
Attributes[AccuracyGoal] = {Protected}
"Compiled is an option for various numerical and plotting functions
which specifies whether the expressions they work with \
should automatically be compiled."
Attributes[Compiled] = {Protected}
"EvaluationMonitor is an option for various numerical computation
functions that gives an expression to evaluate whenever \
functions derived from the input are evaluated numerically."
Attributes[EvaluationMonitor] = {Protected}
"GaussPoints is an option for NIntegrate. With GaussPoints -> n, the
Gaussian part of Gauss-Kronrod quadrature uses n points. With
GaussPoints -> Automatic, an internal algorithm chooses the number of
points."
Attributes[GaussPoints] = {Protected}
"MaxPoints is an option for NIntegrate. With MaxPoints -> n and Method-
>Automatic, the QuasiMonteCarlo method will be used at most n sample
points. If the Method->MonteCarlo, the MonteCarlo method will be used
at n sample points."
Attributes[MaxPoints] = {Protected}
"MaxRecursion is an option for various numerical functions that use a
recursive algorithm. With MaxRecursion -> n, the maximum depth to
which recursion is allowed to go is n even if convergence is not yet
achieved."
Attributes[MaxRecursion] = {Protected}
"Method is an option to Solve, related functions, and various
numerical functions, which specifies what algorithm to use in \
evaluating the result."
Attributes[Method] = {Protected}
"MinRecursion is an option for NIntegrate and other numerical
functions that use a recursive algorithm. With MinRecursion -> n, a
minimum depth of recursion of n is used before tests for convergence
begin."
Attributes[MinRecursion] = {Protected}
"PrecisionGoal is an option for various numerical operations which
specifies how many effective digits of precision should be \
sought in the final result."
Attributes[PrecisionGoal] = {Protected}
"SingularityDepth is an option for NIntegrate. SingularityDepth -> n
specifies that n recursive subdivisions can be done before
a change of variable is used at the endpoints of the interval of
integration."
Attributes[SingularityDepth] = {Protected}
"WorkingPrecision is an option for various numerical operations which
specifies how many digits of precision should be \
maintained in internal computations."
Attributes[WorkingPrecision] = {Protected}
Note that the numerical integration algorithm is terminated as soon as
its results fulfill the PrecisionGoal or AccuracyGoal goals (the word
"goal" is to be taken VERBATIM).
As regards now your question the obvious way to determine how many
digits is that answer accurate to is to compare with
the above obtained analytic result!
Best Regards
Dimitris
Prev by Date:
**RE: Re: Quick integral.**
Next by Date:
**Re: grouping similar list elements with gaps**
Previous by thread:
**Re: Precision issues**
Next by thread:
**Showing that ArcSinh[2]/ArcCsch[2] is 3?**
| |