# [seqfan] Re: Using "Quiet" in Mathematica

Charles Greathouse charles.greathouse at case.edu
Sat Feb 18 21:18:48 CET 2012

```It's probably best if whatever is decided is added to that style sheet, for
future reference.

Charles

On Saturday, February 18, 2012, Alonso Del Arte <alonso.delarte at gmail.com>
wrote:
> My two cents: Whenever practical, the program should avoid error messages.
> If it's something as simple as starting at 1 or 2 rather than 0, then
> that's what should be done.
>
> But when it involves bloating the program so that it becomes very long,
> then I think it's acceptable to wrap the program in Quiet. To me, "very
> long" for a Mathematica program in the OEIS is more than four lines (so
> your example of A031975 I don't find "very long" and it generates no
> Part::partw error messages, or any error messages of any kind).
>
> What should absolutely be avoided is turning off error messages for the
> rest of the user's session, because the user might not realize that this
> has happened.
>
> This is more or less what I wrote in
>
https://oeis.org/w/index.php?title=Style_sheet_for_Mathematica_programs&stable=0
>
> Al
>
> On Sat, Feb 18, 2012 at 1:26 PM, Harvey P. Dale <hpd1 at nyu.edu> wrote:
>
>>        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
>>
>> _______________________________________________
>>
>> Seqfan Mailing list - http://list.seqfan.eu/
>>
>
>
>
> --
> Alonso del Arte
> Author at SmashWords.com<
https://www.smashwords.com/profile/view/AlonsoDelarte>
> Musician at ReverbNation.com <http://www.reverbnation.com/alonsodelarte>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

--
Charles Greathouse
Analyst/Programmer
Case Western Reserve University

```