[seqfan] Using "Quiet" in Mathematica
Harvey P. Dale
hpd1 at nyu.edu
Sat Feb 18 19:26:19 CET 2012
I would like guidance, and perhaps a consensus or rule, about
whether and when to use "Quiet" in Mathematica programs in the OEIS.
Here's an example: A031795 lists numbers such that there are
exactly 27 occurrences of the digit 1 in the period of the continued
fraction of the square root of the number. In Mathematica, it is easy
to generate the terms of the period of the continued fraction --
ContinuedFraction[Sqrt[n]][[2]] does that. It is also easy to count the
number of ones in that period, using Count. The problem is that every
number that is a perfect square causes an error message to be generated
since there is no period of the continued fraction for the square root
of a perfect square.
There are two ways to deal with this. One is simply to wrap the
Mathematica program inside "Quiet." The second is to write a program
that avoids the error messages, in this case by separately testing for
perfect-square status. I chose the latter for the program I submitted
for A031795. But there are two problems with this choice:
(1) it makes the program more opaque to the readers of the OEIS and (2)
it takes additional time to write such an error-code-avoiding program.
(Indeed, in some instances I am not readily able to figure out how to
avoid the error messages and so cannot easily write a program that
avoids their generation.)
Using Quiet to eliminate the error messages, however, might be
dangerous because some of the messages generated might be material,
e.g., they might deal with precision errors or erroneous terms being
generated.
I would assume that no one would want to use Quiet when its
effect might be to pollute the accuracy of the OEIS. The question
really is: if it appears clear that the error messages being generated
are not of the dangerous variety, should Quiet be permitted in lieu of
having to figure out and submit what will always be a more complex
Mathematica program?
I would appreciate guidance.
Best,
Harvey
More information about the SeqFan
mailing list