Re: Numerical Integration: HP, TI, etc. Message #28 Posted by Oliver Unter Ecker on 28 May 2011, 5:47 a.m., in response to message #1 by Chuck
Re your original question about the TI and Mathematica results for cos(1/(8x)).
You're saying "while Mathematica gives 6.4916765549 (claiming to use GuassKronrod)".
Can you tell us exactly how you tested? Are you sure about it using GaussKronrod?
I spent some time in keisan which permits playing with a number of integration schemes, incl. GaussKronrod.
keisan num integration
I can confirm that GaussKronrod (for n=15, 41, 71), does *not* return good results, just as you found in Mathematica. (Using some *other* kind of testing, I assume.)
Interestingly, the result for n=63 does not match the one you got in Mathematica. At 6.46.. it's a little better.
n=15
GaussLegendre 7 6.876098950292528094576
GaussKronrod 15 6.574616683680514255335
accuracy  7
n=41
GaussLegendre 20 6.57836956143155286915
GaussKronrod 41 6.566852251450387088799
accuracy  6.6
n=63 (slow)
GaussLegendre 31 6.46414119548917882461
GaussKronrod 63 6.460665043695674082197
accuracy  6.46
n=71 (slow)
GaussLegendre 35 6.392977564788352852733
GaussKronrod 71 6.479392744161763499238
accuracy  6.5
I'm unable to obtain a result good for two decimal places using *any* of the integration methods and ranges for n supported by keisan, even when the server is busy for 15s or so!
Instead, I'm getting frequent input errors with some methods (=function not accepted) and compute errors for "high" values of n.
Using a different implementation, I know that a 2K GaussLegendre integration returns 6.4902... which is still worse than your TI result.
WolframAlpha returns a result good to 5 decimal places. Assuming the keisan results are correct, and GaussKronrod does not return a good result for this function using "typical" values of n, I suppose it either
 uses much higher values for n
 or, uses a different integration scheme for this function
 or, quite simply (for Mathematica), integrates symbolically and evaluates!
(ND1's result, which is accurate to 4 decimal places, is obtained via double exponential integration with a computational expense roughly equivalent to a 512point Gauss integration.)
Edited: 28 May 2011, 6:01 a.m.
