MathGroup Archive 2008

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

Search the Archive

Re: Align decmal points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84981] Re: [mg84955] Align decmal points
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 21 Jan 2008 07:02:00 -0500 (EST)
  • Reply-to: hanlonr at cox.net

NumberForm[Grid[spheres, Alignment -> Right], {6, 1}]


Bob Hanlon

---- Steve Gray <stevebg at roadrunner.com> wrote: 
> (Best viewed with a fixed-spacing font such as Courier New.)
> 
> I have lists, spheres, of <100 lists {x,y,z,radius}, typically as
> follows:
> N[spheres]
> {{1060.05, 423.413, -171.449, 1102.85}, {33.5541, 16.2535, 14.0345, 
>   83.8389}, {67.8212, 29.8456, 7.84258, 83.2877}, {55.7474, -6.90536, 
>   13.6956, 97.1971}, {84.5821, 5.44961, 8.37983, 
>   99.2468}, {187.597, -144.491, 11.6819, 
>   257.383}, {62.9557, -6.33653, -5.45155, 
>   111.918}, {59.9433, -7.63485, -4.95006, 
>   112.004}, {60.5971, -4.5244, -3.88841, 
>   109.34}, {62.2891, -6.38914, -3.68097, 110.48}, {54.918, 10.2798, 
>   22.727, 97.2316}, {72.0123, 17.306, 19.4247, 98.0057}, {76.3649, 
>   4.28294, 31.4533, 114.151}, {53.7474, 34.5342, 35.4736, 
>   103.675}, {61.7639, -3.8727, -1.2733, 109.211}}
> 
> I want to print this in MatrixForm but with the decimal points of
> successive rows aligned, like this: (1060.0, etc., would be ok too)
> (here the matrix brackets are missing)
> 
> 1060.	423.4  -171.4  1102.9
>   33.6   16.3    14.	 83.8
>   67.8   29.8	  7.8	 83.3
>   55.7   -6.9    13.7	 97.2
>   84.6    5.4     8.4	 99.2
>  187.6 -144.5    11.7	257.4
>   63.    -6.3    -5.5	111.9
>   59.9	 -7.6    -5.	112.
>   60.6	 -4.5    -3.9	109.3
>   62.3	 -6.4    -3.7	110.5
>   54.9	 10.3    22.7	 97.2
>   72.	 17.3    19.4	 98.
>   76.4	  4.3    31.5	114.2
>   53.7	 34.5    35.5	103.7
>   61.8	 -3.9    -1.3	109.2
> 
> Print[MatrixForm[Round[spheres, .1]]] does it except the decimal
> points are not aligned. I will appreciate any tips. Thank you.
> 
> Steve Gray
> 



  • Prev by Date: Optimization in Mathmatica
  • Next by Date: Re: Shuffle problem
  • Previous by thread: Align decmal points
  • Next by thread: Re: Align decmal points