Skip to main content
added 91 characters in body
Source Link

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result.

f[x_] := (1/2) PDF[NormalDistribution[-100, 1], x] 
   + (1/2) PDF[NormalDistribution[+100, 1], x]
g[n_] := NIntegrate[f[x] Log2[1/f[x]], {x, -Infinity, Infinity}, 
   AccuracyGoal -> Infinity, PrecisionGoal -> Automatic, 
   MaxRecursion -> 1000, WorkingPrecision -> n]
Plot[g[n], {n, 50, 100}]

Output

The correct value, which cannot be calculated analytically, should be around 3.0471. There was no error message for any value of n.

I am not interested in calculating this specific integral, but I am curious whether there is any way I can trustfeel assured that the numerical value Mathematica returns is correct and by how much. In comparison, the GNU Scientific Library gives me an error bound (although it uses machine floating point numbers, which can be another source of trouble).

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result.

f[x_] := (1/2) PDF[NormalDistribution[-100, 1], x] 
   + (1/2) PDF[NormalDistribution[+100, 1], x]
g[n_] := NIntegrate[f[x] Log2[1/f[x]], {x, -Infinity, Infinity}, 
   AccuracyGoal -> Infinity, PrecisionGoal -> Automatic, 
   MaxRecursion -> 1000, WorkingPrecision -> n]
Plot[g[n], {n, 50, 100}]

Output

The correct value, which cannot be calculated analytically, should be around 3.0471. There was no error message for any value of n.

I am not interested in calculating this specific integral, but I am curious whether there is any way I can trust the numerical value Mathematica returns. In comparison, the GNU Scientific Library gives me an error bound (although it uses machine floating point numbers, which can be another source of trouble).

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result.

f[x_] := (1/2) PDF[NormalDistribution[-100, 1], x] 
   + (1/2) PDF[NormalDistribution[+100, 1], x]
g[n_] := NIntegrate[f[x] Log2[1/f[x]], {x, -Infinity, Infinity}, 
   AccuracyGoal -> Infinity, PrecisionGoal -> Automatic, 
   MaxRecursion -> 1000, WorkingPrecision -> n]
Plot[g[n], {n, 50, 100}]

Output

The correct value, which cannot be calculated analytically, should be around 3.0471. There was no error message for any value of n.

I am not interested in calculating this specific integral, but I am curious whether there is any way I can feel assured that the numerical value Mathematica returns is correct and by how much. In comparison, the GNU Scientific Library gives me an error bound (although it uses machine floating point numbers, which can be another source of trouble).

added 59 characters in body
Source Link

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result.

f[x_] := (1/2) PDF[NormalDistribution[-100, 1], x] 
   + (1/2) PDF[NormalDistribution[+100, 1], x]
g[n_] := NIntegrate[f[x] Log2[1/f[x]], {x, -Infinity, Infinity}, 
   AccuracyGoal -> Infinity, PrecisionGoal -> Automatic, 
   MaxRecursion -> 1000, WorkingPrecision -> n]
Plot[g[n], {n, 50, 100}]

Output

The correct value, which cannot be calculated analytically, should be around 3.0471. There was no error message for any value of n. How should 

I interpretam not interested in calculating this? specific integral, but I am completely confused about the notions of PrecisionGoal, AccuracyGoal, and WorkingPrecision, as Mathematica doesn't seem to follow what's written in the manual.

Iscurious whether there is any way I can obtain an honest error bound as intrust the numerical value Mathematica returns. In comparison, the GNU Scientific Library gives me an error bound (although it uses machine floating point numbers, so at least I know for sure what Iwhich can trust and how much?be another source of trouble).

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result.

f[x_] := (1/2) PDF[NormalDistribution[-100, 1], x] 
   + (1/2) PDF[NormalDistribution[+100, 1], x]
g[n_] := NIntegrate[f[x] Log2[1/f[x]], {x, -Infinity, Infinity}, 
   AccuracyGoal -> Infinity, PrecisionGoal -> Automatic, 
   MaxRecursion -> 1000, WorkingPrecision -> n]
Plot[g[n], {n, 50, 100}]

Output

There was no error message for any value of n. How should I interpret this? I am completely confused about the notions of PrecisionGoal, AccuracyGoal, and WorkingPrecision, as Mathematica doesn't seem to follow what's written in the manual.

Is there any way I can obtain an honest error bound as in the GNU Scientific Library, so at least I know for sure what I can trust and how much?

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result.

f[x_] := (1/2) PDF[NormalDistribution[-100, 1], x] 
   + (1/2) PDF[NormalDistribution[+100, 1], x]
g[n_] := NIntegrate[f[x] Log2[1/f[x]], {x, -Infinity, Infinity}, 
   AccuracyGoal -> Infinity, PrecisionGoal -> Automatic, 
   MaxRecursion -> 1000, WorkingPrecision -> n]
Plot[g[n], {n, 50, 100}]

Output

The correct value, which cannot be calculated analytically, should be around 3.0471. There was no error message for any value of n. 

I am not interested in calculating this specific integral, but I am curious whether there is any way I can trust the numerical value Mathematica returns. In comparison, the GNU Scientific Library gives me an error bound (although it uses machine floating point numbers, which can be another source of trouble).

Source Link

Question on accuracy and precision of NIntegrate

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result.

f[x_] := (1/2) PDF[NormalDistribution[-100, 1], x] 
   + (1/2) PDF[NormalDistribution[+100, 1], x]
g[n_] := NIntegrate[f[x] Log2[1/f[x]], {x, -Infinity, Infinity}, 
   AccuracyGoal -> Infinity, PrecisionGoal -> Automatic, 
   MaxRecursion -> 1000, WorkingPrecision -> n]
Plot[g[n], {n, 50, 100}]

Output

There was no error message for any value of n. How should I interpret this? I am completely confused about the notions of PrecisionGoal, AccuracyGoal, and WorkingPrecision, as Mathematica doesn't seem to follow what's written in the manual.

Is there any way I can obtain an honest error bound as in the GNU Scientific Library, so at least I know for sure what I can trust and how much?