VelocerBuka aplikasi

Velocer › Flashcard › University of Illinois Urbana-Champaign › CS 357: Numerical Methods I · UIUC

CS 357: Numerical Methods I · UIUC

Studying for CS 357 (numerical methods I), sharing in case anyone else needs them. · oleh green_street_grind · 152 kartu

University of Illinois Urbana-Champaign

Pelajari dek ini Sematkan

  1. What type results from mixing an int and a float in arithmetic?A float. In contrast, int * int stays an int.
  2. After b = a where a is a list, what happens when you call b.append(4)?Both a and b refer to the same list, so the change is visible through a as well.
  3. What does id(x) return?The identity of the object that x is bound to.
  4. What is the difference between a is b and a == b?a is b tests whether they are the same object; a == b tests whether their contents are equal.
  5. Are two separately created [1,2,3] lists == and is?They are == (equal contents) but not is (different objects).
  6. What does it mean for an object to be mutable?It can change after creation. Lists, dicts, and NumPy arrays are mutable.
  7. Give examples of immutable objects in Python.Tuples, strings, and floats are immutable.
  8. What happens if you try item assignment on a tuple or string?It raises a TypeError, because tuples and strings are immutable.
  9. What does NumPy provide for numerical work?Fast array types and vectorized operations.
  10. Which is mutable: a list or a tuple?A list is mutable; a tuple is immutable.
  11. Define absolute error.Absolute error is |x − x̂|, the magnitude of the difference between the true value and the approximation.
  12. Define relative error.Relative error is |x − x̂| / |x|; it is scale-independent.
  13. How many significant digits does 3.14159 have?Six significant digits.
  14. How many significant digits does 0.00035 have?Two significant digits.
  15. How many significant digits does 0.000350 have?Three significant digits (trailing zeros count once they follow a nonzero digit).
  16. When does x̂ have n significant figures in terms of relative error?x̂ has n significant figures if the relative error is roughly below 5 × 10^(−n).
  17. What is truncation error?Truncation error is the error from dropping terms, such as stopping a Taylor series at degree n.
  18. Define f(n) = O(g(n)) as n → ∞.f(n) = O(g(n)) if |f| ≤ M|g| for large n, for some constant M.
  19. What does e(h) = O(h^p) as h → 0 mean for error?It means the error e(h) is bounded by a constant times h^p as h approaches 0, i.e., it decreases at rate p.
  20. What is the general formula for the value of a number written in base β?\((a_n\ldots a_0.b_1b_2\ldots)_\beta=\sum a_k\beta^k+\sum b_k\beta^{-k}\), i.e., sum of digits times powers of β, with negative powers for fractional digits.
  21. How do you convert a decimal integer to binary?Repeatedly divide by 2, record the remainders, and read them bottom-up. For example, 23 = 10111₂.
  22. How do you convert a decimal fraction to binary?Repeatedly multiply the fractional part by 2, record the integer bit each time, and continue. For example, 0.375 = .011₂.
  23. Why does 0.1 lack a finite binary expansion?Some fractions cannot be represented as a finite sum of powers of 1/2, so their binary expansion repeats forever.
  24. What is fixed-point representation and what are its drawbacks?It spends a fixed number of bits on the integer part and a fixed number on the fractional part. Its range and precision are both limited.
  25. What is the normalized floating-point form of a number?\(x=\pm1.f\times2^m\), where the leading 1 is implicit and only the fraction f and exponent m are stored.
  26. How is the exponent stored in normalized floating point?The exponent is stored with a bias added to it, rather than as a signed value directly.
  27. What is the layout of an IEEE single-precision float?1 sign bit, 8 exponent bits (stored as c = m + 127), and 23 fraction bits. Its largest value is about 3.4×10³⁸.
  28. What is the layout of an IEEE double-precision float?1 sign bit, 11 exponent bits (stored as c = m + 1023), and 52 fraction bits. Its largest value is about 1.8×10³⁰⁸.
  29. What is machine epsilon and its formula?Machine epsilon is ε_m = 2⁻ⁿ, where n is the number of fraction bits. It is about 1.2×10⁻⁷ for single and 2.2×10⁻¹⁶ for double.
  30. What is the underflow level (UFL)?The smallest positive normalized floating-point number; in double precision it is 2⁻¹⁰²².
  31. What is the overflow level (OFL)?The largest finite number representable in the floating-point format.
  32. What are subnormal numbers?Numbers that drop the leading-1 requirement and use an all-zero exponent field, filling the gap between 0 and UFL. Zero is technically subnormal.
  33. How are special values like infinity and NaN encoded?They use an all-ones exponent field: infinity has a zero fraction, while NaN has a nonzero fraction.
  34. What are the two machine numbers that a non-representable value x lies between?x_- (obtained by chopping extra bits) and x_+ = x_- + ε_m·2^m.
  35. What does fl(x) denote?The stored (floating-point) value of x after rounding.
  36. Give the formulas for the 1-norm, 2-norm, and infinity-norm of a vector.‖x‖₁ = Σ|xᵢ|, ‖x‖₂ = √(Σxᵢ²), ‖x‖∞ = max|xᵢ|.
  37. What is the general formula for the p-norm of a vector?‖x‖ₚ = (Σ|xᵢ|ᵖ)^(1/p).
  38. How is an induced matrix norm ‖A‖ₚ defined?‖A‖ₚ = max over ‖x‖ₚ = 1 of ‖Ax‖ₚ.
  39. How is the induced matrix 1-norm ‖A‖₁ computed?It equals the largest absolute column sum of A.
  40. How is the induced matrix infinity-norm ‖A‖∞ computed?It equals the largest absolute row sum of A.
  41. How is the induced matrix 2-norm ‖A‖₂ computed?It equals the largest singular value of A.
  42. What is back substitution and what does it solve?It solves an upper-triangular system Ux=b by working from the last row upward. It costs O(n^2).
  43. What is forward substitution and what does it solve?It solves a lower-triangular system Lx=b by working from the top row downward. It costs O(n^2).
  44. What is the cost of forward or back substitution for an n×n triangular system?O(n^2) operations.
  45. What is the LU factorization of a matrix A?A factorization A=LU where L is unit lower triangular and U is upper triangular. Computing it costs O(n^3).
  46. After computing A=LU, what two steps solve Ax=b?First solve Ly=b by forward substitution, then solve Ux=y by back substitution.
  47. Why is it beneficial to factor A=LU once when solving many systems with the same A?The O(n^3) factorization is reused, and each additional right-hand side costs only O(n^2).
  48. When does plain LU factorization fail?When a zero or tiny pivot appears on the diagonal, causing division problems or instability.
  49. What is partial pivoting and what factorization does it produce?It swaps rows to place the largest-magnitude entry on the diagonal, producing PA=LU (LUP factorization).
  50. Why is partial pivoting used?To avoid zero or tiny pivots and improve numerical stability.
  51. What is the computational cost of matrix–matrix multiplication?O(n^3) operations.
  52. What is the computational cost of matrix–vector multiplication?O(n^2) operations.
  53. What is the difference between dense and sparse matrix storage?Dense storage keeps all m×n entries, while sparse formats store only the nonzero entries.
  54. What does COO (coordinate) format store?Three arrays: row indices, column indices, and values for the nonzeros.
  55. What does CSR (compressed sparse row) format store?Values and column indices for the nonzeros, plus a row-pointer array of length m+1 marking where each row starts.
  56. In CSR format, what is the purpose of the row-pointer array?It has length m+1 and marks where each row's nonzeros start in the values and column-index arrays.
  57. What does the condition number of a matrix measure?How much relative errors in the input (b or A) can be amplified in the solution x. It bounds the relative error in x in terms of the relative error in b or A.
  58. What is the formula for cond(A)?cond(A) = ||A|| ||A^{-1}||, and it is always at least 1.
  59. What is the condition number of the identity matrix?1, the minimum possible value.
  60. What is the condition number of a singular matrix by convention?Infinity.
  61. What does it mean for a matrix to be ill-conditioned?Its condition number is large, so errors in the input are greatly amplified in the solution.
  62. What does it mean for a matrix to be well-conditioned?Its condition number is small, so errors are not significantly amplified.
  63. How does the condition number relate to loss of accuracy in digits?You lose roughly log10(cond(A)) digits of accuracy.
  64. How is the 2-norm condition number cond_2(A) computed?cond_2(A) = sigma_max / sigma_min, the ratio of the largest to smallest singular value.
  65. Given a perturbation in b, what bound applies to the relative error in x?||Δx||/||x|| ≤ cond(A) · ||Δb||/||b||.
  66. Given a perturbation E in A, what bound applies to the relative error in x?||Δx||/||x|| ≲ cond(A) · ||E||/||A||.
  67. What is the smallest possible value of a condition number?1, attained by the identity matrix.
  68. If cond(A) = 10^4, about how many digits of accuracy are lost?About 4 digits.
  69. What is the eigenvalue equation for a matrix A?Ax = λx with x ≠ 0, where λ is the eigenvalue and x is the eigenvector.
  70. How are eigenvalues of a matrix found mathematically?They solve det(A − λI) = 0, the characteristic polynomial of degree n.
  71. Why is root-finding on the characteristic polynomial a poor numerical method?There is no closed-form solution for degree ≥ 5, and the roots are sensitive to perturbations.
  72. Can a real matrix have complex eigenvalues?Yes, real matrices can have complex eigenvalues (which appear in conjugate pairs).
  73. What is the power iteration formula?x_{k+1} = Ax_k / ‖Ax_k‖.
  74. When does power iteration converge to the dominant eigenvector?When |λ₁| > |λ₂|, i.e., there is a strictly dominant eigenvalue.
  75. What is the convergence rate of power iteration?Linear convergence with rate |λ₂/λ₁|.
  76. Why normalize the vector in power iteration?To avoid overflow or underflow of the iterates.
  77. What is the Rayleigh quotient used for?It estimates the eigenvalue from an approximate eigenvector: λ ≈ (uᵀAu)/(uᵀu).
  78. What does inverse iteration compute?It applies power iteration to A⁻¹ to find the smallest-magnitude eigenvalue.
  79. How is inverse iteration implemented efficiently?Using an LU factorization of A rather than forming an explicit inverse.
  80. What are the eigenvalues and eigenvectors of the shifted matrix A − σI?Eigenvalues are λ − σ with the same eigenvectors as A.
  81. What does shifted inverse iteration find?The eigenvalue closest to the shift σ.
  82. How does Rayleigh quotient iteration differ from shifted inverse iteration?It updates the shift each step using the current Rayleigh quotient, giving faster convergence.
  83. What property do the columns of a weighted transition matrix for a Markov chain satisfy?Each column sums to 1, since each column gives the probabilities of transitioning out of a state.
  84. What does the Markov property state?The next state depends only on the current state, not on the history of previous states.
  85. What is the state update equation for a Markov chain with transition matrix M?x_{k+1} = M x_k.
  86. What is a steady state x* of a Markov chain?A probability vector satisfying M x* = x*, i.e., an eigenvector of M for eigenvalue 1.
  87. How is the steady state of a Markov chain typically computed?By power iteration, repeatedly applying x_{k+1} = M x_k until convergence.
  88. In PageRank, what does the damping factor d represent?The probability d that the surfer follows a link, with probability 1-d of jumping to a random page instead.
  89. Why does the PageRank damping term guarantee a unique steady state?Adding the (1-d)/n term makes every entry of M positive, which guarantees a unique steady state.
  90. For an undirected graph, what property does its adjacency matrix have?It is symmetric.
  91. What is the difference between the adjacency matrix and the transition matrix in this context?The adjacency matrix records which edges exist (0/1 entries), while the transition matrix holds probabilities and has columns summing to 1.
  92. What eigenvalue corresponds to a steady state of a Markov chain?Eigenvalue 1.
  93. In PageRank, what happens with probability 1-d at each step?The surfer jumps to a random page rather than following a link.
  94. What must be true of a steady state vector x* besides M x* = x*?It must be a probability vector (nonnegative entries summing to 1).
  95. What is the forward difference approximation of the first derivative?(f(x+h) - f(x)) / h, with truncation error O(h).
  96. What is the truncation error of the forward difference approximation?O(h).
  97. What is the backward difference approximation of the first derivative?(f(x) - f(x-h)) / h, with truncation error O(h).
  98. What is the central difference approximation of the first derivative?(f(x+h) - f(x-h)) / (2h), with truncation error O(h^2).
  99. Why is the central difference more accurate than forward or backward differences?Its truncation error is O(h^2) rather than O(h), so it converges faster as h shrinks.
  100. What two sources of error make up the total error in finite differences?Truncation error (roughly Mh) and rounding error (roughly epsilon_m |f(x)| / h).
  101. What is the approximate total error formula for finite differences?Total error ≈ Mh + epsilon_m |f(x)| / h.
  102. What is the optimal step size h for a finite difference approximation?h ≈ sqrt(epsilon_m |f(x)| / M), where the truncation and rounding error curves cross.
  103. What happens to a finite difference approximation if h is made too small?Rounding error dominates and the approximation gets worse, not better.
  104. In the error formula Mh + epsilon_m|f(x)|/h, what does M represent?A bound on the magnitude of the relevant derivative of f (controlling truncation error).
  105. In the error formula, what does epsilon_m represent?Machine epsilon, characterizing floating-point rounding error.
  106. What is a root of a function f?A point x where f(x)=0.
  107. What does the convergence rate limit lim ||e_{k+1}||/||e_k||^r = C describe?It describes how fast an iterative method approaches a solution, with order r and constant C.
  108. What does a linear convergence rate (r=1) mean in practice?A roughly constant number of correct digits is gained per iteration.
  109. What does a quadratic convergence rate (r=2) mean in practice?The number of correct digits roughly doubles each iteration.
  110. What convergence rate does the bisection method have?Linear convergence with factor 1/2, since the interval halves each step.
  111. What is required to start the bisection method?A bracket interval where the function changes sign, guaranteeing a root inside.
  112. Does bisection always converge?Yes, it always converges as long as a valid sign-change bracket is given.
  113. What is the iteration formula for Newton's method?x_{k+1} = x_k - f(x_k)/f'(x_k).
  114. What convergence rate does Newton's method have near a simple root?Quadratic convergence near a simple root.
  115. What are the main drawbacks of Newton's method?It requires the derivative f' and a good starting guess, and it may diverge.
  116. How does the secant method approximate the derivative?It replaces f' with the slope through the last two iterates.
  117. What convergence rate does the secant method have?Superlinear convergence, with order about 1.618.
  118. What advantage does the secant method have over Newton's method?It does not require the derivative, yet still converges superlinearly.
  119. What is the Jacobian J_f used for in solving nonlinear systems?It is the matrix of partial derivatives used to compute Newton steps for systems.
  120. What equation gives the Newton step s_k for a nonlinear system?Solve J_f(x_k) s_k = -f(x_k), then set x_{k+1} = x_k + s_k.
  121. What is the difference between superlinear and quadratic convergence?Superlinear has order between 1 and 2, while quadratic has order exactly 2 and is faster.
  122. What is the necessary condition for a point x* to be a minimizer of f?∇f(x*) = 0, i.e., x* is a stationary point.
  123. What condition is sufficient for a stationary point to be a local minimum in 1D?The second derivative is positive: f''(x*) > 0.
  124. What condition is sufficient for a stationary point to be a local minimum in N dimensions?The Hessian is positive definite at that point.
  125. How does golden section search shrink its bracket?It places interior points using the golden ratio and reuses one interior point, so only one new function evaluation is needed per step.
  126. What are key properties of golden section search?It requires no derivatives, works on unimodal functions, and has linear convergence.
  127. What is the update formula for Newton's method in 1D?x_{k+1} = x_k − f'(x_k)/f''(x_k).
  128. What convergence rate does Newton's method have in 1D?Quadratic convergence locally (near the solution).
  129. What is the search direction in steepest descent?The negative gradient, −∇f(x_k).
  130. How is the step size chosen in steepest descent?By a line search along the negative gradient direction.
  131. What convergence rate does steepest descent have?Linear convergence.
  132. What linear system does Newton's method solve in N dimensions?H_f(x_k) s_k = −∇f(x_k), where H_f is the Hessian.
  133. What is the main trade-off of Newton's method in N-D?It converges fast locally but requires computing and solving with the Hessian.
  134. How do you classify stationary points of a 1D function like f(x)=x^4/4 − x^3/3 − 11x^2 + 40x?Evaluate f'' at each stationary point: positive indicates a minimum, negative indicates a maximum.
  135. What problem does least squares solve for an overdetermined system \(Ax \cong b\) with \(m > n\)?It minimizes the squared residual \(\|b - Ax\|_2^2\).
  136. What are the normal equations for the least squares problem?\(A^T A x = A^T b\).
  137. When is the least squares solution \(x = (A^T A)^{-1} A^T b\) unique?When \(A\) has full column rank.
  138. Why is the SVD preferred over the normal equations for solving least squares?Forming \(A^T A\) squares the condition number, so the SVD is numerically more stable.
  139. How is the least squares solution expressed using the SVD?\(x = A^+ b = V \Sigma^+ U^T b\), where \(A^+\) is the pseudoinverse.
  140. What does \(A^+\) denote in the SVD-based least squares solution?The Moore–Penrose pseudoinverse of \(A\).
  141. What does it mean for a fitting model to be linear in the coefficients?The model is a linear combination of basis functions, so it is linear in the coefficients even if the basis functions themselves are nonlinear.
  142. What is the SVD of a matrix A?A = UΣVᵀ, where U (m×m) and V (n×n) are orthogonal and Σ is diagonal with singular values in non-increasing order.
  143. How are the singular values of A related to eigenvalues?They are the square roots of the eigenvalues of AᵀA (equivalently of AAᵀ).
  144. What are the dimensions in the reduced SVD?U_R is m×k, Σ_R is k×k, and V_R is n×k, where k = min(m, n).
  145. How do you determine the rank of a matrix from its SVD?The rank equals the number of nonzero singular values.
  146. How is the pseudoinverse A⁺ defined via the SVD?Invert each nonzero singular value, keep zeros as zeros, and set A⁺ = VΣ⁺Uᵀ.
  147. What is the 2-norm of a matrix in terms of singular values?‖A‖₂ = σ_max, the largest singular value.
  148. How is the 2-norm condition number of A computed?cond₂(A) = σ_max / σ_min; it is infinite when A is rank deficient.
  149. What is the best rank-k approximation of A?A_k = Σᵢ₌₁ᵏ σᵢuᵢvᵢᵀ, keeping the k largest singular values and their corresponding vectors.
  150. What does principal component analysis (PCA) do to the data's coordinate system?PCA rotates the data into new coordinates so the first axis (first principal component) carries the most variance, the second the next most, and so on.
  151. What preprocessing step is required before applying PCA?Center the data by subtracting each feature's mean.
  152. What two computational approaches can be used to find principal components?Take the SVD of the centered data, or compute the eigenvectors of the covariance matrix.

Velocer gratis: pengulangan berjarak dan kartu Anda sendiri dari dokumen apa pun.

PDF to flashcards · Lecture to flashcards · Practice exam · Syllabus study plan · Anki import

Dek lain dari University of Illinois Urbana-Champaign