|
[Date Index]
[Thread Index]
[Author Index]
Re: DisplayForm changes precission
- To: mathgroup at smc.vnet.net
- Subject: [mg47588] Re: DisplayForm changes precission
- From: "Peter Pein" <petsie at arcor.de>
- Date: Fri, 16 Apr 2004 05:22:01 -0400 (EDT)
- References: <c5lk0f$d4a$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Mario Drobics" <mario.drobics at scch.at> schrieb im Newsbeitrag
news:c5lk0f$d4a$1 at smc.vnet.net...
>
> I am trying to create a GridBox to display some numbers. When applying
> GridBox, however, the precission changes and the output gets unreadable.
> Any ideas why this is happening?
>
> Code:
> (* round to prec digits *)
> NRound[x_, prec_Integer:0] := MapAll[If[NumericQ[#],
> N[Round[#*10^prec]/(10^prec)], #] &, x];
>
> (* everything ok here *)
> NRound[array, 2] // FullForm
> List[List[
> 7.`, 0.`, 11.`, 18.`, 34.`, 1.`, 0.13`], List[7.`, 0.`, 11.`, 18.`,
> 34.`,
> 1.`, 0.13`], List[
> 9.`, 0.`, 25.`, 34.`, 18.`, 1.`, 0.17`], List[26.95`, 7.95`, 7.05`,
> 34.`,
> 18.`, 0.77`, 0.52`], List[29.`, 11.5`, 5.`, 34.`, 18.`, 0.72`,
0.56`],
> List[31.`, 11.5`, 3.`, 34.`, 18.`, 0.73`, 0.6`]]
>
> (* this also works *)
> NRound[array /. Obj`CompResItem -> List, 2] // TableForm
> \!\(\*
> TagBox[GridBox[{
> {"7.`", "0.`", "11.`", "18.`", "34.`", "1.`", "0.13`"},
> {"7.`", "0.`", "11.`", "18.`", "34.`", "1.`", "0.13`"},
> {"9.`", "0.`", "25.`", "34.`", "18.`", "1.`", "0.17`"},
> {"26.95`", "7.95`", "7.05`", "34.`", "18.`", "0.77`", "0.52`"},
> {"29.`", "11.5`", "5.`", "34.`", "18.`", "0.72`", "0.56`"},
> {"31.`", "11.5`", "3.`", "34.`", "18.`", "0.73`", "0.6`"}
> },
> RowSpacings->1,
> ColumnSpacings->3,
> RowAlignments->Baseline,
> ColumnAlignments->{Left}],
> Function[ BoxForm`e$,
> TableForm[ BoxForm`e$]]]\)
>
> (* this does not work!!! *)
> GridBox[
> NRound[array /. Obj`CompResItem -> List, 2]
> ] // DisplayForm
...
Hi Mario.
Strange -- in version 4.0 the following simple example works perfectly:
ppii = N[Pi, 123];
GridBox[
Table[SetAccuracy[ppii, i + j]//NumberForm,
{i, 3}, {j, 3}]]//DisplayForm
No (unwanted) changes of accuracy occur.
"NumberForm" seems to be necessary.
--
Peter Pein, Berlin
to write to me, start the subject with [
Prev by Date:
FW: Re: Length of actual parameters in a function call. (Plus how to organize mathematica stuff)
Next by Date:
Re: DisplayForm changes precission
Previous by thread:
DisplayForm changes precission
Next by thread:
Re: DisplayForm changes precission
|