Branch cut in log or square root

17 views (last 30 days)
murat kara
murat kara on 9 Oct 2015
Commented: Walter Roberson on 21 Dec 2015
Hi All,
I do have some kind of functions which either have logarithmic or square root functions which cause a branch cut. I solve the question analytically and draw the picture by hand in order to have a confirmation of the matlab figure but even for simple functions matlab sometime provide the wrong plot, which I think occurs due to branch cut. For example, let's say we have the function u=-(x+iy).^(3/2) and want to plot imaginary or real part of its counter picture and I use the very basic following code
syms x y
axis equal
figure(1)
hold on
ezplot('imag(-(x+1i*y).^(3/2))');
% this picture should be three line on positive x axis and 2 pi/3 and 4 pi/3
%but it gives positive x axis and 2 pi/3 and 4 pi/3 and negative x axis
ezplot('real((-4/3)*(x+1i*y).^(3/2))');
%this does not provide the negative x-axis
end
or I use
contourf(x,y,imag(u),1);
or
contourf(x,y,real(u),1);
It does have to draw the negative axis in real parts picture but it does not do it, and there should not be a line along the negative axis for imaginary part pictures but there is. I think these are happening because of the branch cut.
Could somebody please provide me some information or help to avoid the the branch cut or to get the right picture with branch cut.

Answers (1)

Walter Roberson
Walter Roberson on 10 Oct 2015
In MATLAB -(x+1i*y).^(3/2) is -power(complex(x,y),1.5) which is -exp(1.5 * log(complex(x,y)) .
That in turn is -exp(1.5 *( log(abs(complex(x,y))) + 1i*atan2(y,x) ))
You can expand this further algebraically, and take its imaginary part, but you will find there is no branch cut.
This might differ from what you are expecting, but you have to remember that in MATLAB, fractions are resolved to floating point numbers so it cannot tell that your intention is to talk about square roots of cubes.
See also realpow() and nthroot()
By the way, if you meant 3/2 in the fraction sense, then the imaginary part, using this interpretation, is equivalent to
-(x^2+y^2)^(3/4)*sin((3/2)*arctan(y, x))
  5 Comments
Walter Roberson
Walter Roberson on 26 Oct 2015
No, '.^' is a specific operator in MATLAB that is defined in terms of log, so there is no square root branch cut. If you want the branch cuts then you need to proceed carefully, and it is more ready if you use the Symbolic Toolbox
Walter Roberson
Walter Roberson on 21 Dec 2015
If you want the n'th branch cut then replace calls to log() with something like
clogn = @(x,n) log(x) + n*2i*pi*(imag(log(x))~=0);
and then call it passing it the branch cut number, such as 0 to replicate the normal log function.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!