You are on page 1of 3

Numerical Methods Test 2 Practice Winter 2010 65 minutes One 3 5 card of notes is allowed.

d. Computers are allowed, but not the Internet. (1) To numerically compute k , for k > 0, we can nd a root of f (x) = x2 k . What function would you iterate to nd such a root? What would be a good starting point? Using Newtons method, we would iterate g (x) = x x2 k f (x) =x f (x) 2x

1 = (x + k/x). 2 A good starting point might be k , or 1, or k/2. (2) Suppose you have a function f (t) that is continuous but not dierentiable, with f (1) = 0.8, f (2) = 0.6, and f (3) = 0.5. What technique would you use to nd a root of f ? The bisection method would be a safe choice here. The nondierentiability of f would make our other techniques erratic. Of course, we could still use the zeroin algorithmeven if the other techniques get thrown o course, zeroin will still nd the root. (3) Suppose that you are trying to nd the minimal value of a function f by using quadratic interpolation, and that the most recent three steps in the process have yielded x4 = 1.7 x5 = 1.4 x6 = 1.5 f (x4 ) = 2.1 f (x5 ) = 1.8 f (x6 ) = 1.6

What would x7 be? We nd the quadratic polynomial through these points: x = [1.7; 1.4; 1.5]; y = [2.1; 1.8; 1.6]; V = vander(x); p = V\backslash y; The result is p(x) = 15x2 45.5x + 36.1. In general, ax2 + bx + c has its max or min at b/2a, so in this case we get x7 = (45.5)/(2 15) = 1.5167. (4) Suppose the full QR decomposition of A is 1/2 1/2 1/2 1/2 3 8 1/2 1/2 1/2 1/2 0 2 A= 1/2 1/2 1/2 1/2 0 0 . 1/2 1/2 1/2 1/2 0 0 Find the thin QR decomposition of A. Since only the rst two rows of the above R are nonzero, we can get the thin QR decomposition by keeping those rows of R, and the rst two columns of Q: 1/2 1/2 1/2 1/2 3 8 A= 1/2 1/2 0 2 . 1/2 1/2 (5) For real n n matrices A and B , we know that det(AB ) = det(A) det(B ) and det(A) = det(A ). Use these facts to show that if Q is orthogonal (real and unitary), then det(Q) = 1. 1 = det(I ) = det(Q Q) = det(Q ) det(Q) = det(Q) det(Q) = det(Q)2

Since det(Q)2 = 1, we must have det(Q) = 1. (The ones with determinant 1 are simply rotations. The ones with determinant 1 combine a rotation with a reection, and are sometimes simply called reections.) 1 (6) Find the matrix P that projects onto the vector v = 2. (That is, for any b R3 , P b 1 should be the projection of b onto v.) The projection of b onto v is v vv v b = b v v v v = Pb

where P = vv v v 1 2 1 2 4 2 1 2 1 = 2 1 + 22 + 12 1 2 1 1 = 2 4 2 . 6 1 2 1

(7) A power-law is a relationship between two positive quantities x and y of the form y = axb , for some constants a and b. Taking log of both sides, we have log y = log(axb ) = log a + b log x, which is a linear relationship between log x and log y ; this is convenient because, in this form, we can t a least squares line to it. From there we can solve for log a and b. There is a power-law relationship between the radii of planetary orbits and their periods. Here is a table of data for some of the planets in our solar system, with orbital radii r in AU1, and orbital periods T in years. Planet r T Mercury 0.387 0.241 Venus 0.723 0.615 Earth 1.000 1.000 Mars 1.523 1.881 Saturn 9.541 29.457 Uranus 19.190 84.008 Neptune 30.086 164.784 Pluto 39.507 248.350 Using the data for Earth, Mars, and Saturn, estimate the values of a and b such that T = arb . Use this to estimate the orbital period of Jupiter, given that its orbital radius is 5.203 AU. (In practice, you would want to use all the data.) We t a least squares line to x = ln r, y = ln T .
1Astronomical units. One astronomical unit is essentially the mean distance from the Earth to the sun, about 93

million miles.

r = [1; 1.523; 9.541]; T = [1; 1.881; 29.457]; x = log(r); y = log(T); A = [x, ones(3,1)]; coeffs = A\y; We get the line y = 1.4997x + 0.0004. If our model is T = arb , we have log(a) = 0.0004 and b = 1.4997, so a = 1.0004. That gives us T = 1.0004r1.4997 . Plugging in r = 5.203 for Jupiter, we get an estimated orbital period of 11.866 years. (The actual period is 11.859, so the estimate was accurate to 0.06%.) Note that 1.4997 is quite close to 3/2, which would be one of Keplers laws. The discrepancy here is primarily due to the fact that the orbits are not perfectly circular, but are instead slightly elliptical. (8) Find the second-order Bernstein polynomial B2 (x) for the function f (x) = x3 . We have B2 (x) = f (0)b0,2 (x) + f (1/2)b1,2 (x) + f (1)b2,2 (x) 1 = 0 + 2x(1 x) + 1 x2 8 = x/4 + 3x2 /4 . (9) Prove that Tm (Tn (x)) = Tmn (x) for m, n 0. (Hint: Use the identity Tn (x) = cos(n cos1 x).) Tm (Tn (x)) = cos(m cos1 (cos(n cos1 (x)))) = cos(mn cos1 (x)) = Tmn (x). Technically, that only proves that Tm (Tn (x)) = Tmn (x) on the interval [1, 1], since the above identities only work for 1 x 1. However, if two polynomials are equal on a nontrivial interval, they must be the same polynomial. (10) In class, for a xed n, we dened vectors qk Cn by (qk )j = eik(2j/n) , j = 0, . . . , n 1, and dened the matrix Q to have q0 , q1 , . . . , qn1 as columns. Give an explicit formula for Qjk . (In this problem, let indices run from 0 to n 1 rather than 1 to n.) Do we have Q = Q? QT = Q? (Here, QT is the ordinary transpose of Q, while Q is the conjugate transpose, which negates imaginary components in addition to transposing.) Qjk will be the j th entry of qk , which is eik(2j/n) = e2ijk/n . Since the above exponent is not changed if we swap j and k , we have Qjk = Qkj , so QT = Q. We do not have Q = Q, because the conjugate transpose will negate the imaginary components. (Exception: For n 2, Q happens to have all real entries, so negating the imaginary components is not an issue, and we will have Q = Q.)

You might also like