[seqfan] Re: Rant on Maple code

Robert G. Wilson, v rgwv at rgwv.com
Thu Aug 13 17:17:52 CEST 2009


   The hierarchy of programming.

1. It must be accurate.
2. It should be efficient (both in computer resources and time)
3. Readable. Please no spaghetti coding.

 For me when all of the above occurs the coding is 'elegant'.

 I also try hard to label functions which are useful in several other sequences 
with unique descriptive titles. As an example, before Mathematica had as a built 
in function, nextPrim[n_]. In this way someone who was following me could cut and 
paste this function into their coding and thereby the OEIS would be internally 

 With consistency for the OEIS in mind, the generating function if not named 
should be the f(n) with helping functions of g(), h(), etc. If the sequence is 
recursive, then a(n) and not f(n) is useful.


----- Original Message ----- 
From: "Charles Greathouse" <charles.greathouse at case.edu>
To: "Sequence Fanatics Discussion list" <seqfan at list.seqfan.eu>
Sent: Thursday, August 13, 2009 10:46 AM
Subject: [seqfan] Re: Rant on Maple code

>I see many different purposes for programs.  Two of the most
> important, for me, are code that runs quickly and code that explains
> the sequence.  Presumably doublefactorial is the fastest on systems
> that have access to it, so that would be an important program to
> have.*  Another computationally efficient version for older versions
> might be good.  Then a program like
> f := n->(2*n)!/(n!*2^n);
> or even
> f := mul(2 * i - 1, i = 1..n);
> is also useful.  Sometimes a definition will be unclear for one reason
> or another, but programs have to be explicit.
> * I have learned about functions I'd never used through the OEIS. For
> example, I had never used Pari's znorder until I saw it there.  So
> even 'obvious' functions like this can be useful -- consider someone
> coming from a Maple V background but using a newer version, for
> example.
> Charles Greathouse
> Analyst/Programmer
> Case Western Reserve University
> On Thu, Aug 13, 2009 at 8:39 AM, Raff, Paul<praff at math.rutgers.edu> wrote:
>> I don't think we should be oppressing the finance-inclined people around, or
>> any other group for that matter. Most of them aren't mathematicians like we
>> are, and most of them would go through their life having no problem
>> calculating something like futurevalue( n, 2, 2) -- and doing it numerous
>> times -- without recognizing that this value is simply 9n. It's simply not
>> in their language.
>> This is what I view the OEIS as - it's a place where people find out things
>> that they wouldn't have realized. For those where mathematics is their
>> profession, it leads to more publications. For others, it may simply make
>> their day easier.
>> So yes, I agree that the code examples shown, for the most part, are crap.
>> But they're right - even the one you said was wrong, Joerg (you forgot the
>> floor). What I would like to see, which I presume can happen easily with the
>> wiki, is the better code coming first with the "trivial" code coming last.
>> [paul]
>> Paul Raff
>> Graduate Assistant - Monitoring Message Streams
>> Rutgers University
>> http://math.rutgers.edu/~praff
> _______________________________________________
> Seqfan Mailing list - http://list.seqfan.eu/ 

More information about the SeqFan mailing list