18.303 Midterm Solutions, Fall 2011 Problem 1: (20 points) • Just like c∇2 from class, we will need a C −1 factor in our inner product to cancel the asymmetric-looking C factor in Â. In particular, when we write hu, ÂviC , we want the C in  to cancel, so there must be a C −1 factor multiplying v. Z hu, viC = ū · C −1 v . Ω Obviously, in order for this to work C must be invertible (at all x). But we require more than that. To have a valid inner product, we must have: Z Z −1 ū · (C −1 v) hv, uiC = v̄ · C u = hu, viC = Ω Ω Z Z ∗ ∗ = [C −1 ] u · v = v̄ · C −1 u Ω Ω ∗ −1 and hence we must have C −1 = C −1 = [C ∗ ] and hence C = C ∗ (we showed in class that the inverse of the adjoint is the adjoint of the inverse) . Furthermore an inner product must satisfy Z 0 < hu, uiC = ū · C −1 u Ω for u 6= 0, and hence C −1 and thus C must be positive definite at all x (excepting isolated points / sets of measure zero). (The condition that C be invertible is therefore redundant.) • Integrating by parts using the rule for ∇×, assuming surface terms are zero, we then obtain Z Z ∇ × u · (B∇ × v) hu, ÂviC = ū · (∇ × B∇ × v) = ZΩ ZΩ = B ∗ ∇ × u · (∇ × v) = ∇ × B∗∇ × u · v Ω Ω Z Z = C −1 C∇ × B ∗ ∇ × u · v == C∇ × B ∗ ∇ × u · C −1 v Ω Ω = hÂ∗ u, viC where Â∗ = C∇ × B ∗ ∇×. For  to be self-adjoint, we must therefore have B = B ∗ (B is self-adjoint everywhere). • To have  positive semidefinite, we must have Z ∇ × u · (B∇ × u) 0 ≤ hu, Âui = Ω from which it follows that B must be positive semidefinite. Problem 2: (20 points) Suppose we have a stretched drum with a position-varying “stretchiness” c(x) > 0, with the displacement u(x) = u(x, y) satisfying −∇ · (c∇u) = f (x) where f is the force per unit area, where the edges of the drum are fixed: u|∂Ω = 0. (a) The solution u(x) is just F0 G(x, x0 ) in terms of the Green’s function G. By the boundary conditions, G(x, x0 ) → 0 as x → ∂Ω. However, reciprocity means that G(x, x0 ) = G(x0 , x) [since this  uses an unweighted inner product, and is real], which means that G also goes to zero at all x as x0 → ∂Ω. Hence u(x) → 0 as x0 → ∂Ω. Physically, this is pretty obvious: when you press on the drum at the edge, it does nothing because the edge is fixed. 1 (b) To handle general Dirichlet boundary conditions, we write u = v + (x2 − y 2 ). In this way, v satisfies where v|∂Ω Âv = −∇ · (c∇v) = f − Â(x2 − y 2 ) = f + g = 0 and we let g = ∇ c∇ x2 − y 2 . We now solve for v using G as above, to find Z u(x) = (x2 − y 2 ) + F0 G(x, x0 ) + G(x, x0 )g(x0 ). x0 ∈Ω Therefore, as x0 → ∂Ω, the F0 term goes to zero as before so u goes to the (Laplace-equation) solution with no external force. Note that if c = 1, then Â(x2 − y 2 ) = 0 and u → x2 − y 2 . Problem 3: (20 points) (a) There are two main differences. First, we now have ∆x = L/N since there are only N intervals ∆x for N points (N − 1 intervals plus two halves at the ends). Second, the first and last rows of A will be different because of the different handling of the boundary conditions (the u00n in the interior is the same). The easiest way to analyze this problem is to recall that Dirichlet boundaries are equivalent to antisymmetric/odd functions around the boundary. e.g. the Dirichlet boundary at x = 0 is equivalent to requiring u(−x) = −u(x). (Alternatively, recall that the solutions can be expanded in sine series, which are odd.) But this means that we can extend our points um to u−m = −um as shown: 2 1 u1 u2 u3 0 So, when we compute u001 , we find u001 ≈ u−1 − 2u1 + u2 −u1 − 2u1 + u2 −3u1 + u2 = = . ∆x2 ∆x2 ∆x2 Similarly for the last row u00N ≈ uN −1 − 2uN − uN uN −1 − 3uN uN −1 − 2uN + uN +1 = = ∆x2 ∆x2 ∆x2 and hence we obtain −3 2 1 N A= L 1 −2 .. . 1 .. . 1 .. . −2 1 . 1 −3 There is also a harder way to solve this problem and get the same answer. You could re-derive the second derivative operation using the steps in part (b), writing A = D2 D1 , The key point is that, in order to get u0 (0) = u00.5 , we could use the Taylor expansion: + u(∆x/2) = u(0) ∆x 0 ∆x2 00 ∆x3 000 u (0) + u (0) + u (0) + · · · . 2 8 48 We can then write u00.5 = u0 (0) ≈ u(∆x/2) 2u1 = . ∆x/2 ∆x Normally, this would be only first-order accurate because of the u00 (0) term, but in this case (odd functions, sine series) u00 (0) = 0 and this is second-order accurate. We therefore obtain the same D1 matrix as below, and A follows. 2 (b) As usual, our D matrix should compute u0 at points halfway between the grid points by a center-difference approximation: un+1 − un u0n+0.5 ≈ . ∆x Again, this will differ at the endpoints by the odd-symmetry/Dirichlet condition: u00.5 ≈ u0N +0.5 ≈ 2u1 u1 − u−1 = , ∆x ∆x uN +1 − uN −2uN = , ∆x ∆x giving the (N + 1) × N matrix 2 −1 N D1 = L 1 .. . .. . −1 1 −2 However, this does not give A = −D1T D1 ! It is easy to check explicitly that −D1T D1 gives a −5 = −22 − 12 instead of a −3 in the a1,1 and aN,N entries. Alternatively, we can think about how we would compute u00n = u0n+0.5 − u0n−0.5 . ∆x u0 −u0 In this case, there is no funny weighting of the endpoints: u001 = 1.5∆x 0.5 , so this operation corresponds to the N × (N + 1) matrix −1 1 −1 1 N D2 = 6= −D1T . .. .. L . . −1 1 We can check that indeed A = D2 D1 , but this is not the desired form. To turn it into the desired form, we first write D2 in terms of −D1T : 0.5 1 T . .. D2 = −D1 1 0.5 where we have multiplied by diagonal (N + 1) × (N + 1) matrix which scales the first and last columns by 0.5 to turn the 2’s into 1’s. We then have 0.5 1 T . .. A = −D1 D1 = −DT D 1 0.5 if we write √ D= 0.5 2 −1 N D1 = L 1 .. . 1 √ √ 0.5 1 .. . .. . −1 1 √ − 2 , where the trick was to take the square root of our diagonal matrix and associate half with D1 and half with D1T . Another way to think about this problem is that this is like your homework problem (pset 1, problem 4) 3 where the usual definition of “matrix transpose” was not really the right concept anymore. The problem is that the u0n+0.5 includes points exactly at the x = 0 and x = L boundaries, and furthermore since u is an odd function then u0 must be an even function at the boundaries. So, just like in homework, the right inner product of the u0n+0.5 has a weight 0.5 for the endpoints, and this changes the appropriate definition of “D1T ” to include the extra 0.5 scalings given here. Note also that it is perfectly reasonable to leave A in the form −D1T W D1 where W is our positive diagonal scaling matrix, since this formulation is still manifestly real-symmetric and positive-definite. 4