Re: tabulate an expression-DigitBlock bug with zero digits
- To: mathgroup at smc.vnet.net
- Subject: [mg94026] Re: tabulate an expression-DigitBlock bug with zero digits
- From: Raffy <raffy at mac.com>
- Date: Tue, 2 Dec 2008 00:42:58 -0500 (EST)
- References: <200811301158.GAA07541@smc.vnet.net> <gh0jkg$5lu$1@smc.vnet.net>
On Dec 1, 7:00 am, Syd Geraghty <sydgerag... at me.com> wrote: > Bob & WRI staff, > > This is a really small nit but there is an annoying bug using > DigitBlock with a set of zero digits. > > They do not get separated as other digits do. > > Evaluate > > > n = 25; > > Grid[Prepend[Table[{ > > NumberForm[N[x], {2, 1}], > > NumberForm[N[Erf[x], 2 n], {n + 1, n}, DigitBlock -> 5]}, > > {x, 0, 1, 1/10}], > > TraditionalForm /@ {x, Erf[x]}], > > Frame -> All] > > and you will see what I mean on the output of erf(0.0). > > There is a workaround:- > > To get rid of the annoying bug ("feature") that a set of zeros is not > split by DigitBlock copy the Table output as a Cell Expression and > paste without interpretation. > > Edit the line of continuous zeros deleting the extra zeros and > replace with a "space" character. > > Then copy the cell as InputText and paste the result with > interpretation. > > That gives the desired table with the zeros seperated like the res= t > of the results for each x value. > > This procedure is, of course, a real pain (especially if you change > the table a few times before you publish it say). > > I realise that I need a real life if I worry about such nits. > > However in the interest of continuous improvement of the magical > Mathematica system (that I am addicted to) I offer this small > suggestion. > > Cheers ... Syd > > Syd Geraghty B.Sc, M.Sc. > > sydgerag... at mac.com > > Mathematica 7.0.0 for Mac OS X x86 (64 - bit) (21st November, 2008) > MacOS X V 10.5.4 > MacBook Pro 2.33 Ghz Intel Core 2 Duo 2GB RAM > > On Nov 30, 2008, at 3:58 AM, Bob Hanlon wrote: > > > n = 25; > > Grid[Prepend[Table[{ > > NumberForm[N[x], {2, 1}], > > NumberForm[N[Erf[x], 2 n], {n + 1, n}, DigitBlock -> 5]}, > > {x, 0, 1, 1/10}], > > TraditionalForm /@ {x, Erf[x]}], > > Frame -> All] You could always cheat and do something silly like: Unprotect[NumberForm]; NumberForm[0, {n_, f_}, ___, DigitBlock -> m_, ___] := StringJoin[{"0.", Riffle[Partition[Table["0", {f}], m, m, 1, {}], " "]}]; Protect[NumberForm];