Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12819 > unrolled thread
| Started by | Themis Matsoukas <tmatsoukas@me.com> |
|---|---|
| First post | 2012-12-17 07:54 +0000 |
| Last post | 2012-12-18 07:34 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: silly question on formatting tables Themis Matsoukas <tmatsoukas@me.com> - 2012-12-17 07:54 +0000
Re: silly question on formatting tables Ray Koopman <koopman@sfu.ca> - 2012-12-18 07:34 +0000
| From | Themis Matsoukas <tmatsoukas@me.com> |
|---|---|
| Date | 2012-12-17 07:54 +0000 |
| Subject | Re: silly question on formatting tables |
| Message-ID | <kamj30$qra$1@smc.vnet.net> |
The question is not silly and I have not found a satisfactory answer yet. A problem is that NumberForm does not force the specified digits to all numbers. It seems to stop working past 10^-5, as the example shows.
m = {{0., 1.}, {1., 0.1}, {2., 0.01}, {3., 0.001}, {4., 0.0001}, {5.,
0.00001}, {6., 0.000001}, {7., 0.000001}, {8., 0.000001}, {9.,
0.000001}, {10., 0.000001}};
m /. a_Real :> NumberForm[a, {3, 2}] // TableForm
0.00 1.00
1.00 0.10
2.00 0.01
3.00 0.00
4.00 0.00
5.00 0.00
6.00 1.00*10^(-6)
7.00 1.00*10^(-6)
8.00 1.00*10^(-6)
9.00 1.00*10^(-6)
10.00 1.00*10^(-6)
[toc] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-12-18 07:34 +0000 |
| Message-ID | <kap69f$44i$1@smc.vnet.net> |
| In reply to | #12819 |
On Dec 16, 11:54 pm, Themis Matsoukas <tmatsou...@me.com> wrote:
> The question is not silly and I have not found a satisfactory answer yet. A problem is that NumberForm does not force the specified digits to all numbers. It seems to stop working past 10^-5, as the example shows.
>
> m = {{0., 1.}, {1., 0.1}, {2., 0.01}, {3., 0.001}, {4., 0.0001}, {5.,
> 0.00001}, {6., 0.000001}, {7., 0.000001}, {8., 0.000001}, {9.,
> 0.000001}, {10., 0.000001}};
>
> m /. a_Real :> NumberForm[a, {3, 2}] // TableForm
>
> 0.00 1.00
> 1.00 0.10
> 2.00 0.01
> 3.00 0.00
> 4.00 0.00
> 5.00 0.00
> 6.00 1.00*10^(-6)
> 7.00 1.00*10^(-6)
> 8.00 1.00*10^(-6)
> 9.00 1.00*10^(-6)
> 10.00 1.00*10^(-6)
m = {#,N[10^-#]}& /@ Range[0,10];
m /. a_Real :> PaddedForm[a,{3,2},
ExponentFunction->(Null&)] //TableForm
0 1.00
1 0.10
2 0.01
3 0.00
4 0.00
5 0.00
6 0.00
7 0.00
8 0.00
9 0.00
10 0.00
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web