Re: newbie question - printing Pi
- To: mathgroup at smc.vnet.net
- Subject: [mg33384] Re: [mg33369] newbie question - printing Pi
- From: BobHanlon at aol.com
- Date: Mon, 18 Mar 2002 23:38:57 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 3/18/02 12:32:41 AM, jgrieve at mindspring.com writes:
>How can I print Pi into a table (starting after the decimal point) of 4
>columns of 5 digits each - for the first say 300 digits?
>
blockSize = 5;
nbrCols = 4;
nbrRows = 15;
(Print[ToString[TraditionalForm[Pi]]<>" = 3."];
Partition[FromDigits /@
Partition[Rest[RealDigits[
N[Pi,nbrRows*nbrCols*blockSize+1]
][[1]]],
blockSize],
nbrColumns]//TableForm)
For comparison
:
NumberForm[N[Pi, nbrRows*nbrCols*blockSize+1],
DigitBlock->5, NumberSeparator->" "]
Bob Hanlon
Chantilly, VA USA