% % Written by: % -- % John L. Weatherwax 2009-04-21 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- close all; clc; clear; % Problem EPage 118 % for n=[ 200, 400, 600, 800, 1000, 1200, 1400 ] , h = 2/n; A = diag( -2/h^2 * ones(1,n) ); A = A + diag( 1/h^2 * ones(1,n-1), 1 ); A = A + diag( 1/h^2 * ones(1,n-1), -1 ); A = -A; [V,D] = eig(A); % we want the smallest eigenvalue: % disp( sprintf( 'n= %5d approximate ev= %10.6f, true ev= %10.6f\n', n, min( diag(D) ), (pi/2)^2 ) ); end