How to use the quantecon.tests.max_abs_diff function in quantecon

To help you get started, we’ve selected a few quantecon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QuantEcon / QuantEcon.lectures.code / ifp / test_ifp.py View on Github external
def test_bellman_fp(self):
        "ifp: solution to bellman is a fixed point"
        new_v = self.cp.bellman_operator(self.v_vfi)
        self.assertLessEqual(max_abs_diff(self.v_vfi, new_v), 1e-3)
github QuantEcon / QuantEcon.lectures.code / odu / test_odu.py View on Github external
def test_phi_pfi_fixed_point():
    "odu: phi from pfi is fixed point"
    new_phi = sp.res_wage_operator(phi_pfi)
    assert_less_equal(max_abs_diff(new_phi, phi_pfi), _tol*10)
github QuantEcon / QuantEcon.lectures.code / ifp / test_ifp.py View on Github external
def test_bellman_coleman_solutions_agree(self):
        "ifp: bellman and coleman solutions agree"
        self.assertLessEqual(max_abs_diff(self.c_vfi, self.c_pfi), 0.2)
github QuantEcon / QuantEcon.lectures.code / lucas_model / test_lucastree.py View on Github external
def test_lucas_op_fixed_point():
    "lucastree: are prices a fixed point of lucas_operator"
    # transform from p to f
    old_f = prices / (grid ** gamma)

    # compute new f
    new_f = tree.lucas_operator(old_f)

    # transform from f to p
    new_p = new_f * grid**gamma

    # test if close. Make it one order of magnitude less than tol used
    # to compute prices
    assert_less_equal(max_abs_diff(new_p, prices), _tol*10)
github QuantEcon / QuantEcon.lectures.code / ifp / test_ifp.py View on Github external
def test_coleman_fp(self):
        "ifp: solution to coleman is a fixed point"
        new_c = self.cp.coleman_operator(self.c_pfi)
        self.assertLessEqual(max_abs_diff(self.c_pfi, new_c), 1e-3)
github QuantEcon / QuantEcon.lectures.code / jv / test_jv.py View on Github external
def test_bellman_sol_fixed_point(self):
        "jv: solution to bellman is fixed point"
        new_V = self.jv.bellman_operator(self.V)
        self.assertLessEqual(max_abs_diff(new_V, self.V), 1e-4)
github QuantEcon / QuantEcon.lectures.code / odu / test_odu.py View on Github external
def test_v_vfi_fixed_point():
    "odu: v from vfi is fixed point"
    assert_less_equal(max_abs_diff(v, new_v), _tol*10)