### Author Topic: --={Challenge}=-- eigenvalues and eigenvectors of square matrix with complex num  (Read 264 times)

0 Members and 2 Guests are viewing this topic.

#### ribarm

• Gator
• Posts: 3333
• Marko Ribar, architect
##### --={Challenge}=-- eigenvalues and eigenvectors of square matrix with complex num
« on: July 31, 2024, 08:36:08 PM »
I think that this topic is somewhat incomlpete : https://www.theswamp.org/index.php?topic=43453.0
and this post is what could be used if neccesarry to use calculus with complex numbers : https://www.theswamp.org/index.php?topic=45666.0

And although I don't know what for are used eigenvalues with their eigenvectors in practical situations and with normal square matrix with normal real numbers, I suppose that question is useful for brainstorming...

If someone finds practical usage, please don't hasitate to share your opinion(s)...
nxn matrix with complex numbers is shown in second link here shown, so you can practice calculus with it for a start, though it's your turn to think if you find something more suitable...

So that's it... Challenge is open for anyone...
« Last Edit: July 31, 2024, 10:17:19 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### ribarm

• Gator
• Posts: 3333
• Marko Ribar, architect
##### Re: --={Challenge}=-- eigenvalues and eigenvectors of square matrix with complex num
« Reply #1 on: August 01, 2024, 05:12:42 PM »
All I did is that I combined eigenvalues with coresponding eigenvectors... Matrix is still with real numbers - not integers and without imaginary numbers i=(sqrt (- 1))

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### ribarm

• Gator
• Posts: 3333
• Marko Ribar, architect
##### Re: --={Challenge}=-- eigenvalues and eigenvectors of square matrix with complex num
« Reply #2 on: August 01, 2024, 05:22:30 PM »
But real challenge is this for ex.

Code - Auto/Visual Lisp: [Select]
1. (eigenvals+eigenvecs '(((1.0 0.5) (2.0 -0.5) (0.5 2.0) (3.0 1.0)) ((4.0 -0.6) (1.0 0.3) (0.6 1.4) (-2.7 -0.6)) ((-1.2 0.6) (2.3 1.2) (4.1 1.2) (-3.2 2.3)) ((-0.2 0.3) (-0.6 1.8) (1.4 0.4) (-0.9 0.2))))
2.
« Last Edit: August 01, 2024, 08:08:41 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### ribarm

• Gator
• Posts: 3333
• Marko Ribar, architect
##### Re: --={Challenge}=-- eigenvalues and eigenvectors of square matrix with complex num
« Reply #3 on: August 01, 2024, 09:10:29 PM »
Code - Auto/Visual Lisp: [Select]
1.   : (eigenvals+eigenvecs '(((1.0 0.5) (2.0 -0.5) (0.5 2.0) (3.0 1.0)) ((4.0 -0.6) (1.0 0.3) (0.6 1.4) (-2.7 -0.6)) ((-1.2 0.6) (2.3 1.2) (4.1 1.2) (-3.2 2.3)) ((-0.2 0.3) (-0.6 1.8) (1.4 0.4) (-0.9 0.2))))
2.
3.
4.   eigenvalue : (-3.10709325337578 0.0)
5.   eigenvectors : ((1.0 0.0) (-1.36926008001226 0.0) (0.373298144625995 0.0) (-0.518407388873907 0.0))
6.
7.   checking solution...
8.   sum-eigenval*eigenvec : (1.59819345715225 0.0)
9.   sum-eigenvec*mat : (1.59819345619477 0.0)
10.
11.   eigenvalue : (1.8113164375 -1.98745309375)
12.   eigenvectors : ((1.0 0.0) (-0.274129672907482 1.24580850756096) (-0.497902712395894 -2.3576943282289) (0.536177151713595 -1.1000671791139))
13.
14.   checking solution...
15.   sum-eigenval*eigenvec : (-3.0120448566176 -5.52524870755717)
16.   sum-eigenvec*mat : (3.38069626167401 3.48826382117068)
17.
18.   eigenvalue : (1.8113164375 1.98745290625)
19.   eigenvectors : ((1.0 0.0) (-0.274129777303998 -1.24580853350094) (-0.497902579829243 2.35769472530721) (0.536177279962932 1.100067332957))
20.
21.   checking solution...
22.   sum-eigenval*eigenvec : (-3.01204520192711 5.52524982606384)
23.   sum-eigenvec*mat : (3.3806961781568 -3.48826389380262)
24.
25.   eigenvalue : (4.68445570698305 0.0)
26.   eigenvectors : ((1.0 0.0) (1.17394600127587 0.0) (1.45548511989103 0.0) (0.202940380682898 0.0))
27.
28.   checking solution...
29.   sum-eigenval*eigenvec : (17.9525745531195 0.0)
30.   sum-eigenvec*mat : (17.9525745506823 0.0)
31.
32.   Complex part of matrix when number of eigenvalues of real part is different than number of eigenvalues of complex part...
33.
34.   eigenvalue : (0.971154166666668 0.0)
35.   eigenvectors : ((1.0 0.0) (-0.278535941614827 0.0) (0.235481139295665 0.0) (-0.13897641200809 0.0))
36.
37.   checking solution...
38.   sum-eigenval*eigenvec : (0.794373794409364 0.0)
39.   sum-eigenvec*mat : (0.794473465133351 0.0)
40.
41.   eigenvalue : (2.94564583333332 0.0)
42.   eigenvectors : ((1.0 0.0) (0.243844303922332 0.0) (1.07162282021324 0.0) (0.425243802740581 0.0))
43.
44.   checking solution...
45.   sum-eigenval*eigenvec : (8.07316372212382 0.0)
46.   sum-eigenvec*mat : (8.07408517999639 0.0)
47.

P.S. In attachment is my lastly modified version...
« Last Edit: Today at 01:00:47 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### Stefan

• Bull Frog
• Posts: 321
• The most I miss IRL is the Undo button
##### Re: --={Challenge}=-- eigenvalues and eigenvectors of square matrix with complex num
« Reply #4 on: August 02, 2024, 02:20:59 PM »
Hi Marko

Seems like your check didn't quite match.
Here is Wolfram solution

And here is my solution
Code: [Select]
`A = Input matrix((1.0 0.5) (2.0 -0.5) (0.5 2.0) (3.0 1.0)) ((4.0 -0.6) (1.0 0.3) (0.6 1.4) (-2.7 -0.6)) ((-1.2 0.6) (2.3 1.2) (4.1 1.2) (-3.2 2.3)) ((-0.2 0.3) (-0.6 1.8) (1.4 0.4) (-0.9 0.2)) Det(A) = (-202.691 64.132)Characteristic polynomial = (1.0 (-5.2 -2.2) (0.2 9.12) (53.246 -38.656) (-202.691 64.132))EigenValue: (4.38714 1.17097)EigenVector: ((0.598196 0.211489) (0.784874 -0.155389) (0.426953 -0.0841711) (0.104031 0.301694))Verification Av=lv:Av = ((2.37672 1.62831) (3.62531 0.237353) (1.97166 0.130679) (0.103124 1.44539))lv = ((2.37672 1.62831) (3.62531 0.237353) (1.97166 0.130679) (0.103124 1.44539))-----------------------------------EigenValue: (-3.46913 1.27897)EigenVector: ((0.647871 -0.0778881) (-0.717905 -0.06007) (0.213061 0.217154) (-0.304411 0.127887))Verification Av=lv:Av = ((-2.14793 1.09881) (2.56733 -0.709787) (-1.01687 -0.480838) (0.892478 -0.832989))lv = ((-2.14793 1.09881) (2.56733 -0.709787) (-1.01687 -0.480838) (0.892478 -0.832989))-----------------------------------EigenValue: (2.52306 2.6949)EigenVector: ((-0.687759 0.188282) (-0.146035 0.486079) (-0.753715 -0.237471) (-0.517126 -0.0415601))Verification Av=lv:Av = ((-2.24266 -1.37839) (-1.67839 0.832858) (-1.26171 -2.63034) (-1.19274 -1.49846))lv = ((-2.24266 -1.37839) (-1.67839 0.832858) (-1.26171 -2.63034) (-1.19274 -1.49846))-----------------------------------EigenValue: (1.75892 -2.94484)EigenVector: ((-0.460627 0.473245) (-0.715456 -0.513732) (0.733856 -0.411936) (0.668689 0.228414))Verification Av=lv:Av = ((0.583425 2.18887) (-2.77129 1.20329) (0.0777078 -2.88565) (1.84881 -1.56742))lv = ((0.583425 2.18887) (-2.77129 1.20329) (0.0777078 -2.88565) (1.84881 -1.56742))-----------------------------------DiagonalizationS = matrix with eigenvectors as columns((0.598196 0.211489) (0.647871 -0.0778881) (-0.687759 0.188282) (-0.460627 0.473245)) ((0.784874 -0.155389) (-0.717905 -0.06007) (-0.146035 0.486079) (-0.715456 -0.513732)) ((0.426953 -0.0841711) (0.213061 0.217154) (-0.753715 -0.237471) (0.733856 -0.411936)) ((0.104031 0.301694) (-0.304411 0.127887) (-0.517126 -0.0415601) (0.668689 0.228414)) J = diagonal matrix with eigenvalues on the main diagonal((4.38714 1.17097) 0.0 0.0 0.0) (0.0 (-3.46913 1.27897) 0.0 0.0) (0.0 0.0 (2.52306 2.6949) 0.0) (0.0 0.0 0.0 (1.75892 -2.94484)) S^-1 = inverse of S((0.336414 -0.32062) (0.499714 0.119857) (0.369659 0.956816) (-0.725748 -0.521228)) ((0.476307 -0.039944) (-0.556818 0.095628) (0.129504 0.0989395) (-0.732553 -0.46865)) ((-0.173855 -0.24299) (-0.0475059 0.142827) (-0.394249 0.859301) (-0.832361 -0.829618)) ((-0.221336 -0.334293) (-0.268556 0.105158) (0.189394 0.279974) (0.211035 -0.430116)) SJS^-1 = A((1.0 0.5) (2.0 -0.5) (0.5 2.0) (3.0 1.0)) ((4.0 -0.6) (1.0 0.3) (0.6 1.4) (-2.7 -0.6)) ((-1.2 0.6) (2.3 1.2) (4.1 1.2) (-3.2 2.3)) ((-0.2 0.3) (-0.6 1.8) (1.4 0.4) (-0.9 0.2)) `
Notice the Eigenvectors are different. That is because each scaled Eigenvector is also an eigenvector.

Code: [Select]
`_\$ (setq eigenval1 (caar r))(4.38714 1.17097)_\$ (setq wolf_eigenvec (mapcar 'car wolf))((0.472509 0.280214) (0.692753 0.0) (0.376781 0.000302835) (0.0376274 0.273733))_\$ (setq my_eigenvec (mapcar 'car s1))((0.598196 0.211489) (0.784874 -0.155389) (0.426953 -0.0841711) (0.104031 0.301694))_\$ (mapcar 'c/ wolf_eigenvec my_eigenvec)((0.849339 0.168152) (0.849339 0.168151) (0.849339 0.168151) (0.849339 0.168151))_\$ `
Edit: file removed
« Last Edit: August 02, 2024, 05:01:28 PM by Stefan »