Esempio n. 1
0
def get_result_MjMi_for_N_step_with_fixed_Q_t(Q, t, start_num, max_num, loop_step):

    assert(Q < t)

    MajorA_2d_sorted_arr, MinorA_2d_sorted_arr, smallest_interval = get_MajorA_MinorA(Q, t)

    result_list=[]

    # We choose a prime, this will determine the interval step.
    # An prime number will make numeric calculation less prone to error.
    # If N  is a multiply of num_of_integration_step, it can cause numeric error in trignometric summation
    # num_of_integration_step = 10007       # an old prime
    num_of_integration_step = 19997

    # try different N
    # Note: whenever, N is a multiple of num_of_integration, the value will be invalid
    for N in xrange(start_num, max_num+1, loop_step):

        if((N% num_of_integration_step) == 0):
            print '__WARNIING__, N = %d is a multiply of num_of_integration_step = %d'%(N, num_of_integration_step)

        # study the effect of step to see how it affect the result.
        for xstep in xrange(1, 2, 1):

            # this will give smalltest step = 0.001
            step = float(xstep)/num_of_integration_step

            # if step is largest than smallest_interval of fare sequence, then
            # this integration does not make sense
            assert(step < smallest_interval)

            result = result_MjMn(N, step, MajorA_2d_sorted_arr, MinorA_2d_sorted_arr, t)
            result['smallest_interval'] = smallest_interval

            result_list.append(result)

    results_all = {'Q': Q,
                   't': t,
                   'result_list': result_list, }

    return results_all
Esempio n. 2
0
    np.set_printoptions(precision=5)
    np.set_printoptions(suppress=True)

    N_list, v_bound_list = vino_bound_trend()

    # Q =20
    # Q =3
    # tao must be larger than 2*Q^2
    tao = 4*Q*Q + 1

    # N = 909
    # M = 50000
    step = 1./M

    MajorA_2d_sorted_arr, MinorA_2d_sorted_arr, smallest_interval, MA_a_q_sorted_arr = get_MajorA_MinorA(Q, tao)
    print MajorA_2d_sorted_arr

    a_q_list, F_N_a_q_list = F_N_a_q(MA_a_q_sorted_arr, N)
    a_q_x_list, F_N_a_q_x_list = F_N_x(MA_a_q_sorted_arr, MajorA_2d_sorted_arr, N, step)

    if(A == 0):
        # note: t is tao in Pan's book P4, formula 11.
        # this is to move interval [0, 1] to [-1/t, 1 - 1/t]
        t1 = 99999999999999999                       # to get 1/t close to 0, this is to shift interval [0, 1] to [-1/t, 1-1/t]
        arc1 = get_arc(t1)

        t2 = 333333                                 # try another t, to get 1/t close to 0
        arc2 = get_arc(t2)

    if(A == 1):