Cauchy integral theorem vs. integral formula
조회 수: 11 (최근 30일)
이전 댓글 표시
Let's have the following integral:
Here y and η are real and positive number. We can solve this integral using Cachy integral theorem by converting this integeral to a complex integral. Let's assume a contour over upper half of the complex plane. Then, we will have:
this integral have two simple poles at and . The residues at both poles are and , respectively. Hence, the total integral will be:
Now, I want to check that if this integral is actually zero, using numerical integration. For that I write the following code:
clear; clc;
a = -1000000; %close to -infinity
b = 1000000; %close to +infinity
n = rand(1); %\eta: some randome number
y = rand(1)*10; %some randome number
f = @(x, n, y) 1 ./ ((x - 1i*n) .* (x - y - 1i*n));
x = linspace(a,b,1e5); dx =x(2)-x(1);
yy = f(x,n,y);
%plot(x,yy)
sum = sum(yy)*dx
this gives me number for one set of random n and y.
1.3303 + 0.2697i
which is not near to zero. what could be the reason?
댓글 수: 0
채택된 답변
Paul
2023년 7월 1일
Hi Luqman,
The numerical integration is using a step size that is proably too large to capture the rapid variation in the integrand near the poles. And the limits of the the numerical integration are going way out into the tails of the integrand that are not really contributing mugh to the integral.
Original code
clear; clc;
a = -1000000; %close to -infinity
b = 1000000; %close to +infinity
rng(101)
n = rand(1); %\eta: some randome number
y = rand(1)*10; %some randome number
f = @(x, n, y) 1 ./ ((x - 1i*n) .* (x - y - 1i*n));
x = linspace(a,b,1e5); dx =x(2)-x(1);
dx % large relative to 1/x
yy = f(x,n,y);
yy([1 end])
%plot(x,yy)
% don't override names of built-in functions
thesum = sum(yy)*dx
Tighten the limits, which also makes the dx smaller
x = linspace(-30,60,1e5); dx =x(2)-x(1);
dx
yy = f(x,n,y);
yy([1 end])
%plot(x,yy)
thesum = sum(yy)*dx
Also, we can use integral
g = @(x) f(x,n,y);
integral(g,-inf,inf)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!