Does MATLAB considers poles while COMPLEX integrating a function?

For example , suppose i want to integrate F(z)=1/(1-z^n) where n is any natural number and z is a complex variable. Now integrating simply
syms z
syms n integer
F=int(1/(1-z^n),z)
F = 
This gives us answer in hypergeometric functions. But i want to know does this integration considers poles, as F(z) has a singularity,i.e, pole at z=1 and at nth roots of unity. so, does it consider that?
If not, how can we make it consider that?

 채택된 답변

David Goodmanson
David Goodmanson 2023년 10월 11일
편집: David Goodmanson 2023년 10월 11일
Hi simran,
Yes, the 2F1 expression does consider the pole, as you can see by the fact that the expression gets large as z appoaches 1 from below. I am going to consider 1/(z^n-1) rather than 1/(1-z^n) since it's easier to keep track of the nth roots of unity on the unit circle. It's easy enough to multiply the solution by -1 after the calculations are done. Also, n is odd here..
The solution for |z| < 1 is found by expanding the denominator in powers of z and integrating term by term, as mentioned by Torsten. I'm kind of surprised that syms got that far, but it's helpful. For |z| >1 you can expand z^(-n)/(1-z^(-n)) and do the same thing. This results in
y = -z*2F1(1,1/n;1+1/n,z^n) |z| < 1
y = z*(2F1(1,-1/n;1-1/n,z^(-n)) -1) |z| > 1
Here y(0) = 0, y(z) -> 0 as z-> +-inf and since the integral from -inf to inf is nonzero, constants of integration have to be added to these solutions to make them match up. syms does not seem to be capable of doing definite integrals in this case, but calculations using the log expression (see below) give
n = 5;
% some definite integrals
% Int(-inf,inf) 1/(z^n-1) = -C
% Int(-inf,0) 1/(z^n-1) = -D
% Int(0,inf) 1/(z^n-1) = -E
a = exp(2*pi*i/n); % poles at z=a^m, for 0<m<n-1 pole at z=1, no pole at z=-1
sqa = sqrt(a);
% use real to eliminate very small nuisance imag values
C = real( (-i*pi/n)*(1+sqa)/(1-sqa) ) % >0
D = real( (-2*i*pi/n)*sqa/(1-a) ) % >0
E = real( (-i*pi/n)*(1+a)/(1-a) ) % >0
% calculate and plot
z1 = -10:.01:-1;
z2 = -1:.01:.99;
z3 = 1.01:.01:10;
H1 = z1.*(hypergeom([1 -1/n],1-1/n,z1.^(-n))-1);
H2 = -z2.*hypergeom([1 1/n],1+1/n,z2.^n);
H3 = z3.*(hypergeom([1 -1/n],1-1/n,z3.^(-n))-1);
H1 = H1 - H1(end) + H2(1); % match at z = -1
H3 = H3 - E; % effectively match at z = inf
figure(1)
plot(z1,H1,z2,H2,z3,H3)
grid on
You can see the effect of the pole at z = 1. The pole can be integrated across by using the so-called principal value (which is how E was determined).
The 2F1 function that syms came up with was pretty good, but a more useful expression is
1/(z^n-1) = (1/n) Sum{0,n-1} a^m/(z-a^m)
and integrating this gives the indefinite integral
y = Int 1/(z^n-1) = (1/n) Sum{0,n-1} a^m log(z-a^m)
since log(p*q) = log(p) + log(q), the argument of each log term can be divided by -a^m and the only consequence is introduction of some constants of integration. This results in
y = Int 1/(z^n-1) = (1/n) Sum{0,n-1} a^m log(1-z/a^m)
which equals 0 at z=0, just as the 2F1 expression does. Now this has to be modifed for the m=0 (pole at z = a^0 = 1) term to use the principal value, log(|1-z|) instead of log(1-z):
y = Int 1/(z^n-1) = (1/n) Sum{1,n-1} a^m log(1-z/a^m) + (1/n) log(|1-z|)
and the function can be calculated in one go, rather than piecewise.
mm = (1:n-1)';
z4 = [z1 z2 z3];
[z m] = meshgrid(z4,mm);
% again remove small nuisance imag
A4 = real((1/n)*(sum(a.^m.*log(1-z./a.^m)))) + (1/n)*log(abs(1-z4));
A plot of z4,A4 is identical to the one above.

추가 답변 (1개)

Torsten
Torsten 2023년 9월 7일
편집: Torsten 2023년 9월 7일

0 개 추천

How should it consider it if you ask MATLAB for an antiderivative to a function ? Should it additionally list the poles ?
An antiderivative to f(x) = 1/x^2 , e.g., is F(x) = -1/x. That's all.
If you try to evaluate definite integrals, you can define Waypoints to circumvent poles:

댓글 수: 12

simran
simran 2023년 9월 7일
편집: simran 2023년 9월 7일
Actually I want integration from 0 to z where z belongs to the unit disk. I.e., |z |<=1. And i saw somewhere integrating the same function by partial fractions because they said since it has a pole on z=1 and at nth roots of unit i.e.,z =e^(2*pi*i*k)/n,where k=0,1,2,....n-1. they split it into n fractions and then integrated it. I want to know if the hypergeometric function obtained by MATLAB command and that integration are same. And if I want to do the same thing by splitting into partial fractions in MATLAB, can I do it?
Do you want to integrate numerically ? What is the path over which you want to integrate for 0 to z ? The straight line ?
See, I think they're not integrating over a certain path they are doing it symbolically. But at the same time considering poles and so splitting into partial fractions. I'm just saying the MATLAB integration that it does, and the one they've done analytically, are they both same??
Returning the result as a hypergeometric function is expanding your function in a power series and integrating this power series term by term. Thus you will get an antiderivative, but in the form of an infinite series that will only converge for | z | < 1. Thus your solution and the MATLAB solution in terms of a hypergeometric function will most probably be the same, but only in the unit circle.
For a more general solution, you have to specify n explicitly, e.g.
syms z
f = 1/(1-z^5);
F = int(f)
F = 
fplot(F)
But it seems this is a solution for | z | > 1 ...
I suggest you compute the function from the article and the hypergeometric function from MATLAB and compare.
simran
simran 2023년 9월 7일
편집: simran 2023년 9월 7일
Yes sir, even my domain is {z: |z|<1}, but i think they are considering poles because when they're taking limit tends to 1, then the limit goes to and so it becomes a pole, the value never becomes 1 exactly, but when tending close to 1,it becomes a pole. I don't know if it is necessary. But are you sure about "most probably be the same" part? Also, my n is a natural number.
Also, if there is any numerical method to compute it on MATLAB?
I looked at the text you included and saw that the function that is integrated is
(1-z)^(-2) * (1-z^n)^(-1)
Why do you consider only
(1-z^n)^(-1)
?
And yes: I'm sure the MATLAB integral function and the function from the article will be the same for
| z | < 1 (possibly up to a constant value (the constant of integration)).
Ohh, i was just considering the simpler one to understand things.
Also, Thankyou very much for making me understand this.
simran
simran 2023년 9월 7일
편집: simran 2023년 9월 7일
Also, do you know any other methods for solving these kind of integrations? if the MATLAB doesn't solve it with the "int" command.
And i'll also be very grateful if you see my question related to quadgk which i posted , if you could answer it?
Torsten
Torsten 2023년 9월 7일
편집: Torsten 2023년 9월 7일
Also, do you know any other methods for solving these kind of integrations? if the MATLAB doesn't solve it with the "int" command.
Why do you write it doesn't solve it with the int-command ? It's just a different representation of the antiderivative (maybe up to a constant of integration).
Bruno Luong
Bruno Luong 2023년 9월 7일
편집: Bruno Luong 2023년 9월 7일
When you integrate fractions in complex plane on the path, the only term that you need to pay attention is -1 power term:
1/(z-pole)
since the primitive (anti-derivative) is log(z-zpole) and as mathematical log is multi-values function and MATLAB log is mono-value function with discontinuity at the half axis Rel(z) <= 0, you must add k(z)*2*pi whenever it crossthe semi real axis z <= 0 so that the primitive is continue along the path.
All the other terms (with power negative or positive) do not have this problem, the difference of the primitive at the end to the start is alright.
No symbolic system can tell you what is k(z) to add since you haven't specify the path.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2023a

질문:

2023년 9월 7일

편집:

2023년 10월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by