Ejemplo n.º 1
0
        return a

    flist = [f1, f2, f3]

    ## APPLYING RK4 ALGO

    from rk4_fnc_pre import rk4_gen

    (y, time) = rk4_gen(flist, initials, timescale, maxt)

    yA = y
    y = y.tolist()

    ## PLOTS

    fncs.plot_2d(y[2], y[0], 'Time', 'Position', str(p) + '.0', lw=0.5)
    fncs.plot_2d(y[0], y[1], 'Position', 'Velocity', str(p) + '.1', lw=0.5)

    ## POINCARE

    (p_maps_pos, p_maps_vel) = fncs.poincare_map(y[0], y[1], n, cycles)

    fncs.plot_2d(p_maps_pos,
                 p_maps_vel,
                 'Position',
                 'Velocity',
                 str(p) + '.1',
                 linestyle='none',
                 marker='.')

    ## EMBEDDED DIMENSION
Ejemplo n.º 2
0
        a = w

        return a

    flist = [f1,f2,f3]

    ## APPLYING RK4 ALGO

    from rk4_fnc_pre import rk4_gen

    (y, time) = rk4_gen(flist, initials, timescale, maxt)

    y = y.tolist()

    ## PLOTS

    fncs.plot_2d(y[2], y[0], 'Time', 'Position', str(i)+ '.0',lw = 0.5)
    fncs.plot_2d(y[1], y[0], 'Velocity', 'Position', str(i)+ '.1',lw = 0.5)

    ## EMBEDDED DIMENSION

    start = 5
    length = len(y[0])
    
    position_add1 = fncs.embed_dim(y[0],length,start)
    fncs.plot_2d(position_add1,y[0],
                                'Position + ' + str(start), 'Position',
                                str(i)+ '.2', lw = 0.5)

plt.show()
Ejemplo n.º 3
0
        a = r[p] * x * (1 - x / K)
        return a

    flist = [f1]

    ## APPLYING RK4 ALGO

    from rk4_fnc_pre import rk4_gen

    (y, time) = rk4_gen(flist, initials, timescale, maxt)

    y = y.tolist()

    ## PLOTS

    fncs.plot_2d(time, y[0], 'Time', 'Position', str(p) + '.0', lw=0.5)

    ## POINCARE

##    (p_maps_pos,p_maps_vel) = fncs.poincare_map(y[0],y[1],n,cycles)
##
##    fncs.plot_2d(p_maps_pos, p_maps_vel,
##                 'Position', 'Velocity', str(p)+ '.1',
##                 linestyle = 'none', marker = '.')
##

## EMBEDDED DIMENSION

##    start = 5
##    length = len(y[0])
##
Ejemplo n.º 4
0
length = int(maxt / timescale)
idx = 0


def listmake(n):
    return [0] * n


xA = listmake(length)
tA = listmake(length)

alist = [0.5, 0.75, 0.87, 0.9]

for p in range(0, len(alist)):

    idx = 0
    initial = 0.2
    xA[0] = initial
    tA[0] = 0

    while idx < length - 1:

        xA[idx + 1] = 4 * alist[p] * xA[idx] * (1 - xA[idx])
        tA[idx + 1] = tA[idx] + timescale
        idx = idx + 1

    fncs.plot_2d(tA, xA, 'Time', 'Position', str(p) + '.0', lw=0.5)

plt.show()
Ejemplo n.º 5
0
        xpos1[i] = m.sin(y[0][i])
        xpos2[i] = m.sin(y[0][i]) + m.sin(y[1][i])
        ypos1[i] = -m.cos(y[0][i])
        ypos2[i] = -m.cos(y[0][i]) - m.cos(y[1][i])

    # Poincare section when bob goes from -ve to +ve

    filtered_array = fncs.bools_spatial_1var(xpos2, 0, 1)
    poincare_array = nparray[:, filtered_array]
    poin_phases = [(phases + np.pi) % (2 * np.pi) - np.pi
                   for phases in poincare_array[0]]

    fncs.plot_2d(poin_phases,
                 poincare_array[2],
                 'Theta 1',
                 'Velocity 1',
                 str(p) + '.1',
                 linestyle='none',
                 marker='.')

    ## Mapping to pie plot

    import operator as op

    pie_plot_raw = np.ndarray(shape=(5, length), dtype=float)
    pie_plot_raw[0] = time

    #Overall direction (column 2)

    direc_top = fncs.bools_spatial_2var(xpos1, op.ge, 0, ypos1, op.gt, 0)
    posi_direc_moment = np.array([x < 0 for x in y[2]