Exemplo n.º 1
0
def test_curry_quadratic_trapz():
    # tests if the quadratic currying function

    # create a specific quadratic function:
    quad234 = curry_quadratic(-2, 2, 3)
    # quad234 is now a function that can take one argument, x
    # and will evaluate quadratic for those particular values of A,B,C

    # try it with the trapz function
    assert trapz(quad234, -5, 5) == trapz(quadratic, -5, 5, -2, 2, 3)
Exemplo n.º 2
0
def test_curry_quadratic():
    # tests if the quadratic currying function

    # create a specific quadratic function:
    quad234 = curry_quadratic(2, 3, 4)
    # quad234 is now a function that can take one argument, x
    # and will evaluate quadratic for those particular values of A,B,C

    # try it for a few values
    for x in range(5):
        assert quad234(x) == quadratic(x, 2, 3, 4)