def mapping_zeros_onto_unit_circle_exp_j_gamma(start, num_of_points, wrap_around_once = True, negative_gamma = False):

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

    # create 1_D array in numpy
    var_arr = np.zeros(num_of_points, dtype = np.complex64)

    end_num = start + num_of_points

    begin = gamma_list[start]
    end =gamma_list[end_num - 1]

    for n in range(start, end_num):

        # print gamma_list[n]
        if(wrap_around_once == True ):
            tmp = wrap_around_unit_circle_once(begin, end, gamma_list[n])

        else:
            tmp = gamma_list[n]

        # return exp(-j*gamma) or its wrap_around once version
        if(negative_gamma == True):
            phase = -1j*tmp

        # return exp(j*gamma) or its wrap_around once version
        else:
            phase = 1j*tmp

        # var_arr[0][n - start] = np.exp(phase)
        var_arr[n - start] = np.exp(phase)

    return var_arr
Example #2
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)
Example #3
0
def first_1000_zeros_determine_prime_locations(upto_n):

    input_file_name = 'first_1000_zeros.txt'
    gamma_list = read_zeros_to_array(input_file_name)
    # upto_n = 30
    num_of_zeros = len(gamma_list)
    print 'num_of_zeros = ', num_of_zeros

    cos_logx_gamma_list, x_range_arr = get_sum_cos_log_list(upto_n, gamma_list)
    plt.figure()
    plot_one_list(cos_logx_gamma_list, upto_n, x_range_arr, 'primes and prime power locations determined by 1st 1000 zeros')
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
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
Example #6
0
def plot_x_p_pair_using_some_algebraic(num_of_zeros, upto_n):

    input_file_name = 'first_1000_zeros.txt'
    gamma_list = read_zeros_to_array(input_file_name)
    beta = 0.5
    print 'num_of_zeros = ', num_of_zeros

    x_p_pair_list, x_range_arr = get_x_p_pair_sum_list(upto_n, gamma_list[:num_of_zeros], beta)

    plt.figure()
    titlestr = 'sum of x^p pairs, %d zeros, algebraic method'%(num_of_zeros)
    plot_one_list(x_p_pair_list, upto_n, x_range_arr, titlestr)

    x_p_pair_list_arr = np.asarray(x_p_pair_list)
    x_minus_x_p_pair = np.subtract(x_range_arr, x_p_pair_list_arr )

    plt.figure()
    titlestr = 'x - (sum of x^p pairs), %d zeros, algebraic method'%(num_of_zeros)
    plot_one_list(x_minus_x_p_pair, upto_n, x_range_arr, titlestr)
Example #7
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)
    (options, args) = parser.parse_args()

    if(len(args) != 3):
        print 'Wrong arguments, require parameters: target_num, factor_list_option, num_of_zeros '
        print 'factor_list_option = 1 for mert, 3 for liouvi'
        print 'num_of_zeros, recommend 50 to see good approximation, 1 to see 1st zero contribution'
        sys.exit(0)

    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):