3

I'm implementing a library which makes use of the GSL for matrix operations. I am now at a point where I need to raise things to any power, including imaginary ones. I already have the code in place to handle negative powers of a matrix, but now I need to handle imaginary powers, since all numbers in my library are complex.

Does the GSL have facilities for doing this already, or am I about to enter loop hell trying to create an algorithm for this? I need to be able to raise not only to imaginary but also complex numbers, such as 3+2i. Having limited experience with matrices as a whole, I'm not even certain on the process for doing this by hand, much less with a computer.

2mac
  • 1,609
  • 5
  • 20
  • 35

3 Answers3

0

Hmm I never thought the electrical engineering classes I went through would help me on here, but what do you know. So the process for raising something to a complex power is not that complex and I believe you could write something fairly easily (I am not too familiar with the library your using, but this should still work with any library that has some basic complex number functions).

First your going to need to change the number to polar coordinates (i.e 3 + 3i would become (3^2 + 3^2) ^(1/2) angle 45 degrees. Pardon the awful notation. If you are confused on the process of changing the numbers over just do some quick googling on converting from cartesian to polar.

So now that you have changed it to polar coordinates you will have some radius r at an angle a. Lets raise it to the nth power now. You will then get r^n * e^(jan).

If you need more examples on this, research the "general power rule for complex numbers." Best of luck. I hope this helps!

Just reread the question and I see you need to raise to complex as well as imaginary. Well complex and imaginary are going to be the same just with one extra step using the exponent rule. This link will quickly explain how to raise something to a complex http://boards.straightdope.com/sdmb/showthread.php?t=261399

Tyler R
  • 474
  • 2
  • 6
  • 15
  • This answer seems to be describing how to raise a complex number to a complex power, but the question asks how to raise a matrix to a complex power. – Paul Hankin Aug 20 '16 at 10:02
0

One approach would be to compute (if possible) the logarithm of your matrix, multiply that by your (complex) exponent, and then exponentiate. That is you could have

mat_pow( M, z) = mat_exp( z * mat_log( M));

However mat_log and even mat_exp are tricky.

dmuir
  • 4,211
  • 2
  • 14
  • 12
0

In case it is still relevant to you, I have extended the capabilities of my package so that now you can raise any diagonalizable matrix to any power (including, in particular, complex powers). The name of the function is 'Matpow', and can be found in package 'powerplus'. Also, this package is for the R language, not C, but perhaps you could do your calculations in R if needed.

Edit: Version 3.0 extends capabilities to (some) non-diagonalizable matrices too.

I hope it helps!

Albert Dorador
  • 331
  • 2
  • 9