1
$\begingroup$

I have two matrices.

    len = 20;V0=0.1;N1=6;X1 = Table[0., {i, 1, Binomial[N1, N1/2]}];
k = 1; Table[If[DigitCount[i, 2, 1] == N1/2, X1[[k++]] = i, 0], {i, 0, 2^N1 - 1}];
S1 = 2*Pi/10*
    DiagonalMatrix[Table[Sum[BitGet[X1[[i]], j] BitGet[X1[[i]], Mod[j + 1, N1]] V0, {j, 0,N1 - 1}], {i, 1, len}]] + DiagonalMatrix[Table[RandomReal[0.000001], {i, 1, len}]];

and

Hrot={{0.12551118587134788 - 3.0165106759535533*^-18*I, 0.000031449913744599316 - 1.2094507963735998*^-6*I, 
   -0.000039054664657328696 - 3.6016142573348786*^-7*I, -2.8896522156606624*^-7 + 4.6914200262233643*^-7*I, 
   -0.00003889668975249304 - 8.878439639167443*^-8*I, 1.7100032481329186*^-7 + 3.428349429508519*^-18*I, 
   -0.000038896689752469836 + 8.87843963673883*^-8*I, 4.702947196824972*^-8 - 3.9197131928691425*^-8*I, 
   3.914073213977243*^-8 - 3.7410176000019987*^-7*I, -8.958466214865641*^-7 - 4.6169900288086026*^-7*I, 
   -2.8896522156606624*^-7 - 4.6914200263172896*^-7*I, -0.000039054664657334334 + 3.6016142573869203*^-7*I, 
   0.00003144991374460257 + 1.209450796369263*^-6*I, 4.652089600368312*^-7 - 6.852339276019505*^-7*I, 
   3.4713124979525445*^-8 + 3.215757348687075*^-18*I, 4.6520896002880813*^-7 + 6.852339276119251*^-7*I, 
   -8.958466214752884*^-7 + 4.616990028875091*^-7*I, 3.914073213088197*^-8 + 3.741017599884905*^-7*I, 
   4.702947196456343*^-8 + 3.919713191698204*^-8*I, -3.138314056592116*^-7 + 4.7440585443682154*^-18*I}, 
  {0.00003144991374460799 + 1.2094507963764187*^-6*I, 0.0628368135327218 - 2.3615278569449893*^-18*I, 
   4.086427829331357*^-7 - 5.242168687733841*^-7*I, -0.000039054664657332924 - 3.601614257380415*^-7*I, 
   -1.7425444953297897*^-8 - 8.353490363816399*^-7*I, 0.00007868500621363746 - 4.0974869020340976*^-7*I, 
   -1.8423263646420718*^-8 + 4.6914200260792654*^-7*I, 7.406085841734494*^-8 - 2.120970499924768*^-18*I, 
   -0.00007786884685595627 + 4.958726446168196*^-8*I, 3.914073215473442*^-8 - 3.7410175997222746*^-7*I, 
   -0.00003889668975249618 - 8.878439636717146*^-8*I, -1.8423263641650228*^-8 - 4.691420026120465*^-7*I, 
   6.736171065824942*^-7 + 4.4894582211518763*^-7*I, -0.00007802682176079822 + 3.2096429381347005*^-7*I, 
   0.00003127902356402654 + 1.50115108777521*^-7*I, -0.0000787034296353818 - 4.6169900287554126*^-7*I, 
   4.652089600034378*^-7 - 6.852339275590161*^-7*I, -0.00007870342963539395 + 4.6169900287554126*^-7*I, 
   2.1797518200204584*^-7 + 1.0593356875852368*^-6*I, 4.702947191230489*^-8 + 3.919713190093585*^-8*I}, 
  {-0.00003905466465733596 + 3.6016142574476356*^-7*I, 4.086427829324852*^-7 + 5.242168687755525*^-7*I, 
   0.06283681353272182 + 8.64312419378288*^-18*I, 0.00003144991374460539 - 1.2094507963553852*^-6*I, 
   -0.0000787034296353818 + 4.61699002882697*^-7*I, 0.00003127902356400963 - 1.501151087749189*^-7*I, 
   6.736171065764227*^-7 - 4.4894582212646333*^-7*I, -0.0000780268217607967 - 3.209642938165058*^-7*I, 
   -1.8423263630808207*^-8 + 4.691420026142149*^-7*I, -0.00003889668975247081 + 8.878439640988903*^-8*I, 
   3.9140732143241874*^-8 + 3.741017599546634*^-7*I, -0.00007786884685595367 - 4.958726445083994*^-8*I, 
   -1.8423263639481824*^-8 - 4.691420026157328*^-7*I, 7.40608584069366*^-8 + 1.8295911660692887*^-19*I, 
   0.00007868500621364223 + 4.0974869019733823*^-7*I, -1.7425444937902226*^-8 + 8.353490364024566*^-7*I, 
   4.702947194363833*^-8 - 3.919713193151035*^-8*I, 2.1797518202459724*^-7 - 1.0593356876277375*^-6*I, 
   -0.00007870342963538744 - 4.6169900291240414*^-7*I, 4.652089600421438*^-7 + 6.852339275681234*^-7*I}, 
  {-2.8896522158536504*^-7 - 4.691420026185479*^-7*I, -0.00003905466465732024 + 3.6016142572958473*^-7*I, 
   0.00003144991374458609 + 1.2094507963709977*^-6*I, 0.12551118587134788 - 1.532915435831903*^-17*I, 
   4.6520896002620604*^-7 - 6.852339275937105*^-7*I, 3.471312497865808*^-8 - 1.9693283651615947*^-18*I, 
   0.00003144991374458956 - 1.209450796369263*^-6*I, 4.6520896003054285*^-7 + 6.852339275954453*^-7*I, 
   -0.00003905466465732891 - 3.601614257343552*^-7*I, -2.8896522155847683*^-7 + 4.691420025730644*^-7*I, 
   -8.958466215188733*^-7 + 4.6169900287944153*^-7*I, 3.9140732139121906*^-8 + 3.7410175999629675*^-7*I, 
   -0.000038896689752475474 - 8.878439639080707*^-8*I, 4.702947196369607*^-8 + 3.919713192739038*^-8*I, 
   1.7100032482023075*^-7 - 7.900348535359275*^-18*I, -0.00003889668975248111 + 8.878439639254179*^-8*I, 
   -3.1383140563427496*^-7 - 3.4201801897413346*^-17*I, 4.7029471960877145*^-8 - 3.919713192131885*^-8*I, 
   3.914073212502728*^-8 - 3.7410176000323564*^-7*I, -8.958466214993577*^-7 - 4.6169900289007704*^-7*I}, 
  {-0.000038896689752482305 + 8.878439638169977*^-8*I, -1.7425444957201025*^-8 + 8.353490363794715*^-7*I, 
   -0.00007870342963539048 - 4.61699002877276*^-7*I, 4.6520896002989233*^-7 + 6.852339276097567*^-7*I, 
   0.06283681353272183 - 5.078809551736785*^-18*I, 0.000031279023564024806 - 1.5011510878012307*^-7*I, 
   -0.00007802682176081622 - 3.209642938104343*^-7*I, -0.00007786884685595345 - 4.95872644699219*^-8*I, 
   7.406085842688592*^-8 - 1.6012310834895294*^-17*I, 4.702947193908468*^-8 - 3.919713191134419*^-8*I, 
   0.00003144991374459151 - 1.2094507963551684*^-6*I, 6.736171065900836*^-7 - 4.4894582213557063*^-7*I, 
   -1.8423263629507164*^-8 + 4.6914200260749286*^-7*I, -1.8423263645987037*^-8 - 4.691420026098781*^-7*I, 
   0.00007868500621364223 + 4.0974869020167504*^-7*I, 2.179751820549549*^-7 - 1.059335687593043*^-6*I, 
   -0.000039054664657341815 + 3.6016142575972555*^-7*I, 4.086427829318347*^-7 + 5.242168687651441*^-7*I, 
   -0.00007870342963538788 + 4.6169900286318136*^-7*I, 3.914073217479216*^-8 + 3.741017599637707*^-7*I}, 
  {1.7100032481481144*^-7 - 6.0225277471429415*^-18*I, 0.00007868500621364032 + 4.097486902011465*^-7*I, 
   0.00003127902356401653 + 1.5011510877178488*^-7*I, 3.471312499117215*^-8 - 1.9699575444177738*^-18*I, 
   0.00003127902356403163 + 1.5011510878146477*^-7*I, 0.00047289909341715545 + 5.283976405403395*^-19*I, 
   0.00003127902356402126 - 1.5011510877528143*^-7*I, 0.00003127902356402689 - 1.5011510878423627*^-7*I, 
   0.00007868500621364193 - 4.0974869020704184*^-7*I, 1.710003248290687*^-7 - 2.6309103812267846*^-17*I, 
   3.4713124969830306*^-8 - 2.0167019258237912*^-18*I, 0.00003127902356403493 - 1.5011510877890335*^-7*I, 
   0.00007868500621365361 - 4.097486901906907*^-7*I, 0.00007868500621362981 - 4.0974869019402463*^-7*I, 
   3.4897536993145955*^-7 + 7.274161440643188*^-20*I, 0.00007868500621364617 + 4.097486902086478*^-7*I, 
   1.7100032481364084*^-7 + 1.2356832599894969*^-17*I, 0.00007868500621362037 + 4.097486902125611*^-7*I, 
   0.00003127902356402084 + 1.5011510880908144*^-7*I, 3.471312495514106*^-8 - 2.225455131335429*^-18*I}, 
  {-0.000038896689752491195 - 8.878439639167443*^-8*I, -1.8423263639481824*^-8 - 4.6914200261052863*^-7*I, 
   6.736171065844457*^-7 + 4.4894582212819806*^-7*I, 0.00003144991374458869 + 1.2094507963731661*^-6*I, 
   -0.00007802682176081058 + 3.209642938186742*^-7*I, 0.00003127902356400789 + 1.5011510877318418*^-7*I, 
   0.06283681353272182 + 3.0899761915836876*^-18*I, -0.00007870342963538788 - 4.61699002871855*^-7*I, 
   4.086427829287989*^-7 - 5.242168687629757*^-7*I, -0.00003905466465733791 - 3.6016142575864135*^-7*I, 
   4.6520896002132713*^-7 - 6.852339276082389*^-7*I, -0.00007870342963539178 + 4.6169900286057927*^-7*I, 
   -1.742544496045363*^-8 - 8.353490364007218*^-7*I, 2.1797518203543927*^-7 + 1.0593356875861042*^-6*I, 
   0.00007868500621363919 - 4.0974869020340976*^-7*I, -1.842326364208391*^-8 + 4.6914200259296455*^-7*I, 
   4.702947196423817*^-8 + 3.9197131902670573*^-8*I, 7.406085840216611*^-8 + 7.555533889508359*^-18*I, 
   -0.00007786884685595605 + 4.9587264433492706*^-8*I, 3.914073214237451*^-8 - 3.7410176000431984*^-7*I}, 
  {4.702947196412975*^-8 + 3.919713192153569*^-8*I, 7.406085841734494*^-8 + 8.809142651444724*^-20*I, 
   -0.00007802682176081491 + 3.209642938212763*^-7*I, 4.6520896002089345*^-7 - 6.852339276010831*^-7*I, 
   -0.00007786884685595519 + 4.9587264458212515*^-8*I, 0.00003127902356402307 + 1.5011510877318418*^-7*I, 
   -0.00007870342963538874 + 4.6169900287489074*^-7*I, 0.06283681353272182 - 2.588532686809142*^-18*I, 
   -1.7425444938552748*^-8 - 8.353490363738336*^-7*I, -0.0000388966897525054 - 8.878439636066625*^-8*I, 
   3.914073211223369*^-8 - 3.7410175997222746*^-7*I, -0.00007870342963540869 - 4.616990028699034*^-7*I, 
   2.179751820287172*^-7 + 1.0593356875995483*^-6*I, 4.086427829342199*^-7 - 5.242168687694809*^-7*I, 
   0.00007868500621364353 - 4.097486902025424*^-7*I, -1.842326363297661*^-8 - 4.6914200261074547*^-7*I, 
   -0.00003905466465734713 - 3.601614257399931*^-7*I, -1.8423263653793293*^-8 + 4.6914200260250553*^-7*I, 
   6.736171065764227*^-7 + 4.4894582213773904*^-7*I, 0.00003144991374459227 + 1.2094507963863934*^-6*I}, 
  {3.914073213727876*^-8 + 3.7410175999586306*^-7*I, -0.00007786884685595757 - 4.958726446038092*^-8*I, 
   -1.8423263645553356*^-8 - 4.691420026142149*^-7*I, -0.00003905466465733368 + 3.6016142574302884*^-7*I, 
   7.406085841777862*^-8 + 3.3203691532368573*^-18*I, 0.00007868500621364136 + 4.0974869020167504*^-7*I, 
   4.0864278293660516*^-7 + 5.242168687629757*^-7*I, -1.7425444957201025*^-8 + 8.353490363764357*^-7*I, 
   0.06283681353272183 - 4.811147140404426*^-19*I, 0.000031449913744583595 - 1.2094507963766356*^-6*I, 
   4.7029471931495266*^-8 - 3.9197131919150446*^-8*I, 2.179751820189594*^-7 - 1.0593356875809*^-6*I, 
   -0.00007870342963540609 + 4.6169900287380654*^-7*I, -0.00007870342963539698 - 4.616990028790107*^-7*I, 
   0.00003127902356400963 - 1.5011510877665363*^-7*I, 6.736171065725195*^-7 - 4.4894582213080014*^-7*I, 
   4.6520896001655664*^-7 + 6.852339276052031*^-7*I, -0.00007802682176080798 - 3.2096429381824054*^-7*I, 
   -1.842326362820612*^-8 + 4.691420026066255*^-7*I, -0.00003889668975251602 + 8.878439638993971*^-8*I}, 
  {-8.958466215238606*^-7 + 4.616990028874306*^-7*I, 3.9140732144326076*^-8 + 3.741017599954294*^-7*I, 
   -0.00003889668975246593 - 8.878439637692928*^-8*I, -2.889652215916534*^-7 - 4.691420026217995*^-7*I, 
   4.7029471960443464*^-8 + 3.919713192565566*^-8*I, 1.710003248167613*^-7 - 5.879715598800411*^-18*I, 
   -0.0000390546646573313 + 3.6016142573652363*^-7*I, -0.000038896689752493906 + 8.878439639340915*^-8*I, 
   0.00003144991374459303 + 1.2094507963618904*^-6*I, 0.12551118587134785 - 2.3611551938559553*^-17*I, 
   -3.138314056167109*^-7 + 1.2382854239345759*^-17*I, 4.702947196781604*^-8 - 3.919713194603866*^-8*I, 
   4.652089600275071*^-7 - 6.85233927595879*^-7*I, 3.9140732143241874*^-8 - 3.7410175999889883*^-7*I, 
   3.471312498559698*^-8 + 1.5541316671601656*^-18*I, 0.000031449913744596714 - 1.2094507963662272*^-6*I, 
   -8.958466215368711*^-7 - 4.6169900288621843*^-7*I, 4.6520896002512184*^-7 + 6.852339275967463*^-7*I, 
   -0.00003905466465734561 - 3.601614257438962*^-7*I, -2.889652216055312*^-7 + 4.6914200263411606*^-7*I}, 
  {-2.8896522158905133*^-7 + 4.691420026115287*^-7*I, -0.000038896689752476775 + 8.878439637562824*^-8*I, 
   3.914073213955559*^-8 - 3.7410175999889883*^-7*I, -8.958466215099829*^-7 - 4.61699002877752*^-7*I, 
   0.00003144991374462794 + 1.2094507963675283*^-6*I, 3.471312497779072*^-8 - 1.4771241322132902*^-18*I, 
   4.652089600255555*^-7 + 6.852339275980474*^-7*I, 3.914073213760402*^-8 + 3.741017600015009*^-7*I, 
   4.7029471961093985*^-8 + 3.9197131933461915*^-8*I, -3.138314055932921*^-7 - 8.264085349465883*^-18*I, 
   0.12551118587134785 + 1.651702286700829*^-17*I, 0.000031449913744581535 - 1.209450796371865*^-6*I, 
   -0.00003905466465731677 - 3.60161425737391*^-7*I, -0.000038896689752483064 - 8.878439638213345*^-8*I, 
   1.710003248167613*^-7 - 2.476266692199744*^-18*I, 4.702947194396359*^-8 - 3.9197131923053574*^-8*I, 
   -2.8896522157517354*^-7 - 4.691420026221204*^-7*I, -0.00003905466465734127 + 3.60161425748233*^-7*I, 
   4.6520896003206073*^-7 - 6.852339275893737*^-7*I, -8.95846621513886*^-7 + 4.6169900287999957*^-7*I}, 
  {-0.00003905466465732772 - 3.6016142573500574*^-7*I, -1.8423263640349186*^-8 + 4.691420026131307*^-7*I, 
   -0.000077868846855958 + 4.958726445907988*^-8*I, 3.914073214085663*^-8 - 3.7410176001082505*^-7*I, 
   6.736171065798921*^-7 + 4.489458221273307*^-7*I, 0.00003127902356403825 + 1.5011510877665363*^-7*I, 
   -0.00007870342963538831 - 4.6169900287987807*^-7*I, -0.00007870342963538788 + 4.6169900287922755*^-7*I, 
   2.1797518202893405*^-7 + 1.059335687590441*^-6*I, 4.702947196749078*^-8 + 3.919713191047683*^-8*I, 
   0.000031449913744612 + 1.2094507963670946*^-6*I, 0.06283681353272182 - 1.5517643593698782*^-17*I, 
   4.086427829292326*^-7 - 5.242168687586389*^-7*I, -1.74254449554663*^-8 - 8.35349036374701*^-7*I, 
   0.00007868500621364266 - 4.0974869020601185*^-7*I, 7.406085843209009*^-8 - 6.9253413767511596*^-18*I, 
   -0.00003889668975245715 - 8.878439638993971*^-8*I, -1.842326365249225*^-8 - 4.6914200261269703*^-7*I, 
   -0.00007802682176082532 + 3.2096429381997527*^-7*I, 4.6520896003054285*^-7 - 6.852339276049862*^-7*I}, 
  {0.000031449913744593244 - 1.2094507963673114*^-6*I, 6.736171065859636*^-7 - 4.4894582212559597*^-7*I, 
   -1.8423263640782866*^-8 + 4.691420026129139*^-7*I, -0.00003889668975248892 + 8.878439639059023*^-8*I, 
   -1.842326363731342*^-8 - 4.6914200261074547*^-7*I, 0.00007868500621364396 + 4.097486902025424*^-7*I, 
   -1.7425444956550504*^-8 + 8.353490363725326*^-7*I, 2.1797518202741617*^-7 - 1.0593356875969462*^-6*I, 
   -0.00007870342963538571 - 4.6169900288248016*^-7*I, 4.652089599986673*^-7 + 6.852339275913253*^-7*I, 
   -0.00003905466465738182 + 3.6016142573825835*^-7*I, 4.0864278293009995*^-7 + 5.24216868772083*^-7*I, 
   0.06283681353272182 - 1.49890950346121*^-17*I, -0.00007870342963539525 + 4.616990028842149*^-7*I, 
   0.00003127902356401223 - 1.501151087792557*^-7*I, -0.00007802682176081144 - 3.2096429382040895*^-7*I, 
   3.914073214020611*^-8 + 3.7410175999521254*^-7*I, -0.0000778688468559541 - 4.958726445561043*^-8*I, 
   7.406085842081439*^-8 - 1.2053278839428694*^-17*I, 4.702947194970986*^-8 - 3.9197131923920936*^-8*I}, 
  {4.652089600285913*^-7 + 6.852339275989147*^-7*I, -0.00007802682176081665 - 3.2096429381563846*^-7*I, 
   7.40608584182123*^-8 - 4.811147140404426*^-19*I, 4.7029471960118203*^-8 - 3.919713191980097*^-8*I, 
   -1.8423263640349186*^-8 + 4.691420026139981*^-7*I, 0.00007868500621364396 + 4.0974869020167504*^-7*I, 
   2.179751820265488*^-7 - 1.0593356875965125*^-6*I, 4.086427829340031*^-7 + 5.242168687668788*^-7*I, 
   -0.00007870342963539221 + 4.616990028833475*^-7*I, 3.91407321176547*^-8 + 3.7410175996789065*^-7*I, 
   -0.00003889668975248111 + 8.878439638386817*^-8*I, -1.7425444961104153*^-8 + 8.353490363833746*^-7*I, 
   -0.00007870342963539872 - 4.6169900288790117*^-7*I, 0.06283681353272183 + 9.788312738470695*^-18*I, 
   0.000031279023564028275 - 1.5011510878272516*^-7*I, -0.00007786884685597123 - 4.958726445474307*^-8*I, 
   0.00003144991374461688 - 1.209450796397669*^-6*I, 6.736171065998414*^-7 - 4.489458221134529*^-7*I, 
   -1.8423263661165867*^-8 - 4.6914200262896007*^-7*I, -0.00003905466465733943 + 3.6016142570399756*^-7*I}, 
  {3.471312498368607*^-8 + 2.303792476865852*^-18*I, 0.00003127902356400773 - 1.501151087782325*^-7*I, 
   0.00007868500621364113 - 4.097486902045177*^-7*I, 1.7100032481718313*^-7 + 1.3662045943498976*^-18*I, 
   0.0000786850062136422 - 4.0974869020541215*^-7*I, 3.4897536993055154*^-7 + 1.2045466296555641*^-20*I, 
   0.00007868500621364173 + 4.097486902034504*^-7*I, 0.00007868500621364014 + 4.09748690211399*^-7*I, 
   0.00003127902356401232 + 1.5011510877502394*^-7*I, 3.471312499136866*^-8 - 7.467798391440407*^-18*I, 
   1.7100032484457279*^-7 + 1.4395821151568325*^-17*I, 0.00007868500621365226 + 4.097486902101318*^-7*I, 
   0.000031279023564036196 + 1.5011510880439904*^-7*I, 0.00003127902356404871 + 1.5011510877653165*^-7*I, 
   0.0004728990934171573 + 4.534132403906944*^-19*I, 0.0000312790235640257 - 1.5011510877299106*^-7*I, 
   3.471312497970163*^-8 + 1.129633895450046*^-17*I, 0.000031279023564061364 - 1.5011510879232374*^-7*I, 
   0.00007868500621365693 - 4.0974869019518676*^-7*I, 1.7100032486596206*^-7 - 5.342135981237564*^-18*I}, 
  {4.652089600297839*^-7 - 6.852339276004326*^-7*I, -0.00007870342963539004 + 4.616990028800949*^-7*I, 
   -1.7425444958285227*^-8 - 8.353490363773031*^-7*I, -0.00003889668975248588 - 8.878439639405968*^-8*I, 
   2.179751820356561*^-7 + 1.0593356875956451*^-6*I, 0.00007868500621364266 - 4.097486902025424*^-7*I, 
   -1.842326363687974*^-8 - 4.6914200261985277*^-7*I, -1.842326364208391*^-8 + 4.6914200261269703*^-7*I, 
   6.7361710658553*^-7 + 4.4894582212429493*^-7*I, 0.00003144991374459834 + 1.209450796354301*^-6*I, 
   4.702947196347923*^-8 + 3.919713193975029*^-8*I, 7.406085842341648*^-8 + 9.979742184550167*^-18*I, 
   -0.00007802682176081795 + 3.2096429381303637*^-7*I, -0.00007786884685596776 + 4.9587264458212515*^-8*I, 
   0.00003127902356401353 + 1.50115108777521*^-7*I, 0.06283681353272182 - 2.244637310223896*^-18*I, 
   3.914073212752094*^-8 - 3.7410175997656427*^-7*I, -0.00007870342963539612 - 4.6169900287445706*^-7*I, 
   4.086427829244621*^-7 - 5.242168687759861*^-7*I, -0.00003905466465736068 - 3.601614257454141*^-7*I}, 
  {-8.958466215143197*^-7 - 4.616990028893002*^-7*I, 4.6520896002902497*^-7 + 6.852339275980474*^-7*I, 
   4.702947195827506*^-8 + 3.919713192522198*^-8*I, -3.138314056093383*^-7 - 1.094659346359169*^-17*I, 
   -0.000039054664657333467 - 3.601614257486667*^-7*I, 1.710003248193634*^-7 - 2.527815560714269*^-18*I, 
   4.70294719595761*^-8 - 3.91971319247883*^-8*I, -0.000039054664657332165 + 3.601614257512688*^-7*I, 
   4.6520896003379546*^-7 - 6.852339275906748*^-7*I, -8.958466215212586*^-7 + 4.6169900290215996*^-7*I, 
   -2.889652215829798*^-7 + 4.6914200261736286*^-7*I, -0.00003889668975246832 + 8.878439640034805*^-8*I, 
   3.914073213196617*^-8 - 3.7410175998241896*^-7*I, 0.00003144991374461406 + 1.209450796378804*^-6*I, 
   3.471312498646434*^-8 + 3.0746938892459166*^-18*I, 3.914073213977243*^-8 + 3.7410175999889883*^-7*I, 
   0.1255111858713478 + 9.791909509857601*^-18*I, 0.000031449913744617313 - 1.2094507963827071*^-6*I, 
   -0.00003889668975245162 - 8.878439637085775*^-8*I, -2.88965221619409*^-7 - 4.691420026121558*^-7*I}, 
  {3.914073213500194*^-8 - 3.741017599960799*^-7*I, -0.00007870342963539048 - 4.6169900287770967*^-7*I, 
   2.1797518202850037*^-7 + 1.0593356875956451*^-6*I, 4.702947195751612*^-8 + 3.9197131918066244*^-8*I, 
   4.086427829309673*^-7 - 5.242168687785882*^-7*I, 0.00007868500621364223 - 4.0974869020340976*^-7*I, 
   7.406085841647758*^-8 - 2.371692252312041*^-19*I, -1.8423263644252313*^-8 - 4.6914200261182967*^-7*I, 
   -0.00007802682176082923 + 3.2096429380436275*^-7*I, 4.6520896002186923*^-7 - 6.852339276114915*^-7*I, 
   -0.000039054664657303976 - 3.6016142575647295*^-7*I, -1.8423263641650228*^-8 + 4.6914200260142133*^-7*I, 
   -0.00007786884685595996 + 4.958726445604411*^-8*I, 6.736171065889994*^-7 + 4.489458221390401*^-7*I, 
   0.000031279023564031744 + 1.501151087818578*^-7*I, -0.00007870342963539698 + 4.616990028714213*^-7*I, 
   0.00003144991374461493 + 1.209450796392465*^-6*I, 0.06283681353272183 + 2.8392544391964147*^-18*I, 
   -1.7425444957201025*^-8 - 8.35349036363859*^-7*I, -0.00003889668975248621 - 8.878439637064091*^-8*I}, 
  {4.702947196857498*^-8 - 3.9197131923487255*^-8*I, 2.1797518202784985*^-7 - 1.0593356875947778*^-6*I, 
   -0.00007870342963538918 + 4.6169900288031175*^-7*I, 3.9140732144326076*^-8 + 3.741017600008504*^-7*I, 
   -0.00007870342963539091 - 4.616990028816128*^-7*I, 0.000031279023564037816 - 1.5011510878099044*^-7*I, 
   -0.00007786884685595931 - 4.958726446168196*^-8*I, 6.736171065842289*^-7 - 4.489458221321012*^-7*I, 
   -1.8423263636012377*^-8 - 4.6914200261334756*^-7*I, -0.00003905466465731666 + 3.6016142573348786*^-7*I, 
   4.652089600221945*^-7 + 6.852339276130093*^-7*I, -0.00007802682176081773 - 3.2096429379959227*^-7*I, 
   7.406085840173243*^-8 + 1.0892843701690302*^-17*I, -1.842326363210925*^-8 + 4.691420026120465*^-7*I, 
   0.00007868500621363919 + 4.0974869020167504*^-7*I, 4.086427829292326*^-7 + 5.242168687703483*^-7*I, 
   -0.000038896689752462355 + 8.878439638820498*^-8*I, -1.7425444967609366*^-8 + 8.3534903636516*^-7*I, 
   0.06283681353272179 + 8.700722434196173*^-18*I, 0.00003144991374460864 - 1.2094507963562526*^-6*I}, 
  {-3.1383140559784577*^-7 + 1.405680481337713*^-18*I, 4.702947195914242*^-8 - 3.91971319247883*^-8*I, 
   4.6520896002685656*^-7 - 6.852339275967463*^-7*I, -8.958466215223428*^-7 + 4.6169900287419326*^-7*I, 
   3.914073213543562*^-8 - 3.7410175999195994*^-7*I, 3.4713124979525445*^-8 - 2.4828757348350535*^-18*I, 
   3.914073213955559*^-8 + 3.741017599993325*^-7*I, 0.00003144991374462664 - 1.2094507963749009*^-6*I, 
   -0.00003889668975246528 - 8.878439637476088*^-8*I, -2.8896522156931885*^-7 - 4.691420026090541*^-7*I, 
   -8.958466214954545*^-7 - 4.616990028912491*^-7*I, 4.6520896001991767*^-7 + 6.85233927595879*^-7*I, 
   4.7029471971502326*^-8 + 3.919713192652302*^-8*I, -0.00003905466465734344 - 3.601614257525698*^-7*I, 
   1.7100032481589394*^-7 - 2.0480539044520317*^-18*I, -0.000039054664657332816 + 3.6016142574953405*^-7*I, 
   -2.8896522156671677*^-7 + 4.691420025950292*^-7*I, -0.00003889668975247764 + 8.878439639340915*^-8*I, 
   0.00003144991374461558 + 1.2094507963549515*^-6*I, 0.1255111858713479 - 1.1639833028722761*^-17*I}};

Please pardon the large chunk of data. These two matrices are really close to each other and each element of one matrix difference from the other at 4th decimal place or at even smaller level.

Now the eigenvector for the first diagonal matrix is an identity matrix. But when I try to find out the eigenvector for the bottom matrix I see clearly they are nowhere close to the identity matrix and hence the basis is somehow rotated. Look below.

The Random diagonal matrix I added was to lift the degeneracy if that was the source of this behaviour, as mathematica picks up it's own favourite basis to diagonalize it, but even after adding that I do not see any improvement. The quantity I am calculating to show how close the two matrices are to each other involves showing how close the Eigenvector of the second matrix is to the identity matrix. Is there some misunderstanding on my part or is there a way I can force mathematica to construct eigenvectors close to the identity matrix?

$\endgroup$
9
  • $\begingroup$ Please make your code self-contained by defining all necessary symbols, so that anyone can try it out. $\endgroup$
    – Roman
    Jun 4, 2020 at 10:54
  • $\begingroup$ I apologize I forgot about X1 matrix. I have added it. $\endgroup$ Jun 4, 2020 at 13:37
  • $\begingroup$ What is N1? Undefined currently. $\endgroup$
    – MikeY
    Jun 4, 2020 at 13:53
  • 1
    $\begingroup$ You could have two matrices that are nowhere "close" to each other, but that have the exact same eigenvectors. Conversely (as you demonstrate) they can be close but have completely different eigenvectors. Not sure using eigenvectors as a measure of closeness makes sense (but don't understand your underlying problem). $\endgroup$
    – MikeY
    Jun 4, 2020 at 14:12
  • 4
    $\begingroup$ What is needed for such a comparison is to gauge differences in what are approximately eigen-subspaces (spaces spanned by eigenvectors from approximately common eigenvalues). $\endgroup$ Jun 4, 2020 at 23:33

0

Browse other questions tagged or ask your own question.