Question 1
matlab | 代做IT | lab作业 – 该题目是一个常规的matlab的练习题目代写, 是比较有代表性的matlab/IT/math等代写方向, 这是值得参考的lab代写的题目
(a):
HTvHv= (I 2
vvT
vTv
)T(I 2
vvT
vTv
) =I 4
vvT
vTv
+ 4
v(vTv)vT
(vTv)^2
=I 4
vvT
vTv
+ 4
vvT
vTv
=I. (1)
(b):HvT= (I 2 vv
T
vTv)
T= IT 2 (vT)TvT
vTv =I^2
vvT vTv=Hv. (c):H^2 v=HvHv=HvTHv=Iby both (a) and (b). (d): By (a),His an orthogonal matrix, and thereforeHpreserves the length of vector in multiplication. Hence, all eigenvalues of it have absolute value 1. Plus, since the matrixHis real (Of course) and symmetric (by (b)), all eigenvalues are 1 or -1. Note thatHvv=v^2 vv Tv vTv =v^2 v=v. Thusvis an eigenvector with eigenvalue -1. And for the nonzero vectorvRm, there existsm 1 independent vectors that are orthogonal tov, and for any of these vectors, sayu,Hvu=u 2 vv Tu vTv =usincev Tu= 0. Then all them 1 independent vectors that are
orthogonal tovare indeedm 1 eigenvectors with eigenvalue 1. Then done. (e): By (d),det(Hv) = mi=1i= 1m^1 (1) = 1.
Question 2
(a): Sincev= [0k,v ]T, we have
vvT= [0k, v]T[0k,v ] =
(
(^0) kk (^0) kn (^0) nk v vT
)
. (2)
Finally, based onvTv= vT vand the fact above, we have
(
Ikk (^0) kn (^0) nk H v
)
=I(k+n)(k+n)
(
(^0) kk (^0) kn (^0) nk 2 v v T vTv
)
=I(k+n)(k+n)
(
(^0) kk (^0) kn (^0) nk 2 v v T vTv
)
=I 2 vv
T
vTv
=Hv. (3)
(b): The Householder matrixHvreflects across the spacespan((1,1)). AndHvu=u (^212)
(
1 1
1 1
)
u=
[ 2 ,1]T.
Figure 1: Plot of Question 2 (b)
Question 3
For both (a) and (b), we use thexidata to obtain the matrixAand set the parameters 0 , 1 ,( 2 )as a vectorX, then use normal equations to obtainATAX=ATy, then use the mat lab function(ATA)\ATyto obtain the result. (a): By running the Matlab code in Question 3, we obtain 0 = 1. 6580 , 1 = 3. 3360. (b): By running the Matlab code in Question 3, we obtain 0 = 3. 5523 , 1 = 0. 6617 , 2 = 0. 8914.
Question 4
In Question 4, we first use parts of Question 3 ( about the construction of matrixA). And then use the Matlab function[Q, R] =qr(A)to obtain the QR decomposition ofA. And byR=QTy, we obtain =R(QTy). (a): By running the Matlab code in Question 4 for (a), we obtain 0 = 3. 5523 , 1 = 0. 6617 , 2 = 0. 8914. (b) By running the Matlab functionalpha=solveLS(y, A), we obtain the similar result of (a): 0 =
- 5523 , 1 = 0. 6617 , 2 = 0. 8914.
Question 5
We first assume that the running time polynomial ofinv(A)has the form of 0 + 1 x+ 2 x^2 + 3 x^3 (based on our knowledge, it should be at mostO(n^3 )). Then we use randn function to generate 10 different matrices A with different size. Then calculate their running time separately as the datay. And the length ofAis the datax. Then we use the function in Question 4 (b) to obtain the result. Note that since the 10 matrices A are all generated randomly, the result ofi, i= 0, 1 , 2 , 3 are different each time running the code. For example, one result is: 0 = 9. 3657 e 03 , 1 = 1. 0404 e 04 , 2 = 2. 7236 e 07 , 3 = 2. 2631 e 10.