Find the Hermitian matrix and its eigenvalues in Python

Thing you want to do:

--Creating a Hermite matrix of linear algebra and cking it in Python --Cck in Python that the eigenvalue is real

What is the Hermite matrix?

The matrix $ A $ is transposed, and the complex conjugate of each component is called the conjugate transpose, which is represented by $ A ^ {\ dagger} $. What is Hermite at this time?

A^{\dagger}=A

Is established

(Sample) Matrix definition

A=\left(
\begin{matrix}
1 & 2+\sqrt{-1} \\
2-\sqrt{-1} & 4 
\end{matrix}
\right), B:=A^{\dagger}

(That is, let's put $ B $ as a conjugate matrix of $ A $):

> import numpy as np
> A = np.array([[1,2+1j],[2-1j,4]])
> B = np.conjugate(A.T) #Transpose, complex conjugate!

For the time being, the contents of ck

> A
array([[ 1.+0.j,  2.+1.j],
       [ 2.-1.j,  4.+0.j]])
> B
array([[ 1.-0.j,  2.+1.j],
       [ 2.-1.j,  4.-0.j]])

Check that it is a Hermite matrix

Since $ B = A ^ {\ dagger} $, I wish I could say $ A = B $.

> A-B
array([[ 0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j]]) #OK!Well, it's a duck that you can see if you look at it, but ...

Then, would you like to find the eigenvalue?

The eigenvalues of the Hermite matrix $ A $ are real, but it's a check. The eigen equation is $ \ det (\ lambda I_2-A) = 0 $, isn't it?

\begin{eqnarray}
\det(\lambda I_2-A) &=& (\lambda-1)(\lambda-4)-(2+\sqrt{-1})(2-\sqrt{-1})\\
&=& \lambda^2-5\lambda+4-5 \\
&=& \lambda^2-5\lambda-1
\end{eqnarray}

So, in theory, this is the case:

\lambda = \frac{5\pm\sqrt{25-4\times(-1)}}{2}=\frac{5\pm\sqrt{29}}{2}

It's a real number! In terms of implementation

> eigen_value, eigen_vector = np.linalg.eig(A)
> eigen_value
array([-0.1925824 -3.07382855e-18j,  5.1925824 -2.18970776e-16j])
> (5-np.sqrt(29))/2
-0.19258240356725187
> (5+np.sqrt(29))/2
5.1925824035672523

So, the imaginary part has popped out, but as usual, it's a numerical one.

Recommended Posts

Find the Hermitian matrix and its eigenvalues in Python
Find the eigenvalues of a real symmetric matrix in Python
Find and check inverse matrix in Python
[Python] Find the transposed matrix in a comprehension
Find the difference in Python
Python --Read data from a numeric data file to find the covariance matrix, eigenvalues, and eigenvectors
Eigenvalues and eigenvectors: Linear algebra in Python <7>
[Python3] Save the mean and covariance matrix in json with pandas
Find it in the procession and edit it
About the difference between "==" and "is" in python
Find the divisor of the value entered in python
Find the solution of the nth-order equation in python
Identity matrix and inverse matrix: Linear algebra in Python <4>
Matrix Calculations and Linear Equations: Linear Algebra in Python <3>
python xlwings: Find the cell in the last row
Find the maximum Python
Find eigenvalues and eigenvectors
List find in Python
The simplest Python memo in Japan (classes and objects)
Receive the form in Python and do various things
Carefully understand the exponential distribution and draw in Python
Plot and understand the multivariate normal distribution in Python
Find the part that is 575 from Wikipedia in Python
Carefully understand the Poisson distribution and draw in Python
Download the file in Python
Find permutations / combinations in Python
Matrix multiplication in python numpy
Stack and Queue in Python
Unittest and CI in Python
Let's find pi in Python
Find the maximum python (improved)
Find out the apparent width of a string in python
Get the MIME type in Python and determine the file format
Sort and output the elements in the list as elements and multiples in Python.
Python --Find out number of groups in the regex expression
I tried programming the chi-square test in Python and Java.
[Python] Display the elapsed time in hours, minutes, and seconds (00:00:00)
Get the current date and time in Python, considering the time difference
Visualize the correlation matrix by principal component analysis in Python
[Tips] Problems and solutions in the development of python + kivy
Get the index of each element of the confusion matrix in Python
Graph the Poisson distribution and the Poisson cumulative distribution in Python and Java, respectively.
The story of Python and the story of NaN
MIDI packages in Python midi and pretty_midi
Count the number of Thai and Arabic characters well in Python
Getting the arXiv API in Python
Difference between list () and [] in Python
Difference between == and is in python
[Python] Find the second smallest value.
View photos in Python and html
Sorting algorithm and implementation in Python
Python in the browser: Brython's recommendation
Save the binary file in Python
Hit the Sesami API in Python
New Python grammar and features not mentioned in the introductory book
Draw a scatterplot matrix in python
Manipulate files and folders in Python
About dtypes in Python and Cython
In the python command python points to python3.8
Implement the Singleton pattern in Python
Assignments and changes in Python objects