Jason Grout wrote:
On 03/04/2010 04:07 AM, Dr. David Kirkby wrote:
Anyway, it seems my view is a minority one here.
I don't think that's necessarily the case (I agree with you that
randomized testing is a good thing). However, I also agree with others
that writing doctests is more important for those that feel like they
can write doctests. For example, I just wrote a lot of doctests for
RealField (i.e., code that I did not write) and found lots of corner
cases that were not handled correctly. I feel like that was more
valuable than writing randomized doctests comparing results to mathematica.
Fair enough. Clearly knowledge of corner cases is important here.
What concerns me about some of the doc tests I've seen, is that the "Expected"
value seems to be whatever someone got on their computer. There is no
justification for that result. It might be berried in some trac ticket (if so
it's not referenced). To me, such tests are not very good.
BTW, playing around I found this bug in Mathematica, by picking some extreme
cases.
In[3]:= Sin[2^900.23]
Out[3]= 0.938865 // This agrees with Sage.
In[4]:= Sin[2^5000.0]
Out[4]= 0.
In[5]:= Sin[2^5000.01]
Out[5]= 0.
In[6]:= Sin[2^5000.3444]
Out[6]= 0.
In[7]:= Cos[2^5000.3444]
Out[7]= 0.
In[8]:= Tan[2^5000.3444]
Out[8]= ComplexInfinity
It seems that for any sufficiently large value, the sine is zero as so is the
cosine. The tangent is complex infinity.
I've not checked the values returned by Sage, but they at least change for large
large values, and satisfy one relation I would expect them to:
sage: tan(2^5000.3444)
0.463572927008021
sage: cos(2^5000.3444)
0.907255812425725
sage: sin(2^5000.3444)
0.420579232511234
sage: 0.907255812425725^2 + 0.420579232511234^2
1.00000000000000
Personally I can't think of any practical cases where I'd need the sine, cosine
or tangent of such huge angles, but Mathematica's willingness to return an
incorrect result is clearly undesirable.
Is that 1-0 to Sage?
If someone were to write a suite of randomized doctests, I would be
willing to donate spare cycles to running those doctests. I imagine
there are lots of other people that would do the same.
Me too.
I think the
question under debate here is more about time priority for those that
feel comfortable writing internal consistency checks and normal doctests
that exhaustively exercise our own code, rather than whether your idea
is good or not.
OK.
Since Sage is a volunteer project, *all* volunteer contributions are
welcome to be submitted! Your idea is certainly good, so if you feel
most comfortable writing randomized tests against another system, go for
it! I don't think anyone is against including more testing!
Unless it is on Solaris!
Let me also say that I appreciate your tireless porting of Sage to
Solaris. It's made me more sensitive about writing cross-platform code
(for example, see my question on #8424 for you).
Thank you Jason. I'll take a look at that.
Dave
--
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