Looking into how Octave does fractional powers to complex
numbers. These produce multiple possible answers, but typically math
systems output the 'principle value' to maintain consistency. I came
across a couple cases where Octave (and Matlab, both match, so it's not a
compatibility issue) don't seem to output the principle values. I have
an example. it seems to occur when the complex argument exceeds pi:
(where for me r = 1)
>> x = 1;n=3;k = 0:floor(n)-1;
>>[exp(1i*(x+2*k*pi)/n);exp(1i*(-x+2*k*pi)/n)]
ans =
0.94496 + 0.32719i -0.75584 + 0.65476i -0.18912 - 0.98195i
0.94496 - 0.32719i -0.18912 + 0.98195i -0.75584 - 0.65476i
Each
row is the set of possible answers, row1 fro positive argument, 2 for a
negative argument. col 1 is the principle value where k=0.
now, taking the exponent directly:
>> ,diag([exp(1i*tvarg);exp(-1i*tvarg)])^(1/xo)
ans =
Diagonal Matrix
0.94496 + 0.32719i 0
0 0.94496 - 0.32719i
BUT, if I choose a value for x that is larger than pi, it doesn't choose the principle value:
>> x = 1.1*pi;n=3;k = 0:floor(n)-1;
ans =
0.40674 + 0.91355i -0.99452 - 0.10453i 0.58779 - 0.80902i
0.40674 - 0.91355i 0.58779 + 0.80902i -0.99452 + 0.10453i
>> ,diag([exp(1i*tvarg);exp(-1i*tvarg)])^(1/xo)
ans =
Diagonal Matrix
0.58779 - 0.80902i 0
0 0.58779 + 0.80902i
for
the positive argument it's choosing k=3, for the negative k=2. Again,
matlab does the same thing. It appears inconsistent to me, but maybe I'm
missing something.
If anyone can shed some light on
this, (and as before I'll link to the right source code on savannah so I
can step through things myself).
nickj