All problems
Branching Process Extinction Probability
Problem
Probability that a branching process dies out, given the offspring distribution probs (probs[k] = P(k offspring)). The extinction probability is the smallest fixed point q of q = sum(probs[k] * q^k), found by iterating from 0. Return 1.0 when the mean offspring number is at most 1 or the distribution is empty.
Hint
Start from q = 0 and use the fact that the extinction probability is the smallest fixed point.
Test cases
case 1
in: [[0.25,0.5,0.25]]
expected: 1
case 2
in: [[0.2,0.3,0.5]]
expected: 0.3999999999997775
case 3
in: [[0.1,0.2,0.3,0.4]]
expected: 0.13278221853728808
case 4
in: [[1]]
expected: 1
case 5
in: [[0.5,0.5]]
expected: 1
Starter codePython
def branching_extinction_probability(probs):
# Your code here
pass5 test cases · run your code against them in the editor