0% found this document useful (0 votes)
35 views2 pages

MATH 3650 Homework 7

Uploaded by

corymoody5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

MATH 3650 Homework 7

Uploaded by

corymoody5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Homework 07

MATH 3650 Spring 2024 ©Timo Heister, [email protected]


1. Manually compute the inverse of
 
0 4 1
A = −5 4 7
−1 3 2

using Gauss-Jordan. Make sure to write down each operation you perform.
Also use MATLAB to compute the inverse and write down the answer (use format long ).
Why is the output slightly different? Which solution is correct?

2. Given vector x and matrices A and B defined as


 
0  
4 0 4 1  
−5 0 2
x= 0
 A = 4 7 , B=
3 0
−1 3 2
−3

(a) Compute kxk2 , kxk∞ , kAk∞ , kBk∞ .


(b) Compute cond∞ (A) and cond∞ (B).
(c) Compute kBk2 using the definition of the matrix norm. Yes, this is a lot more compli-
cated to do. That is why we use the infinity norm if possible.

Note: These computations are to be done manually. Show your work!

3. The following questions are based on the linear system of the finite difference problem (see
HW05 Q4 or finite_difference_laplace.m on Canvas). For a given N , A is a (N − 2) ×
(N − 2) matrix and b is a vector with N − 2 elements. We will use u(0) = 0, u(1) = 1,
f (x) = 1 here.

(a) Create a function function [A,b]=finite_difference_system(N) that returns the


matrix and right hand side as used in finite_difference_laplace.m . With that,
confirm as shown in class, that while the matrix A is sparse (many zero entries), every
entry in the inverse is nonzero (not sparse). Use N = 7.
(b) Compute the time it takes (using tic and toc ) to solve the linear system for different
sizes (2500, 5000, and 10000) using the following methods: 1. using backslash. 2. by
computing the inverse of A and then computing x by multiplying the inverse by b. 3.
using backslash but use the matrix A2=sparse(A) .
Note:The sparse command creates a sparse representation of the matrix that allows
backslash to “know” that most entries of the matrix are zero. Don’t include the time
it takes to compute the sparse representation, but do inlude the computation of the
inverse. Notice how (3.) is much better than (1.) and using the inverse (2.) is a bad
idea.

1
Submit hw07q3.m and finite_difference_system.m .

4. You are given    


2 4 2
A= , b=
3 6.001 3

(a) Solve Ax = b using backslash.


(b) Change the first entry of b to 2.01 and solve for the new solution x̂.
(c) What is the relative difference using the infinity norm between the solutions?
(d) Show that this agrees with the theorem about the difference between solutions with
perturbed right hand side by computing both sides of the inequality.

Submit hw07q4.m .

You might also like