On Wed, Feb 25, 2015 at 10:15 AM, Michael Orlitzky <mich...@orlitzky.com> wrote: > On 02/25/2015 12:55 PM, Jeroen Demeyer wrote: >> Hello, >> >> Should there be code in Sage which is extremely slow and for educational >> purposes only? I am talking about eratosthenes() which is just a very >> slow alternative to prime_range(). >> >> I would just remove that code, but maybe people have other opinions...
I also agree it is OK to have such *code*. However, to have it just there without a name that strongly emphasizes its toy nature is very bad. People often think that if f is a function defined in a respectable math software system (Magma or Sage), then the performance of f(n) is at least reasonable. I think it's best to name any functionality that is "is extremely slow and for educational purposes" explicitly with "toy" somewhere in the name. If you do: sage: search_src("toy") you'll see this convention often in sage. I would be for deprecating eratosthenes() and replacing it by something like toys.eratosthenes() or possibly eratosthenes_toy()... I like the idea of a toys.[tab] that gathers together toy implementations... > > It's nice to leave in code like this and use it as part of the test > suite. It would be easy to check that the sieve of Eratosthenes is > correct, but prime_range() is a long chain of dark magic to me. > > A good test would be that they agree on the primes below (say) 1,000: > > sage: eratosthenes(1000) == prime_range(1000) > True > > There are some tests for prime_range() already, e.g. > > sage: L = prime_range(25000,2500000) > sage: len(L) > 180310 > > but who knows if the results are correct. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.