Complex log branch cuts

조회 수: 9 (최근 30일)
ACE
ACE 2014년 5월 21일
답변: AADITYA KHANAL 2018년 4월 7일
Hello,
Summary: I am having some trouble figuring out the branch cuts Matlab uses for complex logarithms and arctangents. If possible, I would like to be able to redefine the cut.
Motivation: I want to reproduce the code in a piece of literature and it would be hard to re-derive all equations based on a different branch cut. The paper begins with a function in the real plane and then rewrites the equation in the complex plane for additional work. The functions h1, h2 in the code below are the "right" answer from the real plane. The complex function should be such that h = h1+1i*h2.
Original Code:
% Variable setup
H = 0.5;
x = linspace(-5, 5, 32);
z = logspace(log10(0.01), log10(3), 128);
[X,Z] = meshgrid(x,z);
s = X+1i*Z;
% Real and complex functions as given in paper
h1 = @(x,z) z.*log(x.^2+z.^2) - 2*x.*atan(x./z);
h2 = @(x,z) -x.*log(x.^2+z.^2) - 2*z.*atan(x./z);
h = @(s) -2*1i*s.*log(s) - pi*s;
%Plotting for comparison
figure()
subplot(2,2,1)
surf(X,Z, h1(X,Z-H), 'EdgeColor', 'none')
subplot(2,2,2)
surf(X,Z, real(h(s-1i*H)),'EdgeColor', 'none')
subplot(2,2,3)
surf(X,Z, h2(X,Z-H),'EdgeColor', 'none')
subplot(2,2,4)
surf(X,Z, imag(h(s-1i*H)),'EdgeColor', 'none')
Stepping through the simplification of h, these functions match h1, h2 as appropriate:
h = @(s) 1i*s.*log(-s.^(-2));
h = @(s) 1i*s.*(log((s*1i).^(-2)));
These functions do not:
h = @(s) 1i*s.*(log(s.^(-2))+log(-1));
h = @(s) -2*1i*s.*log(s*1i);
So the definition used by Matlab for the principle value for complex logarithms appears to be such that log(xy) ~= log(x) + log(y) and log(x^y) ~= y log(x). Is there some way around this?
Thank you!
Best, A.Craig
  댓글 수: 1
murat kara
murat kara 2015년 12월 16일
Hi, I am having the similar problem on my plots due to the logarithmic branch cut. Did you have a chance to figure out or find out a way to get rid of the problem caused by the b. cut. My plots appear to strange near/around the branch cut. So, if you have a method, would you mind sharing it or suggest a way to me?
thank you

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

답변 (1개)

AADITYA KHANAL
AADITYA KHANAL 2018년 4월 7일
Did you guys have any luck with this?
Thanks

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by