Created
November 11, 2015 12:05
-
-
Save kyoro1/dc2b5113a603f512e1a8 to your computer and use it in GitHub Desktop.
PythonでHermite行列とその固有値を求めてみる ref: http://qiita.com/kyoro1/items/8d324ea9f44a8d9e756d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A^{\dagger}=A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A=\left( | |
\begin{matrix} | |
1 & 2+\sqrt{-1} \\ | |
2-\sqrt{-1} & 4 | |
\end{matrix} | |
\right), B:=A^{\dagger} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> import numpy as np | |
> A = np.array([[1,2+1j],[2-1j,4]]) | |
> B = np.conjugate(A.T) #転置とって、複素共役! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 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]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> A-B | |
array([[ 0.+0.j, 0.+0.j], | |
[ 0.+0.j, 0.+0.j]]) #OK!ま、見りゃわかるか、って感じカモですが、、、 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\lambda = \frac{5\pm\sqrt{25-4\times(-1)}}{2}=\frac{5\pm\sqrt{29}}{2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment