On Thu, Dec 2, 2010 at 6:40 PM, David Kirkby <david.kir...@onetel.net> wrote: > On 2 December 2010 18:20, Robert Bradshaw <rober...@math.washington.edu> > wrote: > >> On the topic of verifying tests, I think internal consistency checks >> are much better, both pedagogically and for verifiability, than >> external checks against other (perhaps inaccessible) systems. For >> example, the statement above that checks a power series against its >> definition and properties, or (since you brought up the idea of >> factorial) factorial(10) == prod([1..10]), or taking the derivative to >> verify an integral. > > Of course I can see logic in this, especially when the software may > not be available. Even though it has limitations, and those > limitations might increase with time, Wolfram Alpha is currently > available to everyone. (It helps if you know Mathematica, as you can > input Mathematica syntax directly). > > * The person writing the mathematical code is usually the same person > who writes the test for that code. Any assumptions they make which are > incorrect may exist in both the algorithm and the test code. Of > course one hopes the referee picks this up, but the referee process, > while useful, is not perfect. > > * The example you give with 10 factorial and prod([1..10], would > probably use a fair amount of common code - such as MPIR.
If you do prod(range(1,11)) and compare that to "factorial(10)", I think it uses absolutely no common code at all. prod(range(1,11)) -- uses arithmetic with Python ints and the Sage prod command (which Robert Bradshaw wrote from scratch in Cython). factorial(10) -- calls a GMP function that is written in C, and shares no code at all with Python. -- William > > * Differentiate(Integrate(f)) = f, in practice for many functions > doing this in Sage does not lead back to the same expression, although > they are mathematically equivalent. Converting to a numerical form > can sometimes be used to show results are equal, but even two > equivalent, but non-identical numerical results often exist. They have to be the same up to rounding errors, right, or it is a bug? So numerically the absolute of the difference must be small. > > (I wrote some Sage code which generated "random" functions and > applied the integrate/differentiate method. If you get a complex > result back after the differentiation step, it is not easy to > determine if it's the same as you started with.). > > Some, though not all of the above can be eliminated by using software > that is developed totally independently.. Of course, even using I don't see how checking differentiation or integration with Mathematica would be any easier than doing the above. You still have the problem of comparing two different symbolic expressions. > Wolfram Alpha will use some code common to Sage since: > > a) Wolfram Alpha uses Mathematica > b) Mathematica uses GMP & ATLAS > c) Sage uses MPIR (derrived from GMP) and ATLAS. > > I suspect there is other common code too, but they are two I'm aware of. I know of no code in common between Mathematica an Sage except GMP and ATLAS. It would be very interesting to find out if there is any other code in common. Does Mathematica use any other open source code at all? Note that as you point out above Sage uses MPIR whereas mathematica uses GMP. These two libraries are _massively_ different at this point -- probably sharing way less than 50% of their code, if that. >> Especially in more advanced math there are so many >> wonderful connections, both theorems and conjectures, that can be >> verified with a good test. For example, computing all the BSD >> invariants of an elliptic curve and verifying that the BSD formula >> holds is a strong indicator that the invariants were computed >> correctly via their various algorithms. > > I'll accept what you say! > > It's clear you have the ability to write decent tests, but I think its > fair to say there are a lot of Sage developers who have less knowledge > of this subject than you [=Bradshaw]. True. However, I think the general mathematical background of the average Sage developer is fairly high. If you look down the second column of http://sagemath.org/development-map.html you'll see many have Ph.D.'s in mathematics, and most of those who don't are currently getting Ph.D.'s in math. > As such, I believe independant verification using other software is > useful. Someone remarked earlier it is common in the commercial world > to compare your results to that of competitive products. +1 -- it's definitely useful. Everyone should use it when possible in some ways. But consistency comparisons using all open source software when possible are very useful indeed, since they are more maintainable longterm. -- William > >> - Robert > > 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 > -- William Stein Professor of Mathematics University of Washington http://wstein.org -- 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