Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Earth Education Math NASA Space Transportation Science Technology

How Many Digits of Pi Does NASA Use? (kottke.org) 174

An anonymous reader quotes an article on Kottke.org: Mathematicians have calculated pi out to more than 13 trillion decimal places, a calculation that took 208 days. NASA's Marc Rayman explains that in order to send out probes and slingshot them accurately throughout the solar system, NASA needs to use only 15 decimal places. Rayman explains, "The most distant spacecraft from Earth is Voyager 1. It is about 12.5 billion miles away. Let's say we have a circle with a radius of exactly that size (or 25 billion miles in diameter) and we want to calculate the circumference, which is pi times the radius times 2. Using pi rounded to the 15th decimal, as I gave above, that comes out to a little more than 78 billion miles. We don't need to be concerned here with exactly what the value is (you can multiply it out if you like) but rather what the error in the value is by not using more digits of pi. In other words, by cutting pi off at the 15th decimal point, we would calculate a circumference for that circle that is very slightly off. It turns out that our calculated circumference of the 25 billion mile diameter circle would be wrong by 1.5 inches. Think about that. We have a circle more than 78 billion miles around, and our calculation of that distance would be off by perhaps less than the length of your little finger."
This discussion has been archived. No new comments can be posted.

How Many Digits of Pi Does NASA Use?

Comments Filter:
  • How many digits to use depends on the application. For a satellite trajectory the 15th decimal is OK, but if you want to make a sharp mirror the precision in the calculation have to be higher.

    • by Anonymous Coward on Saturday March 19, 2016 @12:20PM (#51731975)

      How many digits to use depends on the application. For a satellite trajectory the 15th decimal is OK, but if you want to make a sharp mirror the precision in the calculation have to be higher.

      Err, no. The radius of a proton is around 10^-15 meters. Atoms are 10.000 times larger than that. Visible light is around 5 * 10^-7 m, depending on color. Polishing a mirror at 10^-15 accuracy would be physically impossible and pointless.

    • by ledow ( 319597 )

      And moot in the face of:

      - Not knowing the exact centre of mass of the planet in question to the same accuracy.
      - Not knowing the altitude, density, etc. making up the planet to the same accuracy.
      - Not knowing the warp-effects of space and nearby objects (i.e. everything with mass) to the same accuracy.

      Which is why we aim it "good enough", and then put 10% more fuel than strictly necessary into it, even if that's at ENORMOUS cost.

      Hell, when GPS was launched, the US military still wasn't convinced that Einstei

    • Re: (Score:3, Informative)

      by rgmoore ( 133276 )

      I don't think so. The normal standard for a mirror is 1/4 the wavelength of the light it's supposed to be reflecting, or around 100 nm. Even ultra-high precision mirrors like the ones on the Hubble Space Telescope are only ground to within about 10 nm. A 10 nm error on a mirror 100m in diameter- far larger than any mirror currently under construction- is still only 1 part in 10^10, far lower precision than what you're talking about. Unless you're building a mirror the size of a planet, you aren't going

      • Even ultra-high precision mirrors like the ones on the Hubble Space Telescope are only ground to within about 10 nm.

        And a contributing factor to going to that precision is the need to accommodate potential new (at the time of design) UV sensors.

    • by hankwang ( 413283 ) on Saturday March 19, 2016 @12:53PM (#51732171) Homepage

      if you want to make a sharp mirror the precision in the calculation have to be higher.

      How so? For high-precision applications, you'd typically want a mirror with a deviation from its calculated surface that is better than lambda/20. For UV light at 200 nm and a mirror size of 1 m, that would be about 8 significant digits to describe the surface. Then you have 7 more digits to deal with intermediate results during the calculation.

      Note: For X-ray mirrors, the wavelength is much shorter, but because X-ray mirrors are grazing-incidence mirrors, the surface tolerance is more like lambda/1 - - which also boils down to about 8 significant digits. Anyway, to describe the surface with an accuracy down to the size of an atom, you still only need 10 significant digits.

    • by fizzup ( 788545 ) on Saturday March 19, 2016 @01:46PM (#51732533)

      I can't think of a step in the process of making focusing mirrors that requires a decimal expansion of pi more accurate than 3.14 (an error of 0.05%).

      The only step that I can think of that needs a decimal expansion at all is to estimate how deep you need to hog out the material at the roughest formation (i.e., estimating the saggita). That estimation doesn't need better tolerance than 0.1%.

      The spec on the focal length probably has a tolerance of 1% or 0.1% since nearly every device has an adjustable instrument/detector platform to refocus. You could measure the actual focal length of any mirror more accurately than 0.1%; however, it barely matters because I can't think of any use for pi in performing the measurement.

      I can't think of any mirror test in use that requires a decimal expansion of pi: not Ronchi, not Foucault, not interferometry.

      Honestly, the only exception I can think of is a spin cast mirror, which probably needs an accurate rotational speed on the platter. It may not, though - spin casting is only used to rough out the shape. Maybe it's better than 0.1% and maybe not (it's definitely not one part in a quadrillion, though). The LZT liquid mirror uses closed loop control to fix the rotational speed to within one part in a million but I think it just needs to be constant, rather than precise, so that the focal length doesn't change during an observation and so eddy currents aren't set up in the mirror surface. For all I know they adjust the focus by changing the rotational speed of the platter so an accurate expansion for pi doesn't even enter into it at all. It's possible that slashdot has not yet devolved into a such a pit of misinformation that one of the star nerds that works on the LZT will read this and chime in. Probably not.

      • by fizzup ( 788545 )

        Replying to my own comment because I realized you don't need pi to calculate the sagitta while I was walking the dog!


        s = r - sqrt(r*r - (d/2)*(d/2))

        where s is the sagitta, r is the radius of curvature of the mirror, and d is the diameter of the mirror. I think that the only time you use pi to create a mirror is if you spin cast it.

    • by djl4570 ( 801529 )
      The precision of the calculation can only be as good as the precision of the measurements. With mirrors and lenses we can use interference patterns to measure differences on the order of a wavelength of light. With spacecraft we can make some impressive measurements of velocity, mass, acceleration position using inertial guidance but that is at some level a mechanical measurement. Back to the mirror. Sixteen significant digits of Pi is 3.141592653589793 which should be adequate for calculations invo
    • How many digits to use depends on the application. For a satellite trajectory the 15th decimal is OK, but if you want to make a sharp mirror the precision in the calculation have to be higher.

      Because of floating point format limits mostly NASA would use PI thus
      #include math.h
      Something like...

      $ grep PI ....../usr/include/math.h ......
      #define M_PI 3.14159265358979323846264338327950288 /* pi */
      #define M_PI_2 1.57079632679489661923132169163975144 ....

      It is rare that more digits are used. The troubles are in transcendental functions computed
      as series (Taylor) in math.a/math.so and friends. There is a lot of work on this but has
      little to do with PI in t

  • M_PI (Score:4, Informative)

    by ShanghaiBill ( 739463 ) on Saturday March 19, 2016 @11:26AM (#51731647)

    I just use M_PI which is defined in math.h:

    #define M_PI 3.14159265358979323846264338327950288

    The symbolic constant is easier than typing in 15 digits, and the compiler recognizes the constant and optimizes it to use the hardware constant built in to the FPU, so I get faster execution as well.

    • Moreover, double-precision floating point can make use of up to 17 digits of the M_PI definition, so NASA should be using 17 digits instead of 15 just to avoid needless differences in results on standard hardware.
      • by delt0r ( 999393 )
        His point from the poorly worded summary is that there are far bigger errors. So it really doesn't matter.
      • just to avoid needless differences in results on standard hardware.

        That might not be a value that NASA shares. :) They might only care about results on explicitly defined hardware.

  • 39 digits (Score:5, Informative)

    by J'raxis ( 248192 ) on Saturday March 19, 2016 @11:51AM (#51731783) Homepage

    And similarly, 39 digits of pi will let you calculate a sphere the size of the observable universe with an error the width of a single hydrogen atom.

    • Re:39 digits (Score:5, Insightful)

      by AthanasiusKircher ( 1333179 ) on Saturday March 19, 2016 @12:06PM (#51731885)

      I don't know why any of these "numbers of digits" things are surprising to anyone.

      When you calculate a circumference, for example, you're just multiplying pi by some other number. You're not going to need more precision in pi than you have in the number of orders of magnitude of precision in the other number.

      So, all of these discussions about "how many digits of pi" actually just are asking "how many order of magnitude" of length or whatever are in various sizes/comparisons within the universe.

      It's really not necessary to bring pi into this discussion at all. It's just talking about precision of measurement and orders of magnitude in general.

      It seems to me that these answer would only be interesting/surprising to those who have no understanding of "significant figures" in calculations. (Unfortunately, that seems to apply to most people and students, who will assume that however many digits their calculator or whatever spits out are meaningful.)

      • I don't know why any of these "numbers of digits" things are surprising to anyone.

        Because quite frankly education is quite lacking and people don't really get exponents of decimal places any more.

      • by tlhIngan ( 30335 )

        I don't know why any of these "numbers of digits" things are surprising to anyone.

        When you calculate a circumference, for example, you're just multiplying pi by some other number. You're not going to need more precision in pi than you have in the number of orders of magnitude of precision in the other number.

        So, all of these discussions about "how many digits of pi" actually just are asking "how many order of magnitude" of length or whatever are in various sizes/comparisons within the universe.

        It's really n

        • If you're doing a theoretical calculation wouldn't you just leave it as a symbol like you do with surds?

          • by tlhIngan ( 30335 )

            If you're doing a theoretical calculation wouldn't you just leave it as a symbol like you do with surds?

            Only works if you can keep it symbolic. Far too many things are too hard to do symbolically so they do the calculations numerically.

    • Which is proof against intelligent design or at least evidence that God's not a programmer. Why type pi as an infinite float when a double precision would work. Wildly inefficient and slows the simulation down from infinitely fast to infinitely fast minus a bit.

    • 39 digits of pi will let you calculate a sphere the size of the observable universe with an error the width of a single hydrogen atom.

      42 digits should have sufficed for God during Creation then.

      • 42 digits should be enough for anyone ;)
        • by vovin ( 12759 )

          You see there only are 42 digits ... we just make the rest of them up as we go along :P

      • by qzzpjs ( 1224510 )

        42 digits should have sufficed for God during Creation then.

        God only needed 1 digit since he probably used PI as his base numbering system instead of 10.

    • And for an error to one plank length, you need 62.
    • How well does this apply to the actual observable Universe? It's got mass and energy in it, which means it isn't actually flat, so the circumference will be at least a touch less than you'd get from multiplying the diameter by pi.

  • by coolsnowmen ( 695297 ) on Saturday March 19, 2016 @11:53AM (#51731795)

    https://en.wikipedia.org/wiki/Double-precision_floating-point_format

    "This gives 15–17 significant decimal digits precision. If a decimal string with at most 15 significant digits is converted to IEEE 754 double precision representation and then converted back to a string with the same number of significant digits, then the final string should match the original. If an IEEE 754 double precision is converted to a decimal string with at least 17 significant digits and then converted back to double, then the final number must match the original.[1]"

    • by Solandri ( 704621 ) on Saturday March 19, 2016 @02:09PM (#51732705)
      Posting because I've seen too many programmers misunderstand this and screw things up when using floats. This does not mean you can do whatever you want with floats and your accuracy will be at least 1.5 inches within a 25 billion mile radius. It means an individual double float number has a precision of 17 significant figures, nothing more. When you start doing math with that number, the precision can quickly go out the window [rit.edu].

      For example, if you add a large float to a small float, say 3.14159265359x10^8 + 2.7182818284x10^-3, the latter number doesn't actually matter because it's largest digit is smaller than the uncertainty (the last significant figure) in the first number. In other words, floating point's accuracy decreases the further you get from zero. A solar system modeled with ints will have the same resolution everywhere, which is how people want to think significant figures work. But a solar system modeled with double floats will have very fine resolution close to the origin, lousy resolution out near the edges.

      To do this sort of math accurately using float (e.g. calculating docking coordinates for two spacecraft orbiting Jupiter), you are better off first doing a coordinate transform to center your zero closer to where everything is happening, do your math, then transform the results back to your original coordinates (or keep them in your new coordinate system if you plan to do more math there later). Obviously that's a pointless exercise with this simplified math problem, but it can make a big difference in accuracy with more complex math.

      For a real-world example, we once networked two flight simulators together and tried to make them fly in formation. The position of the second plane appeared to jump all over the place when viewed from the first plane, and vice versa. What was happening was our coordinate system was fixed to the Earth. Planes fly on the order of 1000 kph. At that speed, a transient network lag error of only 10 milliseconds results in a position error of several meters (dp = v * dt). It didn't matter that we knew the velocities to 7 significant figures or even if we'd known them to 17 significant figures, because the error in the timestamp overwhelmed that accuracy. The fix was to define a new coordinate system centered on the first plane. The velocity of the second plane was then only a few cm/sec relative to the first plane (since they're flying in formation), and the jumping disappeared since a 10 ms error only resulted in only a few millimeters of error.
      • by coolsnowmen ( 695297 ) on Saturday March 19, 2016 @04:18PM (#51733493)

        When tracking something in space and time, the coordinate system should never matter (it just makes the mathematical model easier or harder). You should have instead time tagged the state information. Then when the other platform received the state information, it extrapolates the state information to current time before using [displaying] it. The only requirement here is that your two platforms agree on the time to a high [enough] precision. While this is not a simple problem, it is well understood. Search for Kalman filtering and Sensor fusion for more information (advanced knowledge of signal processing is typically a perquisite).

        In sensor fusion you typical track in ECEF or LLA even though you will most commonly detect/search in LTP.

  • by Alain Williams ( 2972 ) <addw@phcomp.co.uk> on Saturday March 19, 2016 @11:53AM (#51731805) Homepage

    The NASA computers will be using IEEE 754 [wikipedia.org] floating point format, which in 64 bits (double precision) yields about 16 decimal digits of precision. So: what came first, NASA deciding that 1.5 inches the needed accuracy in the solar system or their computers being that accurate being deemed an acceptable accuracy ?

    • I guess the computer format came first, and then NASA said: "yeah, that's good enough".
    • by cyn1c77 ( 928549 )

      The NASA computers will be using IEEE 754 [wikipedia.org] floating point format, which in 64 bits (double precision) yields about 16 decimal digits of precision. So: what came first, NASA deciding that 1.5 inches the needed accuracy in the solar system or their computers being that accurate being deemed an acceptable accuracy ?

      The number of digits of precision was decided on in 1990: http://fits.gsfc.nasa.gov/fp89... [nasa.gov]

      Also, your question is poorly posed. The number of digits is not dimensional. Physical accuracy is dimensional. Additionally, use of math and physics to constrain a problem analytically before solving numerically makes it possible to achieve higher levels of precision to the end user than would be achieved with a brute force direct calculation, like that discussed in the example.

      Normally, this would have been commo

  • Planck length (Score:5, Interesting)

    by Sqreater ( 895148 ) on Saturday March 19, 2016 @12:01PM (#51731847)
    How many digits would it take of PI to bring the error down to the Planck length? Anything smaller in any measure of distance would be meaningless.
  • Not so simple (Score:5, Insightful)

    by Waffle Iron ( 339739 ) on Saturday March 19, 2016 @12:09PM (#51731907)

    If you plug that number into an iterative algorithm that uses any ill-conditioned functions, the 1.5-inch error can grow exponentially at every step. Ensuring that computations have acceptable error margins is an extremely complex and tricky subject.

    • You imagine NASA has that problem for their numerical orbital solutions? no they don't.

      • You imagine NASA has that problem for their numerical orbital solutions? no they don't.

        I imagine that they do. Everybody who does complex floating point jobs has this problem. I also imagine that they've solved it.

      • You imagine ...

        No, I didn't.

        • as someone who did orbital mechanics for thesis, let me tell you the sad news that you are ignorant. In fact, pi needn't even be explicitly used at all for calculating trajectories of body in orbit or changing orbits. Instead pi will come up in the question of time, e.g. when to do something or period of orbit. And 16 digits not needed.

          • WTF do you keep assuming I said?

            The topic was going on and on on how great 15 digits of PI is. I pointed out how it would be bad to just assume that therefore you can put pi (or any other number) in a double-precision variable everything will be just peachy for real-world computations.

            I didn't say that 15 digits is insufficient, only that you have to be very careful about precision in general. There are plenty of algorithms where using the "obvious" implementation will cause double-precision values to blow

    • Re:Not so simple (Score:5, Informative)

      by BitterOak ( 537666 ) on Saturday March 19, 2016 @01:31PM (#51732435)

      If you plug that number into an iterative algorithm that uses any ill-conditioned functions, the 1.5-inch error can grow exponentially at every step. Ensuring that computations have acceptable error margins is an extremely complex and tricky subject.

      Orbital motions can be calculated in ways that don't suffer from these problems. Use of quaternion (or equivalent) methods for rotations in 3 dimensional space rather than traditional Euler angles leads to much more stable numerical results.

    • Not a problem since 15 decimal places in pi over a 25billion mile diameter gives you an error of 1.47thou, not 1.5 inches.

  • Maybe using SI units rather than neolithic ones would be more important than the number of digits of pi for NASA.

  • by fizzup ( 788545 ) on Saturday March 19, 2016 @12:21PM (#51731987)

    G, for example, is only known to 6.67408(31)e-11. I can't think of a single physical constant with a relative standard uncertainty smaller than 1e-10, so using 15 digits of Pi is at least three our four more digits than they need for real-universe calculations.

  • The summary confuses decimal places with significant digits. Let it slide, they mean 15 significant decimal digits or 64 bit accuracy.

    The truncation error in cutting PI to 64 bits comes out to 1.5 inches out of 78 billion miles. But that is not how one decides whether 64 bits are good enough or not.

    Each numerical operation will degrade the least significant bit. As you use result of one calc for the next you lose one more bit. If the final result you are looking for is the result of 10 operations, you c

    • Another important source of these errors is cancellation of terms. In math, a * B / B = a, no matter how big B is relative to A. In numerical computation if you add a large number and then subtract the large number, you would lose so many digits of accuracy. Similar thing happens when you multiply and then divide by a large number.

      Not so, unless an intermediate result overflows and underflows. Without overflow or underflow, calculating c = (a * b) / b may give a result slightly different from a, with a small relative error, but then calculating (c * b) / b actually gives c again. Same for c = (a / b) * b and (c / b) * b.

      With addition and subtraction, the error is small compared to the maximum of a and b.

      • Without overflow or underflow? That is a big assumption to make. Once you make such qualification, it degenerates to "no true scottsman", if everyone has a job there will be no employment ...

        The function that calculates the intersection between two line segments could not make such assumptions. One could estimate the numerical error in the final result and recalculate it with 128 bit or 256 bit precision. Or one could try to predict when it would be needed by looking at some determinant. At some point it

  • How much difference does general relativity make when measuring the solar system?

    If the Sun and all the planets were removed, would the distance between where the Sun was and where Voyager is change?

  • If only there was a way to make a "Thug Life" youtube video out of a ./ post.
  • by gnasher719 ( 869701 ) on Saturday March 19, 2016 @01:29PM (#51732415)
    Double precision numbers use a 53 bit mantissa. For the number pi â 3.14 the last bit of the mantissa has a value of 2^-51. Any real number between 2 and 4 can be represented with an error less than 2^-52.

    At a radius of 12.5 billion miles, the error in calculating the product times pi before rounding would less than 12.5 billion miles times 2^-52 times 2, which is 0.352 inches or 8.94 mm.

    The result in miles is about 78 billion, somehow bigger than 2^36. The rounding error would be up to 2^-17 miles or 0.483 inches or 12.3 mm. So the bounds for the rounding error alone is already higher than the bounds due to the error in pi.
  • "...our calculation of that distance would be off by perhaps less than the length of your little finger."

    Or, by another measure, twice as long as Donald Trump's [vanityfair.com] middle finger.

  • 'How I want a drink, alcoholic of course, after the heavy chapters involving quantum mechanics'

  • This would be it. This is a good example of an article that should be on slashdot.
  • A value of 3 was good enough for the Bible, though back then the Earth had 4 corners.

  • I'm usually quick to point out some incorrect garbage in the summary but this seems to come from JPL themselves so I'm cautiously asking if I did this right?

    15 decimal places of pi is 3.141592653589793.
    25billion miles is 40,000,000,000m or 40e9m

    40e9 * 3.141592653589793 - 40e9 * 3.141592653589792 = 40 e-6 or 40 micrometers.
    40 micrometers = 1.57 thousands of an inch, not 1.57 inches.

    Did I do something wrong or are NASA about to crash another rover?

    • by Anonymous Coward

      I'm usually quick to point out some incorrect garbage in the summary but this seems to come from JPL themselves so I'm cautiously asking if I did this right?

      15 decimal places of pi is 3.141592653589793.
      25billion miles is 40,000,000,000m or 40e9m

      40e9 * 3.141592653589793 - 40e9 * 3.141592653589792 = 40 e-6 or 40 micrometers.
      40 micrometers = 1.57 thousands of an inch, not 1.57 inches.

      Did I do something wrong or are NASA about to crash another rover?

      You made an error:

      25billion mile is about 4.02336 × 10^13 meters not 40 × 10^9 meters.

      • Since when do American English or British English speakers use long-scale?
        25 billion miles = 40 billion km.
        40 billion km = 40e9 meters or 4e10 meters.

        If this was published by the ESO I would agree but it was published by JPL.

    • by Anonymous Coward

      "Did I do something wrong or are NASA about to crash another rover?"

      25B miles is 40e13m not 40e9 :)

  • I wondered what kinds of sequences one might find using the 15 digits of pi mentioned.

    So I took "141592653589793" and checked for easy factors. I got it down to 7 x 17 x 23 x 51732792689
    Wolfram Alpha said 73 was a prime factor (to) 708668393 ---> which is itself, a primitive pythagorean triple
    ---> 708668393**2 == 81521865**2 + 703963832**2

    Prime factorization of 81521865 == 3^2 x 5 x 241 x 7517
    Prime factorization of 703963832 == 2^3×11×13×19×139×233

    so, 15 digits of
  • The exact value of pi is only relevant in a flat (Newtonian) space-time, not in general relativity.
  • when will they finally go metric?
    Also slashdot, a quite international website.

  • less than the length of your little finger."

    Unless your name is Donald Trump.

We are Microsoft. Unix is irrelevant. Openness is futile. Prepare to be assimilated.

Working...