# 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. QuantEcon / QuantEcon.lectures.code / ifp / test_ifp.py View on Github ``````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)`````` QuantEcon / QuantEcon.lectures.code / odu / test_odu.py View on Github ``````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)`````` QuantEcon / QuantEcon.lectures.code / ifp / test_ifp.py View on Github ``````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)`````` QuantEcon / QuantEcon.lectures.code / lucas_model / test_lucastree.py View on Github ``````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)`````` QuantEcon / QuantEcon.lectures.code / ifp / test_ifp.py View on Github ``````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)`````` QuantEcon / QuantEcon.lectures.code / jv / test_jv.py View on Github ``````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)`````` QuantEcon / QuantEcon.lectures.code / odu / test_odu.py View on Github ``````def test_v_vfi_fixed_point():
"odu: v from vfi is fixed point"
assert_less_equal(max_abs_diff(v, new_v), _tol*10)``````

## quantecon

Import the main names to top level. GitHub MIT Latest version published 4 months ago

68 / 100

## Popular Python code snippets

Find secure code to use in your application or website