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


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

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

From James Stein <mathgroup@stein.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: These Simple Four Lines of Mathematic Confound Me -- Bug?
Date 2011-09-15 08:48 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j4se48$smv$1@smc.vnet.net> (permalink)
References <j4prlp$fne$1@smc.vnet.net> <4E7109DC.4010308@cs.berkeley.edu>

Show all headers | View raw


I thank Richard Fateman for his informative reply. I had not known about the
persistence of Mathematica's so-called 'wrappers', whose definition I had
not readily found via the program's help features, but which I recently
found alluded to
here <http://reference.wolfram.com/mathematica/tutorial/FormattedOutput.html>
.

The original form of 'g' did not return a list, and was something like this
'f':

f [ expr_ /; NumericQ[expr]] := If [ expr < 1,
    NumberForm[expr, {4, 4}],
    NumberForm[expr, {5, 5}]];
The error message occurred when applying "//N" to a list returned
by Mapping 'f' onto a list.

At the above link I found an interesting technique, leading to this
workaround  :

g
% //. NumberForm[a_, b_] -> a
% // N

One learns every day.
Thanks to Richard and any others that may answer !


On Wed, Sep 14, 2011 at 1:09 PM, Richard Fateman <fateman@cs.berkeley.edu>wrote:

> On 9/14/2011 2:20 AM, James Stein wrote:
>
>> g := { NumberForm [ 13.0, { 5, 3 } ] };
>>    g
>>    % // N
>>
>
>
>
> in FullForm, g is List[NumberForm[13.`,List[5,3]**]]
>
> converting that to floating point numbers results in ...List[5.,3.] which
> is illegal as a format.
>
> while NumberForm [....]  prints something that you appear to like,  it does
> not return a value that you apparently expect.
>
> RJF
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous 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