Let H denote the n times n Hilbert matrix, whose (i,j) entry is 1 /(i + j - 1).
ID: 2966137 • Letter: L
Question
Let H denote the n times n Hilbert matrix, whose (i,j) entry is 1 /(i + j - 1). Write a matlab program to solve Hx = b where b is the vector of all ones, for n = 2,5,10. You can use the backslash command x = H. Report the entries in x. If we solved this problem by hand, they would be integers. Use the solutions x you found in the previous question to compute the matrix-vector product Hx. How far is the result from the true right-hand-side vector bl Use the matlab command ''norm" to measure the size of the difference. What happens if n = 100? n = 1000?Explanation / Answer
10)
H*x
ans =
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
-------------------------------------------------------------------------
>> c=H*x;
>> norm(c)-norm(b)
ans =
-3.9115e-11
% the answers is very close to the original value of 'b'
--------------------------------------------------------------------------------------------------------
for n=100 (to the check the difference)
n=100;
H=zeros(n);
for i=1:n
for j=1:n
H(i,j)=1./(i+j-1);
end
end
b=ones(n,1);
x=H;
c=H*x;
difference=norm(c)-norm(b);
disp(difference)
---------------- ans= 4.6119e-07
for n=1000 (to check the difference)
n=1000;
H=zeros(n);
for i=1:n
for j=1:n
H(i,j)=1./(i+j-1);
end
end
b=ones(n,1);
x=H;
c=H*x;
difference=norm(c)-norm(b);
disp(difference)
--------------- ans= -2.6969e-06
--------------------------------------------------
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.