<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161760</link>
    <title>MATLAB Central Newsreader - problem with complex numbers</title>
    <description>Feed for thread: problem with complex numbers</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 08 Jan 2008 23:30:10 -0500</pubDate>
      <title>problem with complex numbers</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161760#408640</link>
      <author>Yuriy </author>
      <description>can anybody explain me why this code gives different results&lt;br&gt;
for F1 and F2&lt;br&gt;
&lt;br&gt;
clear all&lt;br&gt;
A=5*rand(5,5);&lt;br&gt;
&lt;br&gt;
z=2.5;&lt;br&gt;
&lt;br&gt;
F1=exp(-j*A).^z;&lt;br&gt;
F2=exp(-j*A*z);&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 01:26:02 -0500</pubDate>
      <title>Re: problem with complex numbers</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161760#408643</link>
      <author>James Tursa</author>
      <description>"Yuriy " &amp;lt;aaa@yahoo.com&amp;gt; wrote in message &amp;lt;fm1121&lt;br&gt;
$9dg$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; can anybody explain me why this code gives different &lt;br&gt;
results&lt;br&gt;
&amp;gt; for F1 and F2&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; clear all&lt;br&gt;
&amp;gt; A=5*rand(5,5);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; z=2.5;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; F1=exp(-j*A).^z;&lt;br&gt;
&amp;gt; F2=exp(-j*A*z);&lt;br&gt;
&lt;br&gt;
Raising complex numbers to powers is a multi-valued &lt;br&gt;
operation. Depending on how you formulate the calculation &lt;br&gt;
you can get different results, all valid. For example, &lt;br&gt;
consider the very simple calculation of the square root &lt;br&gt;
of -1. MATLAB will give you one answer, i, by default when &lt;br&gt;
you do sqrt(-1), but an equally valid answer is -i. &lt;br&gt;
Depending on how you do the calculation you can get MATLAB &lt;br&gt;
to give you the other answer as well. Anytime you raise &lt;br&gt;
complex numbers to powers you need to be careful. Other &lt;br&gt;
functions are multi-valued for complex arguments also.&lt;br&gt;
&lt;br&gt;
James Tursa&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 02:08:02 -0500</pubDate>
      <title>Re: problem with complex numbers</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161760#408645</link>
      <author>Roger Stafford</author>
      <description>"Yuriy " &amp;lt;aaa@yahoo.com&amp;gt; wrote in message &amp;lt;fm1121$9dg&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; can anybody explain me why this code gives different results&lt;br&gt;
&amp;gt; for F1 and F2&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; clear all&lt;br&gt;
&amp;gt; A=5*rand(5,5);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; z=2.5;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; F1=exp(-j*A).^z;&lt;br&gt;
&amp;gt; F2=exp(-j*A*z);&lt;br&gt;
-------&lt;br&gt;
&amp;nbsp;In the mathematics of complex numbers it is understood that the quantity &lt;br&gt;
w^z, where w is complex-valued, must satisfy the identity&lt;br&gt;
&lt;br&gt;
&amp;nbsp;w^z = exp(z*log(w)).&lt;br&gt;
&lt;br&gt;
It is this logarithm function that gives rise to the ambiguity of possible values &lt;br&gt;
for w^z.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;If one travels around the zero value of w in a counterclockwise circular &lt;br&gt;
direction, keeping log(w) a continuous function, it will be increased by 2*pi*j &lt;br&gt;
after each complete revolution.  Thus the logarithm function is regarded as &lt;br&gt;
an analytic function but with infinitely many branches, and it has a &lt;br&gt;
discontinuity at w = 0.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;The effect on w^2.5 is to reverse sign after each revolution.  This is the &lt;br&gt;
cause of the sign reversals you see between F1 and F2.  Matlab follows the &lt;br&gt;
convention that the imaginary part of the logarithm is restricted to the &lt;br&gt;
interval from -pi*j to +pi*j, and this leads to the difference between F1 and &lt;br&gt;
F2.  If you had selected z = 2.75, you would see four different kinds of &lt;br&gt;
inequalities occurring between F1 and F2.  They would differ by various &lt;br&gt;
multiples of a pi/2 rotation.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;This is an inevitable ambiguity in the mathematics of complex numbers and &lt;br&gt;
not a fault of matlab's convention.  It is the same problem that prevails when &lt;br&gt;
taking square roots or higher roots.  The square root of 9 can be +3 or -3.  &lt;br&gt;
The fourth root of 16 can be any one of the quantities 2, 2*j, -2, or -2*j.  All &lt;br&gt;
are equally valid from the point of view of complex numbers.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 16:26:02 -0500</pubDate>
      <title>Re: problem with complex numbers</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161760#408727</link>
      <author>Vasia </author>
      <description>Thanks for the answer.&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
