Wednesday, March 14, 2018

Egyptian estimates of PI

I saw a neat tweet on how the estimate the Egyptians used for PI.

This is all my speculation, and maybe a math history buff can enlighten me, but the D^2 dependence they should discover pretty naturally.   Including the constant before squaring is, I would argue, just as natural as having it outside the parentheses, so let's go with that for now.   So was there a nearby better fraction?   How well did the Egyptians do?   A brute force program should tell us.

We will use the ancient programming language C:

#include
#include
int main() {
    double min_error = 10;
    for (int denom = 1; denom < 10000; denom++) {
        for (int num = 1; num < denom; num++) {
            double approx = 2*double(num)/double(denom);
            approx = approx*approx;
            double error2 = M_PI-approx;
            error2 = error2*error2;
            if (error2 < min_error) {
                min_error = error2;
                printf("%d/%d %f\n", num, denom, 4*float(num*num)/float(denom*denom));
            }
        }
    }
}


This produces output:

1/2 1.000000
2/3 1.777778
3/4 2.250000
4/5 2.560000
5/6 2.777778
6/7 2.938776
7/8 3.062500
8/9 3.160494
23/26 3.130177
31/35 3.137959
39/44 3.142562
109/123 3.141252
148/167 3.141597
4401/4966 3.141588
4549/5133 3.141589
4697/5300 3.141589
4845/5467 3.141589
4993/5634 3.141589
5141/5801 3.141590
5289/5968 3.141590
5437/6135 3.141590
5585/6302 3.141590
5733/6469 3.141590
5881/6636 3.141591
6029/6803 3.141591
6177/6970 3.141591
6325/7137 3.141591
6473/7304 3.141591
6621/7471 3.141591
6769/7638 3.141591
6917/7805 3.141592
7065/7972 3.141592
7213/8139 3.141592
7361/8306 3.141592
7509/8473 3.141592
7657/8640 3.141592
7805/8807 3.141592
7953/8974 3.141593
8101/9141 3.141593
8249/9308 3.141593
8397/9475 3.141593
8545/9642 3.141593


So 7/8 was already pretty good, and you need to get to 23/26 before you do any better!   I'd say the Egyptians did extremely well.

What if they had put the constants outside the parens?   How well could they have done?   We can change two of the lines above to:

double approx = 4*double(num)/double(denom);//approx = approx*approx;

and the printf to:

printf("%d/%d %f\n", num, denom, 4*float(num)/float(denom));

And we get:

1/2 2.000000
2/3 2.666667
3/4 3.000000
4/5 3.200000
7/9 3.111111
11/14 3.142857
95/121 3.140496
106/135 3.140741
117/149 3.140940
128/163 3.141104
139/177 3.141243
150/191 3.141361
161/205 3.141464
172/219 3.141552
183/233 3.141631
355/452 3.141593


So 7/9 is not bad!  And 11/14 even better.   So no clear winner here on whether the rational constant should be inside the parens or not.


35 comments:

  1. If you interested, around 464 AD, Zu Chongzhi calculate the approximate value of pi to 355/133。

    ReplyDelete
  2. call girls in

    lahore
    is probably the best office all over in Lahore.

    Our office is giving new and high school young ladies

    inconsistently. Their bodies are hot and delicate like an

    infant. call

    girl
    call girls young ladies are the most excellent and

    they have strong figures. Their countenances and eyes are

    tempting. online calling girlcall

    girls in karachi
    lahore sex lahore girls lahore sex

    Lahore girls for night Lahore girls WhatsApp sex in

    lahore
    need girlfriend in lahore best hotels in lahore

    call

    girl in lahore
    call girls in

    pakistan
    lhr xxx bahria town lahore pics lahore

    escorts
    scott solace premium review 2 number girl lahore

    sexy cal Pakistan escorts hottest Pakistani models Karachi

    girls photos 00 92 0320 0707073

    ReplyDelete
  3. Get professional escort girls in Chandigarh from here at cheap rates. Enjoy your today night with Chandigarh escorts service girl in hotel room or at your apartment.
    Follow us:-
    Chandigarh escorts
    Chandigarh escorts service
    Chandigarh call girls
    Chandigarh escort service
    Chandigarh escort

    ReplyDelete
  4. Dehradun escorts offer independent call girls service in dehradun affordable rates we provides best vip sexy call girls service for cheap rate

    Dehradun Escorts
    Dehradun Escorts Service
    Dehradun Escort
    Amritsar Escorts Service
    Ambala Escorts Service

    ReplyDelete
  5. This is very nice piece of information from the pocket of author, Its very informative for me. If want find pleasure in Dehradun then No need to lead a boring life if your girlfriend has left you. Just hire Dehradun escort services and bring an element of fun in your life. The Dehradun call girls are young, beautiful and convincing. They can spend the entire night at a reasonable cost and offer sexual pleasures, which you cannot find in your routine sex life. So, hire them, make a one-night relationship with them, and take a plunge into the sex pool.
    Dehradun Escorts
    Nainital Escorts

    ReplyDelete
  6. For best outcomes in IAS test, civil administrations, UPSC tests join Ramanasri IAS Institute now. We give the best investigation material to the two Prelims and principle test of IAS. Ramanasri IAS Institute is the top instructing place for UPSC and common administrations tests which furnishes a high calibre of training with singular consideration. You can concentrate under the specialists and clear the IAS tests accomplishing highest levels.


    economics optional syllabus

    ReplyDelete
  7. You have appeared at the best online gateway of Pakistani Call Girls in Islamabad. We are Islamabad Fun Club the certified Escorts in Pakistan offering valid Escorts Islamabad allegorically talking. We are the most given and expert Indian Call Girls in Islamabad people group with a main gathering of wonderful and shocking escort youths. We are incredibly splendid and fulfilled to tell our customers that our Islamabad escort site changed into the most solid comparatively as most visited virtual spot for high class Pakistani Call Girls in Islamabad

    ReplyDelete
  8. Our service is available at any place of your satisfaction Uncle and Out Call.

    Escorts in Lahore
    Escort in Lahore

    ReplyDelete
  9. Welcome to our site As you'll find the most appealing and most experienced young women here.
    whatsapp:- 03001266969
    Independent Escort in Islamabad
    Call Girls Escorts in Islamabad

    ReplyDelete
  10. Go through your valuable minutes with our ESCORTS IN LAHORE in your lodging. We generally attempt to satisfy our customers decision by furnishing them with their selection of young ladies ESCORTS IN KARACHI Our center is to give slick and clean excellent young ladies to have an incredible involvement in us ESCORTS IN ISLAMABAD

    ReplyDelete
  11. Regarded client, we will characterize you, why you contract a Lahore accompanies from us. We are perhaps the most ordered and passionate Escorts administrations Call girls in Lahore, which are serving the most sweltering

    ReplyDelete
  12. You will get a casual day with the pretty

    looking escorts. Each man needs some actual delight. Due to

    extreme remaining task at hand and the pressing factor from family you miss the

    chance completely. This will influence your body in a negative manner.

    The Call girls Lahore in Dehradun comprehend this reality.

    ReplyDelete
  13. hot web series, ullu, web series hot, web series downloading, webseries, ullu web series, adult web series, ullu series, webseries hindi, web series online, adulting web series, ullu web serie, naked web series, best web series hindi, hottest web series, ullu web series download, hindi webseries download, hot webseries download, indianwebseries, webseries download, ullu web series online, web series in hindi, watch web series, kokku web series, kuku web series, nudity web series, romantic web series, sexiest webseries, hot web series, web series downloading, ullu web series, adult web series, ullu series, adulting web series, naked web series, indianwebseries, webseries download

    Hot Web Series | Adult Discussion Forum

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. https://stockconsultantbihar.com/
    https://stockconsultantbihar.com/category/stock-market/
    https://stockconsultantbihar.com/category/ipo/
    https://stockconsultantbihar.com/category/investing-psychology/
    https://stockconsultantbihar.com/category/investing-instruments/
    https://stockconsultantbihar.com/category/technical-analysis/
    https://stockconsultantbihar.com/category/commodity-trading/
    https://stockconsultantbihar.com/category/options-trading/
    https://stockconsultantbihar.com/category/demat-account/
    https://stockconsultantbihar.com/category/mutual-funds/
    https://stockconsultantbihar.com/category/personal-finance/
    https://stockconsultantbihar.com/how-to-open-demat-account-at-angel-broking-in-hindi/
    https://stockconsultantbihar.com/how-is-an-ipo-initial-public-offering-priced-in-hindi/
    https://stockconsultantbihar.com/what-are-new-fund-offerings-nfo-nfo-investment-checklist-in-hindi/
    https://stockconsultantbihar.com/what-are-the-risks-in-ipo-in-hindi/

    1000 words

    https://stockconsultantbihar.com/when-to-apply-in-ipo-ncd-ofs-and-nfo/
    https://stockconsultantbihar.com/how-to-choose-the-best-ncds-to-invest/
    https://stockconsultantbihar.com/what-is-ncd-non-convertible-debentures/
    https://stockconsultantbihar.com/what-is-ofs-offer-for-sale/
    https://stockconsultantbihar.com/how-to-apply-for-ipo-online/
    https://stockconsultantbihar.com/what-is-grey-market-grey-market-premium-in-hindi/
    https://stockconsultantbihar.com/important-terms-used-in-ipo/
    https://stockconsultantbihar.com/what-is-an-initial-public-offering-ipo-in-hindi/
    https://stockconsultantbihar.com/how-to-invest-in-us-stock-market-from-india/
    https://stockconsultantbihar.com/difference-between-primary-market-and-secondary-market/
    https://stockconsultantbihar.com/demat-account-trading-account-difference-comparison/
    https://stockconsultantbihar.com/what-is-primary-market-in-hindi/
    https://stockconsultantbihar.com/stock-market-basics-word-in-hindi-3/

    2000

    https://stockconsultantbihar.com/world-stock-market-timings-in-india/
    https://stockconsultantbihar.com/how-to-start-stock-market-investment-in-hindi/
    https://stockconsultantbihar.com/stock-market-basics-word-in-hindi-2/
    https://stockconsultantbihar.com/what-is-exchange-traded-fund-etf/
    https://stockconsultantbihar.com/what-is-stock-split-share-split-in-hindi/
    https://stockconsultantbihar.com/mcx-ncdex-comparison-difference/
    https://stockconsultantbihar.com/what-is-mcx-how-mcx-works-in-hindi/
    https://stockconsultantbihar.com/how-to-open-and-close-a-demat-account/
    https://stockconsultantbihar.com/how-to-know-your-demat-account-number/
    https://stockconsultantbihar.com/what-is-ncdex-and-how-ncdex-works/
    https://stockconsultantbihar.com/delisting-of-shares-in-stock-market/
    https://stockconsultantbihar.com/moving-averages-to-buy-stocks/
    https://stockconsultantbihar.com/what-is-cdsl-t-pin-how-to-generate-t-pin-in/
    3000
    https://stockconsultantbihar.com/what-is-stock-market-circuit-breaker-in-indian-stock-exchanges/
    https://stockconsultantbihar.com/risk-management-strategies-for-investing/
    https://stockconsultantbihar.com/settlement-process-of-indian-stock-market/
    https://stockconsultantbihar.com/different-types-of-taxes-in-stock-market/
    https://stockconsultantbihar.com/types-of-charges-fees-in-stock-market/
    https://stockconsultantbihar.com/different-types-of-orders-in-stock-market-in-hindi/
    https://stockconsultantbihar.com/top-factors-affecting-share-stock-prices/
    https://stockconsultantbihar.com/how-to-select-a-stock-for-investment-in-hindi/
    https://stockconsultantbihar.com/types-of-shares-every-investor-should-know/
    https://stockconsultantbihar.com/is-it-safe-to-invest-in-stock-market-in-hindi/
    https://stockconsultantbihar.com/what-is-stock-market-indices-in-hindi/
    https://stockconsultantbihar.com/what-is-demat-account-in-hindi/
    https://stockconsultantbihar.com/stakeholder-meaning-in-hindi/
    4000
    https://stockconsultantbihar.com/stock-market-basics-word-in-hindi-1/
    https://stockconsultantbihar.com/what-is-share-market-or-stock-market-in-hindi/
    https://stockconsultantbihar.com/what-is-stocks-in-nse-bse-in-hindi/


    ReplyDelete
  18. 1
    https://indianwebseries.xyz/mtv-spistsvilla-anjali-gaud-latest-stripping-7-min-video/
    https://indianwebseries.xyz/moody-beasty-latest-tango-live-1-july/
    https://indianwebseries.xyz/aditi-mistry-latest-live-2-july-29-min-twerking-her-ass-with-white-towel/
    https://indianwebseries.xyz/koyel-sarkar-latest-escpaenow-live-in-blue/
    https://indianwebseries.xyz/adity-mistry-latest-hot-instagram-live/
    https://indianwebseries.xyz/annie-sharma-latest-onlyfans-live/
    https://indianwebseries.xyz/baby-doll-pink-dress-live/

    2
    https://indianwebseries.xyz/mausami-udeshi-latest-live-dance/
    https://indianwebseries.xyz/abha-paul-app-video/
    https://indianwebseries.xyz/palang-tod-gehana-vashisth/
    https://indianwebseries.xyz/sexy-gunjan-aras-in-black-lingrie/
    https://indianwebseries.xyz/meeti-kalher-latest-5-min-nude-massage-video/
    https://indianwebseries.xyz/meeti-kalher-latest-app-2-videos/
    https://indianwebseries.xyz/rajsi-verma-latest-paid-video/
    https://indianwebseries.xyz/oasi-das-latest-23-min-bath-video/

    3
    https://indianwebseries.xyz/rupssa-latest-31-min-premium-live-with-clear-hindi-audio/
    https://indianwebseries.xyz/ashwitha-latest-7-min-onlyfans-video/
    https://indianwebseries.xyz/aliya-ghosh-hot-striptease-live/
    https://indianwebseries.xyz/koyel-sarkar-escape-tv-2-july-live/
    https://indianwebseries.xyz/sax-ka-silsila-2021-hindi-short-film-boommovies/
    https://indianwebseries.xyz/palang-tod-friend-request-e01-2021-hindi-hot-web-series-ullu/
    https://indianwebseries.xyz/sundra-bhabhi-5-2021-hindi-hot-web-series-cinema-dosti-originals/



    ReplyDelete
  19. https://indianwebseries.xyz/simran-kaur-latest-36-min-app-live/
    https://indianwebseries.xyz/lintang-abdullah-escapenow-hotty-girl/
    https://indianwebseries.xyz/moumita-bose-latest-escapenow-live-show/
    https://indianwebseries.xyz/rajshri-verma-latest-solo-dildo-play/
    https://indianwebseries.xyz/raveena-latest-escapenow-show/
    https://indianwebseries.xyz/real-nasha-exclusive-sexy-paid-live-video/
    https://indianwebseries.xyz/himani-2-girl-hot-tango-live-05-july/
    https://indianwebseries.xyz/misti-basu-05-july-hot-tango-live-in-saree/
    https://indianwebseries.xyz/oasi-das-latest-onlyfans-4-min-clip/
    https://indianwebseries.xyz/category/tango-live/neighborhood-hot-wife/
    https://indianwebseries.xyz/moody-beasty-latest-tango-nude-live/
    https://indianwebseries.xyz/city-s01-e02-2021-hindi-hot-web-series-dreamsfilms/
    https://indianwebseries.xyz/category/adult-contents/
    https://indianwebseries.xyz/tantra-s01-e01-2021-hindi-hot-web-series-hotsite/
    https://indianwebseries.xyz/puddan-s01-e02-2021-hindi-hot-web-series-cineprime/
    https://indianwebseries.xyz/debolina-saree-2021-hot-hindi-photoshoot-md-entertainment/
    https://indianwebseries.xyz/biwi-ka-boyfriend-s01-e01-2020-unrated-hindi-hot-web-series-hot-masti-app/
    https://indianwebseries.xyz/malal-s01-e01-2021-hindi-hot-web-series-aappytv/
    https://indianwebseries.xyz/queen-manvi-latest-no-bra-nipples-visible-live/
    https://indianwebseries.xyz/tiktoker-bhavya-latest-1-to-1-live-1st-time-boobs-show/
    https://indianwebseries.xyz/aditi-mistry-latest-4-july-live-23-min/
    https://indianwebseries.xyz/gunjan-aras-latest-live-1-hour/
    https://indianwebseries.xyz/mtv-spistsvilla-anjali-gaud-latest-stripping-7-min-video/

    ReplyDelete

  20. | 03090222212 Mr. K.K | Escorts in Islamabad
    Welcome to Escorts Service Islamabad (Escorts in Islamabad provider).Call girls in Islamabad We are the top one of the best escorts agencies in Islamabad. | 03090222212 Mr. K.K | VIP Escorts in Islamabad Escorts service Islamabad is the most trusted escorts Provider and one of the biggest agencies. VIP Islamabad Escorts Elite Escorts Islamabad Islamabad Escorts
    | 03090222212 Mr. K.K |

    ReplyDelete
  21. | 03043444111 Salman | Escorts in Lahore We are the most trusted escort service and call girls supplier in Lahore. Escorts service Lahore We promise you that we will provide you cheap girls in Lahore you choose we will never deceive you like others. Call girls in Lahore Moreover, our Escort in Lahore are very skilled and capable and do their work with full loyalty. VIP Call girls in Lahore
    | 03043444111 Salman |

    ReplyDelete
  22. | 03043444111 Salman | Escorts in Lahore Escorts service Lahore is the most trusted escorts Provider and one of the biggest agencies. Call girl in Lahore We have real and trusted Lahore escorts for our Customers. Escort in Lahore We aim to build a good relationship with customers with our VIP Model Escorts in Lahore. Lahore Escorts Service We also have adult many models in Lahore, who are providing escorts services through our agency. Escorts service Lahore You can enjoy your time with hot models in Lahore. We are updating our Lahore Escorts on a website regular basis. Escorts service in Lahore
    | 03043444111 Salman |

    ReplyDelete
  23. | 03043444111 Salman | Call girls in Lahore
    VIP Escorts in Lahore is at the highest point of most escorts.Escorts Lahore They are lovely and hot and bright as well. VIP Call girls LahoreThey are a combo of excellence with cerebrums. They offer you themselves. They will show you attractive moves and will play with you, and will make you insane. VIP Escorts in Lahore They consummately comprehend what you need from these lovely, enchanting hot girls. Escorts service Lahore These young ladies are sweet and hot in talking, respectful, restrained in conduct.

    ReplyDelete
  24. You might be profoundly instructed, however one thing without a doubt, the customary schooling has not shown you how to appreciate with an Islamabad Call Girls. Perhaps everyone accepts that you ought to learn it without anyone else. Luckily, you have Miss Islamabad to show you the most ideal approach to capitalize on your experience with the Escorts in Islamabad.Click Here to visit.

    ReplyDelete
  25. I meant to say!
    Lyrica 300 mg Capsule is a brand name for the medication pregabalin. It is an anticonvulsant drug that is also used to treat certain types of nerve pain and fibromyalgia. pregabalin works by reducing the abnormal electrical activity in the brain that can cause seizures and by modulating pain signals in the nervous system.

    ReplyDelete