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: [mg104832] Re: Formatting Numeric Outpuit
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Wed, 11 Nov 2009 04:27:40 -0500 (EST)
  • References: <hdbhjs$jmt$1@smc.vnet.net>

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


  • Prev by Date: Re: Formatting Numeric Outpuit
  • Next by Date: Re: strange behavior
  • Previous by thread: Re: Re: Formatting Numeric Outpuit
  • Next by thread: How to Calculatelength of an Spline curve between two points?