% DO YOU BELIEVE ... % % the Cauchy integral formula: Example (14.69), p. 14-14? % % Taylor and Laurent series: Example (15.51), p. 15-8? % % Let's check formula (14.71), p. 14-14. N = 400; z = 3*exp(1i*linspace(0,2*pi,N)'); % Points around circle of radius 3 about 0, % oriented counterclockwise since theta runs % from 0 to 2 pi. I = 0; % I will approximate the integral (14.69) for j=2:2:N, fofz = exp(-z(j))/(z(j)+2); % Evaluate f at midpoint of interval jp1 = j+1; % from z(j-1) to z(j+1). if j==N, jp1 = 1; end; dz = z(jp1) - z(j-1); % Delta z I = I + fofz*dz; % Add f(z)*(Delta z). end; I, Cauchyvalue = 2*pi*1i*exp(2), diff=Cauchyvalue-I, pause, % Let's check formula (15.51), p. 15-8. zm1 = 4*rand(1)*exp(1i*2*pi*rand(1));% Generate random value for z-1, % with absolute value beween 0 and 4. z = zm1 + 1; fofz = -4/((z+3)*(z-1)); % f in (15.39) series = -1/(z-1); % series will approximate (15.51) for j=1:100, series = series + (-1)^(j-1)*(z-1)^(j-1)/4^j; end; fofz, series, diff=fofz-series