Compute pi to base 12 using Python?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bengt Richter

    #31
    Re: Compute pi to base 12 using Python?

    On Thu, 14 Apr 2005 03:14:51 GMT, Doug Schwarz <see@sig.for.ad dress.edu> wrote:
    [color=blue]
    >In article <mailman.1865.1 113441561.1799. python-list@python.org >,
    > Dick Moores <rdm@rcblue.com > wrote:
    >[color=green]
    >> Dan wrote at 18:02 4/13/2005:[color=darkred]
    >> >On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores <rdm@rcblue.com >
    >> >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?[/color]
    >>
    >> 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[/color]
    >
    >Does your artist friend have any idea what base 12 means?
    >[/color]
    Maybe he wants to play sounds of pi and has found base 10 digits don't
    hit all the notes, and he may not be as dumb as you think ;-)
    [color=blue]
    >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)
    >
    >so by the time you go all 12 notes in an octave you have doubled the
    >frequency. There is nothing here involving base 12 or pi.
    >[/color]
    I expect something interesting and imaginative ;-)
    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 ;-)

    I found using different base digits to draw end-to-end vectors selected from
    equal vectors equally spaced in all base directions for a "random" walk picture
    was interesting. I also changed the color according to various criteria such
    as digit run length ending on the current digit. Maybe the artist could scale
    that up and put it on the wall as backdrop to the music ;-)
    It would be easy to generate postscript for it, that could be scaled up and
    printed wall size. Or pdf. I'm tempted to play with my pdf plotting toy and
    maybe make it work ;-)

    I'm kind of curious what the ear could pick up about pi from hearing the sequence
    as notes. Or intervals, or grouped to make chords even. Anyone have an easy python
    midi interface for windows to play on the sound card? I could generate a .wav file
    to play tones, but midi would be much more compact ;-)

    Regards,
    Bengt Richter

    Comment

    • Bengt Richter

      #32
      Re: Compute pi to base 12 using Python?

      On Thu, 14 Apr 2005 11:05:17 +1000, John Machin <sjmachin@lexic on.net> wrote:
      [color=blue]
      >On Wed, 13 Apr 2005 08:28:29 -0400, Roy Smith <roy@panix.co m> wrote:
      >[color=green]
      >>In article <1113390479.738 210.49530@z14g2 000cwz.googlegr oups.com>,
      >> "Dan Bishop" <danb_83@yahoo. com> wrote:
      >>[color=darkred]
      >>> But there's no reason other than tradition why you should arrange them
      >>> into groups of 10.[/color]
      >>
      >>Well, it is traditional for people to have 10 fingers :-)[/color]
      >
      >According to anthropology archives, there was once a tribe called
      >"OS/360 system programmers" who would cut off their thumbs and great
      >toes in order that they might better count in hexadecimal.
      >[/color]
      I suspect using four dates back to the nixie tribe, who practiced bi-quinary.
      And they would cut off little toes and fingers rather, because then the thumb
      was more significant and it was easier to remember it as 5 (or 0 if hidden)
      with the rest counting octally ;-)

      Regards,
      Bengt Richter

      Comment

      • Bengt Richter

        #33
        Re: Compute pi to base 12 using Python?

        On 13 Apr 2005 18:20:06 -0700, Paul Rubin <http://phr.cx@NOSPAM.i nvalid> wrote:
        [color=blue]
        >Dick Moores <rdm@rcblue.com > writes:[color=green]
        >> I need to figure out how to compute pi to base 12, to as many digits
        >> as possible. I found this reference,
        >> <http://mathworld.wolfr am.com/Base.html>, but I really don't
        >> understand it well enough. Could someone show me how to do what I need?[/color]
        >
        >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 wanted
        > obase = 12 # output base
        > print 4 * a(1) # pi = 4*arctan(1)
        > 3.184809493B918 664573A6211BB15 1551A05729290A7 809A492742140A6 0A55256A\
        > 0661A03753A3AA5 4805646880181A3 683083272BBBA0A 370B12265529A82 8903B4B2\
        > 56B8403759A7162 6B8A54687621849 B849A8225616B44 2796A31737B229B 23914898\
        > 53943B876372561 6447236B027A421 AA17A38B52A18A8 38B01514A51144A 23315A30\
        > 09A8906B61B8B48 A62253A88A50A43 BA0944572315933 664476B3AABB775 83975120\
        > 683526B75B46206 0BB03B432551913 772729A21475535 31793848A0402B9 99B50585\
        > 35374465A688067 16644039539A843 1935198527B9399 B112990ABB0383B 10764542\
        > 4577A51601B3624 A88B7A676A39929 12121A213887B92 873946A61332242 217AA735\
        > 411535774493911 2602BA4B888818A 3269222B5284877 47839994AB223B6 5B876269\
        > 5422822669BA00A 586097842A51750 362073B5A768363 B21BB1A97A4A194 44774939\
        > 9804922175A068A 46739461990A206 5BB0A30BBAB7024 A585B1A84428195 489784A0\
        > 7A331A7B0A15745 65B373B05B03A5A 80A13AB87857734 679985558A53731 78A7B282\
        > 71992A3894A5776 085083B9B238B22 20542462888641A 2BAB8B3083AB496 59172A31\
        > 2B78518654494A0 68662586A181835 A64440B2970A122 813975898815367 20890580\
        > 103288144922384 142876332961753 1239B9A65740558 4014534390B5876 25606BB8\
        > 0923795944B4375 7A431B039556282 978A6A495905534 90BA18449471756 37A90824\
        > 7B5012772246444 1380A852B0847B5 813019BB70A6766 3B4265654340698 84476132\
        > 193344BA55A2128 A03838974606B85 1B2979321A40806 7225A5AA4B3464A 1A174735\
        > 95333909AB91270 79655B3164B68B9 B28A9B818A220A0 25AB0934203995B 7A62A7AA\
        > 739355340539BA3 182905B19390560 3A43B660B9426A9 2294697144A896A 5B233935\
        > 8BB2B7294BB8963 5B071A635121136 0B820B1882AB843 3B54757B87A3732 84B1BA18\
        > 2A10326476B369A 4A6365B58B80189 94BB15255676547 5A704BB94B6B2A3 9458971A\
        > 8B90512786B5029 404818644323552 916170B3ABB7363 496427B088B6872 5A685700\
        > 40617949289077B 278069A09B55932 4B8A66828B40549 B0296065B230033 0592569A\
        > 7B76B92BA129358 5B6A9B604567A09 01362856373B4B5 6897946256B4172 B1B50474\
        > 351364749A33996 A81BA8847347A84 11B850B79A03018 291672AA0945656 A159AA6A\
        > A0A845531A59200 5B8A34366B88225 7107B190969A846 474836A98007507 78920BA7\
        > 97297A2791101B0 685A86BB704B9BA A17B05529367984 3B35215B0A8B118 2B611953\
        > B080AA5431B2199 07A8448A81B1A94 93245676B88013B 470335240859594 15862101\
        > 421661955324657 0601967448B4701 74B924489244481 7453865A4003B5A A7176451\
        > AAB90681A949786 154AA040477382B A69371041710B87 28458A23979252B 25423675\
        > 3A44A1900AA2835 36A227648812525 743868B410A5677 94663359A6726A5 28678332\
        > 8135114789B7645 505B047848020A7 30A9557B206776A A56A19682744107 901306B2\
        > 9008808619866B4 911A05264B872A4 6B5376383932699 531B449195640B6 2A636228\
        > 30886247A47B395 716986123935804 1AA281333622AA1 5912B0A636047A4 89BB0726\
        > 282A78B96671B27 305A9652496B9B9 99011A7BA368988 91665B1A6009058 978850A2\
        > 1B01A158A1473B8 4A192B8672542A2 A7056581995207A 436A5B3BA282463 7A3112AB\
        > B57176468206A07 1200A327B321642 5148100786502AA 21236ABB3549927 7670A126\
        > 9730583403B1922 A48385600730198 3989159BB688A58 B602339806B6300 2A339A50\
        > B0BA533B8482779 3913081070A3259 5A101803A9A2023 4691B1A0B623274 B69B0B44\
        > 688195169461059 543A252BB052087 20BA13118266A87 2B26B9B584959B4 4B
        > quit
        > $
        >
        >The arctan calculation takes about 20 sec on an Athlon of around 2 ghz.[/color]

        That's cool. I will have to find out about bc. Thanks ;-)

        Interesting to note, it also took about 20 sec on my _old_ machine:
        [color=blue][color=green][color=darkred]
        >>> from time import clock
        >>> def foo():[/color][/color][/color]
        ... t0 = clock()
        ... open('pi12by60. txt','w').write (
        ... ''.join(c+'\n'[:(i+1)%60==0] for i,c in enumerate(pidig its(12, 3003)))+'\n')
        ... print clock()-t0
        ...[color=blue][color=green][color=darkred]
        >>> foo()[/color][/color][/color]
        22.3866400935

        That's on a 300Mhz Pentium II using the Lambert Meertens algorithm for pi ;-)

        Regards,
        Bengt Richter

        Comment

        • Richie Hindle

          #34
          Re: Compute pi to base 12 using Python?


          [Dan][color=blue]
          > Now you've got me curious. Why would an artist want the first 3003
          > digits of pi to the base 12?[/color]

          [Dick][color=blue]
          > 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[/color]

          He should read Douglas Adams' fictional essay "Music and Fractal
          Landscapes", from "Dirk Gently's Holistic Detective Agency":

          "I believe that there must be a form of
          music inherent in nature, in natural objects, in the patterns
          of natural processes. A music that would be as deeply
          satisfying as any naturally occurring beauty [...]"

          You can see the text here:




          or via this tinyurl:

          http://tinyurl.com/6ugnk

          (Search within that page for the phrase "Music and Fractal Landscapes".
          Or Google for it, which is how I found the link.)

          --
          Richie Hindle
          richie@entrian. com

          Comment

          • Greg Lindstrom

            #35
            Re: Compute pi to base 12 using Python?

            > He says,[color=blue]
            > 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[/color]

            It might feel more "natural" to do this with 'e' (2.718...)
            --greg

            Comment

            • François Pinard

              #36
              Re: Compute pi to base 12 using Python?

              [Doug Schwarz]
              [color=blue]
              > 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)[/color]

              This easy view of things has been known for a long time, but has only
              been popular (relatively) recently. Traditionally, scale designers were
              definitely running after rational proportions between scale notes, not
              fearing some problems they necessarily create, because such scales are
              often nicer and interesting to the musical ear.

              I should relate this discussion to Python somehow! :-) Easy, as I have a
              few Python programs doing various scale computations -- I should try to
              bundle these together somewhere in my personal Web site, some day...

              --
              François Pinard http://pinard.progiciels-bpi.ca

              Comment

              • François Pinard

                #37
                Re: Compute pi to base 12 using Python?

                [Bengt Richter]
                [color=blue]
                > 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 ;-)[/color]

                The generated would then run from the low octaves to high octaves
                monotically, then start over again and again.

                Maybe a more interesting approach might be to pick the note in the same
                octave, the octave below or above, where the new note is closest to the
                preceding one.
                [color=blue]
                > a "random" walk picture was interesting.[/color]

                Using the closest note would have similarity with a random walk, given
                π digits are seemingly random. On a random walk, one gets away from
                the departure point on average, the distance being proportional to
                sqrt(N) where N is the number of steps. So, when using the closest
                note, one would need a corrective device nevertheless so notes are kept
                near the middle of the range of comfortable audible frequencies.
                [color=blue]
                > Anyone have an easy python midi interface for windows to play on the
                > sound card? I could generate a .wav file to play tones, but midi
                > would be much more compact ;-)[/color]

                There are surely many. I use my own (Python) interfaces on Linux, and
                even there, by combining a few tools, it is rather easy to get .WAV
                files out of MIDI. In any case, googling around might help.

                --
                François Pinard http://pinard.progiciels-bpi.ca

                Comment

                • Bill Mill

                  #38
                  Re: Compute pi to base 12 using Python?

                  On 13 Apr 2005 19:05:01 -0700, Paul Rubin
                  <"http://phr.cx"@nospam. invalid> wrote:[color=blue]
                  > Dick Moores <rdm@rcblue.com > writes:[color=green]
                  > > I don't believe GNU "bc" is available for Windows, is it?[/color]
                  >
                  > I don't know. It probably works ok under Cygwin at least.[/color]

                  bc definitely works on cygwin, and is available at
                  http://gnuwin32.sourceforge.net/packages/bc.htm for windows. Make sure
                  you download both the dependencies and the binary package for it to
                  work. I put the dll from the dependancy archive in c:/winnt/system32
                  and it worked.

                  It should be noted that running the win32 bc from cygwin messed up my
                  terminal, so I recommend running it from a cmd window (which worked
                  fine).

                  Peace
                  Bill Mill
                  bill.mill at gmail.com

                  Comment

                  • Nick Craig-Wood

                    #39
                    Re: Compute pi to base 12 using Python?

                    mensanator@aol. com <mensanator@aol .com> wrote:[color=blue]
                    > I'm using GMPY (see code).[/color]
                    [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 without breaking a sweat.
                    [color=blue][color=green][color=darkred]
                    >>> import gmpy
                    >>> from math import log
                    >>> bits = int(3003*log(12 )/log(2))
                    >>> pi=gmpy.pi(bits +100)
                    >>> gmpy.fdigits(pi , 12, 3003)[/color][/color][/color]
                    '3.184809493b91 8664573a6211bb1 51551a05729290a 7809a492742140a 60a55256a0661a0 3753a3aa5480564 6880181a3683083 272bbba0a370b12 265529a828903b4 b256b8403759a71 626b8a546876218 49b849a8225616b 442796a31737b22 9b2391489853943 b87637256164472 36b027a421aa17a 38b52a18a838b01 514a51144a23315 a3009a8906b61b8 b48a62253a88a50 a43ba0944572315 933664476b3aabb 775839751206835 26b75b462060bb0 3b4325519137727 29a214755353179 3848a0402b999b5 058535374465a68 806716644039539 a8431935198527b 9399b112990abb0 383b10764542457 7a51601b3624a88 b7a676a39929121 21a213887b92873 946a61332242217 aa7354115357744 939112602ba4b88 8818a3269222b52 8487747839994ab 223b65b87626954 22822669ba00a58 6097842a5175036 2073b5a768363b2 1bb1a97a4a19444 774939980492217 5a068a467394619 90a2065bb0a30bb ab7024a585b1a84 428195489784a07 a331a7b0a157456 5b373b05b03a5a8 0a13ab878577346 79985558a537317 8a7b28271992a38 94a5776085083b9 b238b2220542462 888641a2bab8b30 83ab49659172a31 2b78518654494a0 68662586a181835 a64440b2970a122 813975898815367 208905801032881 449223841428763 329617531239b9a 657405584014534 390b587625606bb 80923795944b437 57a431b03955628 2978a6a49590553 490ba1844947175 637a908247b5012 7722464441380a8 52b0847b5813019 bb70a67663b4265 654340698844761 32193344ba55a21 28a03838974606b 851b2979321a408 067225a5aa4b346 4a1a17473595333 909ab9127079655 b3164b68b9b28a9 b818a220a025ab0 934203995b7a62a 7aa739355340539 ba3182905b19390 5603a43b660b942 6a92294697144a8 96a5b2339358bb2 b7294bb89635b07 1a6351211360b82 0b1882ab8433b54 757b87a373284b1 ba182a10326476b 369a4a6365b58b8 018994bb1525567 65475a704bb94b6 b2a39458971a8b9 0512786b5029404 818644323552916 170b3abb7363496 427b088b68725a6 857004061794928 9077b278069a09b 559324b8a66828b 40549b0296065b2 300330592569a7b 76b92ba1293585b 6a9b604567a0901 362856373b4b568 97946256b4172b1 b50474351364749 a33996a81ba8847 347a8411b850b79 a03018291672aa0 945656a159aa6aa 0a845531a592005 b8a34366b882257 107b190969a8464 74836a980075077 8920ba797297a27 91101b0685a86bb 704b9baa17b0552 93679843b35215b 0a8b1182b611953 b080aa5431b2199 07a8448a81b1a94 93245676b88013b 470335240859594 158621014216619 553246570601967 448b470174b9244 892444817453865 a4003b5aa717645 1aab90681a94978 6154aa040477382 ba69371041710b8 728458a23979252 b254236753a44a1 900aa283536a227 648812525743868 b410a5677946633 59a6726a5286783 328135114789b76 45505b047848020 a730a9557b20677 6aa56a196827441 07901306b290088 08619866b4911a0 5264b872a46b537 6383932699531b4 49195640b62a636 22830886247a47b 395716986123935 8041aa281333622 aa15912b0a63604 7a489bb0726282a 78b96671b27305a 9652496b9b99901 1a7ba3689889166 5b1a60090589788 50a21b01a158a14 73b84a192b86725 42a2a7056581995 207a436a5b3ba28 24637a3112abb57 176468206a07120 0a327b321642514 8100786502aa212 36abb3549927767 0a1269730583403 b1922a483856007 301983989159bb6 88a58b602339806 b63002a339a50b0 ba533b848277939 13081070a32595a 101803a9a202346 91b1a0b623274b6 9b0b44688195169 461059543a252bb 05208720ba13118 266a872b26b9b58 4959b4517951953 4b221a335a2bb69 71b3276b3a63a5b 791723109b17652 9bb90651584279b 7825712521b8269 800738b07a62b14 547884414451224 092937165625696 557a78799a82126 613535a36b41030 9b759976119777b 895801074b9779b 9b5137538b27999 51012273399bb81 8b722@0'

                    --
                    Nick Craig-Wood <nick@craig-wood.com> -- http://www.craig-wood.com/nick

                    Comment

                    • mensanator@aol.com

                      #40
                      Re: Compute pi to base 12 using Python?


                      Nick Craig-Wood wrote:[color=blue]
                      > mensanator@aol. com <mensanator@aol .com> wrote:[color=green]
                      > > I'm using GMPY (see code).[/color]
                      > [snip]
                      >
                      > If you are using gmpy you might as well do it like this.....
                      >
                      > gmpy.pi() uses the Brent-Salamin Arithmetic-Geometric Mean formula[/color]
                      for[color=blue]
                      > pi IIRC. This converges quadratically, and it will calculate you a
                      > million places without breaking a sweat.[/color]

                      It would be nice if that were documented. What do I have to do, go get
                      the documentation for the original GMP to find out what else is in GMPY
                      that they didn't include in the doc file?

                      [color=blue]
                      >[color=green][color=darkred]
                      > >>> import gmpy
                      > >>> from math import log
                      > >>> bits = int(3003*log(12 )/log(2))
                      > >>> pi=gmpy.pi(bits +100)
                      > >>> gmpy.fdigits(pi , 12, 3003)[/color][/color]
                      >[/color]
                      '3.184809493b91 8664573a6211bb1 51551a05729290a 7809a492742140a 60a55256a0661a0 3753a3aa5480564 6880181a3683083 272bbba0a370b12 265529a828903b4 b256b8403759a71 626b8a546876218 49b849a8225616b 442796a31737b22 9b2391489853943 b87637256164472 36b027a421aa17a 38b52a18a838b01 514a51144a23315 a3009a8906b61b8 b48a62253a88a50 a43ba0944572315 933664476b3aabb 775839751206835 26b75b462060bb0 3b4325519137727 29a214755353179 3848a0402b999b5 058535374465a68 806716644039539 a8431935198527b 9399b112990abb0 383b10764542457 7a51601b3624a88 b7a676a39929121 21a213887b92873 946a61332242217 aa7354115357744 939112602ba4b88 8818a3269222b52 8487747839994ab 223b65b87626954 22822669ba00a58 6097842a5175036 2073b5a768363b2 1bb1a97a4a19444 774939980492217 5a068a467394619 90a2065bb0a30bb ab7024a585b1a84 428195489784a07 a331a7b0a157456 5b373b05b03a5a8 0a13ab878577346 79985558a537317 8a7b28271992a38 94a5776085083b9 b238b2220542462 888641a2bab8b30 83ab49659172a31 2b78518654494a0 68662586a181835 a64440b2970a122 813975898815367 208905801032881 449223841428763 329617531239b9a 657405584014534 390b587625606bb 80923795944b437 57a431b03955628 2978a6a49590553 490ba1844947175 637a908247b5012 7722464441380a8 52b0847b5813019 bb70a67663b4265 654340698844761 32193344ba55a21 28a03838974606b 851b2979321a408 067225a5aa4b346 4a1a17473595333 909ab9127079655 b3164b68b9b28a9 b818a220a025ab0 934203995b7a62a 7aa739355340539 ba3182905b19390 5603a43b660b942 6a92294697144a8 96a5b2339358bb2 b7294bb89635b07 1a6351211360b82 0b1882ab8433b54 757b87a373284b1 ba182a10326476b 369a4a6365b58b8 018994bb1525567 65475a704bb94b6 b2a39458971a8b9 0512786b5029404 818644323552916 170b3abb7363496 427b088b68725a6 857004061794928 9077b278069a09b 559324b8a66828b 40549b0296065b2 300330592569a7b 76b92ba1293585b 6a9b604567a0901 362856373b4b568 97946256b4172b1 b50474351364749 a33996a81ba8847 347a8411b850b79 a03018291672aa0 945656a159aa6aa 0a845531a592005 b8a34366b882257 107b190969a8464 74836a980075077 8920ba797297a27 91101b0685a86bb 704b9baa17b0552 93679843b35215b 0a8b1182b611953 b080aa5431b2199 07a8448a81b1a94 93245676b88013b 470335240859594 158621014216619 553246570601967 448b470174b9244 892444817453865 a4003b5aa717645 1aab90681a94978 6154aa040477382 ba69371041710b8 728458a23979252 b254236753a44a1 900aa283536a227 648812525743868 b410a5677946633 59a6726a5286783 328135114789b76 45505b047848020 a730a9557b20677 6aa56a196827441 07901306b290088 08619866b4911a0 5264b872a46b537 6383932699531b4 49195640b62a636 22830886247a47b 395716986123935 8041aa281333622 aa15912b0a63604 7a489bb0726282a 78b96671b27305a 9652496b9b99901 1a7ba3689889166 5b1a60090589788 50a21b01a158a14 73b84a192b86725 42a2a7056581995 207a436a5b3ba28 24637a3112abb57 176468206a07120 0a327b321642514 8100786502aa212 36abb3549927767 0a1269730583403 b1922a483856007 301983989159bb6 88a58b602339806 b63002a339a50b0 ba533b848277939 13081070a32595a 101803a9a202346 91b1a0b623274b6 9b0b44688195169 461059543a252bb 05208720ba13118 266a872b26b9b58 4959b4517951953 4b221a335a2bb69 71b3276b3a63a5b 791723109b17652 9bb90651584279b 7825712521b8269 800738b07a62b14 547884414451224 092937165625696 557a78799a82126 613535a36b41030 9b759976119777b 895801074b9779b 9b5137538b27999 51012273399bb81 8b722@0'[color=blue]
                      >
                      > --
                      > Nick Craig-Wood <nick@craig-wood.com> --[/color]


                      Comment

                      • Dick Moores

                        #41
                        Re: Compute pi to base 12 using Python?

                        Steve Holden wrote at 22:29 4/13/2005:[color=blue]
                        >Dick Moores wrote:[color=green]
                        >>Steve Holden wrote at 19:12 4/13/2005:
                        >>[color=darkred]
                        >>>Dick Moores wrote:
                        >>>
                        >>>>Dan wrote at 18:02 4/13/2005:
                        >>>>
                        >>>>>On Wed, 13 Apr 2005 03:27:06 -0700, Dick Moores <rdm@rcblue.com >
                        >>>>>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?
                        >>>>
                        >>>>
                        >>>>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
                        >>>
                        >>>So it's, like, the guy is going to "play pi"? So why does the melody
                        >>>have 3003 notes?[/color]
                        >>
                        >>Sorry, he's just a friend of a friend. If I find out I'll post. Here's
                        >>his site if you want to poke around for yourself. Maybe his email
                        >>address is there.
                        >>Dick[/color]
                        >Where?[/color]

                        Sorry about that. <http://www.kenjikojima .com/>

                        Dick


                        Comment

                        • Dick Moores

                          #42
                          Re: Compute pi to base 12 using Python?

                          Dick Moores wrote at 18:40 4/14/2005:[color=blue]
                          >Sorry about that. <http://www.kenjikojima .com/>[/color]

                          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 point
                          zero is 0
                          inchi is 1
                          ni is 2
                          san is 3
                          ta? is 4 (don't understand that "ta" or "tan", but it must be 4)
                          go is 5
                          roku is 6 -- in the music 6 sounds like "raku"
                          nana is 7
                          hachi is 8
                          ku is 9

                          Take a look/listen to

                          "String Quartet Pi / 5:06 and the process of data
                          The music was created from the constant PI (3.141592...... .) to 3,000
                          decimal places by programming."

                          Lots of details there on the music.

                          Dick





                          Comment

                          • M.E.Farmer

                            #43
                            Re: Compute pi to base 12 using Python?

                            Dick Moores wrote:[color=blue]
                            > Paul Rubin wrote at 18:20 4/13/2005:[color=green]
                            > >Dick Moores <rdm@rcblue.com > writes:[color=darkred]
                            > > > I need to figure out how to compute pi to base 12, to as many[/color][/color][/color]
                            digits[color=blue][color=green][color=darkred]
                            > > > as possible. I found this reference,
                            > > > <http://mathworld.wolfr am.com/Base.html>, but I really don't
                            > > > understand it well enough. Could someone show me how to do what I[/color][/color][/color]
                            need?[color=blue][color=green]
                            > >
                            > >Using the GNU "bc" utility:
                            > >
                            > > $ bc -l
                            > > bc 1.06
                            > > Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation,[/color][/color]
                            Inc.[color=blue][color=green]
                            > > This is free software with ABSOLUTELY NO WARRANTY.
                            > > For details type `warranty'.
                            > > scale = 3000 # number of output places wanted
                            > > obase = 12 # output base
                            > > print 4 * a(1) # pi = 4*arctan(1)[/color]
                            >
                            > I don't believe GNU "bc" is available for Windows, is it?
                            >
                            > Thanks,
                            >
                            > Dick Moores
                            > rdm@rcblue.com[/color]
                            Nice collection of unix tools, Cygwin not needed.

                            hth,
                            M.E.Farmer

                            Comment

                            • Dick Moores

                              #44
                              Re: Compute pi to base 12 using Python?

                              M.E.Farmer wrote at 23:18 4/14/2005:[color=blue][color=green][color=darkred]
                              > > >Using the GNU "bc" utility:
                              > > >
                              > > > $ bc -l
                              > > > bc 1.06
                              > > > Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation,[/color][/color]
                              >Inc.[color=green][color=darkred]
                              > > > This is free software with ABSOLUTELY NO WARRANTY.
                              > > > For details type `warranty'.
                              > > > scale = 3000 # number of output places wanted
                              > > > obase = 12 # output base
                              > > > print 4 * a(1) # pi = 4*arctan(1)[/color][/color][/color]

                              Wow! this got me the 3003 (changed from 3000) digits of pi to base 12 in
                              60.8 secs. No, I didn't count them yet, nor am I sure they're correct.
                              But I'd bet on them..

                              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.)

                              BTW I found a nice set of SCO UNIX man pages at <http://www.rt.com/man/>.

                              Dick


                              Comment

                              • Roel Schroeven

                                #45
                                Re: Compute pi to base 12 using Python?

                                Dick Moores wrote:[color=blue]
                                > M.E.Farmer wrote at 23:18 4/14/2005:
                                >[color=green][color=darkred]
                                >> > >Using the GNU "bc" utility:
                                >> > >
                                >> > > $ bc -l
                                >> > > bc 1.06
                                >> > > Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation,[/color]
                                >> Inc.[color=darkred]
                                >> > > This is free software with ABSOLUTELY NO WARRANTY.
                                >> > > For details type `warranty'.
                                >> > > scale = 3000 # number of output places wanted
                                >> > > obase = 12 # output base
                                >> > > print 4 * a(1) # pi = 4*arctan(1)[/color][/color]
                                >
                                >
                                > Wow! this got me the 3003 (changed from 3000) digits of pi to base 12 in
                                > 60.8 secs. No, I didn't count them yet, nor am I sure they're correct.
                                > But I'd bet on them..
                                >
                                > 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.)[/color]

                                Works for me (using the Cygwin version though) when I do

                                C:\cygwin\bin\b c -l > pi12.txt

                                Otherwise, to copy from the command prompt window: open the system menu
                                (icon in the top left corner of the window) and choose Edit->Mark. Then
                                select what you want to copy and press Enter or choose Edit->Copy in the
                                system menu.

                                --
                                If I have been able to see further, it was only because I stood
                                on the shoulders of giants. -- Isaac Newton

                                Roel Schroeven

                                Comment

                                Working...