Mth 473: Prctice Problems for the Mteril fter Test, Fll SOLUTION. Consider the following modified het eqution u t = u xx + u x. () Use the relevnt 3 point pproximtion formuls for u xx nd u x to derive forwrd-difference method formul for u(t + t, x) in terms of u(t, x x), u(t, x) nd u(t, x + x). Solution: For the time derivtive the forwrd difference pproximtion is u t (t, x) [u(t + t, x) u(t, x)], t while the three-point formuls re u x (x, t) u xx (x, t) [u(t, x + x) u(t, x x)], x [u(t, x + x) u(t, x) + u(t, x x)] ( x) Now solve for u(t + t, x) to find u(t + t, x) u(t, x) + ( t)u t (t, x) = u(t, x) + ( t)(u xx + u x ) { u(t, x) + ( t) [u(t, x + x) u(t, x) + u(t, x x)] ( x) + } x [u(t, x + x) u(t, x x)] [ t = ( x) t ] [ u(t, x x) + 4 t ] u(t, x) x ( x) [ t + ( x) + t ] u(t, x + x) x (b) Use the formul from prt () to pproximte u(., x) for t =. nd u(, x) is given by the tble u(, x) 3 4 3 4 x.5.5.5 3
Assume tht the boundry conditions u(t, ) = nd u(t, 3) = 4 hold. Solution: For t =. nd x =.5, plug in to find u(t + t, x).7u(t, x x).6u(t, x) +.9u(t, x + x). So the next two time steps re given by u(., x).99.3 4.7.35 4.69 4 u(., x)..5.5 4.3 3. 4 u(, x) 3 4 3 4 x.5.5.5 3 (This pproximtion is unstble, since the coefficient of u(t, x) is negtive.). Compute the liner lest squres polynomil for the dt Solution: Compute i 3 4 5 x i 3 5 6 y i 5 6 8 5 n = 5, xi = 4, yi = 35, x i = 7, xi y i = 43, m = 5 43 4 35.3686, 5 7 4 b = 7 35 43 4.4366, 5 7 4 P (x) = mx + b.3686x +.4366 3. Use Euler s Formul to write cos 4 θ s liner combintion of {cos nθ} for n =,,, 3, 4. You my use the Binomil Formul ( + b) 4 = 4 + 4 3 b + 6 b + 4b 3 + b 4.
Solution: Compute cos 4 θ = ( eiθ + e iθ ) 4 = ( )4 (e iθ + e iθ ) 4 = 6 [(eiθ ) 4 + 4(e iθ ) 3 e iθ + 6(e iθ ) (e iθ ) + 4e iθ (e iθ ) 3 + (e iθ ) 4 ] = 6 (e4iθ + 4e iθ + 6 + 4e iθ + e 4iθ ) = 6 (e4iθ + e 4iθ + 4e iθ + 4e iθ + 6) = 6 [( e4iθ + e 4iθ ) + 8( eiθ + e iθ ) + 6] = 8 cos 4θ + cos θ + 3 8. 4. For the intervl [, ] nd weight function w(x) = x, show tht {, x, x, 4x 3 3x} is n orthogonl set of functions. Solution: First of ll, recll tht the substitution x = cos θ shows tht for continuous function f on [, ], the integrl f(x) dx = f(cos θ) ( sin θ)dθ x π cos θ = = = π f(cos θ) dθ f(cos θ) dθ f(cos θ) dθ. Denote T =, T = x, T = x, T 3 = 4x 3 3x. It is obvious tht α j = T j, T j = T j dx >. x On the other hnd, becuse of integrting n odd function on symmetric intervl, we hve T, T = T, T 3 = T, T = x dx =, x (4x 3 3x) x(x ) dx =, x dx =. x
We still need to check T, T = T, T 3 =. nonzero integer, e kiθ dθ = ki kiθ π = e since e kiθ is π periodic. Now compute T, T = T, T 3 = = = = = = = = (x ) ( cos θ ) dθ x dx [( eiθ + e iθ ) ] dθ ( eiθ + e iθ ) dθ =, x(4x 3 3x) x dx (4 cos 4 θ 3 cos θ)dθ [4( eiθ + e iθ ) 4 3( eiθ + e iθ ) ]dθ Recll tht for k ( 4 e4iθ + e iθ + 3 + e iθ + 4 e 4iθ 3 4 eiθ 3 3 4 e iθ )dθ ( 4 e4iθ + 4 eiθ + 4 e iθ + 4 e 4iθ )dθ =. 5. Consider the intervl [, π] with weight function w(x) =. () Compute the Fourier series of f(x) = x. Solution: For φ =, φ k = cos kx nd φ k = sin kx, compute = f, φ φ, φ = π k = f, φ k φ k, φ k = π x dx =, (cos kx)x dx =, since x cos kx is n odd function. Similrly for k >, we integrte by prts using u = x, dv = sin kx dx, du = dx, v = cos kx to k
find k = π x sin kx dx = π x sin kx dx = [ x ( ) π π k cos kx ( ) k cos kx [ π k cos kπ + + π] k sin kx ] dx = π = k ()k+ So the Fourier series is given by k φ k = k= k= k ()k+ sin kx = sin x sin x + 3 sin 3x 4 sin 4x + 5 sin 5x sin 6x + 6 = sin x sin x + 3 sin 3x sin 4x + 5 sin 5x sin 6x + 3 (b) Among ll liner combintions of {, cos x, sin x, cos x, sin x, cos 3x, sin 3x}, find the lest squres pproximtion of f(x) = x. Solution: The continuous lest squres pproximtion is given by the prtil sum of the Fourier series sin x sin x + sin 3x. 3 6. Consider the first few Legendre polynomils {, x, x, 3 x3 3 x}. For 5 the intervl [, ] with weight function w(x) =, compute the degree 3 lest squres polynomil pproximtion of f(x) = 7x 6. Solution: Compute P (x) = P (x) + P (x) + P (x) + 3 P 3 (x) = + x + (x 3 ) + 3(x 3 3 5 x), i = f, P i P i, P i,
P, P = P, P = P, P = P 3, P 3 = f, P = dx =, x x dx = 3, (x 3 ) dx = = ( 5 9 + 9 ) = 8 = ( 7 6 = =, f, P = = ( ) =, 3 f, P = 45, (x 3 3 5 x) dx = 5 + 3 5 ) = 8 7x 6 dx = 7x 6 x dx =,, 75 (x 4 3 x + 9 ) dx (x 6 6 5 x4 + 9 5 x ) dx 7x 6 dx =, 7x 6 (x ) dx = (7x 8 7 3 3 x6 ) dx = ( 7 9 3 ) = 8 9, = ( 8 9 ) f, P 3 = ( 8 45 ) = 5, 7x 6 (x 3 3 x) dx =, 5 3 = ( 8 75 P (x) = + x + 5(x ) + 3 (x3 3x) = 5 5x. 3 7. For n intervl [, b] with continuous weight function w(x) >, define for f, g continuous functions f, g = f(x)g(x)w(x) dx. () Let f, g, h be continuous functions on [, b] nd let c be constnt. Prove the following formuls: f, g = g, f, ()
Solution: For the first, note f, g = cf, g = c f, g = f, cg, () f + g, h = f, h + g, h. (3) f(x)g(x)w(x) dx = For the second eqution, note cf, g = g(x)f(x)w(x) dx = g, f. cf(x)g(x)w(x) dx = c f(x)g(x)w(x) dx = c f, g. It is similr to check c f, g = f, cg. For the finl eqution, check f + g, h = = = [f(x) + g(x)]h(x)w(x) dx [f(x)h(x)w(x) + g(x)h(x)w(x)] dx f(x)h(x)w(x) dx + = f, h + g, h. g(x)h(x)w(x) dx (b) Let {φ, φ } be n orthogonl set of functions, nd let f be continuous function on [, b]. Consider the pproximtion function P = φ + φ nd error function E = E(, ) = P f, P f. Prove tht the criticl point of E occurs when i = f, φ i φ i, φ i for i =,. Solution: First of ll, eqution (3) bove shows tht the inner product distributes over ddition in the first slot. By using () s well the inner product distributes over ddition in the second slot s well, s f, g + h = g + h, f = g, f + h, f = f, g + f, h.
Then () with c = implies the inner product distributes over subtrction: f g, h = f+()g, h = f, h + ()g, h = f, h +() g, h = f, h g, h. Putting this ll together, we compute E = P f, P f = φ + φ f, φ + φ f = φ, φ + φ f + φ, φ + φ f f, φ + φ f = φ, φ + φ, φ φ, f + φ, φ + φ, φ φ, f f, φ f, φ + f, f = φ, φ + φ, φ φ, f + φ, φ φ, f + f, f The orthogonlity condition implies φ, φ =, nd so E = φ, φ f, φ + φ, φ f, φ + f, f, E = φ, φ f, φ, E = φ, φ f, φ. At the criticl point, both prtil derivtives vnish. So E = when = f, φ φ, φ. Similrly, E = when = f, φ φ, φ.