Re: Pi vs. 3.141592654
- To: mathgroup at smc.vnet.net
- Subject: [mg18102] Re: Pi vs. 3.141592654
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 17 Jun 1999 12:26:39 -0400
- Organization: Universitaet Leipzig
- References: <7juc3u$580@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, a) Mathematica saves all computed values like N[Pi]. The first time Timing[N[Pi,300]] gives the result to calculate Pi the second Timing[N[Pi,400]] uses only the already calculated value. Thats why it is faster. b) How can you avoid Pi ? There is no serious mathematical relation with out Pi Regards Jens Blimbaum Jerry DLPC wrote: > > I was trying to understand the use of the command TracePrint, so I > tried the following: > > f[x_]: = x; > f[1]//TracePrint and got an output with about 4 steps > involved, but then I tried > > f[Pi/2]//TracePrint which came out with about 17 steps > involved!! > > This made me wonder since I see Pi used so many times for > calculating tables or as limits when plotting functions, so > I tried the following timing comparison. > > <<...>> > > and got Time outputs of 3.19 and 0.77 seconds respectively!!! a > factor of greater then 4 between them. > > Should I conclude that I need to avoid using Pi in expressions, etc. > if I want to reduce processing time? > > Thanks. Jerry Blimbaum NSWC Panama City, Fl >