My favorite way to compute Pi....experimentally!

Поділитися
Вставка
  • Опубліковано 13 чер 2024
  • Check out more pi approximation in this Maple Learn document: learn.maplesoft.com/d/OLPIBQF... My thanks to ‪@maplesoft‬ for sponsoring today's video!
    Buffon's problem is an experimental way to compute pi. Drop a bunch of toothpicks on a paper with equally spaced lines. Then pi is nothing but 2 divided by the probability that the toothpick lands on the line (when the spacing is the same length as the toothpick). In this video we'll see precisely why this is the case and check out a few other famous pi equations.
    0:00 Pi Experiment
    0:58 Driving the formula
    6:07 Dealing with arbitrary widths
    7:49 Pi approximations in Maple Learn
    Check out my MATH MERCH line in collaboration with Beautiful Equations
    ►beautifulequations.net/pages/...
    COURSE PLAYLISTS:
    ►DISCRETE MATH: • Discrete Math (Full Co...
    ►LINEAR ALGEBRA: • Linear Algebra (Full C...
    ►CALCULUS I: • Calculus I (Limits, De...
    ► CALCULUS II: • Calculus II (Integrati...
    ►MULTIVARIABLE CALCULUS (Calc III): • Calculus III: Multivar...
    ►VECTOR CALCULUS (Calc IV) • Calculus IV: Vector Ca...
    ►DIFFERENTIAL EQUATIONS: • Ordinary Differential ...
    ►LAPLACE TRANSFORM: • Laplace Transforms and...
    ►GAME THEORY: • Game Theory
    OTHER PLAYLISTS:
    ► Learning Math Series
    • 5 Tips To Make Math Pr...
    ►Cool Math Series:
    • Cool Math Series
    BECOME A MEMBER:
    ►Join: / @drtrefor
    MATH BOOKS I LOVE (affilliate link):
    ► www.amazon.com/shop/treforbazett
    SOCIALS:
    ►Twitter (math based): / treforbazett
    ►Instagram (photography based): / treforphotography

КОМЕНТАРІ • 40

  • @minamagdy4126
    @minamagdy4126 9 місяців тому +14

    For anyone interested in coding it up, a simplified scenario is (to guarantee closeness to the line and to ignore the mirror symmetry) to take a uniformly random x from [0,1) and theta from [0,pi/2), then you count a success if x + sin(theta) >= 1. The probability of success is still 2/pi. Note that sin and cos are interchangeable here.

  • @lexinwonderland5741
    @lexinwonderland5741 9 місяців тому +11

    Very unrelated but nice haircut dude! Whatever your latest look is looks very clean and sharp

    • @DrTrefor
      @DrTrefor  9 місяців тому +3

      Ha thank you! That is my wife’s amazing handiwork:D

  • @johnchessant3012
    @johnchessant3012 9 місяців тому +5

    Fun fact: The same formula holds even when the needle isn't a straight line, except it gives the _expected number_ of crossings; the intuition being that if your "needle" has the same length but is really curled up, it will be less likely to intersect a line but when it does, it will usually intersect it more than once.

    • @DrDeuteron
      @DrDeuteron 9 місяців тому +1

      so do you count the number of crossings? That's going to jack up my error estimate, as it's now a Poisson process.

  • @DrDeuteron
    @DrDeuteron 9 місяців тому +2

    Since one toothpick is a Bernoulli process, you get a binomial distribution, and the square of the uncertainty goes as P(1-P)/N.

  • @Javy_Chand
    @Javy_Chand 9 місяців тому +3

    That is some hilarious T-shirt!
    "sinx = opposite/hipopotamus"

    • @DrTrefor
      @DrTrefor  9 місяців тому +1

      haha I love it:D

  • @zeevkotzer549
    @zeevkotzer549 9 місяців тому +1

    There is a simpler random way to calculate pi by throwing arrows at a circle bounded by a square, and calculating pi from the ratio of the arrows inside the circle. Not only it's much simpler, simulating it does not require usage of pi or trigo functions - just random numbers, substruction and multiplication

  • @jeremytimothy3646
    @jeremytimothy3646 9 місяців тому +4

    Another wonderful video from my favorite math tutor. You're one of the reasons i fell in love with math and now i study it for the beauty not just the marks. Major thanks dr trefor

    • @DrTrefor
      @DrTrefor  9 місяців тому +2

      Wow, thank you!

    • @leif1075
      @leif1075 9 місяців тому

      ​@DrTrefor Yes thanks for sharing Dr Trefor. I really hope you can respond to my other comment when you can. Thanks very much.

  • @General12th
    @General12th 7 місяців тому +1

    Hi Dr. Bazett!
    Very cool!

  • @Ninja20704
    @Ninja20704 9 місяців тому +3

    Theres another pi formula which uses arctan, similar to the 1-1/3+1/5-... one. It is pi = 16arctan(1/5)-4arctan(1/239), and was used to calculate pi to 527 digits, which is the world record for calculating pi by hand. Could you maybe do a video on a geometric proof of this? Because I have no idea where it comes from.

    • @DrTrefor
      @DrTrefor  9 місяців тому +2

      I believe that family is all coming from the Taylor series for arctan

  • @mtaur4113
    @mtaur4113 7 місяців тому

    At the start of the video, the second = is also an "approximately", because you swap out a mathematical probability for its observed frequency.
    It's also probably not so easy to guarantee that the angles and positions are uniformly distributed on the range, but sample size is probably a much more relevant concern for a trial by hand anyway.

  • @kodychoi6984
    @kodychoi6984 9 місяців тому +2

    The integral of arccos(x) from 0 to 1 is the same as the integral of cos(x) from 0 to pi/2, which makes the calculation much easier. (Convince yourself graphically)

    • @DrTrefor
      @DrTrefor  9 місяців тому +1

      Absolutely!

  • @radupopescu9977
    @radupopescu9977 9 місяців тому

    Amazing!

  • @GeoffryGifari
    @GeoffryGifari 9 місяців тому +1

    Is this one of the ways of using monte carlo method to approximate π?

  • @schizoframia4874
    @schizoframia4874 9 місяців тому +1

    That is very cool

  • @vortex6132
    @vortex6132 9 місяців тому

    Hey man! This was a really nice simple and elegant proof. Side note: the chapter of "deriving the formula" was spelt as driving the formula, otherwise, great vid!

  • @GeoffryGifari
    @GeoffryGifari 9 місяців тому +1

    The formula uses probability. how can we express this as a counting problem?
    The number of toothpicks that intersect a line vs the total number of toothpicks?
    and the lined paper needs to be large enough so that every toothpick lies between two lines right?

  • @_abdul
    @_abdul 9 місяців тому +2

    Pi is Cool and all but I can't take my eyes away from that cute Hippopotamus.

  • @carly09et
    @carly09et 9 місяців тому

    Ah I was trying to recall this to prove the quantum version of pi - quantum length and angle from measurement 'noise'

  • @erawanpencil
    @erawanpencil 9 місяців тому +1

    If you toss as many toothpicks as there are lines on the page is there some connection with 1/e ? I keep trying to find ways to visualize the constant e but so far I've been told a catenary arch or a hanging chain are the only things that sorta get close.

    • @DrTrefor
      @DrTrefor  9 місяців тому +1

      I don’t think so, the rotations of the toothpicks make it reasonable that pi is involved but I can’t see an e

  • @billcook4768
    @billcook4768 9 місяців тому

    Fun stuff, but there’s an issue with your computer simulation. I suspect that pi exists somewhere in your code (or in the machine code for one of the functions you use). Could someone program a needle dropping simulation that calculates pi without already knowing pi?

    • @DrTrefor
      @DrTrefor  9 місяців тому +1

      The pi is purely emergent here. The simulation works by randomly choosing an x and y coordinate of midpoints from the square, randomly choosing a rotation angle, and then counts them up.

  • @davethesid8960
    @davethesid8960 9 місяців тому +1

    Before I liked, you'd got 314 likes, wow!

    • @DrTrefor
      @DrTrefor  9 місяців тому +1

      Haha that’s awesome

  • @MathsMadeSimple101
    @MathsMadeSimple101 8 місяців тому

    Maths is life

  • @andrewharrison8436
    @andrewharrison8436 9 місяців тому

    It's lovely maths, but lacks a certain practicality.
    Modelling it as a random walk suggest that the error should be 1/sqrt(n) so for 3 decimal places something like 1,000,000 throws would be needed.
    ... but we are in the company of mathematicians, why worry about such mundane issues.

  • @FredFred-wy9jw
    @FredFred-wy9jw 9 місяців тому

    I liked your analysis of this method to “compute” pi …. But the glib comment about just running a computer a million samples is fraught with danger. It’s very easy with this type of problem to run into problems with the random number generator used … first you need random pairs of numbers (x and theta), something an a lot of pseudo random number generators are very bad at, second it can be fairly easy to exceed the actual length of the generator is capable of generating i.e. its period. Many modern tools and computer libraries have generators that greatly reduce these issues and very many do not. A fun exercise is to calculate the convergence rate and the compare the analytical results to a computer experiment. The convergence rate is quite slow no surprise, but often the computer results stops improving after a surprising small number of trials.

  • @c.f.3503
    @c.f.3503 9 місяців тому +2

    First

    • @DrTrefor
      @DrTrefor  9 місяців тому +2

      Wow you are fast!

  • @drsteel8701
    @drsteel8701 Місяць тому

    You are such an amazing teacher. I really learn a lot from your lectures. Do you have an IG or Facebook?