예제 #1
0
def question_eight(p1 = 0.0,
                   p2 = 0.0,
                   p3 = 0.0,
                   p4 = 0.0):
    # ======= Reference =========
    """
    # Result: State 1
    a_11 = 0
    a_12 = 0.5
    a_13 = 0.5
    a_14 = 1 / 3

    # Result: State 2
    a_21 = 1 / 3
    a_22 = 0
    a_23 = 0
    a_24 = 1 / 3

    # Result: State 3
    a_31 = 1 / 3
    a_32 = 0
    a_33 = 0
    a_34 = 1 / 3

    # Result: State 4
    a_41 = 1 / 3
    a_42 = 0.5
    a_43 = 0.5
    a_44 = 0
    """
    # ======= END Reference =========
    
    # ======= Constants =========
    p_values = [ p1, p2, p3, p4 ]
    a_values = [ [0.0, 0.5, 0.5, 1.0 / 3.0],
                 [1.0 / 3.0, 0.0, 0.0, 1.0 / 3.0],
                 [1.0 / 3.0, 0.0, 0.0, 1.0 / 3.0],
                 [1.0 / 3.0, 0.5, 0.5, 0] ]

    # ======= END Constants =========

    return nth_period( p_values, a_values, 2 )[3]
예제 #2
0
def question_five(p1 = 0.0,
                  p2 = 0.0):
    # ======= Reference =========
    """
    # Result: State 1
    a_11 = 2 / 3
    a_12 = 1 / 2

    # Result: State 2
    a_21 = 1 / 3
    a_22 = 1 / 2
    """
    # ======= END Reference =========
    
    # ======= Constants =========
    p_values = [ p1, p2 ]
    a_values = [ [ 2.0 / 3.0, 0.5 ],
                 [ 1.0 / 3.0, 0.5 ] ]

    # ======= END Constants =========

    return nth_period( p_values, a_values, 2 )[0]