<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239646</link>
    <title>MATLAB Central Newsreader - Weird imaginary number</title>
    <description>Feed for thread: Weird imaginary number</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by 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>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 21 Nov 2008 02:46:07 -0500</pubDate>
      <title>Weird imaginary number</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239646#612298</link>
      <author>Ryan</author>
      <description>I'm writing a code where a variable RH=-2.3927e+004 and y4=0.3500.  In my code RH^y4 spits out a complex number.  When I was debugging the code I tried just running the numbers w/o the variables I got the correct answer.  Is there something syntax rule I'm missing or how should I code this?</description>
    </item>
    <item>
      <pubDate>Fri, 21 Nov 2008 03:06:02 -0500</pubDate>
      <title>Re: Weird imaginary number</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239646#612300</link>
      <author>Matt Fig</author>
      <description>I will guess you are seeing the difference between:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
(-2.3927e+004)^(.35)&lt;br&gt;
&lt;br&gt;
and&lt;br&gt;
&lt;br&gt;
-2.3927e+004^.35&lt;br&gt;
&lt;br&gt;
Operator precedence.</description>
    </item>
    <item>
      <pubDate>Fri, 21 Nov 2008 05:35:03 -0500</pubDate>
      <title>Re: Weird imaginary number</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239646#612324</link>
      <author>Roger Stafford</author>
      <description>Ryan &amp;lt;Galaxian8@aol.com&amp;gt; wrote in message &amp;lt;31509243.1227235597914.JavaMail.jakarta@nitrogen.mathforum.org&amp;gt;...&lt;br&gt;
&amp;gt; I'm writing a code where a variable RH=-2.3927e+004 and y4=0.3500.  In my code RH^y4 spits out a complex number.  When I was debugging the code I tried just running the numbers w/o the variables I got the correct answer.  Is there something syntax rule I'm missing or how should I code this?&lt;br&gt;
--------&lt;br&gt;
&amp;nbsp;&amp;nbsp;You are taking a fractional power of a negative number and that will almost always lead to complex results.  For example the 1/2 power of -1 is plus or minus the square root of -1, or plus or minus i, which is either of two complex values.  With a power of .35 = 20/7 there are seven possible answers, all of them complex-valued.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Mathematicians get around this ambiguity by defining&lt;br&gt;
&lt;br&gt;
&amp;nbsp;y^x = exp(x*log(y))&lt;br&gt;
&lt;br&gt;
where the log function has infinitely many branches in the complex plane.  In Matlab the 'log' function selects the branch with imaginary part equal to pi*i for negative values of y, which generally results in a complex-valued result.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
  </channel>
</rss>

