[Tutor] Numeric Package
cino hilliard
hillcino368@hotmail.com
Mon Feb 24 19:05:02 2003
<html><div style='background-color:'><DIV>
<P>The following uses the arbitrary integer long of python to compute Pi. Can some one help getting this to use the Numeric package in float arbitrary precision.? </P>
<P><BR>def piasn(n):<BR> n1=n*7/2+5<BR> n2=n/2 + 5<BR> import time<BR> t1=time.time()<BR> m=n+5<BR> p,x,d = 3*10**m,3*10**m,1<BR> t1=time.time()<BR> while d <= n1:<BR> x=x*d/(d+1) >> 2<BR># x=x*d/(d+1)/4<BR> p=p+x/(d+2)<BR> d += 2<BR> t2=time.time()<BR> print "Pi = ",p<BR> print "sec to calc",t2-t1</P>
<P>Cino Hilliard<BR></P></DIV></div><br clear=all><hr>Add photos to your e-mail with <a href="http://g.msn.com/8HMAENUS/2746">MSN 8.</a> Get 2 months FREE*.</html>