Fsolve error: relative norm of the current step is less than max(option​s.StepTole​rance^2,ep​s) = 1.000000e-12

2 ビュー (過去 30 日間)
Hello everyone,
I am running the following code, however, I observe an error:
fsolve stopped because the relative norm of the current step, 7.033578e-13, is less than
max(options.StepTolerance^2,eps) = 1.000000e-12. However, the sum of squared function
values, r = 3.409018e+18, exceeds sqrt(options.FunctionTolerance) = 1.000000e-03.
Optimization Metric Options
relative norm(step) = 7.03e-13 max(StepTolerance^2,eps) = 1e-12 (default)
r = 3.41e+18 sqrt(FunctionTolerance) = 1.0e-03 (default)
function F = new(x);
kap_dep = 0.0036;
kap_div = 0.0012;
thetam = 3.53;
mtgparam = thetam/(thetam-1);
thetad = - 1.46;
depparam = thetad/(thetad-1);
div_bar = 9;
chi_saver = 0.601;
log_refi_rate = -3.282968022102128;
log_non_am_share = -0.004357084122431;
log_new_loan_size = 0.484804774865286;
log_nu_t = -0.012277614667639;
log_debt = 0.212443935354230;
log_mstar_bank = 0.193437105171249;
mbank = exp(3.204035192501455);
log_y = -0.033219520228313;
log_ph = -0.282925342335558;
log_h_saver = 1.742131415613060;
log_R_new = 0.015649702109572;
log_inflation_factor = -0.007920530545208;
log_Lam_saver_debt = 0.448184815036209;
log_Lam_saver_0_inv = 0.463834545296377;
Rdep = depparam*(exp(log_R_new)-kap_dep);
log_R_dep = log(depparam*(exp(log_R_new)-kap_dep));
log_pay_bank = 3.300154738807201;
log_m_bank = 3.204035192501455;
F(1) = exp(log_refi_rate) * (exp(x(5)) + (1.0-exp(log_non_am_share)))* exp(log_new_loan_size) +exp(log_nu_t)*x(1)*(1.0-exp(log_refi_rate)) + exp(log_refi_rate)*exp(log_nu_t)*exp(log_debt) - x(1);
F(2) = exp(log_mstar_bank)*(exp(x(5)) - exp(log_non_am_share))+ (1.0 - exp(log_refi_rate))*x(2)*exp(log_nu_t)+ exp(log_refi_rate)*exp(log_nu_t)*exp(mbank) - x(2);
F(3) = exp(log_y) + exp(x(4)) - del*exp(log_ph)*exp(log_h_saver) + (Rdep+kap_dep)*exp(log_inflation_factor)*x(3) - x(3);
F(4) = log(exp(log_inflation_factor)*(exp(log_pay_bank) -exp(log_R_new)*exp(log_m_bank) - exp(log_mstar_bank) + (exp(log_R_new) - exp(log_R_dep) - kap_dep)*chi_saver * x(3)) - kap_div*0.5*(exp(x(4)) - div_bar).^2) - x(4);
F(5) = log(mtgparam*(1.0/x(6) + exp(log_non_am_share) - x(7)/x(6))) - x(5);
F(6) = exp(log_Lam_saver_debt)*(x(6)/exp(log_Lam_saver_0_inv)*exp(log_non_am_share)*(1.0 -exp(log_refi_rate)) + 1.0/(1.0 + kap_div*(exp(x(4))-div_bar))) - x(6);
F(7) = exp(log_Lam_saver_debt)*(x(7)/exp(log_Lam_saver_0_inv)*exp(log_non_am_share)*(1.0 -exp(log_refi_rate))+exp(log_refi_rate)*exp(log_non_am_share)*x(6)/exp(log_Lam_saver_0_inv)+1.0/(1.0 + kap_div*(exp(x(4))-div_bar))-(1.0/((1.0 + kap_div*(exp(x(4))-div_bar))*exp(log_Lam_saver_0_inv)))*exp(log_R_new)*exp(log_inflation_factor)) - x(7);
Then I run
x0=rand(1,7);
x=fsolve(@new,x0)
I looked at other documentations and tried options. Could you tell me or provide guidance on how to approach this problem? Thanks.
  10 件のコメント
Walter Roberson
Walter Roberson 2021 年 12 月 8 日
Alex Sha uses the commercial package at http://www.7d-soft.com/en/
Alex has posted a number of excellent results from the package over the years. I am sometimes able to do slightly better, but it takes me hours to do better than what Alex can do in a few minutes.
However, the software is not inexpensive. I think the price is probably worth it for people who do a lot of optimization... but I would not be able to justify it for myself, for example.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by