Math 257/316 Assignment 6 Solutions 1. For the function f (x) = ⇢ 1 1 2x 0 x < 1/2 1/2 x 1 defined on [0, 1], sketch (several periods of) its even and odd 2-periodic extensions, and for each x 2 [0, 1] determine the value to which its Fourier sine and cosine series converge. The even and odd 2-periodic extensions look like (over 3 periods): 1.2 1 1 0.8 0.5 0.6 0 0.4 0.2 -0.5 0 -1 -0.2 -3 -2 -1 0 1 2 3 -3 -2 -1 0 1 Then in light of the Fourier convergence theorem, for x 2 [0, 1], we have 8 ⇢ 6 {0, 12 , 1} < f (x) x 2 1 f (x) x 6= 2 1 x = 12 F.C.S. of f = F.S.S. of f = 1 1 , 2 x = : 2 2 0 x = 0, 1 2 2. For the following heat conduction problem with homogeneous Dirichlet boundary conditions: 8 ut = 5uxx , (0 < x < 1.5, t > 0) > > < u(0, t) = u(1.5, t) = 0 , ⇢ 0 0 x .75 > > . : u(x, 0) = 1 .75 < x 1.5 1 3 (a) Find the solution (in series form). We have L = 3/2, ↵2 = 5, so u(x, t) = 1 X bn sin(2n⇡x/3)e 20n2 ⇡ 2 t/9 n=1 with bn = = 2 3/2 Z 3/2 sin(2n⇡x/3)u(x, 0)dx = 0 2 (cos(n⇡/2) n⇡ cos(n⇡)) = 8 < : 4 3 2 n⇡ 0 4 n⇡ Z 3/2 sin(2n⇡x/3)dx = 3/4 2 3/2 cos(2n⇡x/3)|3/4 n⇡ n odd n = 4k , n = 4k + 2 so (there are several ways to write this) 1 2X 1 u(x, t) = sin(2(2k + 1)⇡x/3)e ⇡ 2k + 1 k=0 1 X 4 ⇡ k=0 20(2k+1)2 ⇡ 2 t/9 1 sin(2(4k + 2)⇡x/3)e 4k + 2 20(4k+2)2 ⇡ 2 t/9 . (b) (Excel) Use the finite di↵erence method discussed in class to numerically approximate the solution u(x, t). Use the discretization parameters x = 0.06, t = 0.0003. (You are free to use one of the posted spreadsheet examples as a template.) Hand in the approximate value you obtain at x = 0.42, t = 0.015. Compare this value with the value given by the first non-zero term of your series solution from part (a). Do the same for the first two non-zero terms of your series solution from part (a). The computed value is u(0.42, 0.015) ⇡ 0.192. The first term of the series solution gives 2 sin(2⇡(0.42)/3)e ⇡ while the first two terms give u(0.42, 0.015) ⇡ 20⇡ 2 (0.015)/9 ⇡ 0.353 2 2⇡(0.42) 2 4⇡(0.42) 2 2 sin( )e 20⇡ (0.015)/9 sin( )e 20(4)⇡ (0.015)/9 ⇡ 0.185 ⇡ 3 ⇡ 3 (much closer to the numerically computed value!). (c) (Excel) Change the boundary conditions in the problem to u(0, t) = 0, u(1.5, t) = 1. Use the numerical computation to compute the solution up to time t = 0.03 and verify that it approaches a steady state. Hand in a plot showing the approximate solution at times t = 0, t = 0.003, t = 0.01, and t = 0.03. See attached page. u(0.42, 0.015) ⇡ 2 Sheet1 Heat equation Dx Dt Alpha^2 K 0.060 0.000 5.000 0.417 Legend: Boundary conditions Initial condition Interval of x Interval of t x t 0.0000 0.0003 0.0006 0.0009 0.0012 0.0015 0.0018 0.0021 0.0024 0.0027 0.0030 0.0033 0.0036 0.0039 0.0042 0.0045 0.0048 0.0051 0.0054 0.0057 0.0060 0.0063 0.0066 0.0069 0.0072 0.0075 0.0078 0.0081 0.0084 0.0087 0.0090 0.0093 0.0096 0.0099 0.0102 0.0105 0.0108 0.0111 0.0114 0 0.06 0.12 0.18 0.24 0.3 0.36 0.42 0.48 0.54 1.2 1.26 1.32 1.38 1.44 1.5 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0.417 0.583 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0.174 0.313 0.688 0.826 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0.072 0.159 0.411 0.589 0.841 0.928 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0.03 0.078 0.228 0.38 0.62 0.772 0.922 0.97 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0.013 0.038 0.121 0.229 0.417 0.583 0.771 0.879 0.962 0.987 1 1 1 1 1 1 1 Chart Title 0 0 0 0 0 0 0 0.005 0.018 0.062 0.131 0.262 0.408 0.592 0.738 0.869 0.938 0.982 0.995 1 1 1 1 1 1 0 0 0 0 0 0 0.002 0.008 0.031 0.072 0.157 0.268 0.424 0.576 0.732 0.843 0.928 0.969 0.992 1 1 1 1 1 1 0 0 0 0 0 0.001 0.004 0.015 0.039 0.09 0.168 0.287 0.423 0.577 0.713 0.832 0.91 0.961 0.985 1 1 1 1 1 1 0 0 0 0 0 0.002 0.007 0.02 0.05 0.101 0.185 0.294 0.43 0.57 0.706 0.815 0.899 0.95 0.98 0.993 1 1 1 1 1 0 0 0 0 0.001 0.004 0.01 0.027 0.059 0.115 0.195 0.305 0.431 0.569 0.695 0.805 0.885 0.941 0.973 0.99 1 1 1 1 1 0 0 ### 0 0.002 0.005 0.015 0.033 0.069 0.125 0.208 0.312 0.436 0.564 0.688 0.792 0.875 0.931 0.967 0.985 0.995 1 1 1 1 0 ### 0 0.001 0.003 0.008 0.019 0.04 0.078 0.136 0.217 0.32 0.438 0.562 0.68 0.783 0.864 0.922 0.96 0.981 0.992 1 1 1 1 0 ### 0 0.001 0.004 0.01 0.023 0.047 0.087 0.145 0.226 0.326 0.441 0.559 0.674 0.774 0.855 0.913 0.953 0.977 0.99 1 1 1 1 u(x,0) 0 0 0.001 0.002 0.005 0.013 0.028 0.054 0.095 0.155 0.234 0.332 0.442 0.558 0.668 0.766 0.845 0.905 0.946 0.972 0.987 0.995 1 1 1 0 0 0.001 0.003 0.007 0.016 0.032 0.06 0.102 0.163 0.242 0.337 0.445 0.555 0.663 0.758 0.837 0.898 0.94 0.968 0.984 0.993 u(x,0.003)1 1 1 0 0 0.001 0.004 0.009 0.019 0.037 0.066 0.11 0.171 0.249 0.342 0.446 0.554 0.658 0.751 0.829 0.89 0.934 0.963 0.981 0.991 1 1 1 u(x,0.0099) 0 0.001 0.002 0.005 0.011 0.022 0.042 0.072 0.117 0.178 0.255 0.347 0.448 0.552 0.653 0.745 0.822 0.883 0.928 0.958 0.978 0.989 0.995 1 1 u(x,0.030) 0 0.001 0.003 0.006 0.013 0.026 0.046 0.078 0.124 0.185 0.261 0.351 0.449 0.551 0.649 0.739 0.815 0.876 0.922 0.954 0.974 0.987 0.994 1 1 0 0.001 0.003 0.008 0.016 0.029 0.051 0.084 0.13 0.191 0.267 0.354 0.45 0.55 0.646 0.733 0.809 0.87 0.916 0.949 0.971 0.984 0.992 1 1 0 0.002 0.004 0.009 0.018 0.033 0.056 0.089 0.136 0.197 0.272 0.358 0.452 0.548 0.642 0.728 0.803 0.864 0.911 0.944 0.967 0.982 0.991 1 1 0 0.002 0.005 0.011 0.02 0.036 0.06 0.095 0.142 0.203 0.276 0.361 0.453 0.547 0.639 0.724 0.797 0.858 0.905 0.94 0.964 0.98 0.989 0.995 1 0 0.003 0.006 0.012 0.023 0.04 0.065 0.1 0.148 0.208 0.281 0.364 0.454 0.546 0.636 0.719 0.792 0.852 0.9 0.935 0.96 0.977 0.988 0.994 1 0 0.003 0.007 0.014 0.025 0.043 0.069 0.105 0.153 0.213 0.285 0.367 0.455 0.545 0.633 0.715 0.787 0.847 0.895 0.931 0.957 0.975 0.986 0.993 1 0 0.004 0.008 0.016 0.028 0.047 0.073 0.11 0.158 0.218 0.289 0.37 0.456 0.544 0.63 0.711 0.782 0.842 0.89 0.927 0.953 0.972 0.984 0.992 1 0 0.004 0.01 0.018 0.031 0.05 0.077 0.115 0.163 0.223 0.293 0.372 0.457 0.543 0.628 0.707 0.777 0.837 0.885 0.923 0.95 0.969 0.982 0.99 1 0 0.005 0.011 0.02 0.033 0.053 0.082 0.119 0.168 0.227 0.297 0.374 0.458 0.542 0.626 0.703 0.773 0.832 0.881 0.918 0.947 0.967 0.98 0.989 1 0 0.005 0.012 0.022 0.036 0.057 0.086 0.124 0.172 0.231 0.3 0.377 0.458 0.542 0.623 0.7 0.769 0.828 0.876 0.914 0.943 0.964 0.978 0.988 0.995 0 0.006 0.013 0.024 0.039 0.06 0.089 0.128 0.177 0.235 0.303 0.379 0.459 0.541 0.621 0.697 0.765 0.823 0.872 0.911 0.94 0.961 0.976 0.987 0.994 0 0.006 0.014 0.026 0.041 0.063 0.093 0.132 0.181 0.239 0.307 0.381 0.46 0.54 0.619 0.693 0.761 0.819 0.868 0.907 0.937 0.959 0.974 0.986 0.994 0 0.007 0.016 0.028 0.044 0.067 0.097 0.136 0.185 0.243 0.309 0.383 0.46 0.54 0.617 0.691 0.757 0.815 0.864 0.903 0.933 0.956 0.972 0.984 0.993 0 0.008 0.017 0.029 0.047 0.07 0.101 0.14 0.189 0.247 0.312 0.385 0.461 0.539 0.615 0.688 0.753 0.811 0.86 0.899 0.93 0.953 0.971 0.983 0.992 0 0.008 0.018 0.031 0.049 0.073 0.104 0.144 0.193 0.25 0.315 0.386 0.462 0.538 0.614 0.685 0.75 0.807 0.856 0.896 0.927 0.951 0.969 0.982 0.992 0 0.009 0.02 0.033 0.052 0.076 0.108 0.148 0.196 0.253 0.318 0.388 0.462 0.538 0.612 0.682 0.747 0.804 0.852 0.892 0.924 0.948 0.967 0.98 0.991 0 0.01 0.021 0.035 0.054 0.079 0.111 0.151 0.2 0.256 0.32 0.39 0.463 0.537 0.61 0.68 0.744 0.8 0.849 0.889 0.921 0.946 0.965 0.979 0.99 0 0.01 0.022 0.037 0.057 0.082 0.115 0.155 0.203 0.259 0.322 0.391 0.463 0.537 0.609 0.678 0.741 0.797 0.845 0.885 0.918 0.943 0.963 0.978 0.99 0 0.011 0.024 0.039 0.059 0.085 0.118 0.158 0.206 0.262 0.325 0.393 0.464 0.536 0.607 0.675 0.738 0.794 0.842 0.882 0.915 0.941 0.961 0.976 0.989 0 0.012 0.025 0.041 0.062 0.088 0.121 0.161 0.21 0.265 0.327 0.394 0.464 0.536 0.606 0.673 0.735 0.79 0.839 0.879 0.912 0.938 0.959 0.975 0.988 0 0.012 0.026 0.043 0.064 0.091 0.124 0.165 0.213 0.268 0.329 0.395 0.465 0.535 0.605 0.671 0.732 0.787 0.835 0.876 0.909 0.936 0.957 0.974 0.988 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Axis Title Parameters: Finite difference scheme Page 1 0.6 0.66 0.72 0.78 0.84 0.9 0.96 1.02 1.08 1.14 (d) (Excel) In your computation, change t from t = 0.0003 to t = 0.0004 and see what happens. Does your computation make any sense? What is the explanation? Increasing the time step t to 0.004 makes the computation go wild: enormous numbers appear very quickly. That is because the value of K = ↵2 ( t)/( x) becomes K = 0.556, and the stability condition K < 1/2 is violated, producing spurious, exponentially growing solutions. 3. (Excel) Consider the following heat conduction problem with “insulating” BCs: ut = uxx , 0<x<1 ux (0, t) = 0 and ux (1, t) = 0 ⇢ 0 if 0 x 1/2, u(x, 0) = f (x) = 1 if 1/2 < x 1, The solution is given by u(x, t) = 1 a0 X + an cos (n⇡x) e 2 n2 ⇡ 2 t n=1 where an = 2 Z 1 f (x) cos (n⇡x) dx = 0 ( 1 2 n⇡ sin n = 0, n⇡ 2 n > 0. [You should be able to find this solution yourself by separating variables - if you feel you need more practice, try to check it.] (a) Describe, with the aid of a sketch, how the temperature varies over time at the following points; (a) x = 0, (b) x = 1/2, (c) x = 1. To what value does the solution tend as t ! 1? In light of the Fourier convergence theorem (recall the Fourier cosine series describing u(x, 0) is Fourier series of the even periodic extension of f (x)), we have 1 1 1 1 1 1 u(0, 0) = f (0) = 0, u( , 0) = [f ( )+f ( +)] = [0+1] = , u(1, 0) = f (1) = 1. 2 2 2 2 2 2 Moreover, for every x, limt!1 u(x, t) = 1/2. For x = 1/2, in fact, we have u(1/2, t) = 1/2 for all t, by direct substitution of x = 1/2 into the series – all the terms except a0 /2 vanish. Based on these values, one can make a reasonable qualitative sketch of u(0, t), u(1/2, t), and u(1, t) as functions of t: 3 u(0,t) u(1/2,t) u(1,t) 1 0.8 0.6 0.4 0.2 0 0 0.2 0.4 0.6 0.8 1 (b) Now use an Excel spreadsheet and a finite di↵erence approximation to solve the problem numerically, taking N = 10 ( x = 0.1) and t = 0.004 (you can use the template on the website, or your spreadsheet from assignment 5, but remember to account for the derivative boundary conditions). To what value does the solution appear to be converging as t ! 1? Why is this? How could you improve the numerical solution to get closer to the correct answer? A spreadsheet showing this computation is attached, with a plot of the numerical solution at several times. The solution appears to be tending to a constant value of (about) 0.45, whereas we know the true solution tends to 0.5. This is because in representing the initial data we chose the value 0 at the grid point x = 1/2, and so e↵ectively have represented a function with average value (integral) less than 0.5 (i.e. about 0.45) where the true initial data has average value 0.5 (and the solution of the heat equation with insulating BCs tends to the average value of the initial data as t ! 1). 4 dx = Time \x -> 0 0 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.08 0.08 0.08 0.09 0.09 0.1 0.1 0.1 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.16 0.16 0.17 0.17 0.18 0.18 0.18 0.19 0.1 dt = 1 0 0.16 0.06 0.1 0.08 0.09 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.24 0.25 0.26 0.27 0.27 0.28 0.29 0.29 0.3 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.36 0.37 0.37 0 0 0.4 0.08 0.14 0.08 0.09 0.08 0.09 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.23 0.24 0.25 0.26 0.26 0.27 0.28 0.29 0.29 0.3 0.3 0.31 0.31 0.32 0.33 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.36 0.37 0 alpha^2 1 k=a dt/dx^2 0.4 pi 0.1 0.2 0.3 0.4 0.5 0 0 0 0 0 0 0 0 0 0.4 0.16 0 0 0.16 0.32 0.06 0.06 0.06 0.16 0.4 0.1 0.06 0.1 0.22 0.38 0.08 0.09 0.13 0.24 0.41 0.09 0.1 0.16 0.26 0.41 0.09 0.12 0.18 0.28 0.42 0.1 0.13 0.2 0.3 0.42 0.11 0.15 0.21 0.31 0.43 0.12 0.16 0.22 0.32 0.43 0.13 0.17 0.23 0.32 0.43 0.14 0.18 0.24 0.33 0.44 10.15 0.19 0.25 0.34 0.44 0.16 0.2 0.26 0.34 0.44 0.9 0.17 0.21 0.27 0.35 0.44 0.18 0.22 0.28 0.35 0.44 0.8 0.19 0.23 0.28 0.36 0.44 0.7 0.2 0.24 0.29 0.36 0.44 0.21 0.24 0.3 0.37 0.45 0.6 0.22 0.25 0.3 0.37 0.45 0.50.23 0.26 0.31 0.37 0.45 0.24 0.27 0.32 0.38 0.45 0.4 0.24 0.27 0.32 0.38 0.45 0.25 0.28 0.33 0.38 0.45 0.3 0.26 0.29 0.33 0.39 0.45 0.20.27 0.29 0.34 0.39 0.45 0.27 0.3 0.34 0.39 0.45 0.1 0.28 0.31 0.34 0.39 0.45 0.31 0.35 0.4 0.45 00.29 0.29 Col 0.32 Col0.35 Col 0.4Col 0.45 Col Col umn umn 0.3 umn 0.32 umn 0.36 umn 0.4umn 0.45 C H 0.31 D0.33 E 0.36 F 0.4G 0.45 0.31 0.33 0.36 0.4 0.45 0.32 0.34 0.37 0.41 0.45 0.32 0.34 0.37 0.41 0.45 0.33 0.34 0.37 0.41 0.45 0.33 0.35 0.38 0.41 0.45 0.34 0.35 0.38 0.41 0.45 0.34 0.36 0.38 0.41 0.45 0.34 0.36 0.38 0.42 0.45 0.35 0.36 0.39 0.42 0.45 0.35 0.37 0.39 0.42 0.45 0.36 0.37 0.39 0.42 0.45 0.36 0.37 0.39 0.42 0.45 0.36 0.38 0.4 0.42 0.45 0.37 0.38 0.4 0.42 0.45 0.37 0.38 0.4 0.42 0.45 3.14 0.6 0.7 0.8 0.9 1 1 1 1 1 1 0.6 1 1 1 0.6 0.68 0.84 1 0.84 0.92 0.6 0.84 0.87 0.94 0.86 0.62 0.76 0.88 0.88 0.92 0.58 0.75 0.83 0.9 0.89 0.58 0.71 0.83 0.87 0.9 0.57 0.71 0.8 0.86 0.87 0.56 0.69 0.79 0.84 0.86 0.56 0.68 0.77 0.83 0.85 0.55 0.67 0.76 0.81 0.83 0.55 0.66 0.74 0.8 0.82 0.55 0.65 0.73 0.78 0.8 0.54 0.64 0.72 0.77 0.79 0.54 0.63 0.71 0.76 0.77 0.54 0.63 0.7 0.74 0.76 0.53 0.62 0.69 0.73 0.75 0.53 0.61 0.68 0.72 0.73 0.53 0.61 0.67 0.71 0.72 0.53 0.6 0.66 0.7 0.71 0.52 0.59 0.65 0.69 0.7 0.52 0.59 0.64 0.68 0.69 0.52 0.58 0.63 0.67 0.68 0.52 0.58 0.63 0.66 0.67 0.51 0.57 0.62 0.65 0.66 0.51 0.57 0.61 0.64 0.65 0.51 0.56 0.61 0.64 0.65 0.51 0.56 0.6 0.63 0.64 0.5 0.55 0.6 0.62 0.63 0.5 0.55 0.59 0.61 0.62 0.5 0.55 Col 0.58 Col0.61Col 0.62 ColCol umn 0.5 I umn 0.54 umn 0.58 umn0.6umn0.61 J0.54 K0.57 L 0.6M 0.5 0.6 0.49 0.54 0.57 0.59 0.6 0.49 0.53 0.56 0.58 0.59 0.49 0.53 0.56 0.58 0.59 0.49 0.53 0.56 0.57 0.58 0.49 0.52 0.55 0.57 0.58 0.49 0.52 0.55 0.56 0.57 0.49 0.52 0.54 0.56 0.57 0.48 0.52 0.54 0.56 0.56 0.48 0.51 0.54 0.55 0.56 0.48 0.51 0.53 0.55 0.55 0.48 0.51 0.53 0.54 0.55 0.48 0.51 0.53 0.54 0.54 0.48 0.5 0.52 0.54 0.54 0.48 0.5 0.52 0.53 0.54 0.48 0.5 0.52 0.53 0.53 1 0.84 0.94 0.88 0.9 0.87 0.86 0.84 0.83 0.81 0.8 0.78 0.77 0.76 0.74 0.73 0.72 0.71 0.7 0.69 0.68 0.67 0.66 0.65 0.64 0.64 0.63 0.62 0.61 0.61 0.6 0.6 0.59 0.58 0.58 0.57 0.57 0.56 0.56 0.56 0.55 0.55 0.54 0.54 0.54 0.53 0.53