Skip to content
Snippets Groups Projects
Verified Commit fcef3ca0 authored by Willi Mutschler's avatar Willi Mutschler
Browse files

:white_check_mark: Don't do bgp/solow in Octave

[skip ci]
The levenberg-marquardt algorithm is not available in octave's implementation of fsolve, so we check the verbatim block only in matlab
parent 25f1641d
Branches
Tags
1 merge request!1780Don't do bgp/solow-1 in Octave
Pipeline #4464 skipped
...@@ -36,7 +36,9 @@ model; ...@@ -36,7 +36,9 @@ model;
PhysicalCapitalStock = (1-delta)*PhysicalCapitalStock(-1) + s*Output; PhysicalCapitalStock = (1-delta)*PhysicalCapitalStock(-1) + s*Output;
end; end;
if ~isoctave
% The levenberg-marquardt algorithm is not available in octave's
% implementation of fsolve, so we skip this check for Octave
verbatim; verbatim;
bgp.write(M_); bgp.write(M_);
...@@ -57,6 +59,7 @@ verbatim; ...@@ -57,6 +59,7 @@ verbatim;
else else
fun = @solow.bgpfun; fun = @solow.bgpfun;
end end
reverseStr = '';
for i=1:MC for i=1:MC
y = 1+(rand(6,1)-.5)*.2; y = 1+(rand(6,1)-.5)*.2;
g = ones(6,1); g = ones(6,1);
...@@ -66,8 +69,14 @@ verbatim; ...@@ -66,8 +69,14 @@ verbatim;
GY(i) = y(11); GY(i) = y(11);
GK(i) = y(12); GK(i) = y(12);
EG(i) = y(2); EG(i) = y(2);
end end
% Display the progress
percentDone = 100 * i / MC;
msg = sprintf('Percent done: %3.1f', percentDone);
fprintf([reverseStr, msg]);
reverseStr = repmat(sprintf('\b'), 1, length(msg));
end end
fprintf('\n');
% Compute the physical capital stock over output ratio along the BGP as % Compute the physical capital stock over output ratio along the BGP as
% a function of the deep parameters... % a function of the deep parameters...
theoretical_long_run_ratio = s*EfficiencyGrowth_ss*PopulationGrowth_ss/(EfficiencyGrowth_ss*PopulationGrowth_ss-1+delta); theoretical_long_run_ratio = s*EfficiencyGrowth_ss*PopulationGrowth_ss/(EfficiencyGrowth_ss*PopulationGrowth_ss-1+delta);
...@@ -89,3 +98,5 @@ verbatim; ...@@ -89,3 +98,5 @@ verbatim;
assert(var(EG(~isnan(EG)))<1e-16); assert(var(EG(~isnan(EG)))<1e-16);
end; end;
end;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment