Homework #5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

C&EE 103 Applied Numerical Computing and Modeling Summer 2021

Homework #5
Due at 11:59 pm on Wednesday, July 28, 2021

Problem 1. Find the solution x to the linear system Ax D b with


2 3 0 1 0 1
1 2 4 3 x1 1
6 8 57 B C B 3C
AD6 7 ; x D Bx2 C ; and b D B C:
6 0
40 1 2 0 5 @ x3 A @ 7A
2 0 6 2 x4 2

a) Use Gaussian elimination to find the upper triangular matrix U , and use back substitution to find x.

b) Use Gaussian elimination to find the inverse matrix A 1, and find x from x D A 1 b.

c) Use the LU -factorization of A to find x from Lg D b and Ux D g.

For each case, write down each elimination step (and/or the (forward and) back substitution) to find the
solution x by hand calculations.
Problem 2. In engineering problems, it is often the case that m linear systems Axi D bi , with the same
n ⇥ n system matrix A, need to be solved for all i 2 f1; 2; 3; :::; mg to find, e.g., different displacements
that are represented by xi of the same structure that is represented by A subjected to different load cases
that are represented by bi . Give an operations count on how many additions and subtractions (AS) and
multiplications and divisions (MD) are required to solve these m linear systems when Gaussian elimination
is employed. How many arithmetic operations are required in total for n D 100000 and m D 10?
Problem 3. Consider solving the linear system Ax D b, and assume that the n ⇥ n inverse system matrix
A 1 is known. How many arithmetic operations are required to find x from x D A 1 b? Moreover,
how many operations are required for n D 100, and how many operations are required when Gaussian
elimination is employed for the same n? Compare the results, and give a brief statement.
Problem 4. Consider the following 5 ⇥ 5 variant of a staircase matrix:
2 3
b1 c1
6a2 b2 7
6 7
AD6 6 7:
a3 b3 c3 7
4 a4 b4 5
a5 b5

To factorize A as A D LU , consider the general forms of L and U , which are in this case given as
2 3 2 3
1 ˇ1 c1
6˛2 1 7 6 ˇ2 7
6 7 6 7
6 7 6 7:
LD6 ˛3 1 7 and U D 6 ˇ3 c3 7
4 ˛4 1 5 4 ˇ4 5
˛5 1 ˇ5

1
C&EE 103 Applied Numerical Computing and Modeling Summer 2021

a) Derive general formulas to determine the coefficients of both L and U for the case that A is a general
n ⇥ n staircase matrix of the form given above.

b) Use the result found in Part a) to write a M ATLAB script based on the LU -factorization of A that is
able to solve the two linear systems Ax1 D f1 and Ax2 D f2 with user-defined staircase matrix A
and user-defined right-hand side vectors f1 and f2 . Apply this M ATLAB script to the case in which
A, f1 , and f2 are defined as follows:
2 3 0 1 0 1
3 5 5 3
64 6 7 B 1C B9C
6 7 B C B C
6 9 1 7 7 B7C B4C
AD6 6 7 ; f1 D B C ; and f2 D B
B C C
7 B 6C :
6 2 5 7 B C3 B C
4 8 7 15 @ 8A @5A
6 3 4 2

c) Give an operations count for all additions and subtractions (AS) as well as multiplications and divi-
sions (MD) required to solve the two nth-order linear systems Ax1 D f1 and Ax2 D f2 based on
the LU -factorization of A given above. How many operations are required to solve both linear sys-
tems with n D 3000000? Compare the number of total operations with the number of total operations
required to solve the same two linear systems using Gaussian elimination, and give a brief statement.

d) Extend your M ATLAB script obtained in Part b) to include an operations counter into your script,
and output the result of total operations and the result split into two parts according to additions and
subtractions (AS) as well as multiplications and divisions (MD). Furthermore, output the respective
results obtained from Gaussian elimination, and compute the factor by which Gaussian elimination
is computationally more expensive (in terms of the counted operations) than the LU -factorization
derived above.

Hint: a M ATLAB template will be provided on CCLE.

Turn in your M ATLAB script for this problem. Remember to copy all your files into a folder labeled Last-
nameFirstnameHW5, zip that folder, and upload it to CCLE.

You might also like