Re: Compute pi to base 12 using Python?

2005-04-18 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm using GMPY (see code). [snip] If you are using gmpy you might as well do it like this. gmpy.pi() uses the Brent-Salamin Arithmetic-Geometric Mean formula for

Re: Compute pi to base 12 using Python?

2005-04-18 Thread [EMAIL PROTECTED]
Nick Craig-Wood wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm using GMPY (see code). [snip] If you are using gmpy you might as well do it like this. gmpy.pi() uses the Brent-Salamin

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Dick Moores
Tim Roberts wrote at 22:05 4/16/2005: Dick Moores [EMAIL PROTECTED] wrote: # Reading/writing Python source often gives me the impression of # reading/writing a poem! # Layout, indentation, rythm, I like the look and feel! # What does this tiny program do? It is not a sonnet, even not a #

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Dick Moores
M.E.Farmer wrote at 23:18 4/14/2005: Using the GNU bc utility: $ bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. scale = 3000# number of output places

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Roel Schroeven
Dick Moores wrote: M.E.Farmer wrote at 23:18 4/14/2005: Using the GNU bc utility: $ bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. scale = 3000# number

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Bengt Richter
On Sun, 17 Apr 2005 01:00:46 -0700, Dick Moores [EMAIL PROTECTED] wrote: M.E.Farmer wrote at 23:18 4/14/2005: Using the GNU bc utility: $ bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY.

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Dick Moores
Roel Schroeven wrote at 01:45 4/17/2005: Dick Moores wrote: M.E.Farmer wrote at 23:18 4/14/2005: Using the GNU bc utility: $ bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Paul Rubin
Dick Moores [EMAIL PROTECTED] writes: C:\cygwin\bin\bc -l pi12.txt But how or when do you enter the lines scale = 3000 obase = 12 print 4 * a(1) You could put them into a file, say pi.bc. Then run bc -l pi.bc -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Dick Moores
Bengt Richter wrote at 02:26 4/17/2005: Could someone remind me how to get the output of bc -l into a text file on Windows? (I've tried employing pi3003.txt in various ways) OR, how to copy and paste from the command line window, or whatever that window is called? (Sorry for the OT question.) To

Re: Compute pi to base 12 using Python?

2005-04-17 Thread Dick Moores
Paul Rubin wrote at 02:35 4/17/2005: Dick Moores [EMAIL PROTECTED] writes: C:\cygwin\bin\bc -l pi12.txt But how or when do you enter the lines scale = 3000 obase = 12 print 4 * a(1) You could put them into a file, say pi.bc. Then run bc -l pi.bc OK, now that I've got Textpad trained to

Re: Compute pi to base 12 using Python?

2005-04-17 Thread M.E.Farmer
PS. Redirecting with from a script whose interpreter was started by windows extension association doesn't work on some version of windows. To be safe, invoke the interpreter explicitly, e.g., python myscript.py [whatever args here] pi3003.txt Thanks very much for this. What kind of args

Re: Compute pi to base 12 using Python?

2005-04-16 Thread Tim Roberts
Dick Moores [EMAIL PROTECTED] wrote: # Reading/writing Python source often gives me the impression of # reading/writing a poem! # Layout, indentation, rythm, I like the look and feel! # What does this tiny program do? It is not a sonnet, even not a # pi-sonnet, but it surely produces Pi! It

Re: Compute pi to base 12 using Python?

2005-04-16 Thread Tim Roberts
Dick Moores [EMAIL PROTECTED] wrote: M.E.Farmer wrote at 23:18 4/14/2005: Nice collection of unix tools, Cygwin not needed. http://unxutils.sourceforge.net/ Thank you! But a question. I've download both UnxUtils.zip and UnxUpdates.zip. I'm planning to put the contents of UnxUtils.zip in a

Re: Compute pi to base 12 using Python?

2005-04-15 Thread M.E.Farmer
Dick Moores wrote: Paul Rubin wrote at 18:20 4/13/2005: Dick Moores [EMAIL PROTECTED] writes: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it well

Re: Compute pi to base 12 using Python?

2005-04-15 Thread Dick Moores
M.E.Farmer wrote at 23:18 4/14/2005: Nice collection of unix tools, Cygwin not needed. http://unxutils.sourceforge.net/ Thank you! But a question. I've download both UnxUtils.zip and UnxUpdates.zip. I'm planning to put the contents of UnxUtils.zip in a directory and then move the contents of

Re: Compute pi to base 12 using Python?

2005-04-15 Thread M.E.Farmer
Sounds good should work fine ;) M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Richie Hindle
[Dan] Now you've got me curious. Why would an artist want the first 3003 digits of pi to the base 12? [Dick] He says, Do you know how I can get base12 pi? Because the chromatic scale is base12. c c# d d# e f f# g g# a a# b He should read Douglas Adams' fictional essay Music and Fractal

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Greg Lindstrom
He says, Do you know how I can get base12 pi? Because the chromatic scale is base12. c c# d d# e f f# g g# a a# b Dick It might feel more natural to do this with 'e' (2.718...) --greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-14 Thread François Pinard
[Doug Schwarz] The chromatic scale is based on one twelfth powers of two, i.e., if the frequency of a note in the scale is f(n), then the frequency of the next note is given by f(n+1) = f(n) * 2^(1/12) This easy view of things has been known for a long time, but has only been popular

Re: Compute pi to base 12 using Python?

2005-04-14 Thread François Pinard
[Bengt Richter] It might also be interesting to keep a running sum of the base 12 values and use sum % 88 to select piano keys, to let it walk intervals outside of a single octave ;-) The generated would then run from the low octaves to high octaves monotically, then start over again and

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Bill Mill
On 13 Apr 2005 19:05:01 -0700, Paul Rubin http://phr.cx@nospam.invalid wrote: Dick Moores [EMAIL PROTECTED] writes: I don't believe GNU bc is available for Windows, is it? I don't know. It probably works ok under Cygwin at least. bc definitely works on cygwin, and is available at

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm using GMPY (see code). [snip] If you are using gmpy you might as well do it like this. gmpy.pi() uses the Brent-Salamin Arithmetic-Geometric Mean formula for pi IIRC. This converges quadratically, and it will calculate you a million places

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Dick Moores
Steve Holden wrote at 22:29 4/13/2005: Dick Moores wrote: Steve Holden wrote at 19:12 4/13/2005: Dick Moores wrote: Dan wrote at 18:02 4/13/2005: On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist acquaintance who needs (I just learned) the

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Dick Moores
Dick Moores wrote at 18:40 4/14/2005: Sorry about that. http://www.kenjikojima.com/ I just listened to Kojima's NEW Chorus Pi (Japanese) / 2:28 Chorus: MacinTalk Voices. The music was created from the constant PI. on that page. The vocal is singing the digits of base-10 pi. ten is . or decimal

Compute pi to base 12 using Python?

2005-04-13 Thread Dick Moores
I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it well enough. Could someone show me how to do what I need? Thanks, Dick Moores [EMAIL PROTECTED] --

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Bengt Richter
On Wed, 13 Apr 2005 02:06:11 -0700, Dick Moores [EMAIL PROTECTED] wrote: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it well enough. Could someone show me how to

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dick Moores
Bengt Richter wrote at 03:19 4/13/2005: On Wed, 13 Apr 2005 02:06:11 -0700, Dick Moores [EMAIL PROTECTED] wrote: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it well

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-04-13 03:27:06 -0700: Bengt Richter wrote at 03:19 4/13/2005: This is not homework, nor am I a student, though I am trying to learn Python. I'm just trying to help an artist acquaintance who needs (I just learned) the first 3003 digits of pi to the base 12.

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dan Bishop
Dick Moores wrote: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it well enough. How many stars are in *? You probably answered 25. This

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dick Moores
Dan Bishop wrote at 04:07 4/13/2005: (3) A function for converting numbers to their base-12 representation. For integers, this can be done with: DIGITS = 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ def itoa(num, radix=10): is_negative = False if num 0: is_negative = True num = -num

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Roy Smith
In article [EMAIL PROTECTED], Dan Bishop [EMAIL PROTECTED] wrote: But there's no reason other than tradition why you should arrange them into groups of 10. Well, it is traditional for people to have 10 fingers :-) Other fun things to think about are negative bases. For example, 3(10) =

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dan Bishop
Dick Moores wrote: Dan Bishop wrote at 04:07 4/13/2005: ... For a floating-point number x, the representation with d decimal places count be found by taking the representation of int(round(x * radix ** d)) and inserting a . d places from the right. But I'm sorry, but I can't follow you. I do

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Scott David Daniels
Roy Smith wrote: In article [EMAIL PROTECTED], Dan Bishop [EMAIL PROTECTED] wrote: But there's no reason other than tradition why you should arrange them into groups of 10. Well, it is traditional for people to have 10 fingers :-) Other fun things to think about are negative bases. For

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Roy Smith
Scott David Daniels [EMAIL PROTECTED] wrote: If you think those are fun, try base (1j - 1) Get real. I can't imagine using anything so complex. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Kristian Zoerhoff
On 13 Apr 2005 12:06:26 -0400, Roy Smith [EMAIL PROTECTED] wrote: Scott David Daniels [EMAIL PROTECTED] wrote: If you think those are fun, try base (1j - 1) Get real. I can't imagine using anything so complex. +1 QOTW -- Kristian kristian.zoerhoff(AT)gmail.com zoerhoff(AT)freeshell.org

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dan Bishop
Scott David Daniels wrote: Roy Smith wrote: In article [EMAIL PROTECTED], Dan Bishop [EMAIL PROTECTED] wrote: But there's no reason other than tradition why you should arrange them into groups of 10. Well, it is traditional for people to have 10 fingers :-) Other fun things to

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Grant Edwards
On 2005-04-13, Dan Bishop [EMAIL PROTECTED] wrote: Pi has an interesting representation in bases between 0 and 1, exclusive. There are a finite number of digits after the radix point, but an infinite number _before_ it. You really oughtn't make me think so hard right after lunch. -- Grant

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Bengt Richter
On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: Bengt Richter wrote at 03:19 4/13/2005: On Wed, 13 Apr 2005 02:06:11 -0700, Dick Moores [EMAIL PROTECTED] wrote: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference,

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dick Moores
Bengt Richter wrote at 14:52 4/13/2005: import sys def main(): k, a, b, a1, b1 = 2L, 4L, 1L, 12L, 4L while 1: p, q, k = k*k, 2L*k+1L, k+1L a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 d, d1 = a/b, a1/b1 while d == d1: output(d) a, a1 =

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dan
On 13 Apr 2005 12:06:26 -0400, [EMAIL PROTECTED] (Roy Smith) wrote: Scott David Daniels [EMAIL PROTECTED] wrote: If you think those are fun, try base (1j - 1) Get real. I can't imagine using anything so complex. Well said. :-) Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dan
On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist acquaintance who needs (I just learned) the first 3003 digits of pi to the base 12. Now you've got me curious. Why would an artist want the first 3003 digits of pi to the base 12? Dan

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dick Moores
Dan wrote at 18:02 4/13/2005: On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist acquaintance who needs (I just learned) the first 3003 digits of pi to the base 12. Now you've got me curious. Why would an artist want the first 3003 digits

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Paul Rubin
Dick Moores [EMAIL PROTECTED] writes: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it well enough. Could someone show me how to do what I need? Using the GNU bc

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Ivan Van Laningham
Hi All-- Dick Moores wrote: Dan wrote at 18:02 4/13/2005: On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist acquaintance who needs (I just learned) the first 3003 digits of pi to the base 12. Now you've got me curious. Why

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dick Moores
Paul Rubin wrote at 18:20 4/13/2005: Dick Moores [EMAIL PROTECTED] writes: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it well enough. Could someone show me how

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Paul Rubin
Dick Moores [EMAIL PROTECTED] writes: I don't believe GNU bc is available for Windows, is it? I don't know. It probably works ok under Cygwin at least. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Steve Holden
Dick Moores wrote: Dan wrote at 18:02 4/13/2005: On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist acquaintance who needs (I just learned) the first 3003 digits of pi to the base 12. Now you've got me curious. Why would an artist want the

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Steve Holden
Dan wrote: On 13 Apr 2005 12:06:26 -0400, [EMAIL PROTECTED] (Roy Smith) wrote: Scott David Daniels [EMAIL PROTECTED] wrote: If you think those are fun, try base (1j - 1) Get real. I can't imagine using anything so complex. Well said. :-) Oh, no, now we're sunk three-holes-in-the-ground-ly

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Doug Schwarz
In article [EMAIL PROTECTED], Dick Moores [EMAIL PROTECTED] wrote: Dan wrote at 18:02 4/13/2005: On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist acquaintance who needs (I just learned) the first 3003 digits of pi to the base

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Dick Moores
Doug Schwarz wrote at 20:14 4/13/2005: In article [EMAIL PROTECTED], Dick Moores [EMAIL PROTECTED] wrote: Dan wrote at 18:02 4/13/2005: On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist acquaintance who needs (I just learned) the

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Bengt Richter
On Thu, 14 Apr 2005 03:14:51 GMT, Doug Schwarz [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Dick Moores [EMAIL PROTECTED] wrote: Dan wrote at 18:02 4/13/2005: On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores [EMAIL PROTECTED] wrote: I'm just trying to help an artist

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Bengt Richter
On Thu, 14 Apr 2005 11:05:17 +1000, John Machin [EMAIL PROTECTED] wrote: On Wed, 13 Apr 2005 08:28:29 -0400, Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Dan Bishop [EMAIL PROTECTED] wrote: But there's no reason other than tradition why you should arrange them into groups

Re: Compute pi to base 12 using Python?

2005-04-13 Thread Bengt Richter
On 13 Apr 2005 18:20:06 -0700, Paul Rubin http://[EMAIL PROTECTED] wrote: Dick Moores [EMAIL PROTECTED] writes: I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, http://mathworld.wolfram.com/Base.html, but I really don't understand it