Beispiel #1
0
def get_bif(parameter_range,
            offset,
            count,
            start_point_function,
            epsilon,
            end_if_ext,
            stoch_offset=0):
    xs = []
    ys = []
    for parameter in parameter_range:
        start = start_point_function(parameter)
        func = get_ricker_function(parameter)
        sequence = get_sequence(start, func, offset, end_if_ext, 0.0)
        sequence = get_sequence(sequence[-1], func, stoch_offset, end_if_ext,
                                epsilon)
        if not len(sequence) < stoch_offset:
            sequence = get_sequence(sequence[-1], func, count, end_if_ext,
                                    epsilon)
            if len(sequence) < count:
                sequence = []
        else:
            sequence = []
        for value in sequence:
            xs.append(parameter)
            ys.append(value)
    return xs, ys
Beispiel #2
0
def f_main():  # just функция с лестницей Ламерея
    r = 2
    x_start = 1.2
    count = 100
    start = 0
    end = 2
    delta = 0.0001

    func = get_ricker_function(r)
    #func = get_ricker_composition(r)

    xl, yl = get_ladder(x_start, func, count)
    xl = xl[1:]
    yl = yl[1:]

    xpath = 'files/xlad.txt'
    ypath = 'files/ylad.txt'

    write_to_files(xl, yl, xpath, ypath)

    x, y = get_function_points(get_range(start, end, delta), func)

    xpath = 'files/fx.txt'
    ypath = 'files/fy.txt'

    write_to_files(x, y, xpath, ypath)
Beispiel #3
0
def extinction_cycle_main():
    epsilon = 3
    r = 0.125
    curr = 10

    f = get_ricker_function(r)

    values = []

    while True:
        curr = f(curr) + get_noise(epsilon)
        values.append(curr)
        if curr <= 0:
            break

    indexes = [i for i in range(1, len(values) + 1)]

    xpath = 'files/pointst.txt'
    ypath = 'files/pointsv.txt'

    write_to_files(indexes, values, xpath, ypath)

    erf_value = 2.33
    c1, c2 = get_cycle2_points(r)
    ys = get_cycle_boundaries(c1, c2, r, erf_value, epsilon)
    print(ys)
Beispiel #4
0
def get_cycle2_points(r):
    f_start = 1.001
    f_end = 100
    f = lambda x: get_ricker_function(r)(x) - x
    f2 = lambda x: get_ricker_composition(r)(x) - x
    root = get_root(f_start, f_end, f)
    root_cycle_first = get_root(f_start, root - 0.001, f2)
    root_cycle_second = get_root(root + 0.001, f_end, f2)
    return root_cycle_first, root_cycle_second
Beispiel #5
0
def get_boundaries_for_range(parameter_range, epsilon, erf_value):
    xs = []
    ys = []
    for r in parameter_range:
        func = lambda x: get_ricker_function(r)(x) - x
        root = get_root(1.001, 100, func)  # хз, пока за рамки не выходит
        x_min, x_max = get_boundaries_for_equilibrium(root,
                                                      get_ricker_derivative(r),
                                                      erf_value, epsilon)
        xs.append(r)
        xs.append(r)
        ys.append(x_min)
        ys.append(x_max)
    return xs, ys
Beispiel #6
0
def bif_point_proof_main():  # уточнение первой точки бифуркации
    delta = 0.00001
    start = 0.177 + delta
    end = 0.179

    rs = get_range(start, end, delta)

    roots = []

    rs = [0.1787]

    precision = 0.0001

    for r in rs:
        f = get_ricker_function(r)
        der = get_ricker_derivative(r)
        equilibrium = get_root(1.01, 100, lambda x: f(x) - x, 0.000001)
        print(r)
        print(equilibrium)
        print(der(equilibrium))
        roots.append(equilibrium)