Top Banner

of 64

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Math20401 - PDEsMichaelBushellmichael.bushell@student.manchester.ac.ukDecember11,2011AboutThiscourseisanintroductiontosolvingpartialdierentialequa-tions, bothbyndingexactsolutionsandbyniteapproximations.This document is a presentation of the material covered in Tony Shard-lowslecturenotesandexamples. Bewaretheremaybeerrors.1CONTENTS 2Contents1 Introduction 41.1 WhatisaPartialDierentialEquation? . . . . . . . . . . . . 41.2 ThreeClassicalPDEs. . . . . . . . . . . . . . . . . . . . . . . 51.2.1 TheWaveEquation . . . . . . . . . . . . . . . . . . . . 51.2.2 TheHeatEquation . . . . . . . . . . . . . . . . . . . . 51.2.3 TheLaplaceEquation . . . . . . . . . . . . . . . . . . 51.3 InitialandBoundaryConditions. . . . . . . . . . . . . . . . . 71.4 ClassifyingPDEs . . . . . . . . . . . . . . . . . . . . . . . . . 81.5 PrincipleofLinearSuperposition . . . . . . . . . . . . . . . . 102 Well-PosedProblems 112.1 Well-posedness . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 TheEnegeryMethod . . . . . . . . . . . . . . . . . . . . . . . 122.3 TheMaximumPrinciple . . . . . . . . . . . . . . . . . . . . . 142.3.1 Stabilitytochangesintheboundaryconditions . . . . 152.4 Ill-posedProblems . . . . . . . . . . . . . . . . . . . . . . . . 162.4.1 Thebackwardsheatequation . . . . . . . . . . . . . 162.4.2 TheLaplaceequation. . . . . . . . . . . . . . . . . . . 173 FourierSeriers 183.1 TheFourierSineSeries . . . . . . . . . . . . . . . . . . . . . . 183.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.2.1 TheFourierseriesofaconstantfunction . . . . . . . . 203.2.2 Summationof. . . . . . . . . . . . . . . . . . . . . . 214 SeparationofVariables 234.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.2 TheHeatEquation . . . . . . . . . . . . . . . . . . . . . . . . 234.2.1 Constantinitialcondition . . . . . . . . . . . . . . . . 264.2.2 Periodicboundaryconditions*. . . . . . . . . . . . . . 274.3 TheWaveEquation. . . . . . . . . . . . . . . . . . . . . . . . 314.3.1 DAlembertssolution . . . . . . . . . . . . . . . . . . 334.4 TheLaplaceEquation . . . . . . . . . . . . . . . . . . . . . . 344.5 Sturm-LiovilleTheory . . . . . . . . . . . . . . . . . . . . . . 365 TaylorsTheorem 37CONTENTS 36 FiniteDierenceMethods: CenteredApproximation 386.1 Centereddierenceapproximation. . . . . . . . . . . . . . . . 386.2 Reaction-diusionproblem. . . . . . . . . . . . . . . . . . . . 416.3 Errors,ConvergenceandConsistency . . . . . . . . . . . . . . 436.3.1 Constistencyofreaction-diusionproblem . . . . . . . 446.3.2 Relationshipoferrorsofreaction-diusionproblem . . 456.4 Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466.4.1 Stabilityandconvergenceofreaction-diusionproblem 486.5 Convection-diusionproblem . . . . . . . . . . . . . . . . . . 497 FiniteDierenceMethods: UpwindApproximation 527.1 Convection-diusionproblem(revisited) . . . . . . . . . . . . 538 FiniteDierenceMethods: EulerMethodsforODEs 558.1 TheExplicitEulermethod. . . . . . . . . . . . . . . . . . . . 558.2 TheImplicitEulermethod. . . . . . . . . . . . . . . . . . . . 588.3 Stabilityandtime-steprestriction . . . . . . . . . . . . . . . . 599 FiniteDierenceMethods: MethodofLines 619.1 TheHeatEquation . . . . . . . . . . . . . . . . . . . . . . . . 619.2 TheWaveEquation. . . . . . . . . . . . . . . . . . . . . . . . 631 INTRODUCTION 41 IntroductiontoPDEs1.1 WhatisaPartialDierentialEquation?Givenanunknownfunctionuof independentvariablesx, yaPDEisanyequationinvolvingthepartialderivativesofu:ux,2uxy,etc. . .Denition1.1.1. APDEisarelationoftheform:F(u, t, x, y, . . . , ut, ux, uy, . . . , utt, utx, uxx, . . .) = 0whereuisafunctionofindependentvariablest, x, y, . . ..Example1.1.1. Forinstance, letu(x, t)=A(x)B(t)forsomefunctionsAandB. Thenux=A

(x)B(t) , ut= A(x)B

(t)B(t)2anduxt= A

(x)B

(t)B(t)2ThereforeusatisesthePDEuxut= uuxtUsually we are givena PDEandare requiredfor ndthefunctionwhichsatisesit. Theremainderofthiscourseitaimedatlearningtechniquesfordoingjustthis.Denition 1.1.2.The orderof a PDE is the highest degree of dierentiationthatappearsintheequation.1 INTRODUCTION 51.2 ThreeClassicalPDEsThreeclassicalPDEsformthebasisofourstudy, wewillneedtorecogniseeachandunderstandtheirdierences.1.2.1 TheWaveEquationThewaveequationmodelsmotionofparticlesintimeandspace.utt= c2uxx(1)Whereurepresentsthedisplacement ofaparticlefromitsequilibriumposi-tion.1.2.2 TheHeatEquationTheheatequationmodelsthediusionofheatintimeandspace.ut= uxx(2)Whereurepresentsthetemperatureatapointinspace.1.2.3 TheLaplaceEquationTheLaplaceequationmodelssteady-stateheatdistributioninspace.uxx + uyy= 0 (3)These three equations will recur in examples following. For now lets lookatasolutiontotheLaplaceequation:Example1.2.1. ConsidertheLaplaceequation(3)(in3-dimensions):uxx + uyy + uzz= 0Weshowu = (x2+ y2+ z2)1/2isasolution.Proof. Letu = 1/rwherer = (x2+ y2+ z2)1/2,then:ux=ux=dudrrx= 1r2x(x2+ y2+ z2)1/2= xr3= xr31 INTRODUCTION 6anduxx=x(xr3)= (ddxx)r3xx(r3)= r3+ 3xr4rx= r3+ 3xr4(xr1)= r3+ 3x2r5Similary:uyy= r3+ 3y2r5uzz= r3+ 3z2r5Hence:uxx + uyy + uzz= (r3+ 3x2r5) + (r3+ 3y2r5) + (r3+ 3z2r5)= 3r3+ 3(x2+ y2+ z2)r5= 3r3+ 3r2r5= 0ThereforeuisasolutiontotheLaplaceequation.1 INTRODUCTION 71.3 InitialandBoundaryConditionsWhensearchingfor asolutiontoaPDEweoftenhaveextrainformationwhich narrows down the candidate solutions usually to a unique solution.Thesecomeintheformofinitialandboundaryconditions.Denition1.3.1. Iffunctionu(x, t)dependsontimetandspatialvariablex, an initial conditionspecies u at time t = 0 such that x : u(x, 0) = u0(x).Theinitialconditionmayalsobeplacedonderivativesofu.Denition1.3.2. Whenudependsonxinaboundedset, aboundaryconditionspeciesu(x)forx wheredenotestheboundaryof .Theseusuallycomeinoneoftwoforms:1. DirichletConditionsspecifythevalueofuontheboundary,i.e.:x : u(x, t) = g(x), t > 0This type of condition xes the solution u on the boundary for all time.2. NeumannConditionsspecifythe(outward)normal derivativeofuontheboundary,i.e.:x :un(x) = u(x) n(x) = g1(x)Thesearemorecomplicatedbutnotethatforafunctionu(x, t)of asinglespatialdimensionx,thenormalderivativeissimplyux.Supplying boundary conditions is usually necessary for a well-posed prob-lem.1 INTRODUCTION 81.4 ClassifyingPDEsInsolvingPDEs wemust understandwhenamethodis applicable. ThefollowingdenitionshelporganisethedierenttypesofPDEwhichariseinpractise.Denition1.4.1(Linear Operator).The operator L is linear, if for any twofunctionsu,vandany R,1. L(u + v) = L(u) +L(v),and2. L(u) = L(u).Denition1.4.2(PDELinearity). APDEis linear if it canbewrittenL[u] =f, whereLis alinear operator andf afunctionof theindepen-dentvariablesonly. WhenthePDEisnon-linear, forafunctionuof twoindependentvariablesxandt,wemaywritethePDEingeneralformauxx + buxt + cutt + dux + eut + fu = g (4)thenwesaythePDEisquasi-linear ifa, b, careindependentof 2ndorderderivativesofu; orsemi-linear ifa, b, c, areentirelyindependentofuanditsderivatives-otherwisewesayitsfullynon-linear.Example 1.4.1.We classify the following PDEs according to linearity rstconsiderwhetherthePDEislinear,ifnotthenwhatdegreeofnon-linearityisit?ut(x2u)uxx= x tissemi-linear,u2utt12u2x + (uux)x= ueuisquasi-linear,utuxx= u3issemi-linear,(uxy)2uxx + ut= 0isfullynon-linear,ut + uxuy= 10islinear.RearrangethePDEsintothegeneralform(4)andcomparecoecientsa,b,cwiththerelevantdenitions.Denition1.4.3. TherearethreegenerictypesofPDEdeterminedbythecoecientsofequation(4),theseare:hyperbolic b24ac > 0parabolic b24ac = 01 INTRODUCTION 9elliptic b24ac < 0Ifa,b,orcarenotconstantthentypeofthePDEmaychange.Example1.4.2. Thewaveequation(1)ishyperbolic,writing:uttc2uxx= 0Wehaveconstantcoecientsa = c2,b = 0,andc = 1sob24ac = 0 4(c2)(1) = 4c2> 0.Similiarly,itiseasilyshownthattheheatequation(2)isparabolic,andtheLaplaceequation(3)iselliptic.1 INTRODUCTION 101.5 PrincipleofLinearSuperpositionWewillrequirethefollowinginourquestforPDEsolutions:Denition1.5.1. IfaPDEandassociatedboundaryconditionsareoftheformL(u)=0foralinearoperatorL, theboundaryvalueproblemissaidtobehomogenous.Theorem1.5.1(PrincipleofLinearSuperposition). Ifu1,u2aresolutionsof a homogenous linear boundary value problem,then any linear combinationv= u1 + u2with, Risalsoasolution.Proof.L(u1 + u2) = L(u1) + L(u2)= 0 + 0= 0For non-homogeneous equations L(u) = fwith particular solution up(i.e.:afunctionupthatsatisesL(up) = f)wehave:Theorem1.5.2. If upisaparticularsolutionof thelinearboundaryvalueproblemL(u) = fandvisasolutiontothehomogenousproblemL(v) = 0,thenw = up+ visasolutionofL(u) = f.Proof.L(w) = L(up+ v) = L(up) +L(v) = f+ 0 = fInparticular, theprincipleof linearsuperpositionwill becrucial intheuseofFourierseriesassolutionstoPDEs.2 WELL-POSEDPROBLEMS 112 Well-PosedProblems2.1 Well-posednessWhen we are given a PDE to solve we must consider whether the problem iswell-posed. Thekeypropertiestothesolutionofawell-posedproblemare:Existenceisessential,whenthestudyofaphysicalprocessleadstoamodelintheformofapartialdierentialequationwithinitialandboundaryconditions,theabsenceofasolutionwouldpointtoincorrectmodelassumptions.Uniqueness isdesired,asmostphysicalprocesseshaveauniqueandwell-denedbehaviourwhichshouldbereectedinourmodel.Stabilityisoftenvital,wemeasurephysicalquantitiestouseasparametersinourmodelandwecannotdosowithabsoluteprecision. Wewouldlikesmallerrorsinourmeasurestoresultincorrespondinglysmallchangestotheoutcome.Example2.1.1. ConsideragainthePDEinexample(1.1.1)uxut= uuxxWeshowedthatu(x, t) =A(x)B(t)isasolution,ifwesupplytheinitialconditionu(0, x) = u0(x)dowehaveawell-posedproblem?u(x, t) =A(x)B(t)=u0(x) = u(x, 0) =A(x)B(0)HenceA(x) = u0(x)B(0). Thisisundeterminedsotheproblemisill-posed,even thoughwe just needa single value B(0) to completely determine A,wewouldstillhaveanon-uniquesolutionasBcanvary.Inwhatfollowswederivemethodsforprovingexistenceanduniqueness,andwedeviseconditionsunderwhichstabilityisassured.2 WELL-POSEDPROBLEMS 122.2 TheEnegeryMethodTheenergymethodderivesfromconsideringthephysicalinterpretationofaPDEmodel. Inthefollowingexamplewedeneaquantityreferredtoastheenergy1andshowthatitcannotincreasewithtime. Fromthiswecanprovethatasolutionisunique.Example2.2.1. Thereisauniquesolutiontotheheatequationut= uxx(2)subjecttoboundaryconditionsux(0, t) = ux(1, t) = 0andinitialconditionu(x, 0) = u0(x)forx (0, 1).Proof. LetE(t) =_10u(x, t)2dx,thenE

(t) =ddt_10u2dx=_10tu2dx=_202uut dx= 2_20uuxx dx (by(2))= 2__uux_x=1x=0_10u2x dx_= 2___[u(1, t) ux(1, t). .=0u(0, t) ux(0, t). .=0] _10u2x dx___HenceE

(t) = 2_10u2x dx 0, t 0Therefore,Eisanon-increasingfunctionandsoE(t) E(0), t 0.Now,forcontradictionsupposeu,varetwosolutions. Denew = u v,thenaswehaveahomogeneouslinearboundaryvalueproblemweknowthatwisalsoasolutionwithsameboundaryconditions(butzeroinitialcondition).1For dierent PDEs this energy may have a dierent expression, see questions sheetsformoreexamplesusuallytheformoftheenergyisgivenifitdierssucientlyfromtheabove.2 WELL-POSEDPROBLEMS 13Fromabove0 _10w(x, t)2dx _10w(x, 0)2dx = 0Sincew(x, 0) = u(x, 0) v(x, 0) = u0(x) u0(x) = 0,wemustconcludethatw(x, t) = 0,i.e.: u(x, t) v(x, t) = 0asrequired.Thereforeu = vandwehaveauniquesolution.ExactlywhattheenergymeasuresdiersfromPDEandisbeyondthescope of this course. For the heat equation (2) it is proportional to the totalheatenergyinthesystem. Inthewaveequation(1)itisthesumofkineticandpotentialenergy(inforexample,avibratingstring).2 WELL-POSEDPROBLEMS 142.3 TheMaximumPrincipleWeintroduceatechniqueknownasthemaximumprincipletoprovestabilityanduniqueness.Undercertainconditionswecanshowthatthemaximumvalueofthesolutioncanonlyoccuralongitsboundary.Lemma2.3.1. Supposethatf(x) < 0forall x (0, 1). If u

= f,thenu(x) max{u(0), u(1)},i.e.: themaximumforuoccursonitsboundary.Proof. Supposeuhasalocalmaximumat (0, 1). Itisaresultfromcalculusthatu

() 0,i.e. u()

0but u

() = f() < 0,acontradictionsothereisnomaximumfor (0, 1). Therefore,themaximumvaluemustbeat= 0,or= 1asclaimed.Weextendtothecasewheref(x) = 0also.Lemma2.3.2. Suppose u

(x) = 0forall x (0, 1),thenu(x) max{u(0), u(1)}.Proof. For > 0,letv

(x) = u(x) + x2. Then v

= u

2 < 2forx (0, 1). Bythepreviouslemma,v

(x) max{v

(0), v

(1)},henceu(x) v

(x) max{v

(0), v

(1)} max{u(0), u(1) + }Asthisholdsforany > 0nomatterhowsmall,theresultholds.Lemma2.3.3. Suppose u

(x) 0forall x (0, 1),thenu(x) min{u(0), u(1)}.Proof. Simplyletw = u,thenbythetwopreviouslemmau = w max{w(0), w(1)} = min{u(0), u(1)}Assotheresultfollows.WesummarizetheseresultsinthefollowingtheoremTheorem2.3.1. Letubeasolutionof u

= 0for0 < x < 1withu(0) = andu(1) = ,thenforall x (0, 1)wehavemin{, } u(x) max{, }Proof. Thisisanimmediateconsequenceoftheprevioustwolemmas.Wenowusethisresulttoprovethestabilityofasolution.2 WELL-POSEDPROBLEMS 152.3.1 StabilitytochangesintheboundaryconditionsExample2.3.1. Supposethatu

= ffor0 < x < 1andu(0) = ,u(1) = Wewouldliketoshowthisproblemiswell-posedandonecriterionforawell-posedproblemisthestabilityofthesolutiontochangesintheboundaryconditions.Solet1, 2> 0,weintroducesmallchangestotheboundaryconditionstogiveanotherproblemv

= ffor0 < x < 1andv(0) = + 1,v(1) = + 2Giventhat1, 2areassmallaswelike,wewouldexpectthatthetwosolutionsuandvwouldnotvarymuchwhentheproblemiswell-posed.Lete = u vbethe dierence inthetwosolutions,thensubstracting thetwoequationsshowsesatisese

= 0for0 < x < 1ande(0) = 1,e(1) = 2Bytheprevioustheoremwecanconcludethatmin{1, 2} e(x) max{1, 2}i.e.:|u(x) v(x)| = |e(x)| max{|1|, |2|}Hence,smallchangestotheboundaryconditions(1and2)causeonlyasmallchangeinthesolutiontotheproblem. Inthissense,thesolutionisstableandtheproblemiswell-posed.2 WELL-POSEDPROBLEMS 162.4 Ill-posedProblems2.4.1 ThebackwardsheatequationExample2.4.1. Toillustrateanill-posedproblemconsiderthefollowingPDE,thebackwardsheatequationobtainedbysettingconstant = 1intheheatequation(2).ut + uxx= 0 (5)Wehavealreadyshownthatwhensubjecttotheinitialconditionu(x, 0) = 0wehavetheuniquesolutionu(x, t) = 0.Recall,awell-posedproblemmustbestabletosmallchanges. Wewillshowthatthefollowingsolutionsatisestheequationwithonlyasmallchangetotheinitialconditionbutexhibitsbehaviourfarfromthezerosolution.ForconstantsA, T Rwehaveasolutionu(x, t) =AT1/2(T t)1/2ex24(Tt)providedt < T.GivenTand > 0weseeinitially(att = 0)|u(x, 0)| = |Aex24T| |A| < A (, )Thuswecanchooseasolutionsuchthatitisinitiallyboundedtoassmallan as we like thus ascloseto zero as we want. So the solutionis initiallywell-behavedinthissense.Recallwehavespeciedt < TsowhataboutastincreasesandapproachesTfromtheleft?Consideringjustthepointx = 0limtTu(0, t) =limtTAT1/2(T t)1/2=limtTA(1 t/T)1/2=limh0+Ah1/2= DependingonthesignofA,eitherwayweseeherethatthesolutionapproaches ast T. Thisdivergesfarfromthebehaviourofthezerosolution.Asmallchangetotheinitialconditionresultsinalargechangetothesolution,thereforewecannotsaytheproblemiswell-posedrather,itisill-posed.2 WELL-POSEDPROBLEMS 172.4.2 TheLaplaceequationExample2.4.2. ConsidertheLaplaceequation(3)in2spatialdimensionsuxx + uyy= 0Weseethatasolutionisgivenbyu(x, y) = cosh(y/) cos(x/)asux= cosh(y/) sin(x/)uxx= (1/) cosh(y/) cos(x/) = u/2anduy= sinh(y/) cos(x/)uyy= (1/) cosh(y/) cos(x/) = u/2Wealsohavethefollowingboundaryconditionssatisedu(x, 0) = cos(x/), uy(x, 0) = 0Let > 0begiven,then|u(x, 0)| = | cos(x/)| || < (, )Therefore,wecanchoosetomakeuassmallaswelikeontheboundaryy= 0.Butforgivenx, ylim0u(x, y) =lim0 cosh(y/) cos(x/)Now,cos(x/)oscillatesbetween 1and1as 0andcosh(y/) as 0. Sou(x, y)oscillatesbetween and ,i.e. uoscillatesunboundedas 0.Clearly,thisPDEproblemisill-posed. Asmallchangeintheboundaryconditions(i.e.: asmallchangein)resultsinlargechangesinthesolution2.2In general, the Laplace equation is ill-posed if it is subjected to conditions on a bound-arythatdoesnotentirelysurroundthedomaininwhichtheequationistobesatised3 FOURIERSERIERS 183 FourierSeriersBeforesolvingPDEsweneedbeabletowritefunctionsasFourierseries.3.1 TheFourierSineSeriesIsisaremarkablefactandmanyfunctionscanbewrittenasinnitesumsofsinefunctions.Theorem3.1.1. Letu0(x)besuchthatu0(x)andu

0(x)arepiecewisecontinuouson[0, l],thenwemaywrite:u0(x) =

n=1an sin(nxl), (6)forsomecoecientsan.InmanyinstancesitisusefultousethepropertyoforthogonalfunctionstodeterminetheFouriercoecientsofafunction:Denition3.1.1(Orthogonality). Wesaytwofunctions, : [0, l] Rareorthogonal i_l0(x)(x) dx = 0.Theorem3.1.2. Thefunctionssin(mx/l)andsin(nx/l)areorthogonal(ifn = m,l > 0)Proof. Usingthetrigonometricidentities:cos( + ) = cos() cos() sin() sin()cos( ) = cos() cos() + sin() sin()Bysubtracting,wend:cos( ) cos( + ) = 2 sin() sin()Itfollowsthatinthecasen = m:_l0sin(nxl) sin(mxl) dx =12_l0{cos[(n m)x/l] cos[(n + m)x/l]} dx=12_l sin[(n m)x/l](n m)l sin[(n + m)x/l](n + m)_l0= 0Sincesin k= 0, k Z. Sobydenitionsin(nx)andsin(mx)areorthogonal.3 FOURIERSERIERS 19WecannowdeterminethecoecientsinaFourierseries:Theorem3.1.3(FourierCoecients). Atall pointsxofcontinuity,thecoecientsanoftheFourierseries(6)aregivenbyan=2l_l0u0(x) sin(nxl) dxProof. MultiplyingtheFourierseriesequation(6)bysin(mxl)onbothsides,weobtainu0(x) sin(mxl) = sin(mxl)

n=1an sin(nxl)=

n=1an sin(mxl) sin(nxl)Thusintegratingover[0, l]andusingtheorthogonalitytheorem(3.1.2)_l0u0(x) sin_mxl_dx =_l0

n=1an sin_mxl_sin_nxl_dx=

n=1an_l0sin_mxl_sin_nxl_dx= am_l0sin2_mxl_dx= am_l012[1 cos_2mxl_] dx= am12_x l2m sin_2mxl__x=lx=0= anl2Rearranginggivestheresult.3 FOURIERSERIERS 203.2 Examples3.2.1 TheFourierseriesofaconstantfunctionExample3.2.1. Considertheconstantfunctionu0(x) = c forsome c RBythetheorem(3.1.1)wemaywriteu0intheformu0(x) =

n=1an sin(nxl)TheFouriercoecientsare(bytheorem(3.1.3))an=2l_l0u0(x) sin(nxl) dx=2l_l0c sin(nxl) dx=2cl_ln cos(nxl)_x=lx=0=2cn[cos(n) + 1]=2c_1 (1)nn_ThisexamplewillcomeinusefulwhenwehavePDEswithconstantinitialconditions.3 FOURIERSERIERS 213.2.2 SummationofExample3.2.2.=

n=042n + 1(1)nProof. ConsidertheFouriersineseriesx =

n=1an sin(nx), x [0, ] (7)Recallthatsin(nx)andsin(mx)areorthogonal(theorem(3.1.2))forn = m,butwhenn = mwehave_0sin(nx) sin(mx) dx =12_0{cos[(n m)x] cos[(n + m)x]} dx=12_0[cos(0) cos(2nx)] dx=12_x sin(2nx)2n_0=2Nowbymultiplyingourfourierseriesequation(7)bysin(mx)onbothsides,weobtain:x sin(mx) = sin(mx)

n=1an sin nx=

n=1an sin(mx) sin(nx)Thusintegratingover[0, ]:_0x sin(mx) dx =_0

n=1an sin(mx) sin(nx) dx=

n=1an_0sin(mx) sin(nx) dx= an23 FOURIERSERIERS 22Sinceallbutthen = mtermarezero. Henceforn 1:an=2_0x sin(mx) dx=2{_xcos(nx)n_0_0cos(nx)ndx}=2{(1)n+1n+_sin(nx)n2_0. .=0}=2(1)n+1nSubstitutinganbackintothefourierseriesequation(6),gives:x =

n=12(1)n+1nsin(nx)Nowletx = /2,anditfollowsthat:2=

n=12(1)n+1nsin(n/2)=

n=12(1)2n2n 1(1)n+1=

n=02(1)n2n + 1Andhence,multiplyingthroughby2givestheresult:=

n=042n + 1(1)n4 SEPARATIONOFVARIABLES 234 SeparationofVariables4.1 IntroductionTheseparationofvariablesisageneralmethodofsolvinglinearpartialdierentialequations. WeintroducethemethodbyexampleandapplyittoeachofthethreeclassicalPDEs.4.2 TheHeatEquationExample4.2.1. Considertheheatequationutuxx= 0Withhomogeneousboundaryconditionsu(0, t) = u(l, t) = 0, x (0, l),t > 0Writingthesolutionintheformu(x, t) = X(x)T(t)Wearemakingtheassumptionsuchasolutionexistsandisnon-zerothisiswherethenameseparationofvariablesisderived. Dierentiatingut= X(x) ddtT(t) = X(x)T

(t)andsimiliaryuxx=_d2dx2X(x)_T(t) = X

(x)T(t)SubstitutingtheseresultsintothePDEandrearranginggivesX

X=_1_ T

T= (constant)Weknowisconstantduetothefactthattheleft-handsidedependsonlyonxwhereastheright-handsidedependsonlyont.Theboundaryconditionstellus0 = u(0, x) = X(0)T(t) X(0) = 00 = u(l, x) = X(0)T(t) X(l) = 0AssumingT(t) = 0(whichweare,sincewedontwantthetrivialsolutionu(x, t) = 0).4 SEPARATIONOFVARIABLES 24WehavethereforearrivedataneigenvalueproblemforXX

X= 0, X(0) = X(l) = 0WhereisaneigenvalueandX(x)theassociatedeigenfunction. Wesolvebyconsideringthreecasesfor1. If = 0,thenX

= 0soX= ax + bforsomeconstantsa, b R.X(0) = 0givesb = 0.X(l) = 0givesal = 0,hencea = 0.Hence = 0correspondstoX(x) = 0,whichwedontwantso = 0isnotaneigenvalue.2. If = 2for> 0,thenX

2X= 0,soX(x) = a cosh(x) + b sinh(x)forsomeconstantsa, b R.X(0) = 0givesa = 0.X(l) = 0givesb sinh(l) = 0,but> 0andl > 0sosinh(l) = 0,thusb = 0.Andagainwehavenoeigenvaluesfor > 0.3. If = 2for> 0,thenX

+ 2X= 0,soX(x) = a cos(x) + b sin(x)forsomeconstantsa, b R.X(0) = 0givesa = 0.X(l) = 0givesb sin(l) = 0,hencesin(l) = 0toavoidthezerosolution. Thus,l = nforanyn N. Sinceweonlywantlinearlyindependenteigenfunctionswecanchoosebarbitrarily,soletb = 1.Thereforewehaveeigenvaluesolutionsn= (nl)2, Xn(x) = sin(nxl), forn = 1, 2, . . .WethenhaveequationforT(t)givenbyT

n= nTnwhichhasgeneralsolutionTn(t) = ent= e(nl)2t4 SEPARATIONOFVARIABLES 25Wehavefoundthefollowingsolutionsoftheheatequationun(x, t) = Xn(x)Tn(t) = e(nl)2tsin(nxl), forn = 1, 2, . . .Astheheatequationislinearandhomogeneouswemayusetheprincipleoflinearsuperpositionandwritethegeneralsolutionu(x, t) =

n=1ane(nl)2tsin(nxl)forcoecientsan.4 SEPARATIONOFVARIABLES 264.2.1 ConstantinitialconditionExample4.2.2. Consideragaintheheatequation(2)withhomogeneousboundaryconditionsut= uxx= 0, u(0, t) = u(l, t) = 0, fort > 0Withconstantinitialconditionu(x, 0) = u0(x) = 1, for0 < x < lWehaveseeninexample(4.2.1)thesolutionmaybewrittenu(x, t) =

n=1ane(nl)2tsin(nxl)Lettingt = 0wehaveu0(x) = u(x, 0) =

n=1an sin(nxl)Recall,fromexample(3.2.1)(withc = 1)thisgivescoecientsan=2_1 (1)nn_Thus,wehavethesolutionu(x, t) =2

n=11 (1)nne(nl)2tsin(nxl)4 SEPARATIONOFVARIABLES 274.2.2 Periodicboundaryconditions*Example4.2.3. ConsiderthePDEut= uxxforx [0, 2]withperiodicboundaryconditionsu(0, t) = u(2, t), ux(0, t) = ux(2, t).andinitialconditionu(x, 0) = u0(x)Thisistheheatequation(2)withconstant = 1.Guessingthatthereisanon-zerosolutionoftheformu(x, t) = X(x)T(t)(thisisthemainideaofthismethod)wehaveut= X(x)T

(t)anduxx= X

(x)T(t)SubstitutingtheseintothePDEandwecanconclude:X

X=T

T= whereisaconstant,duetothefactthattheleft-handsidedependsonlyonxwhereastheright-handsidedependsonlyont.Theboundaryconditionsgiveu(0, t) = X(0)T(t) = u(2, t) = X(2)T(t)Therefore,assumingT(t) = 0(otherwiseu(x,t)=X(x)T(t)=0,resultinginthetrivialsolution)weconcludeX(0) = X(2)SimilarconsiderationoftheotherboundaryconditiongivesX

(0) = X

(2)4 SEPARATIONOFVARIABLES 28WethereforehavetheeigenvalueproblemX

= XwithX(0) = X(2), X

(0) = X

(2)Thiscanbesolvedbyconsideringthreecases:1. If = 0thenX

= 0soX= ax + b,consideringtherstboundaryconditionX(0) = X(2) 0a + b = 2a + b a = 0andconsideringthesecondboundaryconditionX

(0) = X

(2) a = a 0 = 0givesnothingnew. Soa = 0andbisarbitarygivingX(x) = b. ButwearesolvingforXasaneigenfunctionsoanyconstantmultiplesofasolutionareconsideredthesame,sowecantakeb = 1givingsolutionX(x) = 1.ThecorrespondingT(t)isgivenbyT

T= 0,here = 0soT= 1istheeigenfunctionsolution. Therefore,u(x,t)=X(x)T(t)=1.2. If = 2(> 0)thenX

2X= 0thisisanODEwithsolutionX(x) = a cosh(x) + b sinh(x),againbyconsideringtheboundaryconditionsX(0) = X(2) a cosh(0) + b sinh(0) = a cosh(2) + b sinh(2)a = a cosh(2) + b sinh(2)andX

(0) = X

(2) a sinh(0) + b cosh(0) = a sinh(2) + b cosh(2)b = a sinh(2) + bcosh(2)Toseethatthisgivesnosolutions,wehavesimultaneousequations_0 = a[cosh(2) 1] + b sinh(2)0 = a sinh(2) + b[cosh(2) 1]Whichcanwewritteninmatrixform_cosh(2) 1 sinh(2)sinh(2) cosh(2) 1_. .M_ab_ =_00_4 SEPARATIONOFVARIABLES 29Tohaveanon-zerosolution(again,toavoidthetrivialsolution)thematrixMmusthaveazerodeterminant(fromlinearalgebra),butdet(M) = [cosh(2) 1]2sinh(2)2= cosh(2)22 cosh(2) + 1 sinh(2)2= [cosh(2)2sinh(2)2] 2 cosh(2) + 1= 1 2 cosh(2) + 1= 2[1 cosh(2)]< 0, as> 0.Therefore,therecanbenoeigenvalue = 2.3. If = 2(> 0)thenX

+ 2X= 0thisisanODEwithsolutionX(x) = a cos(x) + b sin(x),againbyconsideringtheboundaryconditionsX(0) = X(2) a cos(0) + b sin(0) = a cos(2) + b sin(2)a = a cos(2) + b sin(2)andX

(0) = X

(2) a sin(0) + b cos(0) = a sin(2) + b cos(2)b = a sin(2) + b cos(2)Givinganotherlinearsystem_0 = a[cos(2) 1] + b sin(2)0 = a sin(2) + b[cos(2) 1]Whichcanwewritteninmatrixform_cos(2) 1 sin(2)sin(2) cos(2) 1_. .M_ab_ =_00_Wehavedeterminantdet(M) = [cos(2) 1]2+ [sin(2)]2= cos(2)22 cos(2) + 1 + sin(2)= [cos(2)2+ sin(2)] + 1 2 cos(2)= 1 + 1 2 cos(2)= 2(1 cos(2))4 SEPARATIONOFVARIABLES 30Andbysimilarconsiderationthismustbezero2(1 cos(2)) = 0 cos(2) = 1So2= 2nforn Z,andwehavesolutionX(x) = a cos(nx) + b sin(nx)Thusforeigenvaluen= n2wehavetwolinearlyindependenteigenfunctionscos(nx)andsin(nx).NowT

+ n2T= 0whichhassolutionT(t) = en2t.Wecompleteoursolutionbyusingtheprincipleoflinearsuperpositionu(x, t) = a0..case=0+

n=1[an cos(nx) + bn sin(nx)]en2t. .case=2SinceourPDEislinearandhomogeneous.Wecandeterminethevaluesofconstantcoecientsai, bibyconsideringtheinitialconditions. Supposeu(x, t)satisesu(x, 0) = u0(x) forx (0, 2)Wehaveu0(x) = u(x, 0) = a0+

n=1[an cos(nx)+bn sin(nx)] =

n=0[an cos(nx)+bn sin(nx)]Itiseasytoshow,basedontheFouriercoecienttheorem(3.1.3)andorthogonalitytheorem(3.1.2),thatbm=1_20u0 sin(mx) dxAndinmuchthesamewayam=1_20u0 cos(mx) dxWevethereforedeterminedthecoecientsandwehaveanexactsolutiontothePDE.4 SEPARATIONOFVARIABLES 314.3 TheWaveEquationExample4.3.1. Considerthehomogeneouswaveequation(1)uttuxx= 0, fort > 0,x (0, l)Withhomogeneousboundaryconditionsu(0, t) = u(l, t) = 0, t > 0Andinitialconditionsu(x, 0) = u0(x), ut(x, 0) = u1(x), forx (0, l)Forgivenfunctionsu0(x)andu1(x)3.Substituteu(x, t) = X(x)T(t)intothePDEtoobtainT

(t)T(t)=X

(x)X(x)= (constant)Theboundaryconditionsu(0, t) = u(l, t) = 0implythatX(0) = X(l) = 0AssumingT(t) = 0(whichavoidsgivingonlythetrivialu(x, t) = 0solution).Thus,wehaveaneigenvalueproblemforX(x),i.e.:X

= X, X(0) = X(l) = 0Thesolution,sameasintheheatequationexample(4.2.1)),isn= nl2, Xn= sin(nxl), n = 1, 2, . . .WehavecorrespondingsolutionsforTngivenbyTn(t) = an cos(ntl) + bn sin(ntl), n = 1, 2, . . .Forsomeconstantsan, bn.3We require two initial conditions for a well-posed problem since the PDE is 2ndorder.4 SEPARATIONOFVARIABLES 32Andso,bytheprincipleoflinearsuperpositionwehavegeneralsolutionu(x, t) =

n=1_an cos(ntl) + bn sin(ntl)_sin(nxl)Todeterminethecoecientsan, bn,lett = 0sothatu0(x) = u(x, 0) =

n=1an sin(nxl)Then,usingorthoganalityofsinefunctionsan=2l_l0u0(x) sin(nxl) dxNow,dierentiatingthesolutiontermbytermgivesut(x, t) =

n=1_nanlsin(ntl) +nbnlcos(ntl)_sin(nxl)Again,lettingt = 0andapplyingtheotherinitialconditionu1(x) = ut(x, 0) =

n=1_nbnl_sin(nxl)Thus,usingtheorthogonalityprinciplesoncemorebn=2n_l0u1(x) sin(nxl) dxThecoecientsan, bndeterminedbytheinitialconditions.4 SEPARATIONOFVARIABLES 334.3.1 DAlembertssolutionExample4.3.2. Supposetheinitialconditionsareu(x, 0) = u0(x), ut(x, 0) = u1(x) = 0Thenbn= 0andu(x, t) =

n=1an cos(ntl) sin(nxl)Fromtheidentitycos() sin() =12[sin( ) + sin( + )]Wecanseethatu(x, t) =12

n=1an sin(n(x t)l) +12

n=1an sin(n(x + t)l)Observethesolutionisthesumofrightandlefttravellingwaves.4 SEPARATIONOFVARIABLES 344.4 TheLaplaceEquationExample4.4.1. ConsidertheLaplaceequationuxx + uyy= 0overthesquaredomain(x, y) (0, 1) (0, 1) = . Withboundaryconditionsu(x) = g(x), x wheredenotestheboundaryofthesquaredomain. Wespecifytheboundaryconditions_u(0, y) = u(1, y) = u(x, 0) = 0u(x, 1) = 1Thusthisproblemhasthreehomogeneousboundaryconditionsandoneinhomogeneousboundarycondition.Substitutingu(x, y) = X(x)Y (y)intothePDEgivesY

Y=X

X= (constant)Withboundaryconditionsu(0, y) = u(1, y) = 0weseethatX(0) = X(1) = 0givingeigenvalueproblemX

X= 0, X(0) = X(1) = 0Thesolutionwehavealreadyseenisn= (n)2, Xn(x) = sin(nx), n = 1, 2, . . .ThecorrespondingODEforYisY

+ Y= 0havingsolutionYn(y) = an sinh(ny) + bn cosh(ny), n = 1, 2, . . .forsomeconstantsan, bn.4 SEPARATIONOFVARIABLES 35Theconditionu(x, 0) = X(x)Y (0) = 0givesY (0) = 0andhencebn= 0,thusYn(Y ) = an sinh(ny)Bylinearsuperposition,wehavesolutionu(x, y) =

n=1an sinh(ny) sin(nx)Todetermineanweconsidertheremainingboundaryconditionu(x, 1) = 1.Thusu(x, 1) =

n=1an sinh(n) sin(nx) = 1Multiplyingbysin(mx)andintegratingfrom0to1givesam sinh(m)12=_10sin(mx) dxHenceam=2sinh(m)_10sin(mx) dx =4(1 (1)m)m sinh(m)Completingoursolution.4 SEPARATIONOFVARIABLES 364.5 Sturm-LiovilleTheory5 TAYLORSTHEOREM 375 TaylorsTheoremToprovethattheapproximationsinthefollowingsectionsbecomebetterasn (nbeingthenumberofpointsestimated)werequirethefollowingtheorem:Theorem5.0.1(TaylorsTheorem). Assuminguisasmoothfunction(ie:all itsderivativesexistofanyorder),thenforsome (x, x + h)wehave:u(x+h) = u(x) +hu

(x) +h22!u

(x) + +hn1(n 1)!u(n1)(x) +hnn!u(n)() (8)(note: thisisTaylorstheoremwithLagrangesformoftheerrorfromRealAnalysisMT20101).6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION386 FiniteDierenceMethods: CenteredApproximation6.1 CentereddierenceapproximationWhenanexactsolutioncantbefounditisoftenusefultoapproximatethesolutionnumericallyatanitenumberofpoints.Denition6.1.1(UniformGrid). Auniformgridon[0, 1]isdenedbythepointsxj= jh,forj= 0, 1, . . . , nwhereh = 1/n. Wesayhisthegridspacing.Awell-posedPDEforafunctionucanbeusedtondapproximationsforu(xj). To begin with we need to approximate the derivatives of the functionu:Denition6.1.2(CenteredDierence).u(x) = u(x + h/2) u(x h/2)thecentereddierenceofuatx.Denition6.1.3(2ndCenteredDierence).2u(x) = (u(x))= u(x + h/2) u(x h/2)= [u(x + h) u(x)] [u(x) u(x h)]= u(x + h) 2u(x) + u(x h)thisisthe2ndcentereddierenceofuatx.Forpointsxjonourgrid,wecannowusetheapproximation:u

(xj) 2u(xj)h2=u(xj + h) 2u(xj) + u(xjh)h2(9)butfortherstderivativewecannotuseu

(xj) u(xj)h=u(xj + h/2) u(xjh/2)hsince this requires values ofu atxj +h/2 andxjh/2 whichare not pointsonourgrid. Werequire:6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION39Denition6.1.4(AveragedCentredDierence).u(x) = u(x + h/2) + u(x h/2)= [u(x + h) u(x)] + [u(x) u(x h)= u(x + h) u(x h)Givingtheapproximationforpointsxjonourgrid:u

(xj) u(xj)2h=u(xj + h) u(xjh)2h(10)Wewouldliketobeabletoshowtheseapproximationsarevalidandmeasuretheirerror. Thefollowinglemmasgivetheorderoftheerrorintroducedwhenmakingtheseestimates.Lemma6.1.1. Theerrorinu

(x)givenby1stcentereddierenceapproximationis O(h2).Proof. ByTaylorstheorem(5.0.1)u(x + h) = u(x) + hu

(x) +h22!u

(x) + +hn1(n 1)!u(n1)(x) +O(hn)u(x h) = u(x) hu

(x) +h22!u

(x) +hn1(n 1)!u(n1)(x) +O(hn)Thusu(x)h=hu

(x) +O(h3)h+O(h2) = u

(x) +O(h2)asclaimed.Lemma6.1.2. Theerrorinu

(x)givenby2ndcentereddierenceapproximationis O(h2).Proof. ByTaylorstheorem:u(x + h) = u(x) + hu

(x) +h22u

(x) +h36u

(x) +O(h4)u(x h) = u(x) hu

(x) +h22u

(x) h36u

(x) +O(h4)Addingtheexpressionsforu(x + h)andu(x h)givesu(x h) + u(x + h) = 2u(x) + h2u

(x) +O(h4)6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION40Hence,2u(x)h2= 2u(x) + u(x + h) + u(x h)h2= 2u(x) + [2u(x) + h2u

(x) +O(h4)]h2=h2u

(x) +O(h4)h2= u

(x) +O(h2)asclaimed.Lemma6.1.3. Theerrorinu

(x)givenbyaveragedcentereddierenceapproximationis O(h)Proof. WesimplyapplyTaylorstheorm(5.0.1)u(x)2h=u(x + h) u(x h)2h= {[u(x) + hu

(x) + h2u

(x) +O(h3)][u(x) hu

(x) + h2u

(x) +O(h3)]}/(2h)= u

(x) +O(h2)asclaimed.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION416.2 Reaction-diusionproblemSonowwecanapproximateafunctionandits1stand2ndderivativesonasetofgridpoints. ButhowdoesthishelpapproximatethesolutiontoagivenPDEproblem?Thefollowingexampleillustratesthemethodofnitedierences.Example6.2.1. Considertheboundaryvalueproblem:_u

+ ru = f,for0 < x < 1withu(0) = ,andu(1) = Wherer 0and, Raregivenconstants. OngridpointsxjthePDEtellsus:u

(xj) + ru(xj) = f(xj), j= 1, . . . , n 1Weknowthatu(x0) = u(0) = andu(xn) = u(1) = .Writingf(xj) = fjandusingapproximationsu(xj) uj, u

(xj) 2ujh2wehave(forj= 1, . . . , n 1)thefollowingequations:2ujh2+ ruj= fjNowbysubstutingequation(9)intothisweget:uj+12uj + uj1h2+ ruj= fjRearrangingwehave:1h2uj1 + (2h2+ r)uj1h2uj+1= fjRecallingu0= andun= ,wehaveasystemoflinearequationswhichcanwewritteninmatrixform. Wecanusemethodsfromlinearalgebratosolveforuj,thefollowingexampledoesthis.Example6.2.2. Considertheboundaryvalueproblem:_u

= 1,for0 < x < 1whereu(0) = u(1) = 0Thisisthereaction-diusionproblemfromexample(6.2.1)withr = 0, f(x) = 1,and = = 0.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION42Solvingthisgivesexactsolutionu(x) =12(x x2),butletsusethemethodofnitedierencestoapproximate.Usingn = 6sothath = 1/6isthegridspacing,wehavegridpointsx1, x2, . . . , x6. Wegetsystemoflinearequations:1h2uj1 +2h2uj1h2uj+1= 1forj= 2, . . . , 5,andu0= u6= 0. Puttingtheseintomatrixformwehavethelinearsystem:__72 36 0 0 036 72 36 0 00 36 72 36 00 0 36 72 360 0 0 36 72____u1u2u3u4u5__=__11111__Givingapproximatesolutions: u1= u5= 5/72, u2= u4= 1/9, u3= 1/8.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION436.3 Errors,ConvergenceandConsistencyWehavederivedamethodforapproximatingnumericalsolutionstoPDEs.Wenowwishtoensurethattheerrorsintroducedaresmall. Wemakethefollowingdenitionsandthengiveexamplesoftheiruse.Denition6.3.1(GlobalError). Theglobal errorisdenedbyej= u(xj) uj, j= 0, 1, . . . , nThismeasureshowclosetheapproximatedsolutionujistothetruesolutionu(xj).Denition6.3.2(LocalError). Thelocal (truncation)errorTjatagridpointxjistheremainderwhenu(xj)(theexactvalue)issubstitutedforuj(theestimate)inthenitedierenceequation(i.e.: theequationthattheapproximatedvalueujsatises). Examplebelow.Denition6.3.3(Convergence). Anitedierencemethodissaidtobeconvergent ifandonlyifmax0jn|ej| 0asn Wewishtheseerrorstobeassmallaspossibleandapproachzeroasweestimatewithincreasinglysmallergridspacing.Denition6.3.4(Kthorderconsistent). AnitedierencemethodissaidtobeKthorderconsistent fork > 0ifthelocaltruncationerrorsatisesTj= O(hk), j= 1, 2, . . . , n 1Wewillshowtherelationshipbetweenconsistencyandconvergencewhenweintroducestabilityintheasubsequentsection.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION446.3.1 Constistencyofreaction-diusionproblemExample6.3.1. Thecentereddierenceapproximationtothereaction-diusionmodel(inexample(6.2.1))is2ndorderconsistent.Proof. ThelocaltruncationerrorTjatgridpointxjistheremainderwhenu(xj)issubstitutedinplaceofujin1h22uj + ruj= fji.e.:Tj= 1h22u(xj) + ru(xj) fjWeknow(fromthePDE)that0 = u

(xj) + ru(xj) fjsosubtractingequationsgivesTj= u

(xj) 1h22u(xj)Theresultimmediatelyfollowsfromlemma(6.1.2).6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION456.3.2 Relationshipoferrorsofreaction-diusionproblemExample6.3.2. WecanrelatetheglobalerrorejatthegridpointxjtothelocalerrorTjasfollowsTj= 1h22u(xj) + ru(xj) fj0 = 1h22uj + rujfjSubtractingtheseequationsandrecallingej= u(xj) ujgivesTj= 1h22ej + rejThis is a linear system of equations for j= 1, . . . , n 1 giving ejin terms ofTj.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION466.4 StabilityTheorem6.4.1. [DiscreteMaximumPrinciple]Considerasetofgrid-pointestimates {uj}nj=0thatsatisfyauj1 + bujcuj+1 0, j= 1, 2, . . . , n 1Leta, b, c Rdenotecoecientswith___a 0c 0b a + c > 0thenuj max{0, u0, un}, j= 0, 1, . . . , n.Proof. Forcontradictionassume uk> 0suchthatuk= max{u0, u1, . . . , un} and min{uk1, uk+1} < ukAs auj1 + bujcuj+1 0,wehavebuk auk1 + cuk+1< auk + cuk= (a + c)uk bukAsb = 0,thisisacontradiction.Therefore,wemayconcludethereisamaximumukwhichiseithernon-positive(uk 0),orontheboundary(uk max{u0, un})Thisisoftencalledthediscretemaximumprinciple.Theorem6.4.2. Supposethatanitedierencemethodiskthorderconsistentandstable,withtheformauj1 + bujcuj+1= fjwitha, c 0andb a + c > 0. Thenthenumerical approximationconvergestotheexactsolution,i.e.:ej= |uju(xj)| = O(hk) ash 0Andthereforethemethodisconvergent.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION47Proof. notgiven.Wehavetheresultconsistency + stability =convergenceRecall,consistencymeansthelocalerrorTjis O(hk)forsomek 1andconvergencemeanstheglobalerrorejissmall.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION486.4.1 Stabilityandconvergenceofreaction-diusionproblemExample6.4.1. Thecentereddierencemethodforthereaction-diusionproblem(seeexample(6.2.1))isstableandthereforeconvergent.Proof. Recallthenitedierenceapproximation1h2uj1 + (2h2+ r)uj1h2uj+1= fjToshowthatthisapproximationisstableweapplythediscretemaximumprinciple(theorem(6.4.1))a =1h2, b =2h2+ r, c =1h2Hence,asa, c 0andb a + casr 0. Therefore,thiscentreddierencemethodisstable.Wehavealsoshownthismethodtobe2ndorderconsistent(example(6.3.1)),thereforeglobalerror ej= |uju(xj)| = O(h2) ash 0Thecentereddierencemethodforthereaction-diusionmodelis(2ndorder)convergent.6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION496.5 Convection-diusionproblemExample6.5.1. Considertheboundaryvalueproblem:_u

+ wu

= f,for0 < x < 1withu(0) = ,andu(1) = Wherescalarw R(knownasthewind)andboundaryvalues, R.Forgrid-pointsxjtheexactsolutionsatisesu

(xj) + wu

(xj) = f(xj), j= 1, 2, . . . , n 1andu(x0) = ,u(xn) = .Substitutingincentereddierenceapproximationsforu

andu

gives2ujh2+ wuj2h= fjwhichisuj12uj + uj+1h2+ wuj+1uj12h= fjandthisrearrangesto_1h2 w2h_. .auj1 +_2h2_. .buj +_1h2+w2h_. .cuj+1= fjforj= 1, 2, . . . , n 1.Usingtheboundaryconditionsu0= ,un= tosimplifythej= 1andj= n 1cases,wehavethelinearsystemofequations___a + bu1cu2= f1auj1 + bujcuj+1= fjforj= 2, . . . , n 2aun2 + bun1c= fn1Whichcanbewritteninmatrixform__b c 0 0 0a b c 0 00.........00 0 a b c0 0 0 a b____u1u2...un2un1__=__f1 + af2...fn2fn1 + c__(11)Note,thisisnon-symmetricasa = c(unlessw = 0).6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION50Thelocaltruncationerroristheremainderafterreplacingujinthenitedierencemethodbyu(xj),i.e.:Tj= 1h22u(xj) +w2hu(xj)2hfjToevaluatethis,subtractu

(xj) + wu

(xj) f(xj) = 0ResultinginTj=_u

(xj) 1h22u(xj)_+ w_u

(xj) +u(xj)2h_Bylemmas(6.1.2)and(6.1.3)weknow1h22u(xj) = u

(x) +O(h2)Andsimilarlyu(xj)2h= u

(x) +O(h2)Therefore,Tj= O(h2) +O(h2) = O(h2)Thereforethismethodis2ndorderconsistent. Tocheckforstabilityweapplythestabilitytheorem(6.4.1)a 01h2+w2h 0c 01h2 w2h 0b a + c > 02h2 2h2> 0Allthreeconditionsaresatisedwhen1. ifw > 0,then1h2 w2h 0wh2 1h 2w2. ifw < 0,then1h2+w2h 0wh2 1h 2w6 FINITE DIFFERENCE METHODS: CENTEREDAPPROXIMATION51Therefore,thiscentereddierenceapproximationisstable(andhenceconvergent bytheorem(6.4.2))when|w|h2 1ThisratioiscalledthemeshPecletnumber,if> 1thecentereddierencemethodsolutionshowsoscillationofperiodhwhichindicatesinstability.7 FINITEDIFFERENCEMETHODS:UPWINDAPPROXIMATION527 FiniteDierenceMethods: UpwindApproximationAnalternatemethodtocentereddierenceapproximationsaretheone-sidedupwinddierenceapproximations.Denition7.0.1(One-sidedDierence). Atgrid-pointsxjtheone-sidednitedierenceapproximationstou

aregivenbyu

(xj) +u(xj)h=u(xj + h) u(xj)handu

(xj) u(xj)h=u(xj) u(xjh)hthesebeingtheright-sidedandleft-sidedapproximations,respectively.Whichsideisconsideredtheupwind-sideandwhichsideisconsideredthedownwind-sidedependsonthegivenproblem.AndbysimpleapplicationofTaylorstheorem(5.0.1)weseethatLemma7.0.1. Theerrorinu

(x)givenbyupwindapproximationis O(h)Proof.+u(xj)h=u(xj + h) u(xj)h=hu

(xj) +O(h2)h= u

(xj) +O(h)u(xj)h=u(xj) u(xjh)h=hu

(xj) +O(h2)h= u

(xj) +O(h)7 FINITEDIFFERENCEMETHODS:UPWINDAPPROXIMATION537.1 Convection-diusionproblem(revisited)Example7.1.1. Letsreturntotheconvection-diusionproblem(example(6.5.1)). Wewillcontinuetousethecentereddierenceapproximationforu

(xj)butwewillnowconsidertheupwindapproximationofu

(xj).Recall,theparameterwintheconvection-diusionmodelwascalledthewind4.Ifw > 0,thentheleft-handsideofgrid-pointxjisconsideredupwindandweapproximateu

(xj) u(xj)hIfw < 0,thentheright-handsideofgrid-pointxjisconsideredupwindandweapproximateu

(xj) +u(xj)hThismethodiscalledtheupwinddierenceapproxmation.Usingthesenewapproximations,forw > 0,weobtain2ujh2+ wujh= fjwhichisuj12uj + uj+1h2+ wujuj1h= fjandthisrearrangesto_1h2 wh_. .auj1 +_2h2+wh_. .buj +_1h2_. .cuj+1= fjforj= 1, 2, . . . , n 1.4up-wind(adverb)towardoragainstthewindorthedirectionfromwhichitisblow-ing. if wis positive, thenthe windingis blowingleft-to-right, therefore if we aretravellingupwindwearetravllingtotheleft. Hence, whenw>0wetaketheleft-sidedapproximation7 FINITEDIFFERENCEMETHODS:UPWINDAPPROXIMATION54Applyingtheboundaryconditionswecanderivethesamelinearsystem(11)fromexample(6.5.1)wherea, b, carenowredenedasabove.Wecanshowthisupwindmethodisconvergentforanychoiceofgridspacingh > 0. WehavelocaltruncationerrorTj= 2u(xj)h2+ wu(xj)hfjSubtractingu

(xj) + wu

(xj) fj= 0WeobtainTj=_u

(xj) 2u(xj)h2_+ w_u

(xj) +u(xj)h_Wehaveshownthat(bylemmas(6.1.2)and(7.0.1))2u(xj)h2= u

(xj) +O(h2),u(xj)h= u

(x) +O(h)Hence,Tj= O(h2) +O(h) = O(h)Thereforethismethodis1storderconsistent. Tocheckforstabilityweapplythestabilitytheorem(6.4.1)a 01h2+wh 0c 01h2 0b a + c > 02h2+wh _1h2+wh_+1h2> 0Recall,wearealreadyconsideringthecasew > 0(thecasew < 0issimilar),soallconditionshavebeenveried.Sincethemethodisconsistentandstablewemayconcludeitisconvergentbytheorem(6.4.2).8 FINITE DIFFERENCE METHODS: EULER METHODS FOR ODES558 FiniteDierenceMethods: EulerMethodsforODEsWebrieystudynitedierencemethodsforODEs,thesewillbeneededforthemethodoflinesintroducedinthefollowingsections.8.1 TheExplicitEulermethodDenition8.1.1(ExplicitEulerMethod). ConsiderthefollowinginitialvalueproblemforsomefunctionU(t)dUdt= f(U), U(0) = U0(12)Fork > 0(thetime-step)weapproximate5dUdtU(t + k) U(t)kLettingt = nkandapplyingtheequalitygivenbytheODE(12)wehaveU((n + 1)k) U(nk)kdU(t)dtt=nk= f(U(nk))UsingapproximationU(nk) Un,wehaveUn+1= Un + kf(Un)ThisistheexplicitEulermethodapproximation.Itispossibletoshowtheglobalerror |U(nk) Un| = O(k)undercertainassumptionsonf(proofnotgiven).Example8.1.1. ConsidertheODEdUdt= 3U, U(0) = 2InthiscasetheexactsolutionisgivenbyU(t) = 2e3t,butletsusetheexplicitEulermethodtoapproximateasolutionfortime-stepk = 0.1.Un+1= Un + kf(Un)U1= U0 + k(3U0) = 2 + 0.1(3 2) = 1.4U2= U1 + k(3U1) = 1.4 + 0.1(3 1.4) = 0.985This approximation should come as no surprise, since if we take the limit as k 0 wehaveanexactequalityasthisisthensimplythedenitionofderivative.8 FINITE DIFFERENCE METHODS: EULER METHODS FOR ODES56IncomparisontotheexactsolutionU1 U(0.1) = 2e30.1= 1.4816 . . .U2 U(0.2) = 2e30.2= 1.0976 . . .Andwecangetmoreaccurateapproximationsbytakingksmaller.Example8.1.2. ForODEdUdt= U(t)2withinitialconditionU(0) = 1,wehavedUdt= U(t)2=_1U2 dU= _dt=1U= t + cForsomeconstantc R,applyingtheinitialconditionU(0) = 1 =11= 0 + c =c = 1Therefore,wehaveexactsolutionU(t) =11 tApproximatingbytheexplicitEulermethod,wehaveUn+1= Un + kU2nAttimet = 0.2wehaveexactanswerU(0.2) =11 0.2= 1.25Fortime-stepk = 0.1,weneedn = 2U1= U0 + 0.1(U0)2= 1 + 0.1 = 1.1U2= U1 + 0.1(U1)2= 1.1 + 0.1(1.1)2= 1.221Hence,theerrorisgivenbyerror = |1.221 1.25| = 0.29Attime-stepk = 0.01,werequiren = 20U1= U0 + 0.01(U0)2= 1 + 0.01 = 1.01U2= U1 + 0.01(U1)2= 1.01 + 0.01(1.01)2= 1.020201...U20= 1.24658447 . . .8 FINITE DIFFERENCE METHODS: EULER METHODS FOR ODES57Hence,theerrorisgivenbyerror = |U20U(0.2)| = |1.24658447 . . . 1.25| = 0.0034 . . .Andtheerrorgetssmalleraskdecreases.8 FINITE DIFFERENCE METHODS: EULER METHODS FOR ODES588.2 TheImplicitEulermethodDenition8.2.1(ImplicitEulerMethod). Consideragaintheinitialvalueproblem(12)fromexample(8.2.1),thistimeusingapproximationdUdtU(t) U(t k)kAnalagousderivationgivesUn= Un1 + kf(Un)AlsowrittenUn+1= Un + kf(Un+1)ThisistheimplicitEulermethodapproximation. Butinthiscase,anon-linearsystemofequationsmustbesolvedtodetermineUn.Againitispossibletoshowthattheglobalerror |Un(nk) Un| = O(k)undercertainassumptionsonf(proofnotgiven).8 FINITE DIFFERENCE METHODS: EULER METHODS FOR ODES598.3 Stabilityandtime-steprestrictionDenition8.3.1(RegionofAbsoluteStability). GivenordinarydierentialequationdUdt= U(t),wedenetheregionofabsolutestabilitytobethesetofk CsuchthattheEulermethodapproximationUn 0asn ,i.e.: thenumericalapproximationdecays(seedenitions(8.1.1)and(8.2.1)).Example8.3.1. Iff(U(t))) = U(t)forsome C,wehaveexactsolutionU(t) = U0etObserve,thatifRe[] < 0,thenlimt|et| =limt|e(Re[]+Im[])t|=limt|eRe[]t||eIm[]t|=limteRe[]t1= limheh= 0Therefore,U(t) 0 as t Thatis,thesolutiondecayswithtimeprovidedthereal-partofisnegative.Denition8.3.2(Time-StepRestriction). Theconditiononthetime-stepksuchthattheEulermethodapproximationUn 0asn iscalledthetime-steprestrictiononk.Example8.3.2. Forf(T) = U,theexplicitEulermethodisUn+1= Un + kUnRearranginggivesUn+1= (1 + k)UnandwecanprovebyinductionthatthishassolutionUn= (1 + k)nU0Hence,asn Un 0|1 + k| < 1Therefore,theregionofabsolutestabilityisthesetofk Cthatbelonginsidethecircleofradius1inthecomplexplanewithcentreat 1.8 FINITE DIFFERENCE METHODS: EULER METHODS FOR ODES60So,byexample(8.3.1),thenumericalapproximationdecaysforallinitialconditionsifandonlyif |1 + k| < 1,i.e.: thisisthetime-steprestrictiononk.Example8.3.3. Forf(T) = U,theimplicitEulermethodisUn= Un1 + kUnRearranginggivesUn=1(1 k)Un1WhichhassolutionUn= (1 k)nU0HenceUn 0|1 k| > 1Thatis,theregionofabsolutestabilityisthesetofk Cthatbelongoutsidethecircleofradius1inthecomplexplanewithcentre1.Inparticular,thisholdsforallwithRe[] < 0. Thus,byexample(8.3.1),whentheODEisstablesoistheimplicitEulermethod. Therefore,thereisnotime-steprestriction.9 FINITEDIFFERENCEMETHODS:METHODOFLINES 619 FiniteDierenceMethods: MethodofLinesWedevelopthemethodoflinesapproximationinthefollowingexample.9.1 TheHeatEquationExample9.1.1. Considertheheatequationfort > 0andx (0, 1),ut= uxxu(0, t) = u(1, t) = 0u(x, 0) = u0(x)SupposethefollowingFourierseriesisapotentialsolutionu(x, t) =

j=1uj(t) sin(jx)Whereuj(t)aresomefunctionsoft. Noticethattheboundaryconditionsaresatised,consideringthatut(x, t) =

j=1u

j(t) sin(jx)uxx(x, t) =

j=1uj(t)(j22) sin(jx)Andthussubstitutingintotheequationgives

j=1u

j(t) sin(jx) =

j=1uj(t)(j22) sin(jx)Equatingcoecientsofsin(jx)giveODEsu

j= j22uj, j= 1, 2, . . . (13)Fromtheinitialconditionu0(x) = u(x, 0) =

j=1uj(0) sin(jx)9 FINITEDIFFERENCEMETHODS:METHODOFLINES 62Hence,bytheFouriercoecienttheorem(3.1.3)uj(0) = 2_10u0(x) sin(jx) dxNow,replacetheinniteseriesofODEs(13)withthenitesystemu

j= j22uj, j= 1, 2, . . . , J (14)whereJ Nisthesizeofsystem.Denition9.1.1(MethodofLinesApproximation).v(x, t) =J

j=1uj(t) sin(jx)isthemethodoflinesapproximationtotheheatequationproblem(9.1.1).Notes WehavetruncatedthenumberoftermsintheinniteseriesofODEs(13). Thecoecientsfunctionsuj(t)forj= 0, . . . , JcannowbecomputednumericallybyEulermethods.Noticetheseequationsaredecoupledandwemaysolveeachseparately.TodosobytheexplicitEulermethod(8.1.1),wemustassumethatthetime-stepkischosensothatkliesintheregionofabsolutestability,i.e.:since = j22we require |1 j22k| < 1,that is: 1 < 1 j22k < 1,forj= 1, 2, . . .,Jandthereforewemusthavethetime-steprestrictionk 0andx (0, 1)utt= uxxsubjecttotheboundaryconditionsu(0, t) = u(1, t) = 0andinitialconditionsu(x, 0) = h0(x),ut(x, 0) = h1(x)whereh0, h1aregivenfunctions. Supposethatu(x, t) =

j=1uj(t) sin(jx)Asinexample(9.1.1)wecanderive2ndorderODEswithinitialconditionsforthecoecientsuj(t),observeutt(x, t) =

j=1u

j(t) sin(jx)uxx(x, t) =

j=1j22uj(t) sin x)SubstitutingintothePDEandequatingcoecientsofthesines,givesu

j(t) = j22ujThegeneralsolutionforujisgivenbyuj(t) = j sin(jt) + j cos(jt)forsomecoecientsj, j. Noticethatuj(t)oscillatesintimeanddoesnotdecayorgrow.Frominitialconditionu(x, 0) = h0(x),wehaveuj(0) = 2_10h0(x) sin(jx) dxsimilarly,ut(x, 0) = h1(x)impliesthatu

j(0) = 2_10h1(x) sin(jx) dxgivinginitialconditionsfromwhichwecandeterminej, j.9 FINITEDIFFERENCEMETHODS:METHODOFLINES 64TheexplicitEulermethodcanbeapplied,bywritingtheODEsforujasarstordersystemu

j= vjv

j= j2ujThentheexplicitEulermethodisgivenby_uj,n+1vj,n+1_ =_uj,nvj,n_ = k_vj,nj22uj,n_orasthelinearsystemXn+1= Xn + kAXn= (I + kA)XnwhereXn=_uj,nvj,n_, A =_0 1j220_Notes BystudyingtheeigenvaluesofI + kA,itcanbeshownthatXnalwaysgetsbiggerfork > 0(assumingnon-trivialinitialconditions).ThesolutionsoftheexplicitEulermethodgrow(foralltime-steps)whilstexactsolutionsoscillate(withthesamemagnitude). TheEulermethoddoesnotgetthisfundamentalaspectofthebehaviourofthewaveequationcorrect.