Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Most Unreliable Technique in the World to compute pi

  1. Mar 6, 2009 #1
    In "http://users.info.unicaen.fr/~karczma/arpap/lazypi.ps.gz [Broken]" Jerzy Karczmarczuk develops some functions for computing pi lazily.

    This thread is motivated by the following response by Hurkly
    in the thread:

    I looked at csprof2000 claim that computers can only deal with approximations to rational numbers and thought about Hurkly's answer. My first thought was what about symbolic computation such as those done in maple and mathematics.

    However, I wondered in such symbolic computations why we might need to represent numbers in decimal form and about the utility of these symbolic results whose complexity would grow with the complexity of the calculation. I wondered do we eventually need the number in decimal form for them to be useful for us and if so what utility a complex symbolic result might yield us.

    Wondering what alternatives their might be to straight symbolic calculations two things about Haskel struck me as possibly relevant to the above questions. First Haskel uses something called Lazy evaluation. This means that results are only computed if needed. Knowing this and that Haskel uses infinite precession I wondered how pi may be represented in Haskel with infinite precession.

    It turns out that infinite precession is not really infinite precession but an unfortunate word used sometimes in computer science for arbatray precession. However, I did not give up my search because I thought that lazy evaluation may still be relevant.

    It turns out that we can use lazy evaluation to compute pi. Moreover, it turns out that by using the BBP formula for PI you can compute any diget of pi without needing any information about the previous digits. This means that in symbolic terms we can separate the digits we compute from the digits we don't compute and only go into further precession as needed for the desired accuracy.

    Say we had some function in the form:


    Then we can represent the first 100 digts we need for our calculations using arbitrary precession, and if at a later time we needed further accuracy we can evaluate to precession without having to repeat the steps required to compute the first 100 digits and with much smaller memory requirements then the memory that would be required to store the number to the precession already computed.

    Thus the basic idea is to break up the computation into two parts, an arbitrary precession part and a symbolic precision part where the arbitrary precision is used to compute results to needed accuracy and the symbolic part is used to represent the air in such a way that we can always refine the precession without having to repeat computation. And consume large amounts of memory.

    Now there seems to be some draw back to this technique in terms of reliability and how well things are defined. After further reading I'll comment more.
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Mar 6, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper

    You can make an infinite precision representation - but you need an inconveniently large universe to store the memory chips in.
  4. Mar 6, 2009 #3
    Either that or one without such inconvenient limitations such as quantum mechanics. Is the interval from zero to one inconveniently large?
  5. Mar 6, 2009 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    You may find http://www.brics.dk/~barnie/RealLib/ [Broken] interesting; it is a full implementation of computable real arithmetic, limited only by your hardware*.

    Incidentally, one shouldn't forget that an (infinitely-long) decimal numeral is (in a typical formulation) quite literally just a function whose domain is the integers and whose image is the set {0,1,2,3,4,5,6,7,8,9}. (For the numeral to represent a real number, we also impose that on the left, it is eventually all zeroes)

    *: Okay, that's probably not strictly true; there are probably some limitations in the actual implementation, if you push it to ridiculous (and probably impossible with current technology) extremes.
    Last edited by a moderator: May 4, 2017
  6. Mar 6, 2009 #5
    I'm looking at it a bit now. I like this statement

    "In the cases where machine precision is sufficient, exact real computations can be executed at a speed comparable to the speed of double precision arithmetic, sometimes even running on par with it. "
    Last edited by a moderator: May 4, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Most Unreliable Technique in the World to compute pi
  1. Calculating pi (Replies: 8)

  2. Pi in binary (Replies: 9)

  3. Randomness of pi (Replies: 24)