<?xml version="1.0" encoding="UTF-8"?>
<Worksheet><Version major="6" minor="1"/><View-Properties><Zoom percentage="100"/></View-Properties><Styles><Layout alignment="left" bullet="dot" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Bullet Item" rightmargin="0.0" spaceabove="3.0" spacebelow="3.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle8" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle7" rightmargin="0.0" spaceabove="8.0" spacebelow="4.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle6" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="centred" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle5" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="centred" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle4" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle3" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="centred" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle2" rightmargin="0.0" spaceabove="8.0" spacebelow="2.0"/><Layout alignment="centred" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle1" rightmargin="0.0" spaceabove="12.0" spacebelow="12.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Heading 1" rightmargin="0.0" spaceabove="8.0" spacebelow="4.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Normal" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle14" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle11" rightmargin="0.0" spaceabove="8.0" spacebelow="2.0"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_pstyle14" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Heading 1" readonly="false" size="18" underline="false"/><Font background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" name="Maple Input" readonly="false"/><Font background="[0,0,0]" family="Times New Roman" name="Page Number" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Normal" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Text" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" executable="false" family="Times New Roman" name="2D Math" readonly="false" underline="false"/><Font background="[0,0,0]" executable="false" foreground="[0,128,128]" italic="false" name="Hyperlink" readonly="false" underline="true"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="ParagraphStyle2" readonly="false" size="14" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="ParagraphStyle1" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_pstyle8" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="true" name="_cstyle13" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_pstyle6" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" italic="false" name="_cstyle12" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" executable="false" family="Times New Roman" name="_cstyle10" readonly="false" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_pstyle3" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Bullet Item" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" name="_cstyle257" readonly="false" underline="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" name="_cstyle256" readonly="false" underline="false"/><Font background="[0,0,0]" executable="false" family="Times New Roman" name="2D Comment" readonly="false" underline="false"/><Font background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" name="_cstyle8" readonly="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_cstyle7" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_cstyle6" readonly="false" size="18" underline="false"/><Font background="[0,0,0]" executable="false" family="Times New Roman" name="_cstyle5" readonly="false"/><Font background="[0,0,0]" executable="false" family="Times New Roman" name="_cstyle4" readonly="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_cstyle2" readonly="false" size="14" underline="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" name="_cstyle1" readonly="false" size="18" underline="true"/></Styles><Page-Numbers enabled="false" first-number="1" first-numbered-page="1" horizontal-location="right" style="Page Number" vertical-location="bottom"/><Group><Input><Text-field layout="_pstyle1" style="_cstyle1"><Font foreground="[0,0,0]" italic="false">Partial Differential Equations</Font></Text-field><Text-field layout="_pstyle2" style="_cstyle2">The Heat Equation: Separation of variables and Fourier series</Text-field><Text-field layout="_pstyle3" style="_pstyle3"/><Text-field layout="_pstyle4" style="Hyperlink"><Hyperlink bold="false" family="Times New Roman" hyperlink="true" linktarget="http://www.math.lsa.umich.edu/~adzham/" size="12" style="Hyperlink">Anton Dzhamay</Hyperlink></Text-field><Text-field layout="_pstyle5" style="Hyperlink"><Hyperlink bold="false" family="Times New Roman" hyperlink="true" linktarget="http://www.math.lsa.umich.edu/" size="12" style="Hyperlink">Department of Mathematics</Hyperlink></Text-field><Text-field layout="_pstyle5" style="Hyperlink"><Hyperlink bold="false" family="Times New Roman" hyperlink="true" linktarget="http://www.umich.edu/" size="12" style="Hyperlink">The University of Michigan</Hyperlink></Text-field><Text-field layout="_pstyle5" style="_cstyle4"><Font bold="false" foreground="[0,0,0]" italic="false" size="12" underline="false">Ann Arbor, MI 48109</Font></Text-field><Text-field layout="_pstyle6" style="_pstyle6"/><Text-field layout="_pstyle5" style="ParagraphStyle1"><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle4" underline="false">wPage: </Font><Hyperlink bold="false" family="Times New Roman" hyperlink="true" linktarget="http://www.math.lsa.umich.edu/~adzham/" size="12" style="Hyperlink">http://www.math.lsa.umich.edu/~adzham</Hyperlink></Text-field><Text-field layout="_pstyle4" style="ParagraphStyle1"><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle5" underline="false">email: </Font><Hyperlink bold="false" family="Times New Roman" hyperlink="true" linktarget="mailto:adzham@umich.edu" size="12" style="Hyperlink">adzham@umich.edu</Hyperlink></Text-field><Text-field layout="_pstyle6" style="_pstyle6"/><Text-field layout="_pstyle4" style="_cstyle5"><Font bold="false" encoding="ISO8859-1" foreground="[0,0,0]" italic="false" size="12" underline="false">Copyright \251  2004  by Anton Dzhamay</Font></Text-field><Text-field layout="_pstyle4" style="_cstyle5"><Font bold="false" foreground="[0,0,0]" italic="false" size="12" underline="false">All rights reserved</Font></Text-field><Text-field layout="_pstyle6" style="_pstyle6"/></Input></Group><Section collapsed="true"><Title><Text-field layout="_pstyle7" style="_cstyle6">Packages</Text-field></Title><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Some packages that we use in this worksheet:</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">restart: with(plottools): with(plots):</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_pstyle8"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="_pstyle7" style="_cstyle6">Introduction</Text-field></Title><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">In this worksheet we consider the one-dimensional heat equation </Font><Equation input-equation="diff(u(x,t), t) = k*diff(u(x,t), x, x)" style="2D Comment">NiMvLSUlZGlmZkc2JC0lInVHNiQlInhHJSJ0R0YrKiYlImtHIiIiLUYlNiVGJ0YqRipGLg==</Equation><Font style="_cstyle7">  describint the evolution of temperature </Font><Equation input-equation="u(x,t)" style="2D Math">NiMtJSJ1RzYkJSJ4RyUidEc=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> inside the homogeneous metal rod. We consider examples with homogeneous Dirichlet (</Font><Equation input-equation="u(0,t)=0" style="2D Math">NiMvLSUidUc2JCIiISUidEdGJw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">, </Font><Equation input-equation="u(L,t)=0" style="2D Math">NiMvLSUidUc2JCUiTEclInRHIiIh</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">) and Newmann (</Font><Equation input-equation="diff(u,x)(0,t)=0" style="2D Math">NiMvLS0lJWRpZmZHNiQlInVHJSJ4RzYkIiIhJSJ0R0Yr</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">, </Font><Equation input-equation="diff(u,x)(L,t)=0" style="2D Math">NiMvLS0lJWRpZmZHNiQlInVHJSJ4RzYkJSJMRyUidEciIiE=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">)  boundary conditions and various  </Font></Text-field><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">initial profiles </Font><Equation input-equation="f(x);" style="2D Comment">NiMtJSJmRzYjJSJ4Rw==</Equation><Font style="_cstyle7"> . Say, we want to solve the problem with homogeneous Dirichlet boundary conditions. Using separation of variables we can get an infinite family of particular solutions of the form </Font><Equation input-equation="u[n](x, t) = sin(n*Pi*x/L)*exp(-(n*Pi/L)^2*k*t)" style="2D Math">NiMvLSYlInVHNiMlIm5HNiQlInhHJSJ0RyomLSUkc2luRzYjKipGKCIiIiUjUGlHRjFGKkYxJSJMRyEiIkYxLSUkZXhwRzYjLCQqKCooRihGMUYyRjFGM0Y0IiIjJSJrR0YxRitGMUY0RjE=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">  . Then we take a linear combination </Font><Equation input-equation="u(x,t)=sum(B[n]*u[n](x,t),n=i..infinity)" style="2D Math">NiMvLSUidUc2JCUieEclInRHLSUkc3VtRzYkKiYmJSJCRzYjJSJuRyIiIi0mRiVGL0YmRjEvRjA7JSJpRyUpaW5maW5pdHlH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> of such solutions with the coefficients chosen in such a way that at </Font><Equation input-equation="t=0" style="2D Math">NiMvJSJ0RyIiIQ==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> we get the initial profile </Font><Equation input-equation="u(x,0)=f(x)" style="2D Math">NiMvLSUidUc2JCUieEciIiEtJSJmRzYjRic=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">.   </Font></Text-field></Section><Section collapsed="true"><Title><Text-field layout="_pstyle7" style="_cstyle6">Definitions</Text-field></Title><Text-field layout="_pstyle8" style="_pstyle8"/><Group><Input><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">assume(n,integer);
assume(m,integer);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Shorthand notation for basic functions</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">s:=(x,n)-&gt;sin(n*Pi*x/L):s(x,n);
c:=(x,n)-&gt;cos(n*Pi*x/L):c(x,n);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Particular solutions</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">uSp:=(x,t,n)-&gt;s(x,n)*exp(-(n*Pi/L)^2*k*t):uSp(x,t,n);
uCp:=(x,t,n)-&gt;c(x,n)*exp(-(n*Pi/L)^2*k*t):uCp(x,t,n);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Fourier sine coefficients for </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> on the interval </Font><Equation input-equation="[0,L]" style="2D Math">NiM3JCIiISUiTEc=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">B:=proc(expr,var,n)
        simplify(int(expr*s(var,n),var=0..L)/int(s(var,n)*s(var,n),var=0..L));
end proc:B(f(x),x,n);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Fourier cosine coefficients for </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> on the interval </Font><Equation input-equation="[0,L]" style="2D Math">NiM3JCIiISUiTEc=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> (note that the formulas are different for </Font><Equation input-equation="n=0" style="2D Math">NiMvJSJuRyIiIQ==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> and </Font><Equation input-equation="n&gt;0" style="2D Math">NiMyIiIhJSJuRw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">)</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">A:=proc(expr,var,n)
        simplify(int(expr*c(var,n),var=0..L)/int(c(var,n)*c(var,n),var=0..L));
end proc:A(f(x),x,0);A(f(x),x,n);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Fourier sine series and Fourier sine polynomial  for </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> [The subtle difference here is that sometimes series (that uses </Font><Font foreground="[0,0,0]" italic="false" size="12" style="_cstyle256">sum</Font><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10">) has troubles with division by zero. The polynomial (that uses </Font><Font foreground="[0,0,0]" italic="false" size="12" style="_cstyle257">add</Font><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10">) does not have this problem, but on the other hand can not evaluate symbolic sums]</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">FPs:=proc(expr,var,n)
        add(B(expr,var,m)*s(var,m),m=1..n);
end proc:
FSs:=proc(expr,var,n)
        sum(B(expr,var,m)*s(var,m),m=1..n);
end proc:FSs(f(x),x,infinity);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Fourier cosine series and Fourier cosine polynomial for </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">FPc:=proc(expr,var,n)
        A(expr,var,0)+add(A(expr,var,m)*c(var,m),m=1..n);
end proc:
FSc:=proc(expr,var,n)
        A(expr,var,0)+sum(A(expr,var,m)*c(var,m),m=1..n);
end proc:FSc(f(x),x,infinity);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Fourier polynomial (and series) solution for homogeneous Dirichlet boundary conditions</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">uPs:=proc(expr,xvar,tvar,n)
        add(B(expr,xvar,m)*s(xvar,m)*exp(-(Pi*m/L)^2*k*tvar),m=1..n);
end proc:
uSs:=proc(expr,xvar,tvar,n)
        sum(B(expr,xvar,m)*s(xvar,m)*exp(-(Pi*m/L)^2*k*tvar),m=1..n);
end proc:uSs(f(x),x,t,n);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Fourier polynomial (and series) solution for homogeneous Neumann boundary conditions</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">uPc:=proc(expr,xvar,tvar,n)
        A(expr,xvar,0)+add(A(expr,xvar,m)*c(xvar,m)*exp(-(Pi*m/L)^2*k*tvar),m=1..n);
end proc:
uSc:=proc(expr,xvar,tvar,n)
        A(expr,xvar,0)+sum(A(expr,xvar,m)*c(xvar,m)*exp(-(Pi*m/L)^2*k*tvar),m=1..n);
end proc:uSc(f(x),x,t,infinity);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_pstyle8"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="_pstyle7" style="_cstyle6">Dirichlet Boundary Conditions</Text-field></Title><Section><Title><Text-field layout="_pstyle11" style="ParagraphStyle2"><Equation input-equation="f(x) = sin(Pi*x/L)+2*sin(4*Pi*x/L);" style="2D Comment">NiMvLSUiZkc2IyUieEcsJi0lJHNpbkc2IyooJSNQaUciIiJGJ0YuJSJMRyEiIkYuKiYiIiNGLi1GKjYjKioiIiVGLkYtRi5GJ0YuRi9GMEYuRi4=</Equation><Font style="_cstyle2"> </Font></Text-field></Title><Text-field layout="_pstyle8" style="_pstyle8"/><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">In this example we take </Font><Equation input-equation="L=1" style="2D Math">NiMvJSJMRyIiIg==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> and </Font><Equation input-equation="k=1" style="2D Math">NiMvJSJrRyIiIg==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">.</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">L:=1: k:=1:</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Since </Font><Equation style="Text">NiMtJSJmRzYjJSJ4Rw==</Equation><Font style="_cstyle7"> is just the sum of two basic functions for </Font><Equation style="Text">NiMvJSJuRyIiIg==</Equation><Font style="_cstyle7"> and </Font><Equation style="Text">NiMvJSJuRyIiJQ==</Equation><Font style="_cstyle7">, so by the principle of superposition </Font><Equation style="Text">NiMvLSUidUc2JCUieEclInRHLCYtJkYlNiMiIiJGJkYtKiYiIiNGLS0mRiU2IyIiJUYmRi1GLQ==</Equation><Font style="_cstyle7"> is the required solution.</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">u:=(x,t)-&gt;uSp(x,t,1)+2*uSp(x,t,4):u(x,t);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">This plot shows our solution and the corresponding particular solutions. Looking at their evolution in time we see that due to faster exponential decay the particular solution </Font><Equation input-equation="u[4](x,t)" style="2D Math">NiMtJiUidUc2IyIiJTYkJSJ4RyUidEc=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> goes to zero much faster than </Font><Equation input-equation="u[1](x,t)" style="2D Math">NiMtJiUidUc2IyIiIjYkJSJ4RyUidEc=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> and so when </Font><Equation input-equation="t" style="2D Math">NiMlInRH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> is large enough the solution is well-approximated by just the first particular solution.</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">display([
  seq(
    plot({u(x,0.005*t),uSp(x,0.005*t,1),2*uSp(x,0.005*t,4)},x=0..L,
     color=[red,blue,green],thickness=2)                
  ,t=0..50)
],insequence=true);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">And this is how the graph of our solution looks like from the top (we extend it a bit in the </Font><Equation input-equation="y" style="2D Math">NiMlInlH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">-direction and also scale the </Font><Equation input-equation="u" style="2D Math">NiMlInVH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">-values by the coefficient of 1/10 to get a better picture). Points are colored according to the temperature, and we can see how  quickly the initial sharp variations in the temperature (which correspond to large </Font><Equation input-equation="n" style="2D Math">NiMlIm5H</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">) disappear:</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">display([seq(plot3d(u(x,0.005*t)/10,
x=0..L,y=0..L/8,shading=zhue,style=patchnogrid),t=0..50)],insequence=true,
scaling=constrained,axes=boxed,orientation=[-90,0],tickmarks=[1,1,1]);</Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Now let's restore </Font><Equation input-equation="L" style="2D Math">NiMlIkxH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> and </Font><Equation input-equation="k" style="2D Math">NiMlImtH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> back to symbols</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">L:='L': k:='k':</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_pstyle8"/></Input></Group><Text-field layout="_pstyle8" style="_pstyle8"/></Section><Section collapsed="true"><Title><Text-field layout="_pstyle11" style="ParagraphStyle2"><Equation input-equation="f(x) = 1;" style="2D Comment">NiMvLSUiZkc2IyUieEciIiI=</Equation><Font style="_cstyle2"> </Font></Text-field></Title><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">This time we'll need the full power of Fourier series.</Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">f:=x-&gt;1:f(x);</Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">The Fourier sine coefficients of </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> are given by</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">B(f(x),x,n);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Here are the first few of them evaluated explicitly (note that all odd coefficients are zero in this case).</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">seq(B[n]=B(f(x),x,n),n=1..10);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">So the Fourier sine series for </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> is</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">FSs(f(x),x,infinity);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">And this is an approximation whith four first non-zero terms:</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">FSs(f(x),x,8);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">For graphing we again choose some values for </Font><Equation input-equation="L" style="2D Math">NiMlIkxH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> and </Font><Equation input-equation="k" style="2D Math">NiMlImtH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">.</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">L:=1: k:=1:</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Sketching Fourier sine series approximations we see that away from the boundary points Fourier approximation is getting closer and closer to our function</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">display([
plot(1,x=0..L,color=red,thickness=2),
display([seq(plot(FSs(f(x),x,2*r+1),x=0..L,color=blue,thickness=2,
title=sprintf("n=%d Fourier Approximation",2*r+1)),r=0..20)],insequence=true)
]);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Sketching the Fourier approximation with </Font><Equation input-equation="n=300" style="2D Math">NiMvJSJuRyIkKyQ=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> helps us see it even better. Near </Font><Equation input-equation="x=0" style="2D Math">NiMvJSJ4RyIiIQ==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> we see that Fourier approximation goes to about 1.18. This is known as the Gibbs phenomena for the Fourier series.</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">plot([f(x),FSs(f(x),x,300)],x=0..L,color=[red,blue],
thickness=[3,1],numpoints=1000,scaling=constrained);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Note, however, that outside of the interval </Font><Equation input-equation="[0,L]" style="2D Math">NiM3JCIiISUiTEc=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> the situation is quite different. Fourier series of </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> converges not to </Font><Equation input-equation="f(x)" style="2D Math">NiMtJSJmRzYjJSJ4Rw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> but to its </Font><Font style="_cstyle13">odd periodic extension</Font><Font style="_cstyle7">.</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">plot([f(x),FSs(f(x),x,100)],x=-3*L..3*L,color=[red,blue],
thickness=[2,1],numpoints=1000,scaling=constrained);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Looking at the </Font><Equation input-equation="t" style="2D Math">NiMlInRH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">-dynamics of the Fourier polynomial of order 15 (red below) and its different term we again see that higher harmonics (green) have amplityde decaying faster than the first harmonic (principal mode, blue): </Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">u:=(x,t)-&gt;uPs(f(x),x,t,15):
display([
  seq(
    plot([u(x,0.005*t),seq(B(f(x),x,2*r+1)*uSp(x,0.005*t,2*r+1),r=0..7)],x=0..L,
    color=[red,blue,seq(green,r=1..7)],thickness=2)        
  ,t=0..40)
],insequence=true);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="ParagraphStyle1"><Font style="_cstyle7">Another way to see it is to look at the "energies" of different mode. We define the energy of </Font><Equation input-equation="u[n](x,t)" style="2D Math">NiMtJiUidUc2IyUibkc2JCUieEclInRH</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7"> to be its </Font><Equation input-equation="L^2" style="2D Math">NiMqJCUiTEciIiM=</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">-norm, </Font><Equation input-equation="int(u[n](x, t)^2, x = (0 .. L))" style="2D Math">NiMtJSRpbnRHNiQqJC0mJSJ1RzYjJSJuRzYkJSJ4RyUidEciIiMvRi07IiIhJSJMRw==</Equation><Font bold="false" foreground="[0,0,0]" italic="false" size="12" style="_cstyle10"> </Font><Font style="_cstyle7">:</Font></Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">eMode:=(n,t)-&gt;int(uSp(x,t,n)^2,x=0..L):eMode(n,t);</Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">This is the relative decay speed of different modes:</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">display([seq(
 display([seq(disk([0.2*r,eMode(2*r+1,0.005*t)],0.02,color=red),r=0..7)])
,t=0..40)],insequence=true,scaling=constrained,view=[-0.1..1.5,0..1]);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">And this is their actual contribution to the initial profile - note that the first mode makes the "bulk" of the initial energy, and also decays the slowest!</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">display([seq(
 display([seq(disk([0.2*r,B(f(x),x,2*r+1)^2*eMode(2*r+1,0.005*t)],0.02,color=red),r=0..7)])
,t=0..40)],insequence=true,scaling=constrained,view=[-0.1..1.5,0..1]);</Font></Text-field></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_cstyle7">Clean-up:</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">L:='L': k:='k': f:='f':</Text-field></Input></Group><Text-field layout="_pstyle8" style="_pstyle8"/></Section><Text-field layout="_pstyle8" style="_pstyle8"/></Section><Section collapsed="true"><Title><Text-field layout="_pstyle7" style="_cstyle6">Newmann Boundary Conditions</Text-field></Title><Section collapsed="true"><Title><Text-field layout="_pstyle11" style="ParagraphStyle2"><Equation input-equation="f(x) = -2*sin(Pi*x/L);" style="2D Comment">NiMvLSUiZkc2IyUieEcsJComIiIjIiIiLSUkc2luRzYjKiglI1BpR0YrRidGKyUiTEchIiJGK0Yy</Equation><Font style="_cstyle2"> </Font></Text-field></Title><Group><Input><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">f:=x-&gt;-2*sin(Pi*x/L):f(x);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Fourier cosine coefficients:</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">A(f(x),x,n);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Explicitly:</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle8"><Font italic="false" size="12" underline="false">seq(A[n]=A(f(x),x,n),n=0..10);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">This is how the Fourier polynomial of order 4 looks like:</Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">FPc(f(x),x,4);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">For graphing we again take <Equation input-equation="L = 1;" style="2D Comment">NiMvJSJMRyIiIg==</Equation>, <Equation input-equation="k = 1;" style="2D Comment">NiMvJSJrRyIiIg==</Equation>.</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">L:=1: k:=1:</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">This function plots the graph of <Equation input-equation="f(x);" style="2D Comment">NiMtJSJmRzYjJSJ4Rw==</Equation> and its <Equation input-equation="k;" style="2D Comment">NiMlImtH</Equation>-th approximation on the interval <Equation input-equation="[0, L];" style="2D Comment">NiM3JCIiISUiTEc=</Equation>.</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">approxplot:=k-&gt;plot([f(x),FPc(f(x),x,k)],x=0..L,
color=[red,blue],title=sprintf("%d-th approximation",k),view=-2.3..0.3,
legend=["Initial profile",sprintf("%d-th approximation",k)],
linestyle=[SOLID,DASHDOT]):</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Here is a sequence of such approximation. Notice the convergence:</Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">display([seq(approxplot(5*i),i=0..6)],insequence=true);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Note, however, that outside of the <Equation input-equation="[0, L];" style="2D Comment">NiM3JCIiISUiTEc=</Equation> interval the function <Equation input-equation="f(x);" style="2D Comment">NiMtJSJmRzYjJSJ4Rw==</Equation> and its Fourier polynomial are quite different:</Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">plot([f(x),FPc(f(x),x,15)],x=-3*L..3*L,color=[red,blue]);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The function below sketches the initial profile and the Fourier polynomial approximation to the solution of order <Equation input-equation="k;" style="2D Comment">NiMlImtH</Equation> at time <Equation input-equation="t;" style="2D Comment">NiMlInRH</Equation>.</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">timeplot:=(t,k)-&gt;plot([f(x),uPc(f(x),x,t,k)],x=0..L,
color=[red,blue],title=sprintf("%d-th FS approximation at time t=%2.2f",k,t),view=-2.3..0.3,legend=["Initial profile",
sprintf("Profile at time t=%2.2f",t)],linestyle=[SOLID,DASHDOT]):</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">We can see that the solution converges to the average of the initial profile <Equation input-equation="f(x)" style="2D Comment">NiMtJSJmRzYjJSJ4Rw==</Equation>.</Text-field><Text-field layout="_pstyle8" prompt="&gt; " style="_cstyle12">display([timeplot(0,20),timeplot(0.01,20),timeplot(0.05,20),timeplot(1,20)],insequence=true);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="_pstyle8" style="_pstyle8"/></Input></Group><Text-field layout="_pstyle8" style="_pstyle8"/></Section><Text-field layout="_pstyle8" style="_pstyle8"/></Section><Section collapsed="true"><Title><Text-field layout="Heading 1" style="Heading 1">References</Text-field></Title><Group><Input><Text-field layout="Bullet Item" style="Bullet Item">Walter A. Strauss, Partial Differential Equations: An Introduction, Wiley, 1992</Text-field><Text-field layout="Bullet Item" style="Bullet Item">Richard Haberman, Elementary Applied Partial Differential Equations, 3rd edition, Prentice Hall</Text-field></Input></Group><Text-field layout="Normal" style="Normal"/></Section><Section collapsed="true"><Title><Text-field layout="Heading 1" style="Heading 1">Disclaimer</Text-field></Title><Text-field layout="Normal" style="Normal">"While every effort has been made to validate the solutions in this worksheet, Waterloo Maple Inc. and the contributors are not responsible for any errors contained and are not liable for any damages resulting from the use of this material." </Text-field></Section><Text-field layout="_pstyle14" style="_pstyle14"/><Text-field/></Worksheet>