will_you_be_alive
    
    
    
      will_you_be_alive,
      a MATLAB code which 
      uses simulation to investigate problems in probability,
      from Paul Nahin's book
      "Will You Be Alive 10 Years From Now?".
    
    
      Licensing:
    
    
      The information on this web page is distributed under the MIT license.
    
    
      Languages:
    
    
      will_you_be_alive is available in 
      a MATLAB version and
      an Octave version and
      a Python version. 
    
    
      Related Data and Programs:
    
    
      
      will_you_be_alive_test
    
    
      
      digital_dice,
      a MATLAB code which
      contains the scripts used to illustrate Paul Nahin's "Digital Dice".
    
    
      
      dueling_idiots,
      a MATLAB code which
      contains the scripts used to illustrate Paul Nahin's "Dueling Idiots".
    
    
      
      mortality,
      a dataset directory which
      lists mortality information for a single year,
      the age at death, number of deaths, male deaths and females deaths,
      for a total of 2,423,509 deaths,
      including 1,203,812 males and 1,219,697 females, 
      between the ages of 0 and 114.
    
    
      Reference
    
    
      
        - 
          Paul Nahin,
          Will You Be Alive 10 Years From Now?,
          Princeton, 2014,
          ISBN: 978-0691156804,
          LC: QA273.25.N344
         
      
    
    
      Source Code:
    
    
      
        - 
          airplane_seat.m, 
          the airplane seating puzzle.
        
 
        - 
          before.m, 
          computes the probability of observing 4 heads before 7 tails.
        
 
        - 
          bernoulli_dice.m, 
          simulates a Bernoulli dice problem.
        
 
        - 
          bingo.m, 
          plays a simplified version of bingo, using 4 different cards,
          and showing a case on nontransitivity.
        
 
        - 
          black.m, 
          estimates the probability that the last ball drawn is black.
        
 
        - 
          chain.m, 
          estimates the probability that a chain letter will go extinct,
          given the number of copies to be made, and the probability that
          a recipient will make those copies.
        
 
        - 
          double_dart.m, 
          estimates the chance that two darts in the unit circle will be
          at least 1 unit apart.
        
 
        - 
          double_six.m, 
          computes the expected number of dice tosses before observing two
          consecutive 6's.
        
 
        - 
          draw.m, 
          simulates a single round of the marble drawing process.
        
 
        - 
          final.m, 
          computes the probablity for random A and B that A^2/3+B^2/3 < 1.
        
 
        - 
          flips.m, 
          estimates chances of an even number of heads in N coin flips.
        
 
        - 
          galileo.m, 
          computes the frequency of various results when rolling three dice.
        
 
        - 
          golf.m, 
          probability golf ball in unit square is closer to center than to
          an edge.
        
 
        - 
          gamblers_ruin.m, 
          A and B gamble at a dollar a game until one of them is bankrupt.
        
 
        - 
          inside.m, 
          analyzes the origin in the random triangle in the circle problem.
        
 
        - 
          liar.m, 
          analyzes the liar problem.
        
 
        - 
          long.m, 
          analyzes a stick-breaking problem.
        
 
        - 
          marks.m, 
          analyzes the marks problem.
        
 
        - 
          newton.m, 
          simulates Newton's dice problem.
        
 
        - 
          obtuse1.m, 
          estimate the probability that a triangle witll be obtuse,
          if it has side 1 of length 1, and
          other two sides have lengths uniformly unit random.
        
 
        - 
          obtuse2.m, 
          estimate the probability that a triangle witll be obtuse.
        
 
        - 
          plums.m, 
          average distance of closest of n plums to the surface of a
          unit spherical pudding.
        
 
        - 
          ping_pong.m, 
          probability of winning pingpong.
        
 
        - 
          ratio1.m, 
          probability a random ratio is greater than a given limit.
        
 
        - 
          ratio2.m, 
          probability a random ratio is greater than a given limit.
        
 
        - 
          spaghetti.m, 
          the spaghetti loop problem.
        
 
        - 
          square_adjacent.m, 
          expected distance between random points on adjacent sides of
          the perimeter of a unit square.
        
 
        - 
          square_inside.m, 
          expected distance between random points inside
          a unit square.
        
 
        - 
          square_opposite.m, 
          expected distance between random points on opposite sides of
          the perimeter of a unit square.
        
 
        - 
          squash.m, 
          determines the likelihood that a player will win at squash.
        
 
        - 
          steve2.m, 
          Steve's elevator problem.
        
 
        - 
          ten_years.m, 
          computes the probability that a certain person will still be alive
          in 1, 2, ..., 10 years.
        
 
        - 
          top.m, 
          analyzes the dreidel game.
        
 
        - 
          twins.m, 
          the twins problem.
        
 
      
    
    
    
      Last revised on 12 January 2022.