Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem with complex numbers
Date: Wed, 9 Jan 2008 02:08:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 43
Message-ID: <fm1aa2$cc0$1@fred.mathworks.com>
References: <fm1121$9dg$1@fred.mathworks.com>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1199844482 12672 172.30.248.35 (9 Jan 2008 02:08:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Jan 2008 02:08:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:444973


"Yuriy " <aaa@yahoo.com> wrote in message <fm1121$9dg
$1@fred.mathworks.com>...
> can anybody explain me why this code gives different results
> for F1 and F2
> 
> clear all
> A=5*rand(5,5);
> 
> z=2.5;
> 
> F1=exp(-j*A).^z;
> F2=exp(-j*A*z);
-------
 In the mathematics of complex numbers it is understood that the quantity 
w^z, where w is complex-valued, must satisfy the identity

 w^z = exp(z*log(w)).

It is this logarithm function that gives rise to the ambiguity of possible values 
for w^z.

  If one travels around the zero value of w in a counterclockwise circular 
direction, keeping log(w) a continuous function, it will be increased by 2*pi*j 
after each complete revolution.  Thus the logarithm function is regarded as 
an analytic function but with infinitely many branches, and it has a 
discontinuity at w = 0.

  The effect on w^2.5 is to reverse sign after each revolution.  This is the 
cause of the sign reversals you see between F1 and F2.  Matlab follows the 
convention that the imaginary part of the logarithm is restricted to the 
interval from -pi*j to +pi*j, and this leads to the difference between F1 and 
F2.  If you had selected z = 2.75, you would see four different kinds of 
inequalities occurring between F1 and F2.  They would differ by various 
multiples of a pi/2 rotation.

  This is an inevitable ambiguity in the mathematics of complex numbers and 
not a fault of matlab's convention.  It is the same problem that prevails when 
taking square roots or higher roots.  The square root of 9 can be +3 or -3.  
The fourth root of 16 can be any one of the quantities 2, 2*j, -2, or -2*j.  All 
are equally valid from the point of view of complex numbers.

Roger Stafford