Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4961

Re: These Simple Four Lines of Mathematic Confound Me -- Bug?

From David Bailey <dave@removedbailey.co.uk>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: These Simple Four Lines of Mathematic Confound Me -- Bug?
Date 2011-09-15 08:44 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j4sdtc$sku$1@smc.vnet.net> (permalink)
References <j4prlp$fne$1@smc.vnet.net>

Show all headers | View raw


On 14/09/2011 10:20, James Stein wrote:
> I've boiled this puzzlement down to bare bones:
>
>     Clear [ g ];
>     g := { NumberForm [ 13.0, { 5, 3 } ] };
>     g
>     % // N
>
> Line 3 gives the output:  {13.0}  (as expected)
> Line 4 gives the output:  {13.}     but first gives this error message:
>
> NumberForm::iprf :  "Formatting specification =91=99{\"5.\", \"3.\"} should be \
> a positive integer or a pair of positive integers."
>
> Line 4 seems to cause 'g' to be called. Why?
> And how has the formatting spec {5,3} been converted away from integers?
> (running Mathematica 8.0.1.0 on a Macintosh)
>
Look at g//FullForm

You will see that NumberForm (like MatrixForm and TableForm, and a 
number of other functions) becomes part of the expression. Your specific 
error happens because the numbers 5 an3 get converted to Reals, which 
are not suitable for NumberForm.

The answer is to never (at least unless you really know what you are 
doing) assign anything to an expression involving any of the above 
functions (NumberForm, etc.), or embed those functions in more calculations.

David Bailey
http://www.dbaileyconsultancy.co.uk

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

These Simple Four Lines of Mathematic Confound Me -- Bug? James Stein <mathgroup@stein.org> - 2011-09-14 09:20 +0000
  Re: These Simple Four Lines of Mathematic Confound Me -- Bug? David Bailey <dave@removedbailey.co.uk> - 2011-09-15 08:44 +0000
  Re: These Simple Four Lines of Mathematic Confound Me -- Bug? Richard Fateman <fateman@cs.berkeley.edu> - 2011-09-15 08:45 +0000
  Re: These Simple Four Lines of Mathematic Confound Me -- Bug? James Stein <mathgroup@stein.org> - 2011-09-15 08:48 +0000

csiph-web