More puzzles on Check[ ], Off[ ] , Indeterminate , Overflow[ ] , etc.

*To*: mathgroup at smc.vnet.net*Subject*: [mg67245] More puzzles on Check[ ], Off[ ] , Indeterminate , Overflow[ ] , etc.*From*: AES <siegman at stanford.edu>*Date*: Wed, 14 Jun 2006 06:29:03 -0400 (EDT)*Organization*: Stanford University*References*: <e6ge2h$nhn$1@smc.vnet.net> <e6lhn1$nf3$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Here are some puzzles, or confused queries, about definitions and behavior of Indeterminate, Overflow, Underflow, Off, Check, NumericQ, and related symbols and operations: (Note sure why I get caught up in these arcane situations, but I do.) The original problem (for me) was how to make an Indeterminate numerical result for a symbol (call it myResult) print as just a "*" rather than as the word "Indeterminate" in the output from a Table definition. The reason for worrying about this was order to keep the column width as narrow as possible, since all the successful results in my particular case were just single-digit integers. I had partial success in accomplishing this with myResult = Check[myExpression, "*"] This stopped working, however, when I Off[ ]'ed all error messages, which I wanted to do just to keep the rest of the notebook printout neat, since all the other error messages coincided with the final Indeterminate result anyway. A reply from dh <dh at metrohm.ch> suggested switching off *all* messages by clearing the value of $Messages and later restoring it with oldmsg = $Messages; $Messages = {} and later $Messages= oldmsg I didn't try this, but assume it will work. It involves steps external to the actual problem calculations, however, which is an added complexity. Another message, whose author I've lost, suggested just using myResult /. {Indeterminate->"*"} in the Table specification, and that worked fine. Another solution that I came up with was to write If [NumericQ[myResult] , myResult , "*"] in the Table definition. This works even *inside* a ToString[] operation in fact. But then, as I ran more cases, my expression started turning out Overflows and Underflows as well as Indeterminates; and I discovered that NumericQ didn't seem to catch Overflows and Underflows (???), and Off[ ] (with no argument) didn't seem to suppress the related msgs. So, I'm presently using in my Table definition myResult /. {Indeterminate->"*", Overflow[]->"+", Underflow[]->"-"} which seems to work, and gives me additional information in a terse form. But even after some digging into the Help messages, I remain confused about several points: 1) Just which messages are Off'ed by Off[ ] (with no argument), and which aren't? (and why?) 2) Indeterminate is apparently non-Numeric, but Over/Underflow apparently are still Numeric? 3) Suppose that executing myResult = myExpression leads to an Underflow. Does executing myResult = myExpression//Chop also lead to an Underflow? How about a subsequent use of just myResult//Chop? 4) Do Over- and Underflow have different behavior with respect to Off[ ] (or other tests or operations)? (There were times I'd swear they did.) 5) If I execute a notebook that contains Off[ ] in the initial cell several times, then change Off[ ] to On[ ] and execute the complete notebook again, does this cancel Off[ ]? (Again, I'd swear there were times that the Off[]'ed messages were not restored until I Quit Mathematica and re-Opened it.)