I'm sorry that I didn't get this post up in time for the big day but, if you start now, you might have pi calculated to a billion digits by Pi Day of next year. You can also use bc for calculating square roots. J(n,x): the Bessel function of order n of x s(x): the sine of x in radiansĪ(x): the inverse tangent of x - the result is returned in radians įor anyone who is mathematically inclined, it may be interesting that bc also includes a number of other useful functions. The a in this calculation represents the inverse tangent or "arctangent" - yet another way of computing pi. What isn't immediately obvious is what a(1) has to do with calculating pi. Swiss researchers at the University of Applied Sciences Graubünden this week claimed a new world record for calculating the number of digits of pia staggering 62.8 trillion figures. $ time echo "scale=100 4*a(1)" | bc -lģ.141592653589793238462643383279502884197169399375105820974944592307\Įach of these bc commands is first setting the number of decimal places we want to see (with the scale setting), calling in the bc math library (with the -l option), and providing the seed values for going after pi. Ask for a million decimal places and you're going to have to wait a while. Ask for pi to 100 decimal places and it will run in a tiny fraction of a second. Some people are even suggesting that yesterday was "rounded up Pi Day" because 03/14/16 is like 3.14159 rounded up to the 10,000ths place.īuilt into most Linux systems and complemented by a math library, bc can make quick work of calculating pi or, as I should say, quick work of entering the command. We celebrate Pi Day because the date (03/14) corresponds to the first three digits. But let's take a look at what I should have explained yesterday.įirst, what is pi? I have a bit of a hard time remembering what I learned in junior high school math, but pi is the ratio between the circumference of a circle and its diameter. voila! OK, depending on how many digits you've selected, there may be quite some time between your hitting the enter key and your shouting "Voila!". You can select just how many digits you want to see, plug that number into a calculation that I'm about to share, and. Want to calculate pi to 1,000 digits? 314,159 digits? No problem. The infinite sum used in the 2020 recordbreaking effort was discovered in 1988 and can calculate 14 new digits of pi for each new term that is added to the sum. Use our pi calculator to get the value of pi with with any number of digits or decimal places until one hundred. And, while I can't remember much past 3.14159 in my head, I know that calculating pi to some outrageous number of digits can be pretty exciting and that we can do that fairly easily on Unix systems. It looks like I've missed Pi Day by some fraction of a day, but I can't help but get a little excited when this special day rolls around - especially if pi turns into pie.
0 Comments
Leave a Reply. |