matrix.rlg 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210
  1. Sun Jan 3 23:46:20 MET 1999
  2. REDUCE 3.7, 15-Jan-99 ...
  3. 1: 1:
  4. 2: 2: 2: 2: 2: 2: 2: 2: 2:
  5. 3: 3: % Miscellaneous matrix tests.
  6. % Tests of eigenfunction/eigenvalue code.
  7. v := mat((1,1,-1,1,0),(1,2,-1,0,1),(-1,2,3,-1,0),
  8. (1,-2,1,2,-1),(2,1,-1,3,0))$
  9. mateigen(v,et);
  10. {{et - 2,
  11. 1,
  12. [ 0 ]
  13. [ ]
  14. [ 0 ]
  15. [ ]
  16. [arbcomplex(1)]
  17. [ ]
  18. [arbcomplex(1)]
  19. [ ]
  20. [arbcomplex(1)]
  21. },
  22. 4 3 2
  23. {et - 6*et + 13*et + 5*et - 5,
  24. 1,
  25. [ 5*arbcomplex(2)*(et - 2) ]
  26. [ ---------------------------- ]
  27. [ 3 2 ]
  28. [ 2*et - 10*et + 23*et + 5 ]
  29. [ ]
  30. [ 2 ]
  31. [ arbcomplex(2)*et*( - et + 6*et - 8) ]
  32. [--------------------------------------]
  33. [ 3 2 ]
  34. [ 2*et - 10*et + 23*et + 5 ]
  35. [ ]
  36. [ arbcomplex(2)*et*( - 3*et + 7) ]
  37. [ -------------------------------- ]
  38. [ 3 2 ]
  39. [ 2*et - 10*et + 23*et + 5 ]
  40. [ ]
  41. [ 3 2 ]
  42. [ arbcomplex(2)*(et - 4*et + 10) ]
  43. [ ---------------------------------- ]
  44. [ 3 2 ]
  45. [ 2*et - 10*et + 23*et + 5 ]
  46. [ ]
  47. [ arbcomplex(2) ]
  48. }}
  49. eigv := third first ws$
  50. % Now check if the equation for the eigenvectors is fulfilled. Note
  51. % that also the last component is zero due to the eigenvalue equation.
  52. v*eigv-et*eigv;
  53. [ 0 ]
  54. [ ]
  55. [ 0 ]
  56. [ ]
  57. [arbcomplex(1)*( - et + 2)]
  58. [ ]
  59. [arbcomplex(1)*( - et + 2)]
  60. [ ]
  61. [arbcomplex(1)*( - et + 2)]
  62. % Example of degenerate eigenvalues.
  63. u := mat((2,-1,1),(0,1,1),(-1,1,1))$
  64. mateigen(u,eta);
  65. {{eta - 1,2,
  66. [arbcomplex(3)]
  67. [ ]
  68. [arbcomplex(3)]
  69. [ ]
  70. [ 0 ]
  71. },
  72. {eta - 2,1,
  73. [ 0 ]
  74. [ ]
  75. [arbcomplex(4)]
  76. [ ]
  77. [arbcomplex(4)]
  78. }}
  79. % Example of a fourfold degenerate eigenvalue with two corresponding
  80. % eigenvectors.
  81. w := mat((1,-1,1,-1),(-3,3,-5,4),(8,-4,3,-4),
  82. (15,-10,11,-11))$
  83. mateigen(w,al);
  84. {{al + 1,
  85. 4,
  86. [ arbcomplex(5) ]
  87. [ --------------- ]
  88. [ 5 ]
  89. [ ]
  90. [ - 5*arbcomplex(6) + 7*arbcomplex(5) ]
  91. [--------------------------------------]
  92. [ 5 ]
  93. [ ]
  94. [ arbcomplex(5) ]
  95. [ ]
  96. [ arbcomplex(6) ]
  97. }}
  98. eigw := third first ws;
  99. [ arbcomplex(5) ]
  100. [ --------------- ]
  101. [ 5 ]
  102. [ ]
  103. [ - 5*arbcomplex(6) + 7*arbcomplex(5) ]
  104. eigw := [--------------------------------------]
  105. [ 5 ]
  106. [ ]
  107. [ arbcomplex(5) ]
  108. [ ]
  109. [ arbcomplex(6) ]
  110. w*eigw - al*eigw;
  111. [ - arbcomplex(5)*(al + 1) ]
  112. [ --------------------------- ]
  113. [ 5 ]
  114. [ ]
  115. [ 5*arbcomplex(6)*al + 5*arbcomplex(6) - 7*arbcomplex(5)*al - 7*arbcomplex(5) ]
  116. [-----------------------------------------------------------------------------]
  117. [ 5 ]
  118. [ ]
  119. [ - arbcomplex(5)*(al + 1) ]
  120. [ ]
  121. [ - arbcomplex(6)*(al + 1) ]
  122. % Calculate the eigenvectors and eigenvalue equation.
  123. f := mat((0,ex,ey,ez),(-ex,0,bz,-by),(-ey,-bz,0,bx),
  124. (-ez,by,-bx,0))$
  125. factor om;
  126. mateigen(f,om);
  127. 4 2 2 2 2 2 2 2 2 2
  128. {{om + om *(bx + by + bz + ex + ey + ez ) + bx *ex + 2*bx*by*ex*ey
  129. 2 2 2 2
  130. + 2*bx*bz*ex*ez + by *ey + 2*by*bz*ey*ez + bz *ez ,
  131. 1,
  132. 2
  133. mat(((om *arbcomplex(7)*ez + om*arbcomplex(7)*(bx*ey - by*ex)
  134. 3 2 2 2
  135. + arbcomplex(7)*bz*(bx*ex + by*ey + bz*ez))/(om + om*(bz + ex + ey )
  136. )),
  137. 2
  138. (( - om *arbcomplex(7)*by + om*arbcomplex(7)*(bx*bz - ex*ez)
  139. 3 2 2 2
  140. - arbcomplex(7)*ey*(bx*ex + by*ey + bz*ez))/(om + om*(bz + ex + ey )
  141. )),
  142. 2
  143. ((om *arbcomplex(7)*bx + om*arbcomplex(7)*(by*bz - ey*ez)
  144. 3 2 2 2
  145. + arbcomplex(7)*ex*(bx*ex + by*ey + bz*ez))/(om + om*(bz + ex + ey )
  146. )),
  147. (arbcomplex(7)))
  148. }}
  149. % Specialize to perpendicular electric and magnetic field.
  150. let ez=0,ex=0,by=0;
  151. % Note that we find two eigenvectors to the double eigenvalue 0
  152. % (as it must be).
  153. mateigen(f,om);
  154. {{om,
  155. 2,
  156. [ arbcomplex(9)*bx - arbcomplex(8)*bz ]
  157. [-------------------------------------]
  158. [ ey ]
  159. [ ]
  160. [ arbcomplex(8) ]
  161. [ ]
  162. [ 0 ]
  163. [ ]
  164. [ arbcomplex(9) ]
  165. },
  166. 2 2 2 2
  167. {om + bx + bz + ey ,
  168. 1,
  169. [ - arbcomplex(10)*ey ]
  170. [ ---------------------- ]
  171. [ bx ]
  172. [ ]
  173. [ - arbcomplex(10)*bz ]
  174. [ ---------------------- ]
  175. [ bx ]
  176. [ ]
  177. [ 2 2 2 ]
  178. [ arbcomplex(10)*(bx + bz + ey ) ]
  179. [----------------------------------]
  180. [ om*bx ]
  181. [ ]
  182. [ arbcomplex(10) ]
  183. }}
  184. % The following has 1 as a double eigenvalue. The corresponding
  185. % eigenvector must involve two arbitrary constants.
  186. j := mat((9/8,1/4,-sqrt(3)/8),
  187. (1/4,3/2,-sqrt(3)/4),
  188. (-sqrt(3)/8,-sqrt(3)/4,11/8));
  189. [ 9 1 - sqrt(3) ]
  190. [ --- --- ------------]
  191. [ 8 4 8 ]
  192. [ ]
  193. [ 1 3 - sqrt(3) ]
  194. j := [ --- --- ------------]
  195. [ 4 2 4 ]
  196. [ ]
  197. [ - sqrt(3) - sqrt(3) 11 ]
  198. [------------ ------------ ---- ]
  199. [ 8 4 8 ]
  200. mateigen(j,x);
  201. {{x - 1,
  202. 2,
  203. [sqrt(3)*arbcomplex(12) - 2*arbcomplex(11)]
  204. [ ]
  205. [ arbcomplex(11) ]
  206. [ ]
  207. [ arbcomplex(12) ]
  208. },
  209. {x - 2,
  210. 1,
  211. [ - sqrt(3)*arbcomplex(13) ]
  212. [ --------------------------- ]
  213. [ 3 ]
  214. [ ]
  215. [ - 2*sqrt(3)*arbcomplex(13) ]
  216. [-----------------------------]
  217. [ 3 ]
  218. [ ]
  219. [ arbcomplex(13) ]
  220. }}
  221. % The following is a good consistency check.
  222. sym := mat(
  223. (0, 1/2, 1/(2*sqrt(2)), 0, 0),
  224. (1/2, 0, 1/(2*sqrt(2)), 0, 0),
  225. (1/(2*sqrt(2)), 1/(2*sqrt(2)), 0, 1/2, 1/2),
  226. (0, 0, 1/2, 0, 0),
  227. (0, 0, 1/2, 0, 0))$
  228. ans := mateigen(sym,eta);
  229. ans := {{eta,
  230. 1,
  231. [ 0 ]
  232. [ ]
  233. [ 0 ]
  234. [ ]
  235. [ 0 ]
  236. [ ]
  237. [ - arbcomplex(14)]
  238. [ ]
  239. [ arbcomplex(14) ]
  240. },
  241. {eta - 1,
  242. 1,
  243. [ 2*arbcomplex(15) ]
  244. [------------------]
  245. [ sqrt(2) ]
  246. [ ]
  247. [ 2*arbcomplex(15) ]
  248. [------------------]
  249. [ sqrt(2) ]
  250. [ ]
  251. [ 2*arbcomplex(15) ]
  252. [ ]
  253. [ arbcomplex(15) ]
  254. [ ]
  255. [ arbcomplex(15) ]
  256. },
  257. {2*eta + 1,
  258. 1,
  259. [ - arbcomplex(16)]
  260. [ ]
  261. [ arbcomplex(16) ]
  262. [ ]
  263. [ 0 ]
  264. [ ]
  265. [ 0 ]
  266. [ ]
  267. [ 0 ]
  268. },
  269. 2
  270. {4*eta + 2*eta - 1,
  271. 1,
  272. [ - arbcomplex(17) ]
  273. [ ------------------- ]
  274. [ 2*sqrt(2)*eta ]
  275. [ ]
  276. [ - arbcomplex(17) ]
  277. [ ------------------- ]
  278. [ 2*sqrt(2)*eta ]
  279. [ ]
  280. [ arbcomplex(17)*( - 2*eta + 1) ]
  281. [-------------------------------]
  282. [ 2*eta ]
  283. [ ]
  284. [ arbcomplex(17) ]
  285. [ ]
  286. [ arbcomplex(17) ]
  287. }}
  288. % Check of correctness for this example.
  289. for each j in ans do
  290. for each k in solve(first j,eta) do
  291. write sub(k,sym*third j - eta*third j);
  292. [0]
  293. [ ]
  294. [0]
  295. [ ]
  296. [0]
  297. [ ]
  298. [0]
  299. [ ]
  300. [0]
  301. [0]
  302. [ ]
  303. [0]
  304. [ ]
  305. [0]
  306. [ ]
  307. [0]
  308. [ ]
  309. [0]
  310. [0]
  311. [ ]
  312. [0]
  313. [ ]
  314. [0]
  315. [ ]
  316. [0]
  317. [ ]
  318. [0]
  319. [0]
  320. [ ]
  321. [0]
  322. [ ]
  323. [0]
  324. [ ]
  325. [0]
  326. [ ]
  327. [0]
  328. [0]
  329. [ ]
  330. [0]
  331. [ ]
  332. [0]
  333. [ ]
  334. [0]
  335. [ ]
  336. [0]
  337. % Tests of nullspace operator.
  338. a1 := mat((1,2,3,4),(5,6,7,8));
  339. [1 2 3 4]
  340. a1 := [ ]
  341. [5 6 7 8]
  342. nullspace a1;
  343. {
  344. [ 1 ]
  345. [ ]
  346. [ 0 ]
  347. [ ]
  348. [ - 3]
  349. [ ]
  350. [ 2 ]
  351. ,
  352. [ 0 ]
  353. [ ]
  354. [ 1 ]
  355. [ ]
  356. [ - 2]
  357. [ ]
  358. [ 1 ]
  359. }
  360. b1 := {{1,2,3,4},{5,6,7,8}};
  361. b1 := {{1,2,3,4},{5,6,7,8}}
  362. nullspace b1;
  363. {{1,0,-3,2},{0,1,-2,1}}
  364. % Example taken from a bug report for another CA system.
  365. c1 :=
  366. {{(p1**2*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2), 0,
  367. (p1*p3*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2),
  368. -((p1**2*p2*(s + z))/(p1**2 + p3**2)), p1*(s + z),
  369. -((p1*p2*p3*(s + z))/(p1**2 + p3**2)),
  370. -((p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)), 0,
  371. (p1**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)},
  372. {0, 0, 0, 0, 0, 0, 0, 0, 0},
  373. {(p1*p3*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2), 0,
  374. (p3**2*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2),
  375. -((p1*p2*p3*(s + z))/(p1**2 + p3**2)), p3*(s + z),
  376. -((p2*p3**2*(s + z))/(p1**2 + p3**2)),
  377. -((p3**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)), 0,
  378. (p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)},
  379. {-((p1**2*p2*(s + z))/(p1**2 + p3**2)), 0,
  380. -((p1*p2*p3*(s + z))/(p1**2 + p3**2)),
  381. -((p1**2*p2**2*(s + 2*z))/((p1**2 + p3**2)*z)), (p1*p2*(s + 2*z))/z,
  382. -((p1*p2**2*p3*(s + 2*z))/((p1**2 + p3**2)*z)),
  383. -((p1*p2*p3*z)/(p1**2 + p3**2)), 0, (p1**2*p2*z)/(p1**2 + p3**2)},
  384. {p1*(s + z), 0, p3*(s + z), (p1*p2*(s + 2*z))/z,
  385. -(((p1**2+p3**2)*(s+ 2*z))/z), (p2*p3*(s + 2*z))/z, p3*z,0, -(p1*z)},
  386. {-((p1*p2*p3*(s + z))/(p1**2 + p3**2)), 0,
  387. -((p2*p3**2*(s + z))/(p1**2 + p3**2)),
  388. -((p1*p2**2*p3*(s + 2*z))/((p1**2 + p3**2)*z)), (p2*p3*(s + 2*z))/z,
  389. -((p2**2*p3**2*(s + 2*z))/((p1**2 + p3**2)*z)),
  390. -((p2*p3**2*z)/(p1**2 + p3**2)), 0, (p1*p2*p3*z)/(p1**2 + p3**2)},
  391. {-((p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)), 0,
  392. -((p3**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)),
  393. -((p1*p2*p3*z)/(p1**2 + p3**2)),p3*z,-((p2*p3**2*z)/(p1**2 + p3**2)),
  394. -((p3**2*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z))), 0,
  395. (p1*p3*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z))},
  396. {0, 0, 0, 0, 0, 0, 0, 0, 0},
  397. {(p1**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2), 0,
  398. (p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2),
  399. (p1**2*p2*z)/(p1**2 + p3**2), -(p1*z), (p1*p2*p3*z)/(p1**2 + p3**2),
  400. (p1*p3*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z)), 0,
  401. -((p1**2*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z)))}};
  402. 2 2 2 2 2
  403. p1 *(p1 + p2 + p3 - s*z - z )
  404. c1 := {{----------------------------------,
  405. 2 2
  406. p1 + p3
  407. 0,
  408. 2 2 2 2
  409. p1*p3*(p1 + p2 + p3 - s*z - z )
  410. ------------------------------------,
  411. 2 2
  412. p1 + p3
  413. 2
  414. - p1 *p2*(s + z)
  415. -------------------,
  416. 2 2
  417. p1 + p3
  418. p1*(s + z),
  419. - p1*p2*p3*(s + z)
  420. ---------------------,
  421. 2 2
  422. p1 + p3
  423. 2 2 2
  424. - p1*p3*(p1 + p2 + p3 )
  425. ----------------------------,
  426. 2 2
  427. p1 + p3
  428. 0,
  429. 2 2 2 2
  430. p1 *(p1 + p2 + p3 )
  431. -----------------------},
  432. 2 2
  433. p1 + p3
  434. {0,0,0,0,0,0,0,0,0},
  435. 2 2 2 2
  436. p1*p3*(p1 + p2 + p3 - s*z - z )
  437. {------------------------------------,
  438. 2 2
  439. p1 + p3
  440. 0,
  441. 2 2 2 2 2
  442. p3 *(p1 + p2 + p3 - s*z - z )
  443. ----------------------------------,
  444. 2 2
  445. p1 + p3
  446. - p1*p2*p3*(s + z)
  447. ---------------------,
  448. 2 2
  449. p1 + p3
  450. p3*(s + z),
  451. 2
  452. - p2*p3 *(s + z)
  453. -------------------,
  454. 2 2
  455. p1 + p3
  456. 2 2 2 2
  457. - p3 *(p1 + p2 + p3 )
  458. --------------------------,
  459. 2 2
  460. p1 + p3
  461. 0,
  462. 2 2 2
  463. p1*p3*(p1 + p2 + p3 )
  464. -------------------------},
  465. 2 2
  466. p1 + p3
  467. 2
  468. - p1 *p2*(s + z)
  469. {-------------------,
  470. 2 2
  471. p1 + p3
  472. 0,
  473. - p1*p2*p3*(s + z)
  474. ---------------------,
  475. 2 2
  476. p1 + p3
  477. 2 2
  478. p1 *p2 *( - s - 2*z)
  479. ----------------------,
  480. 2 2
  481. z*(p1 + p3 )
  482. p1*p2*(s + 2*z)
  483. -----------------,
  484. z
  485. 2
  486. p1*p2 *p3*( - s - 2*z)
  487. ------------------------,
  488. 2 2
  489. z*(p1 + p3 )
  490. - p1*p2*p3*z
  491. ---------------,
  492. 2 2
  493. p1 + p3
  494. 0,
  495. 2
  496. p1 *p2*z
  497. -----------},
  498. 2 2
  499. p1 + p3
  500. {p1*(s + z),
  501. 0,
  502. p3*(s + z),
  503. p1*p2*(s + 2*z)
  504. -----------------,
  505. z
  506. 2 2 2 2
  507. - p1 *s - 2*p1 *z - p3 *s - 2*p3 *z
  508. --------------------------------------,
  509. z
  510. p2*p3*(s + 2*z)
  511. -----------------,
  512. z
  513. p3*z,
  514. 0,
  515. - p1*z},
  516. - p1*p2*p3*(s + z)
  517. {---------------------,
  518. 2 2
  519. p1 + p3
  520. 0,
  521. 2
  522. - p2*p3 *(s + z)
  523. -------------------,
  524. 2 2
  525. p1 + p3
  526. 2
  527. p1*p2 *p3*( - s - 2*z)
  528. ------------------------,
  529. 2 2
  530. z*(p1 + p3 )
  531. p2*p3*(s + 2*z)
  532. -----------------,
  533. z
  534. 2 2
  535. p2 *p3 *( - s - 2*z)
  536. ----------------------,
  537. 2 2
  538. z*(p1 + p3 )
  539. 2
  540. - p2*p3 *z
  541. -------------,
  542. 2 2
  543. p1 + p3
  544. 0,
  545. p1*p2*p3*z
  546. ------------},
  547. 2 2
  548. p1 + p3
  549. 2 2 2
  550. - p1*p3*(p1 + p2 + p3 )
  551. {----------------------------,
  552. 2 2
  553. p1 + p3
  554. 0,
  555. 2 2 2 2
  556. - p3 *(p1 + p2 + p3 )
  557. --------------------------,
  558. 2 2
  559. p1 + p3
  560. - p1*p2*p3*z
  561. ---------------,
  562. 2 2
  563. p1 + p3
  564. p3*z,
  565. 2
  566. - p2*p3 *z
  567. -------------,
  568. 2 2
  569. p1 + p3
  570. 2 2 2 2
  571. - p3 *z*(p1 + p2 + p3 )
  572. -------------------------------,
  573. 2 2 2 2
  574. p1 *s + p1 *z + p3 *s + p3 *z
  575. 0,
  576. 2 2 2
  577. p1*p3*z*(p1 + p2 + p3 )
  578. -------------------------------},
  579. 2 2 2 2
  580. p1 *s + p1 *z + p3 *s + p3 *z
  581. {0,0,0,0,0,0,0,0,0},
  582. 2 2 2 2
  583. p1 *(p1 + p2 + p3 )
  584. {-----------------------,
  585. 2 2
  586. p1 + p3
  587. 0,
  588. 2 2 2
  589. p1*p3*(p1 + p2 + p3 )
  590. -------------------------,
  591. 2 2
  592. p1 + p3
  593. 2
  594. p1 *p2*z
  595. -----------,
  596. 2 2
  597. p1 + p3
  598. - p1*z,
  599. p1*p2*p3*z
  600. ------------,
  601. 2 2
  602. p1 + p3
  603. 2 2 2
  604. p1*p3*z*(p1 + p2 + p3 )
  605. -------------------------------,
  606. 2 2 2 2
  607. p1 *s + p1 *z + p3 *s + p3 *z
  608. 0,
  609. 2 2 2 2
  610. - p1 *z*(p1 + p2 + p3 )
  611. -------------------------------}}
  612. 2 2 2 2
  613. p1 *s + p1 *z + p3 *s + p3 *z
  614. nullspace c1;
  615. {{p3,0, - p1,0,0,0,0,0,0},
  616. {0,1,0,0,0,0,0,0,0},
  617. {0,0,0,p3,0, - p1,0,0,0},
  618. 2 2
  619. {0,0,0,0,p2*p3,p1 + p3 ,0,0,0},
  620. {0,0,0,0,0,0,p1,0,p3},
  621. {0,0,0,0,0,0,0,1,0}}
  622. d1 := mat
  623. (((p1**2*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2), 0,
  624. (p1*p3*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2),
  625. -((p1**2*p2*(s + z))/(p1**2 + p3**2)), p1*(s + z),
  626. -((p1*p2*p3*(s + z))/(p1**2 + p3**2)),
  627. -((p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)), 0,
  628. (p1**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)),
  629. (0, 0, 0, 0, 0, 0, 0, 0, 0),
  630. ((p1*p3*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2), 0,
  631. (p3**2*(p1**2 + p2**2 + p3**2 - s*z - z**2))/(p1**2 + p3**2),
  632. -((p1*p2*p3*(s + z))/(p1**2 + p3**2)), p3*(s + z),
  633. -((p2*p3**2*(s + z))/(p1**2 + p3**2)),
  634. -((p3**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)), 0,
  635. (p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)),
  636. ( ((p1**2*p2*(s + z))/(p1**2 + p3**2)), 0,
  637. -((p1*p2*p3*(s + z))/(p1**2 + p3**2)),
  638. -((p1**2*p2**2*(s + 2*z))/((p1**2 + p3**2)*z)), (p1*p2*(s + 2*z))/z,
  639. -((p1*p2**2*p3*(s + 2*z))/((p1**2 + p3**2)*z)),
  640. -((p1*p2*p3*z)/(p1**2 + p3**2)), 0, (p1**2*p2*z)/(p1**2 + p3**2)),
  641. (p1*(s + z), 0, p3*(s + z), (p1*p2*(s + 2*z))/z,
  642. -(((p1**2 + p3**2)*(s + 2*z))/z),(p2*p3*(s + 2*z))/z,p3*z,0,-(p1*z)),
  643. (-((p1*p2*p3*(s + z))/(p1**2 + p3**2)), 0,
  644. -((p2*p3**2*(s + z))/(p1**2 + p3**2)),
  645. -((p1*p2**2*p3*(s + 2*z))/((p1**2 + p3**2)*z)), (p2*p3*(s + 2*z))/z,
  646. -((p2**2*p3**2*(s + 2*z))/((p1**2 + p3**2)*z)),
  647. -((p2*p3**2*z)/(p1**2 + p3**2)), 0, (p1*p2*p3*z)/(p1**2 + p3**2)),
  648. (-((p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)), 0,
  649. -((p3**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2)),
  650. -((p1*p2*p3*z)/(p1**2 + p3**2)),p3*z,-((p2*p3**2*z)/(p1**2 + p3**2)),
  651. -((p3**2*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z))), 0,
  652. (p1*p3*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z))),
  653. (0, 0, 0, 0, 0, 0, 0, 0, 0),
  654. ((p1**2*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2), 0,
  655. (p1*p3*(p1**2 + p2**2 + p3**2))/(p1**2 + p3**2),
  656. (p1**2*p2*z)/(p1**2 + p3**2), -(p1*z), (p1*p2*p3*z)/(p1**2 + p3**2),
  657. (p1*p3*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z)), 0,
  658. -((p1**2*(p1**2 + p2**2 + p3**2)*z)/((p1**2 + p3**2)*(s + z)))));
  659. 2 2 2 2 2
  660. p1 *(p1 + p2 + p3 - s*z - z )
  661. d1 := mat((----------------------------------,0,
  662. 2 2
  663. p1 + p3
  664. 2 2 2 2 2
  665. p1*p3*(p1 + p2 + p3 - s*z - z ) - p1 *p2*(s + z)
  666. ------------------------------------,-------------------,p1*(s + z),
  667. 2 2 2 2
  668. p1 + p3 p1 + p3
  669. 2 2 2
  670. - p1*p2*p3*(s + z) - p1*p3*(p1 + p2 + p3 )
  671. ---------------------,----------------------------,0,
  672. 2 2 2 2
  673. p1 + p3 p1 + p3
  674. 2 2 2 2
  675. p1 *(p1 + p2 + p3 )
  676. -----------------------),
  677. 2 2
  678. p1 + p3
  679. (0,0,0,0,0,0,0,0,0),
  680. 2 2 2 2
  681. p1*p3*(p1 + p2 + p3 - s*z - z )
  682. (------------------------------------,0,
  683. 2 2
  684. p1 + p3
  685. 2 2 2 2 2
  686. p3 *(p1 + p2 + p3 - s*z - z ) - p1*p2*p3*(s + z)
  687. ----------------------------------,---------------------,p3*(s + z),
  688. 2 2 2 2
  689. p1 + p3 p1 + p3
  690. 2 2 2 2 2
  691. - p2*p3 *(s + z) - p3 *(p1 + p2 + p3 )
  692. -------------------,--------------------------,0,
  693. 2 2 2 2
  694. p1 + p3 p1 + p3
  695. 2 2 2
  696. p1*p3*(p1 + p2 + p3 )
  697. -------------------------),
  698. 2 2
  699. p1 + p3
  700. 2 2 2
  701. p1 *p2*(s + z) - p1*p2*p3*(s + z) p1 *p2 *( - s - 2*z)
  702. (----------------,0,---------------------,----------------------,
  703. 2 2 2 2 2 2
  704. p1 + p3 p1 + p3 z*(p1 + p3 )
  705. 2
  706. p1*p2*(s + 2*z) p1*p2 *p3*( - s - 2*z) - p1*p2*p3*z
  707. -----------------,------------------------,---------------,0,
  708. z 2 2 2 2
  709. z*(p1 + p3 ) p1 + p3
  710. 2
  711. p1 *p2*z
  712. -----------),
  713. 2 2
  714. p1 + p3
  715. p1*p2*(s + 2*z)
  716. (p1*(s + z),0,p3*(s + z),-----------------,
  717. z
  718. 2 2 2 2
  719. - p1 *s - 2*p1 *z - p3 *s - 2*p3 *z p2*p3*(s + 2*z)
  720. --------------------------------------,-----------------,p3*z,0,
  721. z z
  722. - p1*z),
  723. 2 2
  724. - p1*p2*p3*(s + z) - p2*p3 *(s + z) p1*p2 *p3*( - s - 2*z)
  725. (---------------------,0,-------------------,------------------------,
  726. 2 2 2 2 2 2
  727. p1 + p3 p1 + p3 z*(p1 + p3 )
  728. 2 2 2
  729. p2*p3*(s + 2*z) p2 *p3 *( - s - 2*z) - p2*p3 *z p1*p2*p3*z
  730. -----------------,----------------------,-------------,0,------------
  731. z 2 2 2 2 2 2
  732. z*(p1 + p3 ) p1 + p3 p1 + p3
  733. ),
  734. 2 2 2 2 2 2 2
  735. - p1*p3*(p1 + p2 + p3 ) - p3 *(p1 + p2 + p3 )
  736. (----------------------------,0,--------------------------,
  737. 2 2 2 2
  738. p1 + p3 p1 + p3
  739. 2 2 2 2 2
  740. - p1*p2*p3*z - p2*p3 *z - p3 *z*(p1 + p2 + p3 )
  741. ---------------,p3*z,-------------,-------------------------------,0,
  742. 2 2 2 2 2 2 2 2
  743. p1 + p3 p1 + p3 p1 *s + p1 *z + p3 *s + p3 *z
  744. 2 2 2
  745. p1*p3*z*(p1 + p2 + p3 )
  746. -------------------------------),
  747. 2 2 2 2
  748. p1 *s + p1 *z + p3 *s + p3 *z
  749. (0,0,0,0,0,0,0,0,0),
  750. 2 2 2 2 2 2 2 2
  751. p1 *(p1 + p2 + p3 ) p1*p3*(p1 + p2 + p3 ) p1 *p2*z
  752. (-----------------------,0,-------------------------,-----------,
  753. 2 2 2 2 2 2
  754. p1 + p3 p1 + p3 p1 + p3
  755. 2 2 2
  756. p1*p2*p3*z p1*p3*z*(p1 + p2 + p3 )
  757. - p1*z,------------,-------------------------------,0,
  758. 2 2 2 2 2 2
  759. p1 + p3 p1 *s + p1 *z + p3 *s + p3 *z
  760. 2 2 2 2
  761. - p1 *z*(p1 + p2 + p3 )
  762. -------------------------------))
  763. 2 2 2 2
  764. p1 *s + p1 *z + p3 *s + p3 *z
  765. nullspace d1;
  766. {
  767. [0]
  768. [ ]
  769. [1]
  770. [ ]
  771. [0]
  772. [ ]
  773. [0]
  774. [ ]
  775. [0]
  776. [ ]
  777. [0]
  778. [ ]
  779. [0]
  780. [ ]
  781. [0]
  782. [ ]
  783. [0]
  784. ,
  785. [ 0 ]
  786. [ ]
  787. [ 0 ]
  788. [ ]
  789. [ 0 ]
  790. [ ]
  791. [ p3 ]
  792. [ ]
  793. [ 0 ]
  794. [ ]
  795. [ - p1]
  796. [ ]
  797. [ 0 ]
  798. [ ]
  799. [ 0 ]
  800. [ ]
  801. [ 0 ]
  802. ,
  803. [ 0 ]
  804. [ ]
  805. [ 0 ]
  806. [ ]
  807. [ 0 ]
  808. [ ]
  809. [ 0 ]
  810. [ ]
  811. [ p2*p3 ]
  812. [ ]
  813. [ 2 2]
  814. [p1 + p3 ]
  815. [ ]
  816. [ 0 ]
  817. [ ]
  818. [ 0 ]
  819. [ ]
  820. [ 0 ]
  821. ,
  822. [0 ]
  823. [ ]
  824. [0 ]
  825. [ ]
  826. [0 ]
  827. [ ]
  828. [0 ]
  829. [ ]
  830. [0 ]
  831. [ ]
  832. [0 ]
  833. [ ]
  834. [p1]
  835. [ ]
  836. [0 ]
  837. [ ]
  838. [p3]
  839. ,
  840. [0]
  841. [ ]
  842. [0]
  843. [ ]
  844. [0]
  845. [ ]
  846. [0]
  847. [ ]
  848. [0]
  849. [ ]
  850. [0]
  851. [ ]
  852. [0]
  853. [ ]
  854. [1]
  855. [ ]
  856. [0]
  857. }
  858. % The following example, by Kenton Yee, was discussed extensively by
  859. % the sci.math.symbolic newsgroup.
  860. m := mat((e^(-1), e^(-1), e^(-1), e^(-1), e^(-1), e^(-1), e^(-1), 0),
  861. (1, 1, 1, 1, 1, 1, 0, 1),(1, 1, 1, 1, 1, 0, 1, 1),
  862. (1, 1, 1, 1, 0, 1, 1, 1),(1, 1, 1, 0, 1, 1, 1, 1),
  863. (1, 1, 0, 1, 1, 1, 1, 1),(1, 0, 1, 1, 1, 1, 1, 1),
  864. (0, e, e, e, e, e, e, e));
  865. [ 1 1 1 1 1 1 1 ]
  866. [--- --- --- --- --- --- --- 0]
  867. [ e e e e e e e ]
  868. [ ]
  869. [ 1 1 1 1 1 1 0 1]
  870. [ ]
  871. [ 1 1 1 1 1 0 1 1]
  872. [ ]
  873. m := [ 1 1 1 1 0 1 1 1]
  874. [ ]
  875. [ 1 1 1 0 1 1 1 1]
  876. [ ]
  877. [ 1 1 0 1 1 1 1 1]
  878. [ ]
  879. [ 1 0 1 1 1 1 1 1]
  880. [ ]
  881. [ 0 e e e e e e e]
  882. eig := mateigen(m,x);
  883. eig := {{x - 1,
  884. 3,
  885. [ 0 ]
  886. [ ]
  887. [ - arbcomplex(20)]
  888. [ ]
  889. [ - arbcomplex(19)]
  890. [ ]
  891. [ - arbcomplex(18)]
  892. [ ]
  893. [ arbcomplex(18) ]
  894. [ ]
  895. [ arbcomplex(19) ]
  896. [ ]
  897. [ arbcomplex(20) ]
  898. [ ]
  899. [ 0 ]
  900. },
  901. {x + 1,
  902. 3,
  903. arbcomplex(23)
  904. mat((----------------),
  905. e
  906. (arbcomplex(22)),
  907. (arbcomplex(21)),
  908. (( - arbcomplex(23)*e - arbcomplex(23) - 2*arbcomplex(22)*e
  909. - 2*arbcomplex(21)*e)/(2*e)),
  910. (( - arbcomplex(23)*e - arbcomplex(23) - 2*arbcomplex(22)*e
  911. - 2*arbcomplex(21)*e)/(2*e)),
  912. (arbcomplex(21)),
  913. (arbcomplex(22)),
  914. (arbcomplex(23)))
  915. },
  916. 2 2
  917. { - e *x + e*x - 6*e*x + 7*e - x,
  918. 1,
  919. 8 7 7 6 6
  920. mat(((6*arbcomplex(24)*(e *x + 23*e *x - 7*e + 179*e *x - 119*e
  921. 5 5 4 4 3 3
  922. + 565*e *x - 581*e + 768*e *x - 890*e + 565*e *x - 581*e
  923. 2 2 3 8 7
  924. + 179*e *x - 119*e + 23*e*x - 7*e + x))/(e *(e *x + 30*e *x
  925. 7 6 6 5 5
  926. - 7*e + 333*e *x - 168*e + 1692*e *x - 1365*e
  927. 4 4 3 3 2
  928. + 4023*e *x - 4368*e + 4470*e *x - 5145*e + 2663*e *x
  929. 2
  930. - 2520*e + 576*e*x - 251*e + 36*x))),
  931. 9 8 8 7 7
  932. ((arbcomplex(24)*(e *x + 29*e *x - 7*e + 310*e *x - 161*e
  933. 6 6 5 5 4
  934. + 1520*e *x - 1246*e + 3577*e *x - 3836*e + 4283*e *x
  935. 4 3 3 2 2
  936. - 4795*e + 2988*e *x - 3065*e + 978*e *x - 672*e + 132*e*x
  937. 2 8 7 7 6 6
  938. - 42*e + 6*x))/(e *(e *x + 30*e *x - 7*e + 333*e *x - 168*e
  939. 5 5 4 4 3
  940. + 1692*e *x - 1365*e + 4023*e *x - 4368*e + 4470*e *x
  941. 3 2 2
  942. - 5145*e + 2663*e *x - 2520*e + 576*e*x - 251*e + 36*x)))
  943. ,
  944. 9 8 8 7 7
  945. ((arbcomplex(24)*(e *x + 29*e *x - 7*e + 310*e *x - 161*e
  946. 6 6 5 5 4
  947. + 1520*e *x - 1246*e + 3577*e *x - 3836*e + 4283*e *x
  948. 4 3 3 2 2
  949. - 4795*e + 2988*e *x - 3065*e + 978*e *x - 672*e + 132*e*x
  950. 2 8 7 7 6 6
  951. - 42*e + 6*x))/(e *(e *x + 30*e *x - 7*e + 333*e *x - 168*e
  952. 5 5 4 4 3
  953. + 1692*e *x - 1365*e + 4023*e *x - 4368*e + 4470*e *x
  954. 3 2 2
  955. - 5145*e + 2663*e *x - 2520*e + 576*e*x - 251*e + 36*x)))
  956. ,
  957. 9 8 8 7 7
  958. ((arbcomplex(24)*(e *x + 29*e *x - 7*e + 310*e *x - 161*e
  959. 6 6 5 5 4
  960. + 1520*e *x - 1246*e + 3577*e *x - 3836*e + 4283*e *x
  961. 4 3 3 2 2
  962. - 4795*e + 2988*e *x - 3065*e + 978*e *x - 672*e + 132*e*x
  963. 2 8 7 7 6 6
  964. - 42*e + 6*x))/(e *(e *x + 30*e *x - 7*e + 333*e *x - 168*e
  965. 5 5 4 4 3
  966. + 1692*e *x - 1365*e + 4023*e *x - 4368*e + 4470*e *x
  967. 3 2 2
  968. - 5145*e + 2663*e *x - 2520*e + 576*e*x - 251*e + 36*x)))
  969. ,
  970. 9 8 8 7 7
  971. ((arbcomplex(24)*(e *x + 29*e *x - 7*e + 310*e *x - 161*e
  972. 6 6 5 5 4
  973. + 1520*e *x - 1246*e + 3577*e *x - 3836*e + 4283*e *x
  974. 4 3 3 2 2
  975. - 4795*e + 2988*e *x - 3065*e + 978*e *x - 672*e + 132*e*x
  976. 2 8 7 7 6 6
  977. - 42*e + 6*x))/(e *(e *x + 30*e *x - 7*e + 333*e *x - 168*e
  978. 5 5 4 4 3
  979. + 1692*e *x - 1365*e + 4023*e *x - 4368*e + 4470*e *x
  980. 3 2 2
  981. - 5145*e + 2663*e *x - 2520*e + 576*e*x - 251*e + 36*x)))
  982. ,
  983. 9 8 8 7 7
  984. ((arbcomplex(24)*(e *x + 29*e *x - 7*e + 310*e *x - 161*e
  985. 6 6 5 5 4
  986. + 1520*e *x - 1246*e + 3577*e *x - 3836*e + 4283*e *x
  987. 4 3 3 2 2
  988. - 4795*e + 2988*e *x - 3065*e + 978*e *x - 672*e + 132*e*x
  989. 2 8 7 7 6 6
  990. - 42*e + 6*x))/(e *(e *x + 30*e *x - 7*e + 333*e *x - 168*e
  991. 5 5 4 4 3
  992. + 1692*e *x - 1365*e + 4023*e *x - 4368*e + 4470*e *x
  993. 3 2 2
  994. - 5145*e + 2663*e *x - 2520*e + 576*e*x - 251*e + 36*x)))
  995. ,
  996. 9 8 8 7 7
  997. ((arbcomplex(24)*(e *x + 29*e *x - 7*e + 310*e *x - 161*e
  998. 6 6 5 5 4
  999. + 1520*e *x - 1246*e + 3577*e *x - 3836*e + 4283*e *x
  1000. 4 3 3 2 2
  1001. - 4795*e + 2988*e *x - 3065*e + 978*e *x - 672*e + 132*e*x
  1002. 2 8 7 7 6 6
  1003. - 42*e + 6*x))/(e *(e *x + 30*e *x - 7*e + 333*e *x - 168*e
  1004. 5 5 4 4 3
  1005. + 1692*e *x - 1365*e + 4023*e *x - 4368*e + 4470*e *x
  1006. 3 2 2
  1007. - 5145*e + 2663*e *x - 2520*e + 576*e*x - 251*e + 36*x)))
  1008. ,
  1009. (arbcomplex(24)))
  1010. }}
  1011. % Now check the eigenvectors and calculate the eigenvalues in the
  1012. % respective eigenspaces:
  1013. factor expt;
  1014. for each eispace in eig do
  1015. begin scalar eivaleq,eival,eivec;
  1016. eival := solve(first eispace,x);
  1017. for each soln in eival do
  1018. <<eival := rhs soln;
  1019. eivec := third eispace;
  1020. eivec := sub(soln,eivec);
  1021. write "eigenvalue = ", eival;
  1022. write "check of eigen equation: ",
  1023. m*eivec - eival*eivec>>
  1024. end;
  1025. eigenvalue = 1
  1026. check of eigen equation:
  1027. [0]
  1028. [ ]
  1029. [0]
  1030. [ ]
  1031. [0]
  1032. [ ]
  1033. [0]
  1034. [ ]
  1035. [0]
  1036. [ ]
  1037. [0]
  1038. [ ]
  1039. [0]
  1040. [ ]
  1041. [0]
  1042. eigenvalue = -1
  1043. check of eigen equation:
  1044. [0]
  1045. [ ]
  1046. [0]
  1047. [ ]
  1048. [0]
  1049. [ ]
  1050. [0]
  1051. [ ]
  1052. [0]
  1053. [ ]
  1054. [0]
  1055. [ ]
  1056. [0]
  1057. [ ]
  1058. [0]
  1059. 4 3 2 2
  1060. sqrt(e + 12*e + 10*e + 12*e + 1) + e + 6*e + 1
  1061. eigenvalue = ----------------------------------------------------
  1062. 2*e
  1063. check of eigen equation:
  1064. [0]
  1065. [ ]
  1066. [0]
  1067. [ ]
  1068. [0]
  1069. [ ]
  1070. [0]
  1071. [ ]
  1072. [0]
  1073. [ ]
  1074. [0]
  1075. [ ]
  1076. [0]
  1077. [ ]
  1078. [0]
  1079. 4 3 2 2
  1080. - sqrt(e + 12*e + 10*e + 12*e + 1) + e + 6*e + 1
  1081. eigenvalue = -------------------------------------------------------
  1082. 2*e
  1083. check of eigen equation:
  1084. [0]
  1085. [ ]
  1086. [0]
  1087. [ ]
  1088. [0]
  1089. [ ]
  1090. [0]
  1091. [ ]
  1092. [0]
  1093. [ ]
  1094. [0]
  1095. [ ]
  1096. [0]
  1097. [ ]
  1098. [0]
  1099. % For the special choice:
  1100. let e = -7 + sqrt 48;
  1101. % we get only 7 eigenvectors.
  1102. eig := mateigen(m,x);
  1103. eig := {{x + 1,
  1104. 4,
  1105. arbcomplex(27)
  1106. mat((----------------),
  1107. 4*sqrt(3) - 7
  1108. (arbcomplex(26)),
  1109. (arbcomplex(25)),
  1110. ((2*sqrt(3)
  1111. *( - arbcomplex(27) - 2*arbcomplex(26) - 2*arbcomplex(25))
  1112. + 3*arbcomplex(27) + 7*arbcomplex(26) + 7*arbcomplex(25))/(
  1113. 4*sqrt(3) - 7)),
  1114. ((2*sqrt(3)
  1115. *( - arbcomplex(27) - 2*arbcomplex(26) - 2*arbcomplex(25))
  1116. + 3*arbcomplex(27) + 7*arbcomplex(26) + 7*arbcomplex(25))/(
  1117. 4*sqrt(3) - 7)),
  1118. (arbcomplex(25)),
  1119. (arbcomplex(26)),
  1120. (arbcomplex(27)))
  1121. },
  1122. {x - 1,
  1123. 3,
  1124. [ 0 ]
  1125. [ ]
  1126. [ - arbcomplex(30)]
  1127. [ ]
  1128. [ - arbcomplex(29)]
  1129. [ ]
  1130. [ - arbcomplex(28)]
  1131. [ ]
  1132. [ arbcomplex(28) ]
  1133. [ ]
  1134. [ arbcomplex(29) ]
  1135. [ ]
  1136. [ arbcomplex(30) ]
  1137. [ ]
  1138. [ 0 ]
  1139. },
  1140. {x + 7,
  1141. 1,
  1142. [ arbcomplex(31) ]
  1143. [ ----------------- ]
  1144. [ 56*sqrt(3) - 97 ]
  1145. [ ]
  1146. [ - 14*sqrt(3)*arbcomplex(31) + 24*arbcomplex(31) ]
  1147. [--------------------------------------------------]
  1148. [ 168*sqrt(3) - 291 ]
  1149. [ ]
  1150. [ - 14*sqrt(3)*arbcomplex(31) + 24*arbcomplex(31) ]
  1151. [--------------------------------------------------]
  1152. [ 168*sqrt(3) - 291 ]
  1153. [ ]
  1154. [ - 14*sqrt(3)*arbcomplex(31) + 24*arbcomplex(31) ]
  1155. [--------------------------------------------------]
  1156. [ 168*sqrt(3) - 291 ]
  1157. [ ]
  1158. [ - 14*sqrt(3)*arbcomplex(31) + 24*arbcomplex(31) ]
  1159. [--------------------------------------------------]
  1160. [ 168*sqrt(3) - 291 ]
  1161. [ ]
  1162. [ - 14*sqrt(3)*arbcomplex(31) + 24*arbcomplex(31) ]
  1163. [--------------------------------------------------]
  1164. [ 168*sqrt(3) - 291 ]
  1165. [ ]
  1166. [ - 14*sqrt(3)*arbcomplex(31) + 24*arbcomplex(31) ]
  1167. [--------------------------------------------------]
  1168. [ 168*sqrt(3) - 291 ]
  1169. [ ]
  1170. [ arbcomplex(31) ]
  1171. }}
  1172. for each eispace in eig do
  1173. begin scalar eivaleq,eival,eivec;
  1174. eival := solve(first eispace,x);
  1175. for each soln in eival do
  1176. <<eival := rhs soln;
  1177. eivec := third eispace;
  1178. eivec := sub(soln,eivec);
  1179. write "eigenvalue = ", eival;
  1180. write "check of eigen equation: ",
  1181. m*eivec - eival*eivec>>
  1182. end;
  1183. eigenvalue = -1
  1184. check of eigen equation:
  1185. [0]
  1186. [ ]
  1187. [0]
  1188. [ ]
  1189. [0]
  1190. [ ]
  1191. [0]
  1192. [ ]
  1193. [0]
  1194. [ ]
  1195. [0]
  1196. [ ]
  1197. [0]
  1198. [ ]
  1199. [0]
  1200. eigenvalue = 1
  1201. check of eigen equation:
  1202. [0]
  1203. [ ]
  1204. [0]
  1205. [ ]
  1206. [0]
  1207. [ ]
  1208. [0]
  1209. [ ]
  1210. [0]
  1211. [ ]
  1212. [0]
  1213. [ ]
  1214. [0]
  1215. [ ]
  1216. [0]
  1217. eigenvalue = -7
  1218. check of eigen equation:
  1219. [0]
  1220. [ ]
  1221. [0]
  1222. [ ]
  1223. [0]
  1224. [ ]
  1225. [0]
  1226. [ ]
  1227. [0]
  1228. [ ]
  1229. [0]
  1230. [ ]
  1231. [0]
  1232. [ ]
  1233. [0]
  1234. % The same behaviour for this choice of e.
  1235. clear e;
  1236. let e = -7 - sqrt 48;
  1237. % we get only 7 eigenvectors.
  1238. eig := mateigen(m,x);
  1239. eig := {{x + 1,
  1240. 4,
  1241. - arbcomplex(34)
  1242. mat((-------------------),
  1243. 4*sqrt(3) + 7
  1244. (arbcomplex(33)),
  1245. (arbcomplex(32)),
  1246. ((2*sqrt(3)
  1247. *( - arbcomplex(34) - 2*arbcomplex(33) - 2*arbcomplex(32))
  1248. - 3*arbcomplex(34) - 7*arbcomplex(33) - 7*arbcomplex(32))/(
  1249. 4*sqrt(3) + 7)),
  1250. ((2*sqrt(3)
  1251. *( - arbcomplex(34) - 2*arbcomplex(33) - 2*arbcomplex(32))
  1252. - 3*arbcomplex(34) - 7*arbcomplex(33) - 7*arbcomplex(32))/(
  1253. 4*sqrt(3) + 7)),
  1254. (arbcomplex(32)),
  1255. (arbcomplex(33)),
  1256. (arbcomplex(34)))
  1257. },
  1258. {x - 1,
  1259. 3,
  1260. [ 0 ]
  1261. [ ]
  1262. [ - arbcomplex(37)]
  1263. [ ]
  1264. [ - arbcomplex(36)]
  1265. [ ]
  1266. [ - arbcomplex(35)]
  1267. [ ]
  1268. [ arbcomplex(35) ]
  1269. [ ]
  1270. [ arbcomplex(36) ]
  1271. [ ]
  1272. [ arbcomplex(37) ]
  1273. [ ]
  1274. [ 0 ]
  1275. },
  1276. {x + 7,
  1277. 1,
  1278. [ - arbcomplex(38) ]
  1279. [ ------------------- ]
  1280. [ 56*sqrt(3) + 97 ]
  1281. [ ]
  1282. [ - 14*sqrt(3)*arbcomplex(38) - 24*arbcomplex(38) ]
  1283. [--------------------------------------------------]
  1284. [ 168*sqrt(3) + 291 ]
  1285. [ ]
  1286. [ - 14*sqrt(3)*arbcomplex(38) - 24*arbcomplex(38) ]
  1287. [--------------------------------------------------]
  1288. [ 168*sqrt(3) + 291 ]
  1289. [ ]
  1290. [ - 14*sqrt(3)*arbcomplex(38) - 24*arbcomplex(38) ]
  1291. [--------------------------------------------------]
  1292. [ 168*sqrt(3) + 291 ]
  1293. [ ]
  1294. [ - 14*sqrt(3)*arbcomplex(38) - 24*arbcomplex(38) ]
  1295. [--------------------------------------------------]
  1296. [ 168*sqrt(3) + 291 ]
  1297. [ ]
  1298. [ - 14*sqrt(3)*arbcomplex(38) - 24*arbcomplex(38) ]
  1299. [--------------------------------------------------]
  1300. [ 168*sqrt(3) + 291 ]
  1301. [ ]
  1302. [ - 14*sqrt(3)*arbcomplex(38) - 24*arbcomplex(38) ]
  1303. [--------------------------------------------------]
  1304. [ 168*sqrt(3) + 291 ]
  1305. [ ]
  1306. [ arbcomplex(38) ]
  1307. }}
  1308. for each eispace in eig do
  1309. begin scalar eivaleq,eival,eivec;
  1310. eival := solve(first eispace,x);
  1311. for each soln in eival do
  1312. <<eival := rhs soln;
  1313. eivec := third eispace;
  1314. eivec := sub(soln,eivec);
  1315. write "eigenvalue = ", eival;
  1316. write "check of eigen equation: ",
  1317. m*eivec - eival*eivec>>
  1318. end;
  1319. eigenvalue = -1
  1320. check of eigen equation:
  1321. [0]
  1322. [ ]
  1323. [0]
  1324. [ ]
  1325. [0]
  1326. [ ]
  1327. [0]
  1328. [ ]
  1329. [0]
  1330. [ ]
  1331. [0]
  1332. [ ]
  1333. [0]
  1334. [ ]
  1335. [0]
  1336. eigenvalue = 1
  1337. check of eigen equation:
  1338. [0]
  1339. [ ]
  1340. [0]
  1341. [ ]
  1342. [0]
  1343. [ ]
  1344. [0]
  1345. [ ]
  1346. [0]
  1347. [ ]
  1348. [0]
  1349. [ ]
  1350. [0]
  1351. [ ]
  1352. [0]
  1353. eigenvalue = -7
  1354. check of eigen equation:
  1355. [0]
  1356. [ ]
  1357. [0]
  1358. [ ]
  1359. [0]
  1360. [ ]
  1361. [0]
  1362. [ ]
  1363. [0]
  1364. [ ]
  1365. [0]
  1366. [ ]
  1367. [0]
  1368. [ ]
  1369. [0]
  1370. % For this choice of values
  1371. clear e;
  1372. let e = 1;
  1373. % the eigenvalue 1 becomes 4-fold degenerate. However, we get a complete
  1374. % span of 8 eigenvectors.
  1375. eig := mateigen(m,x);
  1376. eig := {{x - 1,
  1377. 4,
  1378. [ - arbcomplex(42)]
  1379. [ ]
  1380. [ - arbcomplex(41)]
  1381. [ ]
  1382. [ - arbcomplex(40)]
  1383. [ ]
  1384. [ - arbcomplex(39)]
  1385. [ ]
  1386. [ arbcomplex(39) ]
  1387. [ ]
  1388. [ arbcomplex(40) ]
  1389. [ ]
  1390. [ arbcomplex(41) ]
  1391. [ ]
  1392. [ arbcomplex(42) ]
  1393. },
  1394. {x + 1,
  1395. 3,
  1396. [ arbcomplex(45) ]
  1397. [ ]
  1398. [ arbcomplex(44) ]
  1399. [ ]
  1400. [ arbcomplex(43) ]
  1401. [ ]
  1402. [ - (arbcomplex(45) + arbcomplex(44) + arbcomplex(43))]
  1403. [ ]
  1404. [ - (arbcomplex(45) + arbcomplex(44) + arbcomplex(43))]
  1405. [ ]
  1406. [ arbcomplex(43) ]
  1407. [ ]
  1408. [ arbcomplex(44) ]
  1409. [ ]
  1410. [ arbcomplex(45) ]
  1411. },
  1412. {x - 7,
  1413. 1,
  1414. [arbcomplex(46)]
  1415. [ ]
  1416. [arbcomplex(46)]
  1417. [ ]
  1418. [arbcomplex(46)]
  1419. [ ]
  1420. [arbcomplex(46)]
  1421. [ ]
  1422. [arbcomplex(46)]
  1423. [ ]
  1424. [arbcomplex(46)]
  1425. [ ]
  1426. [arbcomplex(46)]
  1427. [ ]
  1428. [arbcomplex(46)]
  1429. }}
  1430. for each eispace in eig do
  1431. begin scalar eivaleq,eival,eivec;
  1432. eival := solve(first eispace,x);
  1433. for each soln in eival do
  1434. <<eival := rhs soln;
  1435. eivec := third eispace;
  1436. eivec := sub(soln,eivec);
  1437. write "eigenvalue = ", eival;
  1438. write "check of eigen equation: ",
  1439. m*eivec - eival*eivec>>
  1440. end;
  1441. eigenvalue = 1
  1442. check of eigen equation:
  1443. [0]
  1444. [ ]
  1445. [0]
  1446. [ ]
  1447. [0]
  1448. [ ]
  1449. [0]
  1450. [ ]
  1451. [0]
  1452. [ ]
  1453. [0]
  1454. [ ]
  1455. [0]
  1456. [ ]
  1457. [0]
  1458. eigenvalue = -1
  1459. check of eigen equation:
  1460. [0]
  1461. [ ]
  1462. [0]
  1463. [ ]
  1464. [0]
  1465. [ ]
  1466. [0]
  1467. [ ]
  1468. [0]
  1469. [ ]
  1470. [0]
  1471. [ ]
  1472. [0]
  1473. [ ]
  1474. [0]
  1475. eigenvalue = 7
  1476. check of eigen equation:
  1477. [0]
  1478. [ ]
  1479. [0]
  1480. [ ]
  1481. [0]
  1482. [ ]
  1483. [0]
  1484. [ ]
  1485. [0]
  1486. [ ]
  1487. [0]
  1488. [ ]
  1489. [0]
  1490. [ ]
  1491. [0]
  1492. ma := mat((1,a),(0,b));
  1493. [1 a]
  1494. ma := [ ]
  1495. [0 b]
  1496. % case 1:
  1497. let a = 0;
  1498. mateigen(ma,x);
  1499. {{x - 1,1,
  1500. [arbcomplex(47)]
  1501. [ ]
  1502. [ 0 ]
  1503. },
  1504. { - b + x,1,
  1505. [ 0 ]
  1506. [ ]
  1507. [arbcomplex(48)]
  1508. }}
  1509. % case 2:
  1510. clear a;
  1511. let a = 0, b = 1;
  1512. mateigen(ma,x);
  1513. {{x - 1,2,
  1514. [arbcomplex(49)]
  1515. [ ]
  1516. [arbcomplex(50)]
  1517. }}
  1518. % case 3:
  1519. clear a,b;
  1520. mateigen(ma,x);
  1521. {{ - b + x,
  1522. 1,
  1523. [ arbcomplex(51)*a ]
  1524. [------------------]
  1525. [ b - 1 ]
  1526. [ ]
  1527. [ arbcomplex(51) ]
  1528. },
  1529. {x - 1,1,
  1530. [arbcomplex(52)]
  1531. [ ]
  1532. [ 0 ]
  1533. }}
  1534. % case 4:
  1535. let b = 1;
  1536. mateigen(ma,x);
  1537. {{x - 1,2,
  1538. [arbcomplex(53)]
  1539. [ ]
  1540. [ 0 ]
  1541. }}
  1542. % Example from H.G. Graebe:
  1543. m1:=mat((-sqrt(3)+1,2 ,3 ),
  1544. (2 ,-sqrt(3)+3,1 ),
  1545. (3 ,1 ,-sqrt(3)+2));
  1546. [ - sqrt(3) + 1 2 3 ]
  1547. [ ]
  1548. m1 := [ 2 - sqrt(3) + 3 1 ]
  1549. [ ]
  1550. [ 3 1 - sqrt(3) + 2]
  1551. nullspace m1;
  1552. {
  1553. [ 3*sqrt(3) - 7 ]
  1554. [ ]
  1555. [ sqrt(3) + 5 ]
  1556. [ ]
  1557. [ - 4*sqrt(3) + 2]
  1558. }
  1559. for each n in ws collect m1*n;
  1560. {
  1561. [0]
  1562. [ ]
  1563. [0]
  1564. [ ]
  1565. [0]
  1566. }
  1567. end;
  1568. 4: 4: 4: 4: 4: 4: 4: 4: 4:
  1569. Time for test: 1930 ms, plus GC time: 80 ms
  1570. 5: 5:
  1571. Quitting
  1572. Sun Jan 3 23:46:28 MET 1999