Пример #1
0
def test_matyas():
    random.seed(0.258)
    m = Minuit(matyas, x=random.random(), y=random.random(),
               pedantic=False, print_level=0)
    m.migrad()

    assert m.fval < 1e-26
    assert_array_almost_equal(m.args, [0, 0], decimal=12)
Пример #2
0
def test_matyas_oneside():
    '''One-side limit when the minimum is in the forbidden region'''
    random.seed(0.258)
    m = Minuit(matyas, x=2 + random.random(), y=random.random(),
               limit_x=(1, None),
               pedantic=False, print_level=0)

    m.migrad()
    assert_array_almost_equal(m.args, [1, 0.923], decimal=3)
Пример #3
0
def test_beale():
    random.seed(0.258)
    m = Minuit(beale, x=random.random(), y=0.5 * random.random(),
               pedantic=False, print_level=0)

    m.migrad()

    assert_array_almost_equal(m.args, [3, 0.5], decimal=3)
    assert m.fval < 1e-6
Пример #4
0
def test_ackleys():
    random.seed(0.258)
    m = Minuit(ackleys, x=1.5 * random.random(), y=1.5 * random.random(),
               error_x=1.7, error_y=1.7,
               pedantic=False, print_level=0)
    m.migrad()

    assert m.fval < 1e-5
    assert_array_almost_equal(m.args, [0, 0], decimal=3)