[seqfan] metadata for Mathematica code

Eric Rowland rowland at lacim.ca
Mon Nov 2 19:28:17 CET 2015


Hi all,

Wolfram Research has a mentorship student, JungHwan Min, who is going to be
contributing Mathematica / Wolfram Language code to OEIS entries.  I think
this is a great opportunity to start adding metadata identifying what each
program does (computes the nth term vs. computes the first n terms, etc.).
Having more structured data in the OEIS will make it that much more useful,
especially for programmatic tasks.  You can imagine eventually being able
to query for a list of all functions that define the nth term of a
2-automatic sequence, for example.

Charles Greathouse and I discussed this at length about a year ago and came
up with an initial list of labels.  It makes sense to put labels in
comments, so for example the Mathematica field for A000108 would look like
this:

(* TermFunction *)
CatalanNumber
(* TermFunctionDefinition *)
A000108[ n_ ] := (2 n)!/n!/(n+1)!
(* TermFunctionDefinition *)
A000108[n_] := Hypergeometric2F1[1 - n, -n, 2, 1] (* Richard L. Ollerton, Sep
13 2006 *)
(* TermListByIndexFunctionDefinition *)
A000108list[nmax_] := Table[ CatalanNumber@ n, {n, 0, nmax}] (* Robert G.
Wilson v, Feb 15 2011 *)
(* TermListByIndexFunctionDefinition *)
A000108list[nmax_] := CoefficientList[InverseSeries[Series[x/Sum[x^n, {n,
0, nmax+1}], {x, 0, nmax+1}]]/x, x] (* Mats Granvik, Nov 24 2013 *)

Here is an initial list of labels:

* TermFunction - function that computes the nth term (respecting the offset)
* TermListByIndexFunction - function that computes the list of terms up to
the nth term
* TermListByMaximumFunction - function for computing the list of terms <= m
for a non-decreasing sequence
* TermListFunction - other function for computing a list of terms (where it
may not be clear in advance how many terms it computes)
* MembershipTestFunction - predicate function for testing membership,
returning True or False

For a function definition, append "Definition" to the label (getting
TermFunctionDefinition / TermListByIndexFunctionDefinition /
TermListByMaximumFunctionDefinition / TermListFunctionDefinition /
MembershipTestFunctionDefinition).  For example,
   CatalanNumber
and
   Function[n, CatalanNumber[n]]
would get the label TermFunction, whereas
   a[n_] := CatalanNumber[n]
is a TermFunctionDefinition.

Some entries have programs with hard-coded parameters, so they are not
functions or function definitions.  These could get labels such as the
following.

* TermList - code that produces some list of terms
* Visualization - code that produces related graphics

Undoubtedly there will be others.

Comments?  Where is the right place to document a list of "official"
metadata labels?

Eric



More information about the SeqFan mailing list