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

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 40

  • @minamagdy4126
    @minamagdy4126 Год назад +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 Год назад +11

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

    • @DrTrefor
      @DrTrefor  Год назад +3

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

  • @Javy_Chand
    @Javy_Chand Год назад +3

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

  • @johnchessant3012
    @johnchessant3012 Год назад +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 Год назад +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.

  • @Ninja20704
    @Ninja20704 Год назад +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  Год назад +2

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

  • @GeoffryGifari
    @GeoffryGifari Год назад +1

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

  • @General12th
    @General12th 10 месяцев назад +1

    Hi Dr. Bazett!
    Very cool!

  • @DrDeuteron
    @DrDeuteron Год назад +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.

  • @GeoffryGifari
    @GeoffryGifari Год назад +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?

  • @schizoframia4874
    @schizoframia4874 Год назад +1

    That is very cool

  • @kodychoi6984
    @kodychoi6984 Год назад +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)

  • @davethesid8960
    @davethesid8960 Год назад +1

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

    • @DrTrefor
      @DrTrefor  Год назад +1

      Haha that’s awesome

  • @zeev549
    @zeev549 Год назад +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 Год назад +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  Год назад +2

      Wow, thank you!

    • @leif1075
      @leif1075 Год назад

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

  • @andrewharrison8436
    @andrewharrison8436 Год назад

    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.

  • @_abdul
    @_abdul Год назад +2

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

  • @erawanpencil
    @erawanpencil Год назад +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  Год назад +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

  • @MathsMadeSimple101
    @MathsMadeSimple101 Год назад

    Maths is life

  • @radupopescu9977
    @radupopescu9977 Год назад

    Amazing!

  • @mtaur4113
    @mtaur4113 10 месяцев назад

    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.

  • @vortex6132
    @vortex6132 Год назад

    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!

  • @FredFred-wy9jw
    @FredFred-wy9jw Год назад

    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.

  • @carly09et
    @carly09et Год назад

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

  • @billcook4768
    @billcook4768 Год назад

    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  Год назад +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.

  • @c.f.3503
    @c.f.3503 Год назад +2

    First

  • @drsteel8701
    @drsteel8701 5 месяцев назад

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