Test1Practice2
pdf
keyboard_arrow_up
School
University of New South Wales *
*We aren’t endorsed by this school
Course
2089
Subject
Mathematics
Date
Apr 3, 2024
Type
Pages
13
Uploaded by EarlFreedomWildcat32
(a)
[
4 marks
]
(i)
What is the value of after the following commands are executed in MATLAB
or Python (with defined to be the relative machine precision for )?
(ii)
What are the elements of after the following commands are executed in
MATLAB or Python (with the appropriate import commands)?
MATLAB: Python:
(b)
[
3 marks
]
A technician claims that the amount of energy used in a chemical reaction (in
appropriate units) is
and that the measurement was made to decimal places.
(i)
Give the correctly rounded value for .
(ii)
Give an estimate of the absolute error in .
MATLAB: Python: MATLAB: Python: MATLAB: Python: MATLAB: Python:
MATLAB: Python:
MATLAB: Python: MATLAB: Python:
MATLAB: Python: MATLAB: Python:
MATLAB: Python:
MATLAB: Python:
(iii)
Give an estimate of the relative error in .
(c) [
3 marks
]
You are asked to calculate the expression
when and is much smaller in magnitude than .
(i)
Is this expression good or not good for implementation on a computer?
(ii)
Find a mathematically equivalent, but numerical preferable, expression for .
(Select the original expression if it is already the preferable one.)
This expression risks a potential catastrophic
cancellation.
This expression is good for implementation
on a computer.
(a)
[
4 marks
]
The computational complexities of some common operations with by matrices are given in the table below.
Operations
Flops
Matrix-matrix multiplication
Matrix-vector multiplication
LU factorization
Cholesky factorization
Back/forward substitution
Tridiagonal solve
You have a GHz workstation with cores where each core can do floating
point operations per clock cycle. Estimate how long it will take to solve the by
linear system where is symmetric and positive definite and .
(b)
[
4 marks
]
Estimate the size of the largest by matrix that can be stored in GB RAM
using double precision floating point arithmetic. Assume that GB = bytes.
(c)
[
2 marks
]
Suppose is an invertible matrix with no special structure and .
A programmer claims that the best strategy to solve two linear systems
and is to first calculate the inverse and then
compute and . Justify or refute this claim.
0.039 seconds
18 minutes
8.9 minutes
7.6E-6 seconds
FALSE. Better to compute the factorization of the matrix once, then use
forward and back substitutions to solve
for .
TRUE. Computing the inverse of the matrix is the most efficient way.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
You are given the results of the following MATLAB commands and some related spy
plots corresponding to a matrix with real number entries.
NOTE: Related (not necessarily the same) Python commands are
(a)
[
2 marks
]
You are told that
has the Cholesky factorization . Tick ALL
statements that apply.
(b)
[
2 marks
]
Is the matrix positive definite? Tick ALL answers that apply.
(c) [
2 marks
]
What are the steps to solve using the Cholesky factorization
?
(d)
[
4 marks
]
The elements of the coefficient matrix are known exactly and the elements of
the right-hand-side vector are known to significant figures. From the above
MATLAB results it can be deduced that the -norm condition number of the
matrix is .
(i)
Give an estimate on the relative error in the computed solution to
.
(ii)
How many significant figures do you have in the computed solution?
The matrix is lower triangular.
The matrix is upper triangular.
All the diagonal elements of are positive.
All the diagonal elements of are equal to .
All the diagonal elements of are nonzero.
No, since is not symmetric because
.
Yes, since is symmetric and its Cholesky
factorization exists.
Yes, since all eigenvalues of are positive.
Not enough information, since we cannot
deduce that is symmetric from its spy plot.
Yes, since is symmetric and all its eigenvalues
are positive.
Solve for by back substitution, and
then solve for by forward substitution.
Solve for by back substitution, and then
solve for by forward substitution.
Solve for by forward substitution, and
then solve for by back substitution.
Solve for by forward substitution, and
then solve for by back substitution.
You are given the results of the following MATLAB commands and some related spy
plots corresponding to a matrix with real number entries.
NOTE: Related (not necessarily the same) Python commands are
(a)
[
2 marks
]
You are told that
has
an
factorization .
Tick ALL
statements that apply.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
(b)
[
2 marks
]
Is an identity matrix this example? Tick ALL answers that apply.
(c) [
2 marks
]
What are the steps to solve using the factorization ?
(d)
[
4 marks
]
From the above MATLAB results it can be deduced that the -norm condition
number of the matrix is
. You want to guarantee significant
figures in the computed solution to . The elements of the coefficient
matrix are known exactly.
(i)
Estimate the relative error in the right-hand-side vector that would be
required to guarantee this.
(ii)
How many significant figures do you need in the right-hand-side vector ?
All the diagonal elements of are equal to .
The matrix is upper triangular.
The matrix is obtained by swapping columns of
the identity matrix.
The matrix is obtained by swapping rows of the
identity matrix.
All the diagonal elements of are equal to .
The matrix is lower triangular.
No, from the spy plot of we see that is not
even a diagonal matrix.
Yes, is always the identity matrix.
Not enough information, since we cannot tell the
entries of from its spy plot.
No, will never be the identity matrix.
Solve for by back substitution, and then
solve for by forward substitution.
Solve for by forward substitution, and
then solve for by back substitution.
Solve for by forward substitution, and
then solve for by back substitution.
Solve for by back substitution, and
then solve for by forward substitution.
The desired accuracy on is impossible to
achieve.
The desired accuracy on is impossible to
achieve.
You do NOT need MATLAB or Python to answer this question.
Consider the data values measured at the times for given in
the table below.
1
2
3
4
5
0
0.5
1.0
1.5
2.0
0.2
3.1
4.9
7.2
8.1
The data, which is in column vectors and , produces the approximation
obtained with the following MATLAB commands
The data and the approximation are plotted in the figure below.
NOTE: Related (not necessarily the same) Python commands are
(a) [
2 marks
]
What are the values of and for this example?
(b) [
2 marks
]
It is claimed that the solution to the linear system is given by
, where . Is this correct for this example?
5
3
(c) [
2 marks
]
What do the MATLAB commands above calculate?
(d) [
2 marks
]
Give the formula for the approximation obtained.
Hint: You should enter a Maple expression such as 1 + 2*x + 3*x^2. Remember
to type the multiplication symbol * whenever appropriate. Click on the preview
button to double check your answer. Type exp for the exponential function if
needed.
For this answer box, just use the numbers from the given MATLAB output rather
than running your own calculation. (But keep in mind that in a real calculation
there are generally more digits than shown by the default MATLAB output
format.)
(e) [
2 marks
]
For a different matrix , the results of the following MATLAB commands are
NOTE: Related (not necessarily the same) Python commands are
Explain why ?
YES. This gives one of the many possible
solutions.
NO. The inverse of exists but the solution is not
given by .
NO. The inverse of does not exist.
YES. The inverse of exists and the unique
solution is given by .
The exact solution to the linear system .
The least squares approximation to the data using
the exponential model .
The least squares approximation to the data using
the linear model .
The least squares approximation to the data using
the quadratic model .
0.22 + 5.98*x -x^2
Since , and is not an identity matrix.
This is due to the limited floating point precision.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
You will need to use MATLAB or Python to answer this question.
We want to find the interpolating polynomial
for the data points below:
This problem can be formulated as a linear system , with being a column
vector of the data values and with being an -by-
matrix depending on the
values .
The matrix has condition number . Use this information as a
consistency check to be sure that you have defined correctly.
(a)
[
2 marks
]
What are the values of and ?
and (b) [
7 marks
]
Provide the approximation you obtained.
Give your coefficients to at least 3 significant figures. Enter 0 for terms that do
not appear.
(c)
[
1 mark
]
Use your approximation to estimate the data value at .
Give your answer to at least 3 significant
figures.
5
5
5.4847307
-7.517792
3.2512343
-0.506354
0.0257812
0
0
1.9796338
You are given the results of the following MATLAB commands and some related spy
plots corresponding to a matrix with real number entries.
NOTE: Related (not necessarily the same) Python commands are
(a)
[
3 marks
]
Is the matrix symmetric?
Give reasons for your answers.
(b)
[
3 marks
]
Is the matrix positive definite?
Give reasons for your answers.
True
False
Equation
Editor
Styles
Font
Size
Since relative error given by
symchk = norm(A-A’,1)/norm(A,1) = 5.5511e-16
is small and close to eps, matrix A is symmetric.
Words: 20
True
False
Equation
Editor
Styles
Font
Size
A matrix is positive definite if it has a Cholesky factorisation .
Words: 12
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
(c) [
2 marks
]
What are the steps to solve using the Cholesky factorization
?
(d)
[
2 marks
]
What does the MATLAB command
aim to achieve. Is it
successful on this example?
Equation
Editor
Styles
Font
Size
Step 1. Cholesky factorisation A = R' R
Step 2. Forward substitution - solve R' y for x
Step 3. Back substitution - solve Rx = y
Words: 27
Equation
Editor
Styles
Font
Size
MATLAB symrcm (symmetric reverse Cuthill-McKee permutation): reorder columns and rows of a matrix to move
non-zero elements closer to the diagonal, to yield a banded matrix, so that the corresponding Cholesky
factorisation will be banded too (fill-in occurs within bands)
In this example, p = symrcm(A) did work as indicated in the spyplot of A(p,p) since the non-zero elements are
now much closer to the diagonal as compared to the non-zero elements in the spyplot of A
Words: 77