## Leibniz formula for π

an alternating series. It is also called the **Leibniz-Madhava** series as it is a special case of a more general series expansion for the inverse tangent function, first discovered by the Indian mathematician Madhava of Sangamagrama in the 14th century, the specific case first published by Leibniz around 1676. [1] The series for the inverse tangent function, which is also known as Gregory's series, can be given by:

The Leibniz formula for π / 4 can be obtained by putting *x* = 1 into this series. [2]

It also is the Dirichlet L -series of the non-principal Dirichlet character of modulus 4 evaluated at *s* = 1 , and therefore the value *β*(1) of the Dirichlet beta function.

## Calculating Pi: My attempt at breaking the Pi World Record

Before I go into the specifics of my record attempt, it is important for you to have some background information. Over the past few years I have been steadily acquiring server hardware to increase my knowledge of system administration and cyber security. This is not only for personal growth: it has also helped me immensely in my professional career. I have served in various roles including cyber security (Cyber Defense Analyst, Chief Information Security Officer) and system administration (Senior System Administrator). Historically, I have also donated my spare system computing resources to various distributed computing projects through the BOINC 1 platform. In late 2018 I decided to shift the primary focus of my lab to distributed computing. I still maintain a small 1U server for personal use, but most of the other servers run BOINC exclusively.

UPDATE: Partway through the world record attempt (July, 2019), I founded a nonprofit organization, North Alabama Charitable Computing, which repurposes enterprise-grade compute and storage equipment for STEM research. After I break the Pi world record, most of my servers will be donated where they will provide scientists and various research projects with computing power.

Anyways, back to the reason you are here: My primary reason for attempting to break the record set by Emma Haruka Iwao/Google 2 (March, 2019 – 31.4 trillion digits) is to test the limits of my hardware. Once I am finished breaking the Pi world record, the server and hard drives will be repurposed for STEM research (e.g., BOINC, Open Science Grid 3 , university research projects).

One of the first things I did was reach out to Alexander Yee, who wrote and maintains a program called y-cruncher 4 . y-cruncher is a program that computes various mathematical constants based on user input. y-cruncher is able to take advantage of the newest processor features and features many optimizations, which in part explains why it has been used to set several of the past Pi records (and other mathematical constants). After emailing back and forth with Alex, I started to gain an understanding of what would be required for such a feat: 50 trillion digits of Pi. In order to calculate this many digits, y-cruncher determined I would need 256TiB of ephemeral storage, in addition to 38TiB for the final output.

One of the first things that you may notice is that y-cruncher calculates everything in tebibytes (base-2), rather than terabytes (base-10). It can be confusing since these units of measure are sometimes used interchangeably (I’m looking at you, Windows 5 , and Linux 6 df “-h” vs “-H”), but the difference can be significant: for example, 256TiB is equivalent to 281TB. You don’t want to get 3/4 of the way through a record attempt and realize you don’t have enough storage.

Once I had a rough estimate of the amount of equipment and disk required for the Pi computation, I started looking for used hardware, primarily on eBay. From January to March of 2019, I started purchasing equipment that would be required for the attempt: a new server, several hard drives, various PCI-E cards, and a tape libary and drive, to name just a few. Below is a picture of my home lab in it’s entirety (except for an Asus ESC8000 G4 in my office). Everything inside the red box is used for the Pi computation.

## 10,000 digits of Pi formatted for humans

`3. 1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679 8214808651 3282306647 0938446095 5058223172 5359408128 4811174502 8410270193 8521105559 6446229489 5493038196 4428810975 6659334461 2847564823 3786783165 2712019091 4564856692 3460348610 4543266482 1339360726 0249141273 7245870066 0631558817 4881520920 9628292540 9171536436 7892590360 0113305305 4882046652 1384146951 9415116094 3305727036 5759591953 0921861173 8193261179 3105118548 0744623799 6274956735 1885752724 8912279381 8301194912 9833673362 4406566430 8602139494 6395224737 1907021798 6094370277 0539217176 2931767523 8467481846 7669405132 0005681271 4526356082 7785771342 7577896091 7363717872 1468440901 2249534301 4654958537 1050792279 6892589235 4201995611 2129021960 8640344181 5981362977 4771309960 5187072113 4999999837 2978049951 0597317328 1609631859 5024459455 3469083026 4252230825 3344685035 2619311881 7101000313 7838752886 5875332083 8142061717 7669147303 5982534904 2875546873 1159562863 8823537875 9375195778 1857780532 1712268066 1300192787 6611195909 2164201989 3809525720 1065485863 2788659361 5338182796 8230301952 0353018529 6899577362 2599413891 2497217752 8347913151 5574857242 4541506959 5082953311 6861727855 8890750983 8175463746 4939319255 0604009277 0167113900 9848824012 8583616035 6370766010 4710181942 9555961989 4676783744 9448255379 7747268471 0404753464 6208046684 2590694912 9331367702 8989152104 7521620569 6602405803 8150193511 2533824300 3558764024 7496473263 9141992726 0426992279 6782354781 6360093417 2164121992 4586315030 2861829745 5570674983 8505494588 5869269956 9092721079 7509302955 3211653449 8720275596 0236480665 4991198818 3479775356 6369807426 5425278625 5181841757 4672890977 7727938000 8164706001 6145249192 1732172147 7235014144 1973568548 1613611573 5255213347 5741849468 4385233239 0739414333 4547762416 8625189835 6948556209 9219222184 2725502542 5688767179 0494601653 4668049886 2723279178 6085784383 8279679766 8145410095 3883786360 9506800642 2512520511 7392984896 0841284886 2694560424 1965285022 2106611863 0674427862 2039194945 0471237137 8696095636 4371917287 4677646575 7396241389 0865832645 9958133904 7802759009 9465764078 9512694683 9835259570 9825822620 5224894077 2671947826 8482601476 9909026401 3639443745 5305068203 4962524517 4939965143 1429809190 6592509372 2169646151 5709858387 4105978859 5977297549 8930161753 9284681382 6868386894 2774155991 8559252459 5395943104 9972524680 8459872736 4469584865 3836736222 6260991246 0805124388 4390451244 1365497627 8079771569 1435997700 1296160894 4169486855 5848406353 4220722258 2848864815 8456028506 0168427394 5226746767 8895252138 5225499546 6672782398 6456596116 3548862305 7745649803 5593634568 1743241125 1507606947 9451096596 0940252288 7971089314 5669136867 2287489405 6010150330 8617928680 9208747609 1782493858 9009714909 6759852613 6554978189 3129784821 6829989487 2265880485 7564014270 4775551323 7964145152 3746234364 5428584447 9526586782 1051141354 7357395231 1342716610 2135969536 2314429524 8493718711 0145765403 5902799344 0374200731 0578539062 1983874478 0847848968 3321445713 8687519435 0643021845 3191048481 0053706146 8067491927 8191197939 9520614196 6342875444 0643745123 7181921799 9839101591 9561814675 1426912397 4894090718 6494231961 5679452080 9514655022 5231603881 9301420937 6213785595 6638937787 0830390697 9207734672 2182562599 6615014215 0306803844 7734549202 6054146659 2520149744 2850732518 6660021324 3408819071 0486331734 6496514539 0579626856 1005508106 6587969981 6357473638 4052571459 1028970641 4011097120 6280439039 7595156771 5770042033 7869936007 2305587631 7635942187 3125147120 5329281918 2618612586 7321579198 4148488291 6447060957 5270695722 0917567116 7229109816 9091528017 3506712748 5832228718 3520935396 5725121083 5791513698 8209144421 0067510334 6711031412 6711136990 8658516398 3150197016 5151168517 1437657618 3515565088 4909989859 9823873455 2833163550 7647918535 8932261854 8963213293 3089857064 2046752590 7091548141 6549859461 6371802709 8199430992 4488957571 2828905923 2332609729 9712084433 5732654893 8239119325 9746366730 5836041428 1388303203 8249037589 8524374417 0291327656 1809377344 4030707469 2112019130 2033038019 7621101100 4492932151 6084244485 9637669838 9522868478 3123552658 2131449576 8572624334 4189303968 6426243410 7732269780 2807318915 4411010446 8232527162 0105265227 2111660396 6655730925 4711055785 3763466820 6531098965 2691862056 4769312570 5863566201 8558100729 3606598764 8611791045 3348850346 1136576867 5324944166 8039626579 7877185560 8455296541 2665408530 6143444318 5867697514 5661406800 7002378776 5913440171 2749470420 5622305389 9456131407 1127000407 8547332699 3908145466 4645880797 2708266830 6343285878 5698305235 8089330657 5740679545 7163775254 2021149557 6158140025 0126228594 1302164715 5097925923 0990796547 3761255176 5675135751 7829666454 7791745011 2996148903 0463994713 2962107340 4375189573 5961458901 9389713111 7904297828 5647503203 1986915140 2870808599 0480109412 1472213179 4764777262 2414254854 5403321571 8530614228 8137585043 0633217518 2979866223 7172159160 7716692547 4873898665 4949450114 6540628433 6639379003 9769265672 1463853067 3609657120 9180763832 7166416274 8888007869 2560290228 4721040317 2118608204 1900042296 6171196377 9213375751 1495950156 6049631862 9472654736 4252308177 0367515906 7350235072 8354056704 0386743513 6222247715 8915049530 9844489333 0963408780 7693259939 7805419341 4473774418 4263129860 8099888687 4132604721 5695162396 5864573021 6315981931 9516735381 2974167729 4786724229 2465436680 0980676928 2382806899 6400482435 4037014163 1496589794 0924323789 6907069779 4223625082 2168895738 3798623001 5937764716 5122893578 6015881617 5578297352 3344604281 5126272037 3431465319 7777416031 9906655418 7639792933 4419521541 3418994854 4473456738 3162499341 9131814809 2777710386 3877343177 2075456545 3220777092 1201905166 0962804909 2636019759 8828161332 3166636528 6193266863 3606273567 6303544776 2803504507 7723554710 5859548702 7908143562 4014517180 6246436267 9456127531 8134078330 3362542327 8394497538 2437205835 3114771199 2606381334 6776879695 9703098339 1307710987 0408591337 4641442822 7726346594 7047458784 7787201927 7152807317 6790770715 7213444730 6057007334 9243693113 8350493163 1284042512 1925651798 0694113528 0131470130 4781643788 5185290928 5452011658 3934196562 1349143415 9562586586 5570552690 4965209858 0338507224 2648293972 8584783163 0577775606 8887644624 8246857926 0395352773 4803048029 0058760758 2510474709 1643961362 6760449256 2742042083 2085661190 6254543372 1315359584 5068772460 2901618766 7952406163 4252257719 5429162991 9306455377 9914037340 4328752628 8896399587 9475729174 6426357455 2540790914 5135711136 9410911939 3251910760 2082520261 8798531887 7058429725 9167781314 9699009019 2116971737 2784768472 6860849003 3770242429 1651300500 5168323364 3503895170 2989392233 4517220138 1280696501 1784408745 1960121228 5993716231 3017114448 4640903890 6449544400 6198690754 8516026327 5052983491 8740786680 8818338510 2283345085 0486082503 9302133219 7155184306 3545500766 8282949304 1377655279 3975175461 3953984683 3936383047 4611996653 8581538420 5685338621 8672523340 2830871123 2827892125 0771262946 3229563989 8989358211 6745627010 2183564622 0134967151 8819097303 8119800497 3407239610 3685406643 1939509790 1906996395 5245300545 0580685501 9567302292 1913933918 5680344903 9820595510 0226353536 1920419947 4553859381 0234395544 9597783779 0237421617 2711172364 3435439478 2218185286 2408514006 6604433258 8856986705 4315470696 5747458550 3323233421 0730154594 0516553790 6866273337 9958511562 5784322988 2737231989 8757141595 7811196358 3300594087 3068121602 8764962867 4460477464 9159950549 7374256269 0104903778 1986835938 1465741268 0492564879 8556145372 3478673303 9046883834 3634655379 4986419270 5638729317 4872332083 7601123029 9113679386 2708943879 9362016295 1541337142 4892830722 0126901475 4668476535 7616477379 4675200490 7571555278 1965362132 3926406160 1363581559 0742202020 3187277605 2772190055 6148425551 8792530343 5139844253 2234157623 3610642506 3904975008 6562710953 5919465897 5141310348 2276930624 7435363256 9160781547 8181152843 6679570611 0861533150 4452127473 9245449454 2368288606 1340841486 3776700961 2071512491 4043027253 8607648236 3414334623 5189757664 5216413767 9690314950 1910857598 4423919862 9164219399 4907236234 6468441173 9403265918 4044378051 3338945257 4239950829 6591228508 5558215725 0310712570 1266830240 2929525220 1187267675 6220415420 5161841634 8475651699 9811614101 0029960783 8690929160 3028840026 9104140792 8862150784 2451670908 7000699282 1206604183 7180653556 7252532567 5328612910 4248776182 5829765157 9598470356 2226293486 0034158722 9805349896 5022629174 8788202734 2092222453 3985626476 6914905562 8425039127 5771028402 7998066365 8254889264 8802545661 0172967026 6407655904 2909945681 5065265305 3718294127 0336931378 5178609040 7086671149 6558343434 7693385781 7113864558 7367812301 4587687126 6034891390 9562009939 3610310291 6161528813 8437909904 2317473363 9480457593 1493140529 7634757481 1935670911 0137751721 0080315590 2485309066 9203767192 2033229094 3346768514 2214477379 3937517034 4366199104 0337511173 5471918550 4644902636 5512816228 8244625759 1633303910 7225383742 1821408835 0865739177 1509682887 4782656995 9957449066 1758344137 5223970968 3408005355 9849175417 3818839994 4697486762 6551658276 5848358845 3142775687 9002909517 0283529716 3445621296 4043523117 6006651012 4120065975 5851276178 5838292041 9748442360 8007193045 7618932349 2292796501 9875187212 7267507981 2554709589 0455635792 1221033346 6974992356 3025494780 2490114195 2123828153 0911407907 3860251522 7429958180 7247162591 6685451333 1239480494 7079119153 2673430282 4418604142 6363954800 0448002670 4962482017 9289647669 7583183271 3142517029 6923488962 7668440323 2609275249 6035799646 9256504936 8183609003 2380929345 9588970695 3653494060 3402166544 3755890045 6328822505 4525564056 4482465151 8754711962 1844396582 5337543885 6909411303 1509526179 3780029741 2076651479 3942590298 9695946995 5657612186 5619673378 6236256125 2163208628 6922210327 4889218654 3648022967 8070576561 5144632046 9279068212 0738837781 4233562823 6089632080 6822246801 2248261177 1858963814 0918390367 3672220888 3215137556 0037279839 4004152970 0287830766 7094447456 0134556417 2543709069 7939612257 1429894671 5435784687 8861444581 2314593571 9849225284 7160504922 1242470141 2147805734 5510500801 9086996033 0276347870 8108175450 1193071412 2339086639 3833952942 5786905076 4310063835 1983438934 1596131854 3475464955 6978103829 3097164651 4384070070 7360411237 3599843452 2516105070 2705623526 6012764848 3084076118 3013052793 2054274628 6540360367 4532865105 7065874882 2569815793 6789766974 2205750596 8344086973 5020141020 6723585020 0724522563 2651341055 9240190274 2162484391 4035998953 5394590944 0704691209 1409387001 2645600162 3742880210 9276457931 0657922955 2498872758 4610126483 6999892256 9596881592 0560010165 525637567 `

## What is Perfusion Index (PI)

**Perfusion Index or PI** is the ratio of the pulsatile blood flow to the non-pulsatile static blood flow in a patient's peripheral tissue, such as finger tip, toe, or ear lobe. Perfusion index is an indication of the pulse strength at the sensor site. The PI's values range from 0.02% for very weak pulse to 20% for extremely strong pulse. The perfusion index varies depending on patients, physiological conditions, and monitoring sites. Because of this variability, each patient should establish his own "normal" perfusion index for a given location and use this for monitoring purposes.

Perfusion index is normally monitored with pulse oximeters. PI is also a good indicator of the reliability of the pulse oximeter reading. For most pulse oximeters for general use, the reading is unreliable or unavailable if PI is at or below 0.4%. There are oximeters, such as those from Masimo, designed for extreme low PI. Most people that use an oximeter at home would not need a perfusion index indicator because they are considered to be in general good health. A perfusion index adds a lot of sensitivity to the oximeter sensor thus adding to the cost of the oximeter.

The pleth (Plethysmograph), available in many pulse oximeters, is a graphical representation of the perfusion index.

In a hospital, perfusion index, along with many other parameters, is used to monitor critically ill patients. Studies have shown that PI has a high correlation with capillary refill time and central-to-toe temperature difference. In neonatal acute care, a low PI is an objective and accurate measure of acute illness. It is superior to qualitative approach such as foot warmth.

Perfusion index is also used as an early warning of anesthetic failure. Studies have shown that an increase in PI is an early indicator that general or epidural anesthesia has initiated peripheral blood vessel dilation, which typically occurs before the onset of anesthesia. Lacking the spike would indicate the lack of anesthetic effect.

Other uses of the perfusion index can be found throughout various literature. As we learn more about PI, more clinical applications are being discovered.

## Using the Perfusion Index with Pulse Oximeters

The reason having a perfusion index on your pulse oximeter is a good idea is because it can help increase the accuracy of the readings which the pulse oximeter gives you in relation to your blood oxygen levels.

Simply put, the stronger your pulse is at the monitoring site (where the pulse oximeter is attached), the more accurate the readings of it will be.

The perfusion index can help you determine how appropriate the application site is it can help you find the best location to attach the pulse oximeter. Generally speaking, you want to apply the sensor to the area that has the highest percentage. If your earlobe has a perfusion index rating of 3%, and your finger has a rating of 15%, then the finger is where you want to attach the pulse oximeter.

## How do you calculate #Cos^-1 [cos ((7pi)/6) ]#?

You can write #(7pi)/6# as #(pi+pi/6)#

Thus we can clearly see the angle falls in the third quadrant. And the cosine value in third quadrant is always negative.

coming back to the question

#cos^-1[cos((7pi)/6)] = cos^-1[-cos(pi/6)]#

= #pi - cos^-1[cos(pi/6)]#

= #pi- pi/6#

= #(5pi)/6#

# arccos( cos ( <7 pi>/ 6) ) = pm <7pi>/6 + 2pi k,# integer #k#

#### Explanation:

I treat #arccos( cos ( <7 pi>/ 6) ) # as a multivalued expression, all the angles whose cosine equals #cos ( <7 pi>/ 6).#

In general #cos x = cos a # has solution #x=pm a + 2 pi k, # integer #k#

# arccos( cos ( <7 pi>/ 6) ) = pm <7pi>/6 + 2pi k,# integer #k#

The principal value is in the second quadrant, given here by the minus sign and #k=1.#

## Method 2

and writing *1/(1 + t 2 ) = 1 - t 2 + t 4 - t 6 + .* and integrating term-by-term, we obtain the infinite series

*tan -1 (x) = x - x 3 /3 + x 5 /5 - x 7 /7 + . ,*

which converges for *-1 <= x <= 1*. Substituting *x = 1*, we obtain Leibniz's series

However, because *x = 1* is an endpoint of the interval of convergence, this series converges very slowly and so is impractical for calculation. (For example, the first five terms give the approximations *4., 2.666, 3.466, 2.895, 3.339* to *pi*.)

On the other hand, we may substitute *x = 1/sqrt(3) = tan -1 (pi/6)*. Then, after some algebraic manipulation, we obtain the series

and the first five terms of this series give the approximations *3.46410, 3.07920, 3.15618, 3.13785, 3.14260* to *pi*, the last of which differs from *pi* by litle more than *.001*.

Indeed, we can do even better. Substituting *x = tan(pi/n)* for *n >= 4* (so that the series converges), we obtain the series

*pi = n(tan(pi/n) - tan 3 (pi/n)/3 + tan 5 (pi/n)/5 - tan 7 (pi/n)/7 + tan 9 (pi/n)/9 - . )*.

Now *tan(x/2) = sqrt((1 - cos(x))/(1 + cos(x)))*, so we may again compute *tan(pi/n)* recursively, starting with *n = 6*. We obtain the following approximations to *pi*, where in the last two columns of this table, *S _{k}(tan(pi/n))* denotes the approximation obtained by using the first

*k*terms of the above series.

Welcome to the

Feature Column!

These web essays are designed for those who have already discovered the joys of mathematics as well as for those who may be uncomfortable with mathematics.

Read more . . .

## Advanced Statistical Computing

There are many introductions and overviews of Markov chain Monte Carlo out there and a quick web search will reveal them. A decent introductory book is Markov Chain Monte Carlo in Practice by Gilks, Richardson, and Spiegelhalter, but there are many others. In this section we will give just the briefest of overviews to get things started.

A Markov chain is a stochastic process that evolves over time by transitioning into different states. The sequence of states is denoted by the collection (

(X_tmid X_

(X_tmid X_

This relationship means that the probability distribution of the process at time (t) , given all of the previous values of the chain, is equal to the probability distribution given just the previous value (this is also known as the Markov property). So in determining the sequence of values that the chain takes, we can determine the distribution of our next value given just our current value.

The collection of states that a Markov chain can visit is called the *state space* and the quantity that governs the probability that the chain moves from one state to another state is the *transition kernel* or *transition matrix*.

### 7.1.1 A Simple Example

A classic example of a Markov chain has a state space and transition probabilities that can be drawn as follows.

Here, we have three states in the state space and the arrows indicate to which state you can travel given your current state. The fractions next to each arrow tell you what is the transition probabilities of going to a given state. Note that in this Markov chain, you can only ever travel to two possible states no matter what your current state happens to be.

We can write the transition probabilities in a matrix, a.k.a. the transition matrix, as [ P = left[ egin

(X_

From the matrix, we can see that the probability of going from state (1) to state (3) is (0) , because the ((1, 3)) entry of the matrix is (0) .

Suppose we start this Markov chain in state (3) with probability (1) , so the initial probability distribution over the three states is (pi_0=(0,0,1)) . What is the probability distribution of the states after one iteration? The way the transition matrix works, we can write [ pi_1 = pi_0 P = (0, 1/2, 1/2) ] A quick check of the diagram above confirms that if we start in state (3) , then after one iteration we can only be in either state (3) or in state (2) . So state (1) gets (0) probability.

What is the probability distribution over the states after (n) iterations? We can continue the process above to get [ pi_n = pi_0 overbrace

### 7.1.2 Basic Limit Theorem

For a Markov chain with a discrete state space and transition matrix (P) , let (pi_star) be such that (pi_star P = pi_star) . Then (pi_star) is a *stationary distribution* of the Markov chain and the chain is said to be stationary if it reaches this distribution.

The basic limit theorem for Markov chains says that, under a specific set of assumptions that we will detail below, we have [ |pi_star - pi_n|longrightarrow 0 ] as (n
ightarrowinfty) , where (|cdot|) is the total variation distance between the two densities. Therefore, no matter where we start the Markov chain ( (pi_0) ), (pi_n) will eventually approach the stationary distribution. Another way to think of this is that [ lim_

There are three assumptions that we must make in order for the basic limit theorem to hold.

The stationary distribution (pi_star) exists.

The chain is **irreducible**. The basic idea with irreducibility is that there should be a path between any two states and that path should altogether have probability (> 0) . This does not mean that you can transition to any state from any other state *in one step*. Rather, there is a sequence of steps that can be taken with positive probability that would connect any two states. Mathematically, we can write this as there exists some (n) such that (mathbb

(X_n = jmid X_0 = i)) for all (i) and (j) in the state space.

The chain is **aperiodic**. A chain is aperiodic if it does not make deterministic visits to a subset of the state space. For example, consider a Markov chain on the space of integers that starts at (X_0=0) , and has a transition rule where [ X_

### 7.1.3 Time Reversibility

A Markov chain is *time reversible* if [ (X_0, X_1,dots,X_n) stackrel

In addition to stationarity, the time reversibility property tells us that for all (i) , (j) , the following are all equivalent:

[egin

(X_0=i, X_1=j) & = & mathbb

(X_1=i, X_0 = j) mathbb

(X_0=i)mathbb

(X_1=jmid X_0=i) & = & mathbb

(X_0=j)mathbb

(X_1=imid X_0=j) end

The last line can also be written as [ pi(i)P(i, j) = pi(j)P(j, i) ] which are called the *local balance equations*. A key property that we will exploit later is that if the local balance equations hold for a transition matrix (P) and distribution (pi) , then (pi) is the stationary distribution of a chain governed by the transition matrix (P) .

Why is all this important? Time reversibility is relevant to analyses making use of Markov chain Monte Carlo because it allows us to find a way to construct a proper Markov chain from which to simulate. In most MCMC applications, we have no trouble identifying the stationary distribution. We already know the stationary distribution because it is usually a posterior density resulting from a complex Bayesian calculation. Our problem is that we cannot simulate from the distribution. So the problem is constructing a Markov chain that leads to a given stationary distribution.

Time reversibility gives us a way to construct a Markov chain that converges to a given stationary distribution. As long as we can show that a Markov chain with a given transition kernel/matrix satisfies the local balance equations with respect to the stationary distribution, we can know that the chain will converge to the stationary distribution.

### 7.1.4 Summary

To summarize what we have learned in this section, we have that

We want to sample from a complicated density (pi) .

We know that aperiodic and irreducible Markov chains with a stationary distribution (pi) will eventually converge to that stationary distribution.

We know that if a Markov chain with transition matrix (P) is time reversibile with respect to (pi) then (pi) must be the stationary distribution of the Markov chain.

Given a chain governed by transition matrix (P) , we can simulate it for a long time and eventually we will be simulating from (pi) .

That is the basic gist of MCMC techniques and I have given the briefest of introductions here. That said, in the next section we will discuss how to construct a proper Markov chain for simulating from the stationary distribution.

## Y-cruncher - A Multi-Threaded Pi-Program

The first scalable multi-threaded Pi-benchmark for multi-core systems.

How fast can your computer compute Pi?

y-cruncher is a program that can compute Pi and other constants to trillions of digits.

It is the first of its kind that is multi-threaded and scalable to multi-core systems. Ever since its launch in 2009, it has become a common benchmarking and stress-testing application for overclockers and hardware enthusiasts.

y-cruncher has been used to set several world records for the most digits of Pi ever computed.

Windows:Version0.7.8 Build 9507(Released: September 14, 2020)

Linux :Version0.7.8 Build 9507(Released: September 14, 2020)

**Version 0.7.8 Patch with Zen 2 Optimizations:** (March 1, 2020) - permalink

A new patch for v0.7.8 has been released. Aside from the usual bug fixes, this release includes a new binary optimized for AMD Zen 2 processors.

I don't usually add new features to patch releases. However, my priorities in recent months have largely shifted away from y-cruncher. As such, very little progress has been made on v0.7.9. With no timeline for when the next feature release will happen, I decided to pull the Zen 2 optimizations into the v0.7.8 branch.

That aside, the new Zen 2 binary seems bring about 10% performance improvement. This is far greater than the 1-2% that I had expected.

This may be a bit of a shocker, but I have no idea why the improvement is so large nor do I have the time to investigate. Most of the tuning is automated by a superoptimizer. So all I did was run the superoptimizer, wait a week for it to finish, then copy-paste the results into the code.

In other words, I have no idea what it did or what it found that is so significant. But it worked, and I'll take it - no questions asked.

**The Pi Record Returns to the Personal Computer:** (January 29, 2020) - permalink

After a grueling 10 months of computation running from April of last year to today, the world record for Pi has once again fallen. This time to Timothy Mullican who computed 50 trillion digits of Pi on a dated (but still powerful) personal computer.

As the previous record was set by Google using their cloud platform, this computation marks the return of the Pi record to single machine personal computers.

Timothy used a 2012-era computer (Ivy Bridge) along with a very large array of 48 modern hard drives. While the processing power was significantly less than that of Google's computation, it had a better balance of computing power and storage bandwidth - thus leading to a computation of comparable speed to Google's.

Full details of the computation can be found on Tim's blog.

y-cruncher has been used to set a number of world record sized computations.

Blue: Current World Record

Green: Former World Record

Red: Unverified computation. Does not qualify as a world record until verified using an alternate formula.

AMD Threadripper 3995WX @ 2.7 GHz

2 x Intel Xeon E5-2680 v2 @ 2.8 GHz

2 x Intel Xeon E5-2690 v4 @ 2.6 GHz

2 x Intel Xeon E5-2690 v4 @ 2.6 GHz

*Not Verified*

2 x Intel Xeon Gold 6140 @ 2.3 GHz

4 x Intel Xeon E7-4880 v2 @ 2.5 GHz

Christophe Patris de Broe

*Not Verified*

2 x Intel Xeon Platinum 8268 @ 2.9 GHz

2 x Intel Xeon E5-2651 v2 @ 1.8 GHz

2 x Intel Xeon Gold 6140 @ 2.3 GHz

2 x Intel Xeon 8260L @ 2.4 GHz

AMD Threadripper 1950X @ 3.4 GHz

Emma Haruka Iwao Pi 31,415,926,535,897 Compute: 121 days

See the complete list including other notably large computations. If you want to set a record yourself, the rules are in that link.

The main computational features of y-cruncher are:

- Able to compute Pi and other constants to trillions of digits.
- Two algorithms are available for most constants. One for computation and one for verification.
**Multi-Threaded**- Multi-threading can be used to fully utilize modern multi-core processors without significantly increasing memory usage.**Vectorized**- Able to fully utilize the SIMD capabilities for most processors. (SSE, AVX, AVX512, etc. )**Swap Space**management for large computations that require more memory than there is available.**Multi-Hard Drive**- Multiple hard drives can be used for faster disk swapping.**Semi-Fault Tolerant**- Able to detect and correct for minor errors that may be caused by hardware instability or software bugs.

### Sample Screenshot: 1 trillion digits of Pi

**Latest Releases:** (September 14, 2020)

Downloading any of these files constitutes as acceptance of the license agreement.

OSDownload LinkSizeWindows

y-cruncher v0.7.8.9507.zip

43.4 MB Linux (Static)

y-cruncher v0.7.8.9507-static.tar.xz

29.2 MB Linux (Dynamic)

y-cruncher v0.7.8.9507-dynamic.tar.xz

22.8 MB

The Linux version comes in both statically and dynamically linked versions. The static version should work on most Linux distributions, but lacks Cilk Plus and NUMA binding. The dynamic version supports all features, but is less portable due to the DLL dependency hell.

The Windows download comes bundled with the HWBOT submitter which allows benchmarks to be submitted to HWBOT.

**System Requirements:**

- Windows 7 or later.
- The HWBOT submitter requires the Java 8 Runtime.

- 64-bit Linux is required. There is no support for 32-bit.
- The dynamic version has been tested on Ubuntu 18.04.

- An x86 or x64 processor.

**Version History:**

**Other Downloads (for C++ programmers):**

**Advanced Documentation:**

**Comparison Chart:** (Last updated: May 31, 2021)

Computations of Pi to various sizes. All times in seconds. All computations done entirely in ram.

The timings include the time needed to convert the digits to decimal representation, but not the time needed to write out the digits to disk.

Blue: Benchmarks are up-to-date with the latest version of y-cruncher.

Green: Benchmarks were done with an old version of y-cruncher that is comparable in performance with the current release.

Red: Benchmarks are significantly out-of-date due to being run with an old version of y-cruncher that is no longer comparable with the current release.

Purple: Benchmarks are from unreleased internal builds that are not speed comparable with the current release.