1/57
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Which MATLAB command yields the number of columns for matrix A?
size(A,2)
Q1
How do you write code for a 2 column and 3 row matrix?
A=[8, -10; 15, 0; -1,0]
Q1
Let A=[1 4; 5 2; 7 0]. Ho can you compute the 2nd column vector of A?
norm(A(:,2))
Q1
Given A an arbitrary nxn square matrix, the number of arithmetic operations for the Gaussian elimination for solving Ax=b is...
Order O(n^3)
Q1
Given A an arbitrary square matrix with n rows and n columns, the MATLAB command for the LU factorization is [L, U, P] = lu(A). What do L, U, and P stand for?
L= lower triangular matrix
U= upper triangular matrix
P= permutation, such that LU=PA
Q1
Let A=[1,2; 3,4; -6,9]. Define b=(1:1:end,end). What is b?
[2; 4; 9]
Q2
Which MATLAB command yields the number of rows for matrix A?
size(A,1)
Q2
Consider the following MATLAB program
x=0
for j= 1:1:4,
x=x+j;
end
What is the final value for x?
x=0
j=1 x=0+1 x=1
j=2 x=1+2 x=3
j=3 x=3+3 x=6
j=4 x=6+4 x=10
Q2
Given an arbitrary n x n square matrix, the number of arithmetic operations for the Gaussian elimination when solving Ax = b is
Order O(n^3)
Q2
The MATLAB statement [L, U] = lu(A) produces a square "psychologically" lower triangular matrix L and a square upper triangular matrix U from the matrix A, satisfying the equation A=L*U. Which MATLAB statement gives the solution to the system Ax=b?
x=U\(L\b)
Q2
An invertible square matrix ( ) is always diagonalizable.
False
Q2
Which MATLAB command yields the diagonal for matrix A in a column vector?
diag(A)
Q2
A singular (or non-invertible) square matrix is always diagonalizable.
False
Q2
Given x = [2, 4, 5, 8, 9, 10] and y = [2, 9, 12, 32, 40, 52], which of the following MATLAB statements fits the data with a cubic curve (cubic = polynomial of degree 3)?
p=polyfit(x,y,3)
originally p=polyfit(x,y,n)
n=degree of function
x & y= coefficients of polynomial
Q2
Given x = [1, 2, 3, 4, 5]' and y = [1, 1, 1, 0, 0], consider the MATLAB command: p = polyfit(x, y, 2). Is this a curve fitting or an interpolation?
Polyfit is curve fitting
Q2
A diagonalizable matrix is always invertible (det(A)≠0)
False
Q3
A diagonalizable matrix could be square or rectangle (i.e. with less columns than rows).
False
Q3
The MATLAB statement [L, U, P] = lu(A) produces a square lower triangular matrix L, a square upper triangular matrix U, and a permutation matrix P from the square matrix A, satisfying the relation PA=LU. Which MATLAB statement gives the solution to the system Ax=b?
x=U\(L\(P*b))
Q3
Given x = [1, 2, 3, 4, 5] and y = [1, 1, 1, 0, 0], which MATLAB statement yields the coefficients for a cubic polynomial fitting the data?
p = polyfit(x,y,3)
Q3
For a given set of data points (ti, yi) i=1,...,n. Which value of n do you need to interpolate exactly the data with a cubic polynomial? Recall that interpolation goes exactly through the data points.
always +1 of the degree of polynomial, so n=4
Q3
Let f(x)= -x^4 +x +1. Which statement finds the root r such that f(r)= 0 using the initial guess x=0?
fzero(@(x) -x.^4+x+1, 0)
Q3
What does the fzero function do?
Tries to find zero of function near X0 if X0 is a scaler.
Q3
A global minimum is also a local minimum
True
Q3
What statement yields the maximum of a function f(x) using an initial guess x=1?
Inverse of f(x) and use fmin search
Let f(x)=x^4+10xsin(x^2). This function has a local minima between -2 and -1. What MATLAB statement yields an approximation to this local minimum?
[x1, f1] = fminbnd(@(x) x.^4+10x.sin(x.^2), -2, -1)
Let A = [1, 2, 3, 4]. We have three commands:
1). norm(norm(A,1),1)
2). sum(abs(A))
3). abs(sum(A))
Which of the following statements is correct?
All are correct
Q3
When approximating in double precision with a central difference scheme, the time-step that minimizes the error is...
10^(-5)
Q3
When approximating with a finite difference scheme, the central difference formula is more accurate than the forward difference formula.
True
Q3
Since the midpoint quadrature rule is based on interpolation by a constant, whereas the trapezoid quadrature rule is based on linear interpolation, the trapezoid rule is
False
Q4
Which MATLAB statement yields an approximation for integral of exp(-x^2)dx from 0 to 2?
integral(@(x) exp(-x.^2), 0,2)
Which of the following time-integration method is implicit?
Backward Euler Method
Q4
How would you estimate the value of y at t=10 for the ODE dy/dt=-10y-2ty
[t,y]=ode45(@(t,y)-10y-2t.*y,[0,10],1); yf=y(end)
Q4
In the numerical solution of an ODE, the local error and the global error are identical.
False
Q4
In solving an ODE numerically, the roundoff error always dominates the global error.
False
Q4
When solving a stable differential equation numerically (such as y'=-2y ), the (implicit) backward Euler method is stable for any choice of time-step ∆t
True
Q4
A numerical ODE method is of the order p when
when the global error is O(h^p)
Q4
Which MATLAB command yields the number of rows for matrix A?
size(A,1)
Let matrix A be 50x50. The MATLAB command, cond(A), returns the value 10^14 . Which of the following statements is correct?
A is ill-conditioned
Any matrix A (square or rectangular) has a singular value decomposition.
True
The MATLAB statement [U,S,V]=svd(A,0) produces a reduced singular value decomposition for the square matrix A, satisfying the equation USV'=A. What is the expression for A*A'?
US^2U'
Let A be a square invertible matrix. The MATLAB statement [U,S,V]=svd(A, 0) produces a reduced singular value decomposition for the square matrix A, satisfying the equation USV'=A. Which MATLAB statement gives the solution to the system Ax=b?
x=V'\(S\(U\b))
The number of arithmetic operations for the fast Fourier transform (FFT) is
order (nlog(n))
The fast Fourier transform (FFT) algorithm can compute both the discrete Fourier transform and its inverse with equal efficiency.
True
The MATLAB statement R = chol(A) produces a square upper triangular matrix R from the symmetric matrix A, satisfying the equation R'*R=A. This decomposition is the Cholesky factorization, a specialization of the LU factorization for symmetric matrices with positive eigenvalues. Which MATLAB statement gives the solution to the system Ax=b?
x=R\(R'\b)
For A = [1/2, 1/2, 1/3; 1/4, 0, 1/3;1/4, 1/2, 1/3], we run the command [U, V]=eig(A), and got diag(V) = [1, 0.1371, -0.3038]'. Which of the following is equal to U(:,1)?
A*U(:,1)
Suppose we are using a composite trapezoid rule to integrate a (nontrivial) f(x) from 0 to 1 and we partition [0, 1] into N sub-intervals, at least how many function evaluations do we need to take?
N+1
Which of the following MATLAB statements will draw a blue dotted line between two points (x0, y0) = (0,2) and (x1,y1) = (4,6) ?
plot([0 4],[2 6],'b:');
Which of the following MATLAB statements will draw the sine function over the interval -pi to pi?
plot((-pi):0.1:pi, sin((-pi):0.1:pi)
Given the ODE , which of the following statements defines properly the function f"=-y'-2ty handle for solving this ODE with ode45?
f = @(t,y) [y(2);-y(2)-2t.y(1)];
The MATLAB command ode45 yields results that are usually more accurate than the results from ode23.
True
What order is DFT?
O(n^2)
DFT is an algorithm, not a transform
True
FFT can be used to calculate DFT
True
to solve Ax = b is the same algorithm as factoring A = LU and solving LUx = b.
Gaussian Ellimination
inv(A) * b is more expensive than A\b
True
Eigendecomposition requires....
• A has to be square matrix
• Ax = λx with x = 0
• det (A − λI) = 0
What does the Jacobi iteration do?
1)Solves Ax=b
2)Decompose A = L∗ + D + U∗
3) Iteration Dx(k+1) = b−(L∗ + U∗) x(k) orx(k+1) = D−1 b − (L∗ + U∗) x(k)
What order is forward substitution?
On^2