MathGroup Archive 2002

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

Search the Archive

RE: newbie question - printing Pi

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33375] RE: [mg33369] newbie question - printing Pi
  • From: David.Annetts at csiro.au
  • Date: Mon, 18 Mar 2002 23:38:45 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Jim,

> 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?

One solution might be as follows ...
1.	Convert the first 300 digits of Pi to a string:-
	pistr = ToString[N[Pi, 300]];

2.	Take appropriately-sized substrings:-
	pisub = StringTake[pistr, {#, # + 4}] & /@ Range[1, 300, 5]

3.	Partition & print as a table ...
	Partition[pisub, 4] // TableForm

Regards,

Dave. 


  • Prev by Date: Re: Integrals Step-by-Step
  • Next by Date: Full text of the current warning message(s)
  • Previous by thread: Re: newbie question - printing Pi
  • Next by thread: Re: newbie question - printing Pi