Path: news.mathworks.com!not-for-mail
From: "James Tursa" <aclassyguywithaknotac@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem with complex numbers
Date: Wed, 9 Jan 2008 01:26:02 +0000 (UTC)
Organization: Boeing
Lines: 27
Message-ID: <fm17ra$jtl$1@fred.mathworks.com>
References: <fm1121$9dg$1@fred.mathworks.com>
Reply-To: "James Tursa" <aclassyguywithaknotac@hotmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1199841962 20405 172.30.248.37 (9 Jan 2008 01:26:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Jan 2008 01:26:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: news.mathworks.com comp.soft-sys.matlab:444971


"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);

Raising complex numbers to powers is a multi-valued 
operation. Depending on how you formulate the calculation 
you can get different results, all valid. For example, 
consider the very simple calculation of the square root 
of -1. MATLAB will give you one answer, i, by default when 
you do sqrt(-1), but an equally valid answer is -i. 
Depending on how you do the calculation you can get MATLAB 
to give you the other answer as well. Anytime you raise 
complex numbers to powers you need to be careful. Other 
functions are multi-valued for complex arguments also.

James Tursa