Ejemplo n.º 1
0
def test_newton_hard():
    """
    Harder test for convergence.
    """
    true_fval = 0.408
    fval = newton(func_two, 0.4, func_two_prime)
    assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0.01)
Ejemplo n.º 2
0
def test_newton_hard():
    """
    Harder test for convergence.
    """
    true_fval = 0.408
    fval = newton(func_two, 0.4, func_two_prime)
    assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0.01)
Ejemplo n.º 3
0
def test_newton_basic_two():
    """
    Uses the function f defined above to test the scalar maximization
    routine.
    """
    true_fval = 1.0
    fval = newton(func, 5, func_prime)
    assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0)
Ejemplo n.º 4
0
def test_newton_basic():
    """
    Uses the function f defined above to test the scalar maximization
    routine.
    """
    true_fval = 1.0
    fval = newton(func, 5, func_prime)
    assert_almost_equal(true_fval, fval.root, decimal=4)
Ejemplo n.º 5
0
def test_newton_basic_two():
    """
    Uses the function f defined above to test the scalar maximization 
    routine.
    """
    true_fval = 1.0
    fval = newton(func, 5, func_prime)
    assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0)
Ejemplo n.º 6
0
def test_newton_basic():
    """
    Uses the function f defined above to test the scalar maximization 
    routine.
    """
    true_fval = 1.0
    fval = newton(func, 5, func_prime)
    assert_almost_equal(true_fval, fval.root, decimal=4)