On Feb 20, 2010, at 12:13 PM, Erik Lane wrote:

That's almost certainly true. In fact, the result printed by the "failure" is more accurate than the expected value! I tried this in Mathematica:

This might be a trivial question, but how do you know which number is
more accurate than the other, if those results are machine-dependent?

It's pretty standard in numerical integration (and any other numerical algorithms) for the last couple of bits to be wrong due to (the accumulation of) rounding, which can be platform dependent. This is why, for example, numerical_integral provides an answer and an error bound:

sage: numerical_integral(sin(x)/x^2, 1, 1/2*pi)
(0.33944794097891573, 3.7686291973639345e-15)

Or is the Mathematica answer your gold standard? If that is the case I
find it troubling.

Sometimes Mathematica is wrong, but it can still provide a useful check.

One of the reasons for Sage, in my mind, is to
avoid Mathematica and its 'black-box' approach. Therefore to trust its
answers over your own program's as the arbiter of accuracy is not a
promising sign.

I really am not meaning to troll, but that raised a huge red flag in my mind.

I think the reason Mathematica was invoked is because it can do arbitrary precision numerical integration, and a good test to see if the last couple of digits are right is to compute the result to much higher precision. (We do have arbitrary precision for lots of other stuff, but much of the numerical stuff is to double precision only, which is the most useful and lots faster.)

- Robert


--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to