From: David Park on
You need:

n1 = RandomReal[100, 10]

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

Column[n2, Right]


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/


From: BenT [mailto:brtubb(a)pdmusic.org]


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: dnquark on
On Nov 10, 6:08 am, BenT <brt...(a)pdmusic.org> wrote:
- use Column[] before NumberForm[]
- read the docs for NumberForm[]

Is this closer to what you want?:

n1 = RandomReal[100, 10]
NumberForm[Column[n1, Right], {5, 3}, NumberPadding -> "0"]

> 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: Bob Hanlon on

n1 = RandomReal[100, 10];

(n2 = NumberForm[n1, {3, 3}])//FullForm

Look at the FullForm of your n2. Then note that NumberForm does not have the attribute Listable.

Attributes[NumberForm]

{Protected}

Use

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

Column[n2, Right]


Bob Hanlon

---- 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


--

Bob Hanlon


From: Patrick Scheibe on
Hi,

what about

Column[NumberForm[#, {5, 3}, NumberPadding -> {"0", "0"}] & /@
RandomReal[100, 10]]

?

Cheers
Patrick

On Tue, 2009-11-10 at 05:57 -0500, 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
>


From: Murray Eisenberg on
You may obtain what you want by mapping the appropriate NumberForm
expression onto the list n1 and feeding that into Column (for the sake
of this post, I shortened the list to have length 2):

n1 = RandomReal[100, 2];
n2 = NumberForm[#, {3, 3}] & /@ n1;
Column[n2, Right]
91.900
56.100

I don't know how completely to explain why what you tried doesn't work,
except to note the result of ...

NumberForm[n1, {3, 3}] // FullForm

...which shows a NumberForm expression. Remember that NumberForm does not
affect evaluation, only display.

But I've long considered the same effect you observed as an a
Mathematica annoyance. Like you, I've always expected the NumberForm to
change the display of all the numbers no matter where they're
subsequently embedded.

I don't know why this annoying behavior cannot be changed, although from
my perspective it's hard to tell what effects the change might make as
they ricochet through the whole system.

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
>

--
Murray Eisenberg murray(a)math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305