Cauchy integral theorem vs. integral formula
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Luqman Saleem
am 1 Jul. 2023
Kommentiert: Luqman Saleem
am 1 Jul. 2023
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 Kommentare
Akzeptierte Antwort
Paul
am 1 Jul. 2023
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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!