Re: which pi formula is given in the decimal module documentation?

2009-12-22 Thread Albert van der Horst
In article <00b967e1$0$15623$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >Nice work! But I have a question... > >On Mon, 21 Dec 2009 20:40:40 +, Albert van der Horst wrote: > >> def pi4(): >> ' Calculate pi by a 5th order process, with favorable stop >> criterion' >> precis

Re: which pi formula is given in the decimal module documentation?

2009-12-21 Thread Steven D'Aprano
On Tue, 22 Dec 2009 04:04:56 +, Albert van der Horst wrote: > In article <00b967e1$0$15623$c3e8...@news.astraweb.com>, Steven D'Aprano > wrote: >>Nice work! But I have a question... >> >>On Mon, 21 Dec 2009 20:40:40 +, Albert van der Horst wrote: >> >>> def pi4(): >>> ' Calculate pi

Re: which pi formula is given in the decimal module documentation?

2009-12-21 Thread Gabriel Genellina
En Mon, 21 Dec 2009 17:40:40 -0300, Albert van der Horst escribió: In article , Albert van der Horst wrote: In article , Mark Dickinson wrote: After a cup of coffee, it's much clearer: this just comes from the Taylor series for arcsin(x), applied to x = 1/2 to get asin(1/2) = pi/6.

Re: which pi formula is given in the decimal module documentation?

2009-12-21 Thread Steven D'Aprano
Nice work! But I have a question... On Mon, 21 Dec 2009 20:40:40 +, Albert van der Horst wrote: > def pi4(): > ' Calculate pi by a 5th order process, with favorable stop > criterion' > precision = 10e-20 Why do you say 10e-20 instead of 1e-19? -- Steven -- http://mail.pytho

Re: which pi formula is given in the decimal module documentation?

2009-12-21 Thread Albert van der Horst
In article , Albert van der Horst wrote: >In article , >Mark Dickinson wrote: >>On Dec 11, 10:30=A0am, Mark Dickinson wrote: >>> > It looks like an infinite series with term `t`, where`n` =3D (2k-1)^2 >>> > and `d` =3D d =3D 4k(4k+2) for k =3D 1... Does it have a name? >>> >>> Interesting. =A0

Re: which pi formula is given in the decimal module documentation?

2009-12-21 Thread Albert van der Horst
In article , Mark Dickinson wrote: >On Dec 11, 10:30=A0am, Mark Dickinson wrote: >> > It looks like an infinite series with term `t`, where`n` =3D (2k-1)^2 >> > and `d` =3D d =3D 4k(4k+2) for k =3D 1... Does it have a name? >> >> Interesting. =A0So the general term here is >> 3 * (2k choose k) /

Re: which pi formula is given in the decimal module documentation?

2009-12-11 Thread Mark Dickinson
On Dec 11, 8:16 am, Anh Hai Trinh wrote: > I'm just curious which formula for pi is given here: docs.python.org/library/decimal.html#recipes>? > > def pi(): >     """Compute Pi to the current precision. > >     >>> print pi() >     3.141592653589793238462643383 > >     """ >     getcontext().prec

Re: which pi formula is given in the decimal module documentation?

2009-12-11 Thread Mark Dickinson
On Dec 11, 10:30 am, Mark Dickinson wrote: > > It looks like an infinite series with term `t`, where`n` = (2k-1)^2 > > and `d` = d = 4k(4k+2) for k = 1... Does it have a name? > > Interesting.  So the general term here is > 3 * (2k choose k) / (16**k * (2*k+1)),  k >= 0. > > I've no idea what its

Re: which pi formula is given in the decimal module documentation?

2009-12-11 Thread Mark Dickinson
On Dec 11, 8:16 am, Anh Hai Trinh wrote: > I'm just curious which formula for pi is given here: docs.python.org/library/decimal.html#recipes>? > > def pi(): >     """Compute Pi to the current precision. > >     >>> print pi() >     3.141592653589793238462643383 > >     """ >     getcontext().prec

which pi formula is given in the decimal module documentation?

2009-12-11 Thread Anh Hai Trinh
I'm just curious which formula for pi is given here: ? def pi(): """Compute Pi to the current precision. >>> print pi() 3.141592653589793238462643383 """ getcontext().prec += 2 # extra digits for intermediate steps three = Decimal(3) # substitute "three=3.0" for reg

small inaccuracy in the logging module documentation (Python Library Reference)

2006-06-29 Thread Petr Jakeš
Hi, I have found some inaccuracy in the Python Library Reference 6.29.5.4 TimedRotatingFileHandler (http://docs.python.org/lib/node349.html) 1) it is not really obvious from the documentation the "when" value has to be in the format "w0", "w1" ... "w6" if "Type of interval" is defined as a "week

Re: Module documentation

2006-03-27 Thread msoulier
Bruno Desthuilliers wrote: > In the python shell, typing 'help()' should get you started most > of the time. And honestly, it should work all of the time. If it doesn't, file a bug report. I can't stand it when that doesn't work. Some of us don't do all of our work with a browser handy, and a net

Re: Module documentation

2006-03-26 Thread Georg Brandl
Tony Burrows wrote: > Just getting to grips with Python, a great language BUT > With something like Java I can find the syntax of a method call with no > problems, how do I do the same with Python? > > For example, using MySQLdb or SGMLParser I can see what the available > methods are with dir, bu

Re: Module documentation

2006-03-26 Thread Bruno Desthuilliers
Tony Burrows a écrit : > Just getting to grips with Python, a great language BUT > With something like Java I can find the syntax of a method call with no > problems, how do I do the same with Python? > > For example, using MySQLdb or SGMLParser I can see what the available > methods are with dir,

Re: Module documentation

2006-03-26 Thread Tony Burrows
On Sun, 26 Mar 2006 17:19:35 +0200, Rene Pijlman wrote: > Tony Burrows: >>With something like Java I can find the syntax of a method call with no >>problems, how do I do the same with Python? > > The basic syntax is just the name, with parameters in brakcets: > >object.method(par1, par2, ...

Re: Module documentation

2006-03-26 Thread Paul Boddie
Tony Burrows wrote: > Just getting to grips with Python, a great language BUT > With something like Java I can find the syntax of a method call with no > problems, how do I do the same with Python? > > For example, using MySQLdb or SGMLParser I can see what the available > methods are with dir, but

Re: Module documentation

2006-03-26 Thread Rene Pijlman
Tony Burrows: >With something like Java I can find the syntax of a method call with no >problems, how do I do the same with Python? The basic syntax is just the name, with parameters in brakcets: object.method(par1, par2, ...) This is explained in the documentation, of course. >how do I find

Module documentation

2006-03-26 Thread Tony Burrows
Just getting to grips with Python, a great language BUT With something like Java I can find the syntax of a method call with no problems, how do I do the same with Python? For example, using MySQLdb or SGMLParser I can see what the available methods are with dir, but how do I find out what paramet

Re: email module documentation

2005-11-22 Thread David Bear
Robert Kern wrote: > David Bear wrote: >> I'm confused about how to use the email module in python 2.4.x >> >> I'm using python packaged with suse 9.3. >> >>>From the module documetation at http://docs.python.org/lib/node597.html I >> found the following example (items cut): >> >> import email

Re: email module documentation

2005-11-22 Thread Robert Kern
David Bear wrote: > I'm confused about how to use the email module in python 2.4.x > > I'm using python packaged with suse 9.3. > >>From the module documetation at http://docs.python.org/lib/node597.html I > found the following example (items cut): > > import email > > ... > msg = email.messag

email module documentation

2005-11-22 Thread David Bear
I'm confused about how to use the email module in python 2.4.x I'm using python packaged with suse 9.3. >From the module documetation at http://docs.python.org/lib/node597.html I found the following example (items cut): import email ... msg = email.message_from_file(fp) .. Yet, when I try thi