From: BenT on
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

From: DrMajorBob on
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(a)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(a)yahoo.com

From: Peter Breitfeld on
BenT 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
>

If you look at the FullForm of n2, you see:

NumberForm[List[66.34054656810791`,...],List[3,3]]

Column is for displaying Lists, so you have to feed Column not with
NumberForm[List[...], List[...]] but List[NumberForm[...]].
This is done like this:

n3=NumberForm[#,{3,3}]&/@n1

Column[n3]

<prints ok>

--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

From: Tomas Garza on
Perhaps this is what you want:

In[5]:= Column[PaddedForm[#,{6,3}]&/@n1]
Out[5]=
47.517
15.307
13.930
70.045
30.902
7.979
86.600
22.895
57.105
65.637

Tomas



> Date: Tue, 10 Nov 2009 05:57:09 -0500
> From: brtubb(a)pdmusic.org
> Subject: Formatting Numeric Outpuit
> To: mathgroup(a)smc.vnet.net
>
> 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
>

From: Bill Rowe on
On 11/10/09 at 5:57 AM, brtubb(a)pdmusic.org (BenT) 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?

The problem with the above code is NumberForm puts a wrapper
around the list of numbers, making the head of n2 NumberForm
rather than List as Column expects. You can achieve what you
want with

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