Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Formatting Numeric Outpuit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104822] Re: [mg104782] Formatting Numeric Outpuit
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 11 Nov 2009 04:25:29 -0500 (EST)
  • References: <200911101057.FAA19555@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

This works:

n1 = RandomReal[100, 10];
NumberForm[Column[n1, Right], {3, 3}]

46.700
87.700
93.300
  6.080
64.100
97.500
97.100
66.100
24.800
86.500

And so does this:

Column[NumberForm[#, {3, 3}] & /@ n1, Right]

46.700
87.700
93.300
  6.080
64.100
97.500
97.100
66.100
24.800
86.500

Your post is just one more indication that NumberForm is not a "wrapper",  
as the documentation claims.

Here's more proof, if such is needed:

n2 = NumberForm[n1, {3, 3}];

n2 + n2

2 {46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500}

n2 + n1

{46.7002+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},87.6606+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},93.313+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},6.0828+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},64.1356+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},97.4756+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},97.1373+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},66.0927+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},24.753+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500},86.5165+{46.700,87.700,93.300,6.080,64.100,97.500,97.100,66.100,24.800,86.500}}

That's apparently what it means to say, "NumberForm acts as a 'wrapper',  
which affects printing, but not evaluation."

Bobby

On Tue, 10 Nov 2009 04:57:09 -0600, BenT <brtubb at pdmusic.org> wrote:

> Please consider these Mathematica 7 code Input lines:
>
> n1 = RandomReal[100, 10]
>
> n2 = NumberForm[n1, {3, 3}]
>
> Column[n2, Right]
>
> What I expected to get was "ignored", namely right aligned "arbitrary"
> numeric data with 3 digits to the right, and 3 digits to the left of
> the decimal point) formatted in a single column. How can this be
> achieved with any numeric list of data?
>
> --- Benjamin Tubb
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: strange behavior
  • Next by Date: Re: Re: Set::setps error? Twitter.m's OOP-like approach?
  • Previous by thread: Re: Formatting Numeric Outpuit
  • Next by thread: Re: Formatting Numeric Outpuit