Ejemplo n.º 1
0
def student_test(arr_b, number_x=10):
    dispersion_b = sqrt(dispersion_b2)
    for column in range(number_x + 1):
        t_practice = 0
        t_theoretical = student(f3, q)
        for row in range(N):
            t_practice += middle_y[row] / N if column == 0 else middle_y[
                row] * matrix_pe[row][column - 1]
        if fab(t_practice / dispersion_b) < t_theoretical: arr_b[column] = 0
    return arr_b
Ejemplo n.º 2
0
def student(b_lst, number_x=10):
    disp_b = sqrt(disp_b2)
    for column in range(number_x + 1):
        tp = 0
        tt = Critical_values.get_student_value(f3, q)
        for row in range(N):
            if column == 0:
                tp += average_y[row] / N
            else:
                tp += average_y[row] * matrix_pfe[row][column - 1]
        if fab(tp / disp_b) < tt:
            b_lst[column] = 0
    return b_lst
Ejemplo n.º 3
0
def student_test(b_lst, number_x=10):
    """Критерій Стьюдента"""
    dispersion_b = sqrt(dispersion_b2)
    for column in range(number_x + 1):
        t_practice = 0
        t_theoretical = student_value(f3, q)
        for row in range(N):
            if column == 0:
                t_practice += average_y[row] / N
            else:
                t_practice += average_y[row] * matrix_pfe[row][column - 1]
        if fab(t_practice / dispersion_b) < t_theoretical:
            b_lst[column] = 0
    return b_lst
Ejemplo n.º 4
0
def student_test(arr_b, number_x=10):
    dispersion_b = sqrt(dispersion_b2)
    for column in range(number_x):
        t_practice = 0
        t_theoretical = critStudentValue(f3, q)
        for row in range(N):
            if column == 0:
                t_practice += middle_y[row] / N
            else:
                t_practice += middle_y[row] * matrix_of_planning[row][column -
                                                                      1]
        if fab(t_practice / dispersion_b) < t_theoretical:
            arr_b[column] = 0
    return arr_b
def student_test(arr_b, number_x=10):
    start_time = datetime.now()
    dispersion_b = sqrt(dispersion_b2)
    for column in range(number_x + 1):
        t_practice = 0
        t_theoretical = student(f3, q)
        for row in range(N):
            t_practice += middle_y[row] / N if column == 0 else middle_y[
                row] * matrix_pe[row][column - 1]
        if fab(t_practice / dispersion_b) < t_theoretical: arr_b[column] = 0
    end_time = datetime.now()
    print("Час виконання перевірки значимості за Стьюдентом : ",
          str(end_time - start_time))
    return arr_b
Ejemplo n.º 6
0
def student_test(arr_b, number_x=10):
    # Критерій Стьюдента
    dispersion_b = sqrt(dispersion_b2)
    for column in range(number_x + 1):
        t_practice = 0
        t_theoretical = CritValues.studentValue(f3, q)
        for row in range(N):
            if column == 0:
                t_practice += middle_y[row] / N
            else:
                t_practice += middle_y[row] * matrix_pe[row][column - 1]
        if fab(t_practice / dispersion_b) < t_theoretical:
            arr_b[column] = 0
    return arr_b
Ejemplo n.º 7
0
def student_test(arr_b, number_x=10):
    with Profiler() as p:
        print("Час виконання стат. перевірки Стьюдета")
        # Критерій Стьюдента
        dispersion_b = sqrt(dispersion_b2)
        for column in range(number_x):
            t_practice = 0
            t_theoretical = CritValues.studentValue(f3, q)
            for row in range(N):
                if column == 0:
                    t_practice += middle_y[row] / N
                else:
                    t_practice += middle_y[row] * matrix_pe[row][column - 1]
            if fab(t_practice / dispersion_b) < t_theoretical:
                arr_b[column] = 0
        return arr_b
Ejemplo n.º 8
0
def studentTest(b_lst, number_x=4):
    # Критерій Стьюдента
    dispersion_b = sqrt(sum(dispersion_y) / (N * N * m))
    t_lst = [0.0 for x in range(N)]
    for k in range(number_x):
        for x in range(N):
            if k == 0:
                t_lst[x] += middle_y[x] / N
            else:
                t_lst[x] += middle_y[x] * matrixExp[x][k - 1] / N
    for i in range(len(t_lst)):
        t_lst[i] = fab(t_lst[i]) / dispersion_b
    tt = CritValues.studentValue(f3, q)
    for i in range(number_x):
        if t_lst[i] > tt:
            continue
        else:
            t_lst[i] = 0
    for j in range(number_x):
        b_lst[j] = 0 if t_lst[j] == 0 else b_lst[j]
    return b_lst
 def pt_line_segment_intersect(self, a, b, c, d):
     y, x, cp = d.y - c.y, c.x - d.x, self.cross_product(d, c)
     u = math.fab(y * a.x + x * a.y + cp)
     v = math.fab(y * b.x + x * b.y + cp)
     return pt_xy((a.x * v + b.x * u) / (v + u),
                  (a.y * v + b.y * u) / (v + u))
Ejemplo n.º 10
0
import math
value = []
i = 1
while True:
    z = int(input())
    if z == -1: break
    value.append(z)
for x in range(1, len(value) + 1):
    li = []
    i = 1
    li.append(value[x - 1] / 2)
    while True:
        li.append(li[i - 1] - ((li[i - 1]**3 - value[x - 1]) /
                               (3 * li[i - 1]**2)))
        if math.fab(li[i]**3 - value[x - 1]) < 0.00001 * value[x - 1]:
            break
        i += 1
    print(min(li))