#Fourth-Order Forest Ruth

for j in range(len(dt)):
    r_0 = [(1, 0, 0)]
    v_0 = [(0, .5, 0)]
    t = 0
    r = r_0
    v = v_0
    s = 2**(1 / 3)
    H = dt[j] / (2 - s)

    for i in range(0, int((6 * np.pi) / dt[j])):
        v_n = np.asarray(v[len(v) - 1])
        r_n = np.asarray(r[len(r) - 1])

        r_n = use.int_q_array(r_n, v_n, .5 * dt[j])
        B = np.asarray([0, 0, 1 / (r_n[0]**2)])
        v_n = use.v_magnetic_calc(r_n, v_n, B, dt[j])
        r_n = use.int_q_array(r_n, v_n, .5 * dt[j])

        r.append(r_n)
        v.append(v_n)

    r = np.asarray(r)
    x_val = [x[0] for x in r]
    y_val = [x[1] for x in r]
    ax3.plot(x_val, y_val)

###################################################
###################################################
#graphing
Beispiel #2
0
# y_0 = -50
# v_int = 1/10

# r_0 = [(x_0, 0)]
# v_0 = [(0, v_int)]

# r = r_0
# v = v_0
# A_x = []
# A_y = []

for i in range(0, int(10000)):
    v_n = np.asarray(v[len(v) - 1])
    r_n = np.asarray(r[len(r) - 1])

    r_n = use.int_q_array(r_n, v_n, .5 * t)
    v_n = use.int_v_array(r_n, r1, r2, v_n, t)
    r_n = use.int_q_array(r_n, v_n, .5 * t)

    # if i > 9991:
    # print(r)
    # exit()
    # print('we made it through!!')

    r.append(r_n)
    v.append(v_n)

r = np.asarray(r)
l = []
x_val = [x[0] for x in r]
y_val = [x[1] for x in r]
for j in range(len(dt)):
    r_0 = [(1, 0, 0)]
    v_0 = [(0, .5, 0)]
    t = 0
    r = r_0
    v = v_0
    s = 2**(1 / 3)
    H = dt[j] / (2 - s)

    for i in range(0, int((6 * np.pi) / dt[j])):
        v_n = np.asarray(v[len(v) - 1])
        r_n = np.asarray(r[len(r) - 1])

        #############
        r_n = use.int_q_array(r_n, v_n, .5 * H)
        B = np.asarray([0, 0, 1 / r_n[0]**2])
        v_n = use.v_magnetic_calc(r_n, v_n, B, H)
        r_n = use.int_q_array(r_n, v_n, .5 * H)
        ##############
        r_n = use.int_q_array(r_n, v_n, -.5 * s * H)
        B = np.asarray([0, 0, 1 / r_n[0]**2])
        v_n = use.v_magnetic_calc(r_n, v_n, B, -s * H)
        r_n = use.int_q_array(r_n, v_n, -.5 * s * H)
        #############
        r_n = use.int_q_array(r_n, v_n, .5 * H)
        B = np.asarray([0, 0, 1 / r_n[0]**2])
        v_n = use.v_magnetic_calc(r_n, v_n, B, H)
        r_n = use.int_q_array(r_n, v_n, .5 * H)
        ##############
        r.append(r_n)