Ejemplo n.º 1
0
def test_CT20():
    xk = 1119
    slope = mmm.calculate_slope(numbers)
    const = mmm.calculate_const(numbers, slope)
    variance = mmm.calculate_variance_with_regression(numbers, slope, const)
    std_dev = mmm.std_derivation(variance)
    student_val = 1.860
    assert mmm.calculate_interval(xk, numbers, std_dev, student_val) < 439.5455325
Ejemplo n.º 2
0
def tp5():
    """ Fonction pour le tp5 """
    numbers = mr.read_csv_data("test_tp5.csv")
    xk = float(
        mr.get_user_input(
            "Quelle valeur voulez-vous chercher l'intervalle de confiance?"))
    slope = mmm.calculate_slope(numbers)
    const = mmm.calculate_const(numbers, slope)
    variance = mmm.calculate_variance_with_regression(numbers, slope, const)
    std_dev = mmm.std_derivation(variance)
    student_val = mmm.get_student_with_alpha()
    interval = mmm.calculate_interval(xk, numbers, std_dev, student_val)
    yk = const + xk * slope
    bounds = mmm.calculate_bounds_interval(interval, yk)
    print("Intevalle = {:0.6f}".format(interval))
    print("Limite supérieure = {:0.6f}".format(bounds[0]))
    print("Limite inférieure = {:0.6f}".format(bounds[1]))
Ejemplo n.º 3
0
def tp3():
    """ Fonction pour le tp3 """
    def _ask_for_x_value(slope, const):
        """ Demande une valeur x pour retourner une valeur y """
        x_val = float(mr.get_user_input("Entrez une valeur de x: "))
        y_val = slope * x_val + const
        return y_val

    def _ask_for_y_value(slope, const):
        """ Demande une valeur y pour retourner une valeur x """
        y_val = float(mr.get_user_input("Entrez une valeur de y: "))
        x_val = (y_val - const) / slope
        return x_val

    numbers = mr.read_csv_data("test_tp3.csv")
    slope = mmm.calculate_slope(numbers)
    const = mmm.calculate_const(numbers, slope)
    print("slope: {:8.6f}".format(slope))
    print("const: {:8.6f}".format(const))
    print(_ask_for_x_value(slope, const))
    print(_ask_for_y_value(slope, const))
def test_CT15():
    try:
        mmm.calculate_slope([])
        assert False
    except:
        assert True
def test_CT14():
    assert mmm.calculate_slope(numbers) < 1.72794
def test_CT13():
    assert mmm.calculate_slope(numbers) > 1.72792