Please show code and explain all steps/conclusions. Thank you. Hint : Try [Q,H]=
ID: 2967030 • Letter: P
Question
Please show code and explain all steps/conclusions. Thank you.
Hint: Try [Q,H]=hess(hilb(n))
Calculate the Hesseuberg reductions (Q, H) of the Hubert matrices of size n Epsilon {2. 4.6,8, 10. 12} (Matlab, functions hess and hub). (a) Is there a pattern in the (1, 1) element of H? (b) Is there a pattern in the condition number of H? (c) Is there a pattern in the determinant of H? (d) Which of these is most relevant for indicating the size of the smallest eigenvalue? In each case, support s-our answers wit h numerical evidence.Explanation / Answer
clear all
clc
format long
% Input the size (n) of the Hilbert matrix.
n = input('Enter a value of n = ');
% Construct a Hilbert matrix HM of size n.
HM = hilb(n);
% Do Hessenberg reductions of the Hilbert matrix HM.
[Q,H] = hess(HM);
% The matrix H is the Hessenberg form of HM and Q is a
% unitary matrix so that HM = Q*H*Q'.
disp('Q = ')
disp(Q)
disp('H = ')
disp(H)
% Find H(1,1).
disp('H(1,1) = ')
disp(H(1,1))
% Find 2-norm condition number of H.
cd = cond(H);
disp('Condition number of H is = ')
disp(cd)
% Find the determinant of the matrix H.
d = det(H);
disp('The determinant of the matrix H is = ')
disp(d)
% Find the eigen values of the matrix H.
lambda = eig(H);
disp('The eigenvalues of H are : ')
disp(lambda)
-------------------------------------------------------Outputs---------------------------------------------------------------
---------------------------------------------------------n=2-------------------------------------------------------------------
Enter a value of n = 2
Q =
1 0
0 1
H =
1.000000000000000 0.500000000000000
0.500000000000000 0.333333333333333
H(1,1) =
1
Condition number of H is =
19.281470067903971
The determinant of the matrix H is =
0.083333333333333
The eigenvalues of H are :
0.065741454089335
1.267591879243998
--------------------------------------------------------------n=4-----------------------------------------------------------------
Enter a value of n = 4
Q =
-0.158934960433806 0.703559195726522 -0.692635644809415 0
0.741696482024431 -0.377955131223045 -0.554108515847532 0
-0.651633337778607 -0.601792636122129 -0.461757096539610 0
0 0 0 1.000000000000000
H =
0.003063047891699 -0.006838097843378 0 0
-0.006838097843378 0.180590114865942 -0.268310528561767 0
0 -0.268310528561767 1.349680170575693 -0.360940130461795
0 0 -0.360940130461795 0.142857142857143
H(1,1) =
0.003063047891699
Condition number of H is =
1.551373873890015e+004
The determinant of the matrix H is =
1.653439153442778e-007
The eigenvalues of H are :
0.000096702304023
0.006738273605761
0.169141220221450
1.500214280059243
-------------------------------------------------------------n=6---------------------------------------------------------------
Enter a value of n = 6
Q =
-0.007411553845305 0.058291051355222 0.279344451554841 0.772077486611638 -0.567811812359061 0
0.127981923660017 -0.466777663178740 -0.724816999543446 -0.059217545424291 -0.486695839164909 0
-0.523420041804733 0.646587803560269 -0.198754962106470 -0.295120939860508 -0.425858859269296 0
0.760830754028545 0.268671576321424 0.246593097958447 -0.380592361333287 -0.378541208239374 0
-0.361571181992381 -0.537085247287026 0.544330142134049 -0.410417741249060 -0.340687087415437 0
0 0 0 0 0 1.000000000000000
H =
0.000003494455325 -0.000007913316465 0 0 0 0
-0.000007913316465 0.000335978504270 0.000582395859675 0 0 0
0 0.000582395859675 0.013771440282109 0.022429972463462 0 0
0 0 0.022429972463462 0.319754647090010 -0.376396495159912 0
0 0 0 -0.376396495159912 1.453436026969874 -0.293524479482427
0 0 0 0 -0.293524479482427 0.090909090909091
H(1,1) =
3.494455324922451e-006
Condition number of H is =
1.495105864722880e+007
The determinant of the matrix H is =
5.367299884959512e-018
The eigenvalues of H are :
0.000000108279948
0.000012570757123
0.000615748354183
0.016321521319876
0.242360870575210
1.618899858924340
--------------------------------------------------------------n=8----------------------------------------------------------------
Enter a value of n = 8
Q =
Columns 1 through 6
-0.000291642518999 -0.002983584537208 -0.019729161385640 -0.095617713862787 -0.349769226562492 0.790402336084096
0.011001419948867 0.068969638114807 0.252212558547448 0.567165508269021 0.640561137824085 0.084922129148379
-0.101742749101115 -0.367011617418754 -0.637836938127268 -0.368592727249490 0.367860529547748 -0.145488057784851
0.383381232015169 0.643718438756655 0.156085465177788 -0.470193302597001 0.065849905190481 -0.245219076306024
-0.685683632659966 -0.145357509331743 0.492666201453915 -0.214169081966556 -0.163372235030671 -0.291991987644950
0.580707924307099 -0.548365376150873 0.211613107677285 0.142355226177113 -0.326588966978897 -0.313367054008202
-0.187516373143258 0.352604509678721 -0.466155403301053 0.496089500540951 -0.440833865663001 -0.321395359899135
0 0 0 0 0 0
Columns 7 through 8
-0.493340309945685 0
-0.438524719951720 0
-0.394672247956548 0
-0.358792952687771 0
-0.328893539963790 0
-0.303594036889652 0
-0.281908748540391 0
0 1.000000000000000
H =
Columns 1 through 6
0.000000003664459 0.000000009071759 0 0 0 0
0.000000009071759 0.000000515784347 0.000000936124013 0 0 0
0 0.000000936124013 0.000031851010971 0.000049518152065 0 0
0 0 0.000049518152065 0.001137799616959 0.001646153279252 0
0 0 0 0.001646153279252 0.026811449649384 -0.039161057640661
0 0 0 0 -0.039161057640661 0.423906423747998
0 0 0 0 0 -0.441416978847519
0 0 0 0 0 0
Columns 7 through 8
0 0
0 0
0 0
0 0
0 0
-0.441416978847519 0
1.503245711659636 -0.253374795207313
-0.253374795207313 0.066666666666667
H(1,1) =
3.664458778605225e-009
Condition number of H is =
1.525756631098546e+010
The determinant of the matrix H is =
2.737051816421030e-033
The eigenvalues of H are :
0.000000000111154
0.000000017988737
0.000001294332092
0.000054369433698
0.001467688117742
0.026212843578119
0.298125211316931
1.695938996921949
---------------------------------------------------------n=10--------------------------------------------------------------------
Enter a value of n = 10
Q =
Columns 1 through 6
-0.000010590043858 0.000129150638829 0.001046146953708 0.006441683775568 0.031594062009297 -0.125353351489611
0.000700317854454 -0.005947093429273 -0.031895033807336 -0.121254343758108 -0.330456751426825 0.605600569082118
-0.011471684895306 0.066263006833961 0.225714678479648 0.487485983369994 0.599734512998628 -0.182608665834276
0.079783445147869 -0.294368716837768 -0.559154611175354 -0.470798020526462 0.139477271628580 -0.416735474214434
-0.286449480001648 0.582005189621332 0.363867199988241 -0.311055109462712 -0.282860450643342 -0.353444797422174
0.574517757119975 -0.391100710813913 0.364944253791118 0.183581724796598 -0.397050031710640 -0.172777010373023
-0.649862196096093 -0.287662559117279 -0.231204691741301 0.421350211221833 -0.252056439010624 0.040358500858339
0.387428352027271 0.539358142651661 -0.458497935888623 0.214905120929081 0.057410292808620 0.248971963976548
-0.094641175288397 -0.208744166779821 0.325762187516280 -0.414469282837344 0.454067839549186 0.438325381554754
0 0 0 0 0 0
Columns 7 through 10
-0.398172338775796 0.793162755302973 -0.442263923743204 0
0.564026573886630 0.168860347223157 -0.402058112493822 0
0.418675535384999 -0.052342972673119 -0.368553269786004 0
0.197706711299028 -0.157253308388189 -0.340203018264003 0
0.012419272971287 -0.212555771197301 -0.315902802673717 0
-0.129353160170650 -0.242730285606206 -0.294842615828803 0
-0.235259997231437 -0.258889974651307 -0.276414952339503 0
-0.313795846375945 -0.266750689404367 -0.260155249260708 0
-0.371825344850953 -0.269504620101722 -0.245702179857336 0
0 0 0 1.000000000000000
H =
Columns 1 through 6
0.000000000003650 -0.000000000009842 0 0 0 0
-0.000000000009842 0.000000000678825 0.000000001323232 0 0 0
0 0.000000001323232 0.000000057151863 0.000000093423617 0 0
0 0 0.000000093423617 0.000002878099968 0.000004211349387 0
0 0 0 0.000004211349387 0.000096530664739 -0.000131965004137
0 0 0 0 -0.000131965004137 0.002282210188704
0 0 0 0 0 0.003042780081096
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
Columns 7 through 10
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0.003042780081096 0 0 0
0.040384977632762 -0.055391207810038 0 0
-0.055391207810038 0.505359763517890 -0.485467761720152 0
0 -0.485467761720152 1.532497533273784 -0.226109331174079
0 0 -0.226109331174079 0.052631578947368
H(1,1) =
3.650356777195646e-012
Condition number of H is =
1.602740925342500e+013
The determinant of the matrix H is =
2.163760154221119e-053
The eigenvalues of H are :
0.000000000000109
0.000000000022667
0.000000002147439
0.000000122896774
0.000004729689293
0.000128749614276
0.002530890768670
0.035741816271639
0.342929548483509
1.751919670265178
------------------------------------------------------------n=12----------------------------------------------------------------
Enter a value of n = 12
Q =
Columns 1 through 6
-0.000000367276465 0.000005107035342 0.000047858882257 0.000347371771492 0.002058213429040 0.010195596342352
0.000037653482793 -0.000392710306806 -0.002678328064644 -0.013615294835321 -0.053707515623311 -0.165012118575994
-0.000960169990544 0.007427104781563 0.036229623185626 0.125376821658240 0.313041942493734 0.538553800284806
0.010581665251119 -0.059034585924045 -0.196771006804292 -0.426680747291036 -0.562882009657141 -0.290119654476204
-0.062271892017049 0.237324437241412 0.487235710969349 0.511408209475099 0.050960727867359 -0.411108878250121
0.216636920657220 -0.505554171939819 -0.468894333640643 0.097619517671960 0.409537032445493 -0.116797361112831
-0.467359376815622 0.504496151903347 -0.132521946154475 -0.389126913049120 0.230304000743097 0.200069397094211
0.631986352204067 -0.000550377805117 0.427235849921140 -0.253634530090098 -0.151220732454365 0.349735028581711
-0.521182744710043 -0.488338018724329 0.135086251939702 0.230220465069930 -0.378088210892466 0.281923238506154
0.239584639193405 0.421719556339455 -0.491587511490527 0.416203205636659 -0.231969580277720 0.012891081154516
-0.047052862807056 -0.117105154977910 0.206644043713520 -0.298318568614158 0.373221182632646 -0.416912534269325
0 0 0 0 0 0
Columns 7 through 12
0.042600635880892 -0.149876181948035 -0.434109343057191 0.789701661127745 -0.404393831776184 0
-0.383874146448309 0.619632234221360 0.498990747408851 0.223731245036030 -0.373286613947246 0
0.534708233559261 -0.055401196283695 0.430812410677642 0.012137032903476 -0.346623284379586 0
0.281146849728207 -0.335427212184587 0.263720156363665 -0.094110583229565 -0.323515065420947 0
-0.091956716971743 -0.364587930505474 0.110415368130006 -0.153931115943920 -0.303295373832138 0
-0.304216301617940 -0.276828314869902 -0.013706899018453 -0.189409993581686 -0.285454469489071 0
-0.339409315933396 -0.142812438208986 -0.110875579712950 -0.210807768740376 -0.269595887850789 0
-0.242248011252999 0.002951417057358 -0.186164159388395 -0.223533555081814 -0.255406630595484 0
-0.060147582576996 0.144279067520261 -0.244315554103147 -0.230687485234252 -0.242636299065710 0
0.170010192667971 0.274125132436367 -0.289165675145739 -0.234154949999774 -0.231082189586391 0
0.422447397195652 0.389985770590862 -0.323686359811125 -0.235134324965398 -0.220578453696100 0
0 0 0 0 0 1.000000000000000
H =
Columns 1 through 6
0.000000000000004 -0.000000000000010 0 0 0 0
-0.000000000000010 0.000000000000816 0.000000000001704 0 0 0
0 0.000000000001704 0.000000000087125 0.000000000151275 0 0
0 0 0.000000000151275 0.000000005693318 0.000000008740534 0
0 0 0 0.000000008740534 0.000000254361720 0.000000357984687
0 0 0 0 0.000000357984687 0.000008220339777
0 0 0 0 0 0.000010885822535
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
Columns 7 through 12
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0.000010885822535 0 0 0 0 0
0.000198406911997 -0.000253183625744 0 0 0 0
-0.000253183625744 0.003658970345240 0.004645075650753 0 0 0
0 0.004645075650753 0.053836179544785 -0.070675917601366 0 0
0 0 -0.070675917601366 0.571432480624651 -0.517584870971281 0
0 0 0 -0.517584870971281 1.551740059869170 -0.206069743861610
0 0 0 0 -0.206069743861610 0.043478260869565
H(1,1) =
3.534875738265536e-015
Condition number of H is =
1.420858872896724e+016
The determinant of the matrix H is =
3.279041538752771e-078
The eigenvalues of H are :
0.000000000000000
0.000000000000027
0.000000000003111
0.000000000225196
0.000000011228611
0.000000408237611
0.000011163357483
0.000233089089022
0.003722312237891
0.044738548752181
0.380275245955037
1.795372059561997
---------------------------------------------------------------(a)------------------------------------------------------------------
Note that H(1,1) is decreasing as n increases.
---------------------------------------------------------------(b)------------------------------------------------------------------
The condition number of H is increasing as n increases.
---------------------------------------------------------------(c)------------------------------------------------------------------
The determinant of H is decreasing as n increases.
---------------------------------------------------------------(d)------------------------------------------------------------------
Note that for each n, the smallest eigen value of H is less than H(1,1). So, H(1,1) is most relevant to indicate the size of the smallest eigen value.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.