{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 14 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {PARA 256 "" 0 "" {TEXT -1 142 "Time Dependent Boundary Condit ions for the One Dimensional Diffusion Equation - Solutions by Separat ion of Variables and by Numerical Methods." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 95 "Suppose that we want to find a function w that satisfies the one dime nsional diffusion equation" }}{PARA 0 "" 0 "" {TEXT -1 11 " \+ " }{XPPEDIT 18 0 "dw/dt;" "6#*&%#dwG\"\"\"%#dtG!\"\"" }{TEXT -1 3 " = \+ " }{XPPEDIT 18 0 "diff(w,`$`(x,2));" "6#-%%diffG6$%\"wG-%\"$G6$%\"xG\" \"#" }{TEXT -1 2 " " }}{PARA 0 "" 0 "" {TEXT -1 42 "with time depende nt boundary conditions " }{XPPEDIT 18 0 "dw/dx;" "6#*&%#dwG\"\"\"%#d xG!\"\"" }{TEXT -1 15 "(t, 0) = - f(t)" }}{PARA 0 "" 0 "" {TEXT -1 63 "and " } {XPPEDIT 18 0 "diff(w,x);" "6#-%%diffG6$%\"wG%\"xG" }{TEXT -1 14 "(t, \+ 1) = g(t)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 41 "and with initial condition w(0, x) = 0. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 338 "The time dependent bound ary conditions model the in-flow and out-flow at the left and right bo undary. When f(t) > 0 this model reflects that the value of w at the l eft end will be greater than in nearby values. When g(t) > 0, the righ t end will also be greater than in nearby values. Analogous results ho ld for negative values of f and g." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 360 "The goal is to create a function u and a partial differential equation for u. The partial differential equatio n for u will have a non-zero forcing function and will have homogeneou s boundary conditions. We want the created u to be related to the desi red w in a simple manner. Most important, the u will have a solution t hat can be found by standard techniques." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 58 "We want to find F(t, x) so that th e PDE for u has the form" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 11 " " }{XPPEDIT 18 0 "du/dt;" "6#*&%#duG\" \"\"%#dtG!\"\"" }{TEXT -1 3 " = " }{XPPEDIT 18 0 "diff(u,`$`(x,2));" " 6#-%%diffG6$%\"uG-%\"$G6$%\"xG\"\"#" }{TEXT -1 4 " + " }{TEXT 256 6 " F(t,x)" }{TEXT -1 1 "," }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 37 "with homogeneous boundary conditions " }}{PARA 0 "" 0 "" {TEXT -1 14 " " }{XPPEDIT 18 0 "du/dx;" "6#*&%#duG\" \"\"%#dxG!\"\"" }{TEXT -1 10 "(t, 0) = 0" }}{PARA 0 "" 0 "" {TEXT -1 11 "and " }{XPPEDIT 18 0 "diff(u,x);" "6#-%%diffG6$%\"uG%\"xG" }{TEXT -1 12 "(t, 1) = 0." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 62 "The initial condition for u will be determined in the process." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 25 " We create u as follows. " }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 41 "We use the fact that the derivative o f " }{XPPEDIT 18 0 "x^2/2-x;" "6#,&*&%\"xG\"\"#F&!\"\"\"\"\"F%F'" } {TEXT -1 59 " is -1 at x = 0 and 0 at x = 1. Also, the derivative of " }{XPPEDIT 18 0 "x^2/2;" "6#*&%\"xG\"\"#F%!\"\"" }{TEXT -1 120 " i s 0 at x = 0 and is 1 at x = 1. We use these functions to make the con nection between w and u in terms of f and g." }}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "w:=(t,x)->u(t,x)+(x^2/2-x)*f(t)+x^2*g(t)/2;" }}}{PARA 0 "" 0 " " {TEXT -1 92 "Knowing what PDE the function w should satisfy, we ask \+ what PDE the function u will satisfy." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "diff(w(t,x),t)-diff(w(t,x),x,x)=0;" }}}{PARA 0 "" 0 " " {TEXT -1 53 "Next, we ask what boundary conditions u must satisfy." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "D[2](w)(t,0)+f(t)=0;\nD[2] (w)(t,1)-g(t)=0;" }}}{PARA 0 "" 0 "" {TEXT -1 57 "Finally, we determin e the initial value that u must have." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "w(0,x)=0;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 39 "From this we see how to make u. We \+ want" }}{PARA 0 "" 0 "" {TEXT -1 11 " " }{XPPEDIT 18 0 "du/d t;" "6#*&%#duG\"\"\"%#dtG!\"\"" }{TEXT -1 3 " = " }{XPPEDIT 18 0 "diff (u,`$`(x,2));" "6#-%%diffG6$%\"uG-%\"$G6$%\"xG\"\"#" }{TEXT -1 29 " + f(t) + g(t) + x f '(t) - " }{XPPEDIT 18 0 "x^2/2;" "6#*&%\"xG\"\"#F%! \"\"" }{TEXT -1 20 " ( f '(t) + g '(t) )" }}{PARA 0 "" 0 "" {TEXT -1 29 "with homogenous conditions " }{XPPEDIT 18 0 "du/dt;" "6#*&%#duG \"\"\"%#dtG!\"\"" }{TEXT -1 9 "(t, 0) = " }{XPPEDIT 18 0 "0;" "6#\"\"! " }{TEXT -1 3 " = " }{XPPEDIT 18 0 "diff(u,x);" "6#-%%diffG6$%\"uG%\"x G" }{TEXT -1 7 "(t, 1)," }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 43 "and initial conditions u(0, x) = x f(0) - " } {XPPEDIT 18 0 "x^2/2;" "6#*&%\"xG\"\"#F%!\"\"" }{TEXT -1 17 " ( f(0) + g(0) )." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 28 "Because the functions cos(n " }{XPPEDIT 18 0 "Pi;" "6#%#PiG" } {TEXT -1 107 " x) serve as a basis for solutions of the standard diffu sion equation with homogeneous boundary conditions:" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 11 " " }{XPPEDIT 18 0 "du/dt;" "6#*&%#duG\"\"\"%#dtG!\"\"" }{TEXT -1 3 " = " }{XPPEDIT 18 0 "diff(u,`$`(x,2));" "6#-%%diffG6$%\"uG-%\"$G6$%\"xG\"\"#" }{TEXT -1 8 ", with " }{XPPEDIT 18 0 "du/dt;" "6#*&%#duG\"\"\"%#dtG!\"\"" } {TEXT -1 9 "(t, 0) = " }{XPPEDIT 18 0 "0;" "6#\"\"!" }{TEXT -1 3 " = \+ " }{XPPEDIT 18 0 "diff(u,x);" "6#-%%diffG6$%\"uG%\"xG" }{TEXT -1 7 "(t , 1) " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 156 "and because we will solve the problem by the method of separation of \+ variables, we know a form that the solution u must have. The general \+ solution will be " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 13 " u(t, x) = " }{XPPEDIT 18 0 "T[0];" "6#&%\"TG6#\"\"!" } {TEXT -1 6 "(t) + " }{XPPEDIT 18 0 "T[1];" "6#&%\"TG6#\"\"\"" }{TEXT -1 8 "(t) cos(" }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT -1 6 " x) + " } {XPPEDIT 18 0 "T[2];" "6#&%\"TG6#\"\"#" }{TEXT -1 10 "(t) cos(2 " } {XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT -1 11 " x) + ... ." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 59 "We have only to dete rmine the time dependent coefficients, " }{XPPEDIT 18 0 "T[n](t);" "6# -&%\"TG6#%\"nG6#%\"tG" }{TEXT -1 154 ". First, we check the boundary c ondition to be sure that we are using the correct basis function. (We \+ make a seven term approximation for the function u.)" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "N:=6;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "u:=(t,x)->sum(T[n](t)*cos(n*Pi*x),n=0..N);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "D[2](u)(t,0);\nD[2](u)(t,1); " }}}{PARA 0 "" 0 "" {TEXT -1 113 "We will determine the T's by using \+ the PDE and initial condition that u should satisfy. Here is a worked \+ example." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 257 14 "Worked Example" }}{PARA 0 "" 0 "" {TEXT -1 37 "We \+ work an example. Take f(t) = g(t)." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "f:=t->sin(2*Pi*t);\ng:=t->sin(2*Pi*t);" }}}{PARA 0 " " 0 "" {TEXT -1 46 "Here is the forcing function for the PDE in u." }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "combine(f(t)+g(t)+x*diff(f(t ),t)-x^2/2*diff(f(t)+g(t),t));" }}}{PARA 0 "" 0 "" {TEXT -1 68 "Here i s the initial value for the PDE in u: u(0, x) = x f(0) - " } {XPPEDIT 18 0 "x^2/2;" "6#*&%\"xG\"\"#F%!\"\"" }{TEXT -1 17 " ( f(0) + g(0) )." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "x*f(0)-x^2/2*(f( 0)+g(0));" }}}{PARA 0 "" 0 "" {TEXT -1 44 "We separate out that forcin g function first." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "F:=(t,x )->f(t)+g(t)+x*diff(f(t),t)-x^2/2*diff(f(t)+g(t),t):\nF(t,x);" }}} {PARA 0 "" 0 "" {TEXT -1 30 "Here is the sequence of ODE's." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "diff(u(t,x),t)=diff(u(t,x),x,x)+F(t ,x);" }}}{PARA 0 "" 0 "" {TEXT -1 57 "At this point, we should equate \+ the coefficient of cos(n " }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT -1 83 " x) on each side of the equation. To do this, we make a cosine se ries for F(t,x). " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 97 "for n f rom 0 to N do a[n]:=int(F(t,x)*cos(n*Pi*x),x=0..1)/int(cos(n*Pi*x)^2, x=0..1);\nod;\nn:='n';" }}}{PARA 0 "" 0 "" {TEXT -1 83 "Using these va lues, here is the N term cosine series for F(t,x). We call it H(t,x). " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "H:=(t,x)->sum(a[n]*cos(n *Pi*x),n=0..N);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "H(t,x);" }}}{PARA 0 "" 0 "" {TEXT -1 34 "We check to see how good H fits F." }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 131 "J:=plot3d(H(t,x),x=0..1,t=0 ..1,axes=normal,color=red):\nK:=plot3d(F(t,x),x=0..1,t=0..1,axes=norma l,color=blue):\nplots[display](J,K);" }}}{PARA 0 "" 0 "" {TEXT -1 37 " This is an industrial grade good fit." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 58 "Using this approximation we compute t he sequence of ODE's." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "S:= diff(u(t,x),t)=diff(u(t,x),x,x)+sum(a[n]*cos(n*Pi*x),n=0..N);" }}} {PARA 0 "" 0 "" {TEXT -1 75 "We extract the ordinary differential equa tions from the above. Look at them" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 110 "diff(T[0](t),t)=a[0];\nfor n from 1 to N do\n coef f(lhs(S),cos(n*Pi*x))=coeff(rhs(S),cos(n*Pi*x));\nod;\nn:='n';" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 107 "The initial value for each of these comes from the initial val ue of u. In this special case, this is zero. " }}{PARA 0 "" 0 "" {TEXT -1 33 "We solve the ODE's one at a time." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 138 "for n from 0 to N do\n S:=dsolve(\{diff(y(t),t )=-n^2*Pi^2*y(t)+a[n],\n y(0)=0\},y(t)):\n T[n]:=unap ply(rhs(S),t):\nod:\nn:='n';" }}}{PARA 0 "" 0 "" {TEXT -1 43 "Here, th en, is an approximation for u(t,x)." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "u(t,x);" }}}{PARA 0 "" 0 "" {TEXT -1 58 "We check it. \+ Here is the check of the boundary conditions." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "D[2](u)(t,0);\nD[2](u)(t,1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 41 "Here is a \+ check of the initial condition." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "simplify(u(0,x));" }}}{PARA 0 "" 0 "" {TEXT -1 116 "Here is a \+ check of the PDE. We will not get exactly zero, so we plot the result \+ and verify that it is close to zero." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "simplify(diff(u(t,x),t)-diff(u(t,x),x,x)-H(t,x));" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "plot3d(%,x=0..1,t=0..1,axes =NORMAL);" }}}{PARA 0 "" 0 "" {TEXT -1 52 "We go back and recover w. H ere is a plot of w(t, x)." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "plot3d(w(t,x),x=0..1,t=0..2,axes=normal,orientation=[-135,60]);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 28 "Look at the plot of w(t, 0)." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "plot(w(t,0),t=0..2);" }}}{PARA 0 "" 0 "" {TEXT -1 167 "Compare the value of w in the middle and at the edge with the cha nging boundary condition. This graph shows how the maximum in the midd le follows the forcing function." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "plot([sin(2*Pi*t),w(t,1/2),w(t,0)],t=0..2, color=[red,blue,gre en]);" }}}{PARA 0 "" 0 "" {TEXT -1 41 "Finally, here is an animation o f w(t, x)." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "plots[animate] (w(t,x),x=0..1,t=0..2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 259 44 "A N UMERICAL PROCEDURE for the worked example" }}{PARA 0 "" 0 "" {TEXT -1 88 "Here is the numerical method for getting solutions. We seek a func tion that we call the " }{TEXT 258 11 "numerical w" }{TEXT -1 130 ", o r wn. To get this function, we define the PDE for numerical calculatio n and the boundary conditions for numerical calculations." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "pdeNum:=diff(wn(t,x),t)=diff(wn(t,x ),x,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "bcNum:=\{D[2](wn )(t,0)=-sin(2*Pi*t),D[2](wn)(t,1)=sin(2*Pi*t),wn(0,x)=0\};" }}}{PARA 0 "" 0 "" {TEXT -1 65 "The next step is to get the numerical procedure for the solution." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 86 "WN:=pd solve(pdeNum,bcNum,type=numeric,time=t,range=0..1,timestep=1/100,space step=1/6);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 " " 0 "" {TEXT -1 107 "We want to be able to compute the values for this numerically computed function. Thus, we make a procedure." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "wValue:=WN:-value();\n" }}}{PARA 0 "" 0 "" {TEXT -1 84 "In the following calculation, we see that the pro cedure wValue is actually a triple." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "wValue(1/3,1/4);" }}}{PARA 0 "" 0 "" {TEXT -1 144 "We make up the numerical solution for the PDE and boundary conditions by picking out the right hand side of the third coordinate of this tripl e." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "wpro:=unapply('rhs(op( 3,wValue(t,x)))',(t,x));" }}}{PARA 0 "" 0 "" {TEXT -1 195 "Look now at the graph of numerical solution. It looks like the solution found by \+ separation of variable techniques above. (Note that single quotes are \+ used around wpro to delay evaluation of the " }{TEXT 260 3 "pro" } {TEXT -1 8 "cedure.)" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "plot 3d('wpro(t,x)',x=0..1,t=0..2,axes=normal,orientation=[-135,60]);" }}} {PARA 0 "" 0 "" {TEXT -1 209 "Just as above, we look at how the middle and boundary of the solution follows the time dependent boundary cond itions. Red is the boundary condition, blue is the middle values, and \+ green is the boundary values." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 76 "plot([sin(2*Pi*t),'wpro(t,1/2)','wpro(t,0)'],t=0..2,color=[red,b lue,green]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 137 "A gain, the values of w found by this numerical procedure are similar to those found by the separation of variables analytic method above." }} }{MARK "0 0" 142 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }