horzline = '__________________';
fprintf('\n\n HW #9, problem 4: Prediction power depends\n');
fprintf(' on precision in specifying initial conditions');
fprintf('\n\n%s \n m |    d    | nd \n%s\n', horzline, horzline);

for m = 1:16
    d = 10^(-m);
    nd(m) = butterfly(0.3, d, 4);
    fprintf('%2d | %7.1e | %2d\n', m, d, nd(m));
end

n = 1:16;
plot(n, nd, 'ob-'); hold on;
title('Predictive power vs. Precision, Ricker equation y_{n+1}=y_n e^{4 (1-y_n)}')
xlabel('Precision in initial condition (significant digits)');
ylabel('Predictive power (steps)');

plot(n, 1+4.7.*(n-1), 'r--', n, 1+5.*(n-1),'g--');
legend('nd vs. m','slope=4.7','slope=5.0','Location','Best');