예제 #1
0
def plot_x_p_pair_using_direct_calculation(num_of_zeros, upto_n):

    input_file_name = 'first_1000_zeros.txt'
    gamma_list = read_zeros_to_array(input_file_name)
    # print gamma_list

    assert(num_of_zeros >= 1)
    # this function only support up to 1000 zeros
    assert(num_of_zeros <= 1000)
    assert(upto_n > 2)

    rou_list, rou_conj_list = get_rou_rou_conj_list(gamma_list[:num_of_zeros])
    x_p_x_p_conj_pair_sum_list, x_range_arr = get_x_p_pair_directly(rou_list, rou_conj_list, upto_n)
    x_p_x_p_conj_pair_sum_list = np.asarray(x_p_x_p_conj_pair_sum_list, dtype=complex)

    # get real part, even though imag part of x_p_x_p_conj_pair_sum_list should be zero
    # maybe because of some numerical calculation issue, it can have very tiny left,
    # so we get real part, because we only can plot real part anyway
    x_p_x_p_conj_pair_sum_list_real = x_p_x_p_conj_pair_sum_list.real
    plt.figure()
    titlestr = 'sum of x^p pairs, %d zeros, direct calculation'%(num_of_zeros)
    plot_one_list(x_p_x_p_conj_pair_sum_list_real, upto_n, x_range_arr,titlestr)

    # calculate 'x - sum(x_p_x_p_conj)'
    x_p_x_p_conj_pair_sum_list_real_arr = np.asarray( x_p_x_p_conj_pair_sum_list_real)
    x_minus_x_p_x_p_conj_pair = np.subtract(x_range_arr, x_p_x_p_conj_pair_sum_list_real_arr)

    # plot 'x - sum(x_p_x_p_conj)' against x
    plt.figure()
    titlestr = 'x - (sum of x^p pair), %d zeros, direct calculation'%(num_of_zeros)
    plot_one_list(x_minus_x_p_x_p_conj_pair, upto_n, x_range_arr, titlestr)
def mapping_zeros_on_unit_circle_s_1_minus_s(num_of_zeros):

    input_file_name = 'first_1000_zeros.txt'
    gamma_list = read_zeros_to_array(input_file_name)

    assert(num_of_zeros >= 1)
    # this function only support up to 1000 zeros
    assert(num_of_zeros <= 1000)

    rou_list, rou_conj_list = get_rou_rou_conj_list(gamma_list[:num_of_zeros])

    rou_on_circle_list = convert_critline_to_unit_circle_s_1_minus_s(rou_list)
    rou_conj_on_circle_list = convert_critline_to_unit_circle_s_1_minus_s(rou_conj_list)

    return rou_on_circle_list, rou_conj_on_circle_list
예제 #3
0
def lamda_n_from_zet_zeros(num_of_lamda, num_of_terms):

    input_file_name = 'first_10000_zeros.txt'
    gamma_list = read_zeros_to_array(input_file_name)

    assert(num_of_terms >= 1)
    # this function only support up to 10000 zeros
    assert(num_of_terms <= 10000)

    rou_list, rou_conj_list = get_rou_rou_conj_list(gamma_list[:num_of_terms])

    lamda_lst = []

    for n in range(1, num_of_lamda):
        lamda = lamda_n(n, num_of_terms, rou_list, rou_conj_list)
        print 'n = ', n, ', lamda_n:', lamda
        lamda_lst.append(lamda)

    return lamda_lst
예제 #4
0
def verify_slow_converge_sign_change_of_x_p_pair_sequence(num_of_zeros, x):

    input_file_name = 'first_1000_zeros.txt'
    gamma_list = read_zeros_to_array(input_file_name)
    # print gamma_list

    assert(num_of_zeros >= 1)
    # this function only support up to 1000 zeros
    assert(num_of_zeros <= 1000)

    rou_list, rou_conj_list = get_rou_rou_conj_list(gamma_list[:num_of_zeros])
    x_p_x_p_conj_pair_list = get_x_p_pair_sequences(rou_list, rou_conj_list, x)
    x_p_x_p_conj_pair_list = np.asarray(x_p_x_p_conj_pair_list, dtype=complex)

    # get real part, even though imag part of x_p_x_p_conj_pair_sum_list should be zero
    # maybe because of some numerical calculation issue, it can have very tiny left,
    # so we get real part, because we only can plot real part anyway
    x_p_x_p_conj_pair_list_real = x_p_x_p_conj_pair_list.real
    plt.figure()
    titlestr = 'x^p pair sequences, x = %10.2f, %d zeros'%(x, num_of_zeros)
    x_range_arr = range(1, num_of_zeros + 1)
    plot_one_list(x_p_x_p_conj_pair_list_real, x_range_arr,titlestr)
    target_num = int(args[0])
    factor_list_option = int(args[1])
    num_of_zeros = int(args[2])             # 1 to see the contribution from 1st zero, 50 for good approximation

    assert(num_of_zeros >= 1) and (num_of_zeros <= 1000)

    input_file_name = 'first_1000_zeros.txt'
    gamma_list = read_zeros_to_array(input_file_name)
    print gamma_list

    assert(num_of_zeros >= 1)
    # this function only support up to 1000 zeros
    assert(num_of_zeros <= 1000)

    rou_list, rou_conj_list = get_rou_rou_conj_list(gamma_list[:num_of_zeros])

    zet_2_pk_list, zet_deri_pk_list = pre_calculated_needed_zet_values_to_list(num_of_zeros, rou_list)

    check_lx_at_poly_conj_failed_x(num_of_zeros, rou_list, zet_2_pk_list, zet_deri_pk_list)
    
    summatory_approx_list = []

    if(factor_list_option == 1):
        for x in range(1, target_num + 1):

            # mx = lx_from_zet_zeros(num_of_zeros, x, rou_list)
            mx = mx_from_zet_zeros_using_pre_cal_zets(num_of_zeros, x, rou_list, zet_2_pk_list, zet_deri_pk_list)
            summatory_approx_list.append(mx)

            print 'x = ', x, ', mx = ', mx