Complex log branch cuts

9 次查看(过去 30 天)
ACE
ACE 2014-5-21
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