def _add_mNrmStEIndNumba( PermGroFac, Rfree, Ex_IncNext, mNrmMin, mNrm, cNrm, MPC, MPCmin, hNrm, _searchfunc, ): """ Finds steady state (normalized) market resources and adds it to the solution. This is the level of market resources such that the expectation of market resources in the next period is unchanged. This value doesn't necessarily exist. """ # Minimum market resources plus next income is okay starting guess m_init_guess = mNrmMin + Ex_IncNext mNrmStE = newton_secant( _searchfunc, m_init_guess, args=(PermGroFac, Rfree, Ex_IncNext, mNrmMin, mNrm, cNrm, MPC, MPCmin, hNrm), disp=False, ) if mNrmStE.converged: return mNrmStE.root else: return None
def test_secant_hard(): """ Harder test for convergence for secant function. """ true_fval = 0.408 fval = newton_secant(func_two, 0.4) assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0.01)
def test_secant_hard(): """ Harder test for convergence for secant function. """ true_fval = 0.408 fval = newton_secant(func_two, 0.4) assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0.01)
def test_secant_basic(): """ Basic test for secant option. """ true_fval = 1.0 fval = newton_secant(func, 5) assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0.001)
def test_secant_basic(): """ Basic test for secant option. """ true_fval = 1.0 fval = newton_secant(func, 5) assert_allclose(true_fval, fval.root, rtol=1e-5, atol=0.001)