Open source software for calculation of eigenvalues of symbolic matrix

1k Views Asked by At

I have following matrix

\begin{bmatrix} -\alpha & 0 & \beta & \gamma\cdot\omega_m \\ 0 & -\alpha & -\gamma\cdot\omega_m & \beta \\ R_r\frac{L_h}{L_r} & 0 & -\frac{R_r}{L_r} & -\omega_m \\ 0 & R_r\frac{L_h}{L_r} & \omega_m & -\frac{R_r}{L_r} \end{bmatrix}

where

$$ \alpha = \frac{R_s + R_r\frac{L^2_h}{L^2_r}}{L_{s\sigma}+\frac{L_h}{L_r}L_{r\sigma}} $$ $$ \beta = \frac{R_r\frac{L_h}{L^2_r}}{L_{s\sigma}+\frac{L_h}{L_r}L_{r\sigma}} $$ $$ \gamma = \frac{\frac{L_h}{L_r}}{L_{s\sigma}+\frac{L_h}{L_r}L_{r\sigma}}\cdot p_p $$

and I would like to calculate the eigenvalues of that in symbolic manner.

EDIT:

The matrix can be rewritten in following form

\begin{bmatrix} -a & 0 & b & c\cdot d \\ 0 & -a & -c\cdot d & b \\ e\cdot f & 0 & -e & -d \\ 0 & e\cdot f & d & -e \end{bmatrix}

I have been looking for some open source software usable for that purpose. I have already tried the wxMaxima but I have received some overcomplicated expressions containing the square roots which I am not able to simplify. Can anybody recommend me any open source software which offers good results for eigenvalues calculation in symbolic manner?

4

There are 4 best solutions below

8
On BEST ANSWER

It turns out that we can find a symbolic expression for the eigenvalues as follows:

The matrix can be written in the form $$ A = \pmatrix{-a & b\\ ef & -e} \otimes I_2 + \pmatrix{0& -cd\\0 & d} \otimes \pmatrix{0&-1\\1&0}, $$ where $\otimes$ denotes a Kronecker product. In other words: via the standard representation of the complex numbers over $\Bbb R^2$, this is the real analog to the complex matrix $$ M = \pmatrix{-a & b\\ef & -e} + i \pmatrix{0 & -cd\\0 & d} = \pmatrix{-a & b - icd\\ef & -e + id}. $$ In other words, this matrix $M$ has the following property: for any real numbers $x_1,x_2,x_3,x_4$, we have $$ M \pmatrix{x_1 + ix_2\\ x_3 + ix_4} = \pmatrix{y_1 + iy_2\\ y_3 + iy_4} \iff A \pmatrix{x_1\\x_2\\x_3\\x_4} = \pmatrix{y_1\\ y_2\\y_3\\ y_4}. $$ Consequently, the eigenvalues/eigenvectors of $A$ can be found using the eigenvalues/eigenvectors of $M$. If $\lambda = a + bi \in \Bbb C, x \in \Bbb R^4$ are such that $$ M \pmatrix{x_1 + ix_2\\x_3 + ix_4} = \lambda \pmatrix{x_1 + ix_2\\ x_3 + ix_4}, $$ then it follows that $a \pm bi$ are eigenvalues of $A$, with $$ A \pmatrix{x_1 + ix_2\\x_2 - ix_1\\ x_3 + ix_4\\ x_4 - ix_3 } = (a + bi)\pmatrix{x_1 + ix_2\\x_2 - ix_1\\ x_3 + ix_4\\ x_4 - ix_3 }, \quad A \pmatrix{x_1 - ix_2\\x_2 + ix_1\\ x_3 - ix_4\\ x_4 + ix_3 } = (a - bi)\pmatrix{x_1 - ix_2\\x_2 + ix_1\\ x_3 - ix_4\\ x_4 + ix_3 }. $$

The eigenvalues of this complex matrix will simply be the solutions to the characteristic equation $$ \lambda^2 - k_1 \lambda + k_2 = 0, $$ with $k_1 = \operatorname{tr}(M) = -a - e + id$ and $k_2 = \det(M) = -a(-e + id) - (b - i cd)f$. It follows that the eigenvalues of $M$ are given by $$ \lambda_\pm = \frac{k_1 \pm \sqrt{k^2 - 4k_2}}{2}, $$ where we note that this square root is the square root of a complex number.

From there, we deduce that the original matrix has eigenvalues $$ \lambda_+, \bar \lambda_+, \lambda_-, \bar \lambda_-, $$ where $\bar z$ denotes the complex conjugate of $z$.


An equivalent approach: consider the similar matrix $$ \frac 12 \pmatrix{-i & 1\\ 1 & -i \\ &&-i & 1\\ &&1 & -i} \pmatrix{-a & 0 & b & c\cdot d \\ 0 & -a & -c\cdot d & b \\ e\cdot f & 0 & -e & -d \\ 0 & e\cdot f & d & -e } \pmatrix{-i & 1\\ 1 & -i \\ &&-i & 1\\ &&1 & -i} = \\ \pmatrix{-a & 0 & b - icd & 0\\ 0 & -a & 0 & b + icd\\ ef & 0 & -e + id & 0\\ 0 & ef & 0 & -e - id}. $$ With the commutation matrix $K_2$, we have $$ K_2^T\pmatrix{-a & 0 & b - icd & 0\\ 0 & -a & 0 & b + icd\\ ef & 0 & -e + id & 0\\ 0 & ef & 0 & -e - id}K_2 = \pmatrix{-a & b - icd\\ef & -e + id\\ &&-a & b + icd\\&&ef & -e - id} $$

6
On

The characteristic polynomial of your matrix is given by \begin{align} \chi(t) &= t^4 + 2t^3(a + e) +t^2(a^2 + 4ae - 2bef + d^2 + e^2) + {}\\ &\qquad+2t(a^2e - abef + ad^2 + ae^2 - be^2f - cd^2ef) +{}\\ &\qquad+ a^2d^2 + a^2e^2 - 2abe^2f - 2acd^2ef + b^2e^2f^2 + c^2d^2e^2f^2 \end{align} The eigenvalues are the zeros of it over the given field. There are explicit formulas for the solutions, see here. However, they are very complicated.

0
On

We do have software for symbolic computations, but none for miracles.

The Eigenvalues of a $4\times4$ matrix are the roots of a quartic equation, which have a notoriously complex expression.

2
On

This response is (perhaps) barely appropriate as an answer rather than a comment. However, it may well be the best that the OP can do.

First of all, consider trying to programmatically identify the general roots of a quartic equation. Although the general formula is somewhat unwieldy, writing a computer program (e.g. using java, c, python, ...) to calculate the roots should be very straight forward.

Similarly, writing a computer program to calculate the eigenvalues of a 4x4 matrix should also be straight forward. Given the other responses to this posting, I would say (as a retired professional programmer) that the OP's surrendering to the need to write his own software may be best.

Edit
It just occurred to me that dealing with roots like $(1 + \sqrt{2})$ or $[1 + \sin(23^{\circ})]$ may be problematic if the OP needs exactness rather than (for example) the right answers correct to 10 decimal places.

If exactness is needed, then the OP has to (somehow) anticipate all the various forms that the solution may come in and develop special methods to handle them. For example, computing
$(1 + \sqrt{2}) \times (3 - \sqrt{2}) \;=\; [1 + 2\sqrt{2}]$ would probably require special code.