% CLASSOCT1.TXT Transcript of Matlab/Octave commands in % Bueler's Math 310 class on 1 Oct, 2010. % an example illustrating that for a function, some starting points % give fixed point iterations that converge, while some diverge g = @(x) x.^3 - 1.5*x + 1 format long g p=0.3, for n=1:20, p=g(p), end p=0.3, for n=1:2000, p=g(p), end p=1.33, for n=1:20, p=g(p), end p=1.32, for n=1:20, p=g(p), end % an example illustrating that it can be even worse than that; see: % http://en.wikipedia.org/wiki/Logistic_map % http://en.wikipedia.org/wiki/Cobweb_diagram h = @(x) 4*x.*(1-x) p=0.3, for n=1:200, p=h(p), end p=0.3, for n=1:200000, p=h(p), end p=0.753, for n=1:200000, p=h(p), end % picture y=h(x); print this out and try doing a spider-web (cob-web) % diagram on it x = 0:0.001:1; plot(x,h(x)) grid on, hold on, plot(x,x), axis equal, hold off