Mathematical Methods (10/24.539) V. General Boundary Value Problems (BVPs)

Size: px
Start display at page:

Download "Mathematical Methods (10/24.539) V. General Boundary Value Problems (BVPs)"

Transcription

1 Mathematcal Methods (10/4.539) V. General Boundary Value Problems (BVPs) Introducton In the prevous secton we focused on varous schemes (both analytcal and numercal) for solvng general IVPs. We now emphasze another mportant class of problems known as Boundary Value Problems (BVPs). The dfference between these two problem classes s related to the specfcaton of the n condtons needed to unquely determne the n arbtrary coeffcents n the general soluton to an n th order ODE. The n condtons are specfed at a sngle (ntal) pont for IVPs. However, for a BVP, the n boundary condtons are specfed at two or more ponts n the doman of nterest. Ths modfcaton results n completely dfferent algorthms for solvng these problems - especally n the numercal soluton schemes used for BVPs. Analytcal schemes for lnear constant coeffcent non-homogeneous BVPs have already been dscussed n Secton II - Lnear Dfferental Equatons. Exact soluton methods for general nonlnear BVPs are smply not avalable (although a number of trcks can be appled to specfc problems). Varable coeffcent lnear problems do have a general soluton procedure - referred to as the Power Seres Soluton Method - but t s often qute tedous and not overly useful for solvng general engneerng desgn problems. The Power Seres technque s qute powerful, however, and t s very useful for dervng analytcal solutons for several mportant problems. We wll dscuss ths method n some detal later n ths course (see Secton VII - Power Seres Soluton Method and Secton VIII - Specal Functons). Note also that Egenvalue Problems, a specal class of homogeneous BVPs, are dscussed later n these notes (see Secton IX - The Sturm-Louvlle Problem). For now, we are nterested n the soluton of non-homogeneous BVPs that occur n real engneerng applcatons, and the only general soluton method for these problems rely on numercal schemes. In partcular, n ths secton of notes we focus on two numercal technques for treatng general non-homogeneous BVPs wth a sngle ndependent varable - the Shootng Method and the Fnte Dfference Method. The Shootng Method s essentally an teratve applcaton of the numercal ntegraton technques used for IVPs. It s easy to apply n most cases, but t s not approprate for solvng BVPs wth more that one ndependent varable (PDEs are dscussed later n ths course). The Fnte Dfference Method takes a completely dfferent approach to the problem. It essentally converts the ODE nto a coupled set of algebrac equatons, wth one balance equaton for each fnte volume or node n the system. Ths technque s very powerful, and t s easly extended to multdmensonal and space-tme stuatons. Thus, ths method wll be used agan when dscussng the numercal soluton technques approprate for general PDEs (later n the course). The general notaton assocated wth BVPs and an overvew of the Shootng and Fnte Dfference methods are dscussed wthn the followng subsectons: General Notaton for BVPs The Shootng Method Basc Algorthm

2 Math Methods -- Secton V: General Boundary Value Problems (BVPs) Pckng the Next α Second Order BVPs Example A -pont BVP va the Shootng Method The Fnte Dfference Method Basc Concepts Dervatve Approxmaton usng the Taylor Seres Some Addtonal Dervatve Approxmatons Example 5. - A -pont BVP va the Fnte Dfference Method A Classcal BVP - Heat Transfer n a Crcular Fn Development of the Mathematcal Model Example 5.3A - Shootng Method Soluton to the Crcular Fn Problem Example 5.3B - Fnte Dfference Soluton to the Crcular Fn Problem The reader mght also vst my webste for my undergraduate Appled Problem Solvng wth Matlab course (see There are some examples of both the Shootng method and the Fnte Dfference method. These are qute straghtforward snce the treatment n that course s qute ntroductory. However, these extra examples may be useful!!! Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

3 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 3 General Notaton for BVPs Boundary Value Problems (BVPs) dffer n one very mportant respect relatve to Intal Value Problems (IVPs). Ths dfference s related to the specfcaton of the n condtons needed to unquely determne the n arbtrary coeffcents n the general soluton to an n th order ODE. For a BVP, the n boundary condtons are specfed at two or more ponts n the doman of nterest (whereas the n condtons are specfed at a sngle pont for IVPs). Ths dfference gves rse to sgnfcant varatons n the algorthms used to solve these problems - especally n the numercal soluton schemes. For BVPs one needs to satsfy condtons at up to n boundary ponts. For example, we mght have,, y p1 = k1 y p = k y pn = kn where p 1, p, up to p n are the boundary ponts for an n th order system. More often, however, there are only two boundary ponts, p 1 and p, wth multple condtons at each pont. If we defne n 1 and n as the number of condtons at ponts p 1 and p, respectvely, then n = n 1 + n for an n th order system. The boundary condtons (BCs) at the two ponts can be wrtten n a very general form as Bj( p 1,z) = 0 for j= 1,, n 1 (5.1) Bk( p,z) = 0 for k = 1,, n (5.) where ( n 1) z = y y' y'' y. T The most common stuaton that arses n practcal applcatons, of course, s the nd order BVP. In ths case, there s a sngle boundary specfcaton for each of the two boundary ponts. If the BCs are lnear n y and y, then they can be wrtten as B p,y,y' = ay p + by' p w 1 = 0 (5.3) B p,y,y' = a y p + b y' p w = 0 (5.4) If both w 1 and w are zero, the boundary condtons (BCs) are sad to be homogeneous. Also f both a 1 and b 1, for example, are nonzero, then ths boundary condton s referred to as a mxed BC. Varous combnatons can occur and a varety of specfc examples are treated n ths secton of notes and throughout the remander of the course. Note: In the techncal lterature, the varous BCs are often referred to as Drchlet BC: B( y, y ') B(y) only a functon of y Neumann BC: B( y, y ') B(y ') only related to the dervatve of y Robn BC: B( y, y ') B(y, y ') functon of both y and y (mxed BC) Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

4 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 4 The Basc Algorthm Shootng Method for -Pont BVPs The basc dea behnd the Shootng Method s llustrated n Fg Tral ntegratons that satsfy the boundary condton at one endpont are launched. The dscrepances from the desred boundary condton at the other endpont are used to adjust the startng condtons, untl boundary condtons at both endponts are ultmately satsfed. Fg. 5.1 Schematc for the Shootng Method. Ths rather smple descrpton can be formalzed n the form of an algorthm as follows: 1. Gven an n th order ODE, convert t to n 1 st order equatons wth n BCs by lettng ( n 1) z = y y' y'' y T (5.5). Set up the problem as an IVP wthn a standard ODE solver. In addressng the ntal condtons for the IVP, let n 1 condtons be specfed at x 1 = p 1 (consdered as the ntal pont for ndependent varable x). Therefore, we have n unknown or free parameters at x 1, n = n n 1 Let α be a vector of free parameters (n n length). Therefore, at x 1 = p 1, z( p ) z( p, ) = α, 1 1 (5.6) whch smply says that the state at p 1 s really not known but t can be wrtten as some functon of the vector of free parameters. Our goal s to fnd α n an teratve fashon such that the n boundary condtons at pont x = p are satsfed. 3. Guess 0 0 α, whch gves z( p 1) = z( p 1, α ) the IVP can be solved n the usual way.. Now we have a full set of ntal condtons so that m m 4. Now solve the IVP usng your favorte ODE solver to get z( p, ) z p = α where m s an teraton counter (.e. m = 0 for the frst guess). Because we only have a guess for some of the ntal condtons, ths IVP problem wll not be equvalent to the desred BVP. In partcular, the n boundary condtons at pont p wll not be satsfed exactly. Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

5 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 5 5. To quantfy the error, defne a dscrepancy vector, m k k m m m ε k ε, whose elements,, satsfy ε = B p,z for k = 1,, n (5.7) where, for the exact soluton, z, we have B p,z = 0. That s, t satsfes the exact BCs. k 6. Fnally, check convergence aganst a user-specfed convergence crteron, tol. In partcular, f m k ε < tol for all k, then one termnates the teratve process and edts the results. If, however, m k ε > tol for any k, then we guess a new go back to Step 4 to perform another teraton. m+ 1 α (recall that m s smply an teraton counter) and The above scheme s actually very easy to mplement and t represents a very powerful method for solvng -pont BVPs wth only one ndependent varable. Pckng the Next α The Shootng Method s a numercal scheme for BVPs n whch one teratvely mproves upon n free parameters wthn the ntal condton vector for a standard IVP. The error condton s related to the dfference between the desred BCs at the second boundary pont, p, and the actual values computed usng a guess for part of the ntal condton vector. Gven an error vector for m m+ 1 teraton m, ε, our goal s to choose a free parameter vector, α, such that the error tends towards zero. Wth ths goal, let s choose where m+ 1 α as m+ 1 m m α =α + α (5.8) m α s the soluton to m m ε A α = ε wth A = aj = α j Note that the error vector on the rght hand sde of ths equaton s negatve so that computed such that t tends to reduce the error on teraton m, ths expresson can be wrtten as ε α m m ε = ε = α j j m ε m α s (5.9), to zero. In component form, j (5.10) In practce, the partal dervatves of the error terms wth respect to the free varables are computed by a fnte dfference approxmaton, or ε α j (,,,, ) (,,, ) ε α1 α α j+ αj ε α1 α αn = α j A smple algorthm for computng ε α j s as follows: (5.11) Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

6 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 6 1. Compute the error vector assocated wth the current choce for the free parameters, or m m α ε.. Perturb only one element, the j th element, α j, and ths leads to a new error vector, droppng the teraton ndex notaton for convenence, we have Ths gves ε εj ε = α α j j ε α j for all and a sngle j. 3. Repeat Step for all the elements of α (.e. let j vary from 1 to n elements). Ths procedure can be repeated for each step n the teraton process. Fnally, t should be noted that, n many practcal applcatons, the farly general procedure outlned here s really much easer than t may seem. For example, for the very common nd order BVP, there s only one free parameter and one error component. Thus the above development smplfes consderably. Because of ts mportance n applcaton, ths case s hghlghted n the next subsecton. Second Order BVPs m ε j. Then, (5.1) Second order systems occur so frequently that t makes sense to llustrate the Shootng Method for ths specfc case. In dscussng ths partcular problem, let s try to follow, at least roughly, the basc algorthm outlned prevously for the Shootng Method. Step 1. Recall that a nd order system can always be wrtten as a set of coupled 1 st order equatons, or d z f x,z wth z y y' [ dx = = ] wth lnear boundary condtons of the form a y x + b y' x w =0 ayx + by'x w = 0 T (5.13) (5.14) (5.15) where x 1 and x are the boundary pont locatons [f the BCs are nonlnear, one smply uses the more general form gven n eqns. (5.1) and (5.)]. For ease of dscusson, let s specalze ths to a partcular stuaton where the functon, y(x), s known at both endponts. In ths case, the boundary condtons become (note that ths s a specfc example) y x = w and y x = w 1 1 Step. Now we wrte the system as an IVP wth an unknown ntal value, d y( x ) z f ( x,z, ) wth z ( x 1) y' ( x ) dx 1 w1 = α = = 1 α Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

7 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 7 where y'(x ) s to be determned so that the second boundary condton, y x = w, s satsfed. α= 1 Step 3. Now guess α 1 and solve the IVP for y( x,α 1), and guess α and solve the IVP agan for ( y x,α ). Wth two values of α and ther correspondng endpont results, we can compute the errors n the second BC, or ε 1 = y x, α1 w and ε = y x, α w And, wth these error estmates, an approxmaton to ε αcan be constructed, or ε ε ε1 α α α 1 Step 4. Note that the desred change n error s the negatve of the error n the prevous stage. Therefore, ε ε ε = α = ε and α = α ε α whch gves a new ncrement n the free varable. Now we can compute α 3 as α 3 =α + α and solve the IVP agan, gvng, etc., etc. ε 3 Ths basc procedure s contnued untl the user-specfed convergence crteron s met (.e. untl ε < tol ). In practce only a few steps are usually requred for good accuracy n lnear or m mldly nonlnear problems (3-5 steps or less n most cases). Example 5.1 and Example 5.3A llustrate the shootng method for two specfc nd order BVPs. The frst example mplements both a manual and automated teratve scheme wthn Matlab to show how the basc method works, and the second sample problem represents a practcal applcaton to the classcal crcular fn heat transfer problem. Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

8 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 8 Problem Descrpton: Example The Shootng Method for -Pont BVPs Solve the followng -pont BVP usng the Shootng Method: y'' + 3xy' + 7y= cos(x) wth y( 0) = 1 and y( π ) = 0 Problem Soluton: Case 1 Manual Interactve Iteraton 1. To start ths problem, let s convert to a set of coupled equatons. Lettng = [ y' ] T z' = z 1 z ' = 3xz 7z1+ cos(x) or, n general terms, ths becomes z' f( x,z) =. z y gves. Next we set ths up as an IVP and use an ODE solver n Matlab to numercally ntegrate ths system, wth the ntal condtons gven by z 0 y 0 1 = = y' 0 α 3. In ths nteractve example, the user s prompted for an nput value for α and, after the call to Matlab's ODE routne, we compute the error at the second boundary pont as ε= z 1 ( πα, ) y( π) 4. Step 3 s repeated untl the correct value of α s determned. That s, untl ε s small (.e. less than the desred tolerance). Ths manual nteractve soluton procedure for Case 1 has been mplemented wthn the man Matlab scrpt fle shootm1.m and functon fle shootf.m. These fles are lsted n Tables 5.1 and 5., respectvely. The partcular mplementaton gven here s very smple and t assumes that the user wll do some auxlary computatons to help decde the next value of α to choose. Followng the frst two arbtrary guesses, the next guess should be made usng the gudelnes n the prevous secton. A typcal nteractve sesson wth shootm1.m has been saved wth Matlab s dary feature and later ths fle was annotated wth the nformaton used to compute the thrd (and last) value of α. A lstng of the annotated dary fle s gven n Table 5.3. Note here that very good convergence was acheved wth only three values of α. In addton to the sesson dary, the computed solutons, y (x), for the three dfferent values of α used n ths llustraton are plotted n Fg 5.. Ths set of curves was generated n a separate m-fle called shootm.m. Ths fle s gven n Table 5.4. The value of the ntal y that gves the correct soluton (.e. properly satsfes the second BC) s α = y (0) = The profles Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

9 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 9 for the frst two arbtrary guesses ( α= ±1) are substantally dfferent from the correct profle and, n partcular, they gve the wrong endpont value at x = π. Note that the endpont values are all qute smlar, so a relatvely tght convergence s needed. Notce, however, that t s relatvely easy to converge on the proper value of the sngle free varable. Fg. 5. Some tral solutons for Case 1 from Example 5.1. Tables summarze the basc procedures assocated wth the Shootng Method, and the student should study these fles as needed to get a good understandng of ths method. The nteractve approach s gven here as a good mechansm for understandng the overall teratve scheme. In practcal applcatons, however, ths procedure should be automated to elmnate the manual computaton of α (and the possblty of error ntroduced va the hand calculatons). An automated procedure, as llustrated below for Case, s smply easer and more effcent for routne applcaton. Table 5.1 Lstng of the Matlab man program shootm1.m. SHOOTM1.M Example of Shootng Method for Solvng -Pont BVPs (Manual Iteratve Procedure) Ths demo solves a partcular nd order ODE usng an teratve form of the shootng method. The varable ALF s chosen nteractvely. Ths s dscussed as Example 5.1 Case 1 Manual Interactve Iteraton n the course notes for Math Methods (10/4.539). The goal s to fnd the value of the free parameter, ALF = y'(0) whch, upon soluton of the IVP, satsfes the desred boundary condton at x = p. also see SHOOTF.M - contans descrpton of gven dfferental equaton y'' + 3xy' + 7y = cos(x) wth y(0) = 1 and y(p) = 0 also see related fles: SHOOTM.M - shows multple curves of y(x) for dfferent ALF SHOOTA.M - solves same problem usng an automated teratve scheme Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

10 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 10 BVPSH.M - mplements Shootng Method for nd order BVP wth lnear BCs Fles prepared by J. R. Whte, UMass-Lowell (Aug. 003) gettng started clear all, close all set doman lmts and tolerance for ODE3 xo = 0; xf = p; tol = 1e-6; specfy desred BCs yxo = 1.0; yxf = 0; set format for edt to long words (more sgnfcant dgts) format long guess at ntal condtons (note that ALF s defned manually) ALF = nput('input ntal guess for free parameter (ALF) = ') start loopng (for varous values of ALF) optons = odeset('reltol',tol); whle ALF ~= 0 zo = [yxo ALF]'; call ODE3 [x,z] = ode3('shootf',[xo xf],zo,optons); plot results for vsual nspecton of soluton at each teraton plot(x,z(:,1),'lnewdth',),ttle('shootm1: Shootng Method for ODEs') xlabel('x values'),ylabel('y values'),grd edt error n BC at second boundary pont (x = xf) [nr,nc] = sze(z); eps = z(nr,1)-yxf; dsp(' ') dsp(' Error n nd BC'), eps ALF = nput('enter another guess for ALF (zero to qut)? ') end dsp('manual teratve procedure termnated by user...') end demo Table 5. Lstng of the ode3 functon program shootf.m. SHOOTF.M Functon fle for SHOOTM1.M, SHOOTM.M, and SHOOTA.M (used by ODE3) Gven dfferental eqn.: y'' + 3xy' + 7y = cos(x) Fle prepared by J. R. Whte, UMass-Lowell (Aug. 003) functon zp = odefle(x,z) zp = zeros(length(z),1); zp(1) = z(); zp() = -3*x*z() - 7*z(1) + cos(*x); end of functon Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

11 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 11 Table 5.3 Matlab dary fle from shootm1.m. Ths lstng llustrates the teratve process for the Shootng Method. The Matlab output has been edted n MS Word and the computaton of the thrd guess for α = ALF has been added.» shootm1 Input ntal guess for free parameter (ALF) = 1 (ths s α 1) Error n nd BC eps = (ths s ε 1 ) Enter another guess for ALF (zero to qut)? ALF = -1 (ths s α ) Error n nd BC eps = (ths s ε ) Computaton for new choce of ALF (done outsde Matlab) Therefore, ε α ε ε α α 1 = = e 3 ε.4041e ε α e 3 α 3 =α = = Enter another guess for ALF (zero to qut)? ALF = (ths s α 3 ) Error n nd BC eps = e-007 (ths s ε 3 ) Enter another guess for ALF (zero to qut)? ALF = 0 (eps was small enough, so qut) Manual teratve procedure termnated by user... Table 5.4 Lstng of Matlab fle shootm.m. SHOOTM.M Example of Shootng Method for Solvng ODEs Ths s a follow up to demo SHOOTM1.M. Ths fle smply generates the plots obtaned for each of the guesses for the ALF used n SHOOTM1.M The goal was to fnd the ALF at x = 0 whch gves y(p) = 0. also see SHOOTF.M - contans descrpton of gven dfferental equaton y'' + 3xy' + 7y = cos(x) wth y(0) = 1 and y(p) = 0 Fle prepared by J. R. Whte, UMass-Lowell (Aug. 003) gettng started clear all, close all, nfg = 0; wth manual procedure, ALFs of 1, -1, and were used n SHOOTM1.M let's plot the functon for these dfferent guesses to see how ths works Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

12 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 1 gs = [ ]; set doman lmts and solve IVP xo = 0; xf = p; tol = 1.0e-6; yxo = 1.0; optons = odeset('reltol',tol); [x1,z1] = ode3('shootf',[xo xf],[yxo gs(1)],optons); [x,z] = ode3('shootf',[xo xf],[yxo gs()],optons); [x3,z3] = ode3('shootf',[xo xf],[yxo gs(3)],optons); now plot results nfg = nfg+1; fgure(nfg) plot(x1,z1(:,1),'g-',x,z(:,1),'r-.',x3,z3(:,1),'b--','lnewdth',) ttle('shootm: Shootng Method for ODEs (Case 1 - Manual Iteraton)') xlabel('x values'),ylabel('y values'),grd legend('alf = 1','alf = -1','alf = ') end of demo Case Automated Iteraton The Shootng Method for a nd order BVP has been automated wthn Matlab fle bvpsh.m. Ths fle s lsted n Table 5.5 and, as apparent from the embedded comments, t s currently lmted to the case where lnear BCs of the form gven n eqns. (5.14) and (5.15) are specfed. Ths restrcton was made only because t was easy to generalze the codng for BCs n ths form. Note that, although t would be more dffcult to allow general nonlnear BCs, the exstng fle could easly be modfed for a partcular problem. The comments at the begnnng of bvpsh.m show how to use ths routne. In partcular, the user needs to supply nformaton about the lnear BCs for the problem of nterest wthn the zbc array, as follows: a1 b1 w1 zbc = a b w where the ndvdual coeffcents, a 1, b 1, etc. are defned n eqns. (5.14) and (5.15). Ths array replaces the usual IC array that s used wth Matlab s bult-n ode3 or ode45 IVP solvers. At the ntal boundary pont, x 1, a check s made wthn bvpsh.m to determne the knd of BC that s mposed and, from ths, t can determne the form of the IC vector for the teratve IVP soluton. In partcular, the three standard BCs can be represented as follows: Drchlet BC: f b 1 = 0, y(x 1 ) = w 1 /a 1 then z o w1 a1 = α α Neumann BC: f a 1 = 0, y'(x 1 ) = w 1 /b 1 then zo = w1 b 1 Robn (mxed) BC: f both a 1 and b 1 are nonzero, then z o α = (w1 a 1 ) b α 1 where α s the unknown parameter at the ntal pont, x 1, whch wll be computed as part of the teratve soluton. Note that the Neumann BC s just a subset of the Robn BC wth a 1 = 0, and t s mplemented as such wthn bvpsh.m. Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

13 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 13 The value of α s determned as part of the overall soluton such that the BC at x s satsfed to wthn some small tolerance. An arbtrary guess for α ntates the teratve procedure, gvng a frst estmate of the soluton wth partcular focus on the relatve error n the second boundary condton. If the relatve error at the second boundary pont s greater than a user-specfed tolerance, a 1 change s made n the current value of α, a new IVP soluton s obtaned, and a fnte dfference estmate for ε α s computed. Usng ths dervatve estmate, a new value of α s chosen wth the goal of reducng the relatve error to zero. Wth the new α, a new teraton s ntated, wth the process contnung untl the preset convergence crteron s met or the maxmum number of teratons s reached. Ths automated procedure was used wthn Matlab fle shoota.m (see Table 5.6) to solve the same problem as for Case 1. Ths fle calls bvpsh.m for general mplementaton of the Shootng Method for problems wth lnear BCs. The startng pont here s exactly the same as for Case 1. In partcular, we set the problem up as an IVP usng standard state space notaton (as n Steps 1 and from Case 1) and the same ODE functon fle, shootf.m, s used. In shoota.m, however, the bvpsh.m routne handles all the detals of the method. In ths case, the requred zbc matrx s smply zbc = [1 0 1; 1 0 0], and the rest of the problem s then no more dffcult to solve than a standard IVP that uses Matlab s bult-n ode3 routne. The fnal converged soluton from shoota.m s gven n Fg. 5.3 and the soluton s dentcal to the converged soluton from Case 1 usng the manual approach to the Shootng Method. Obvously, the automated methodology bult nto the bvpsh.m routne s the easer of the two approaches, and the automated technque llustrated here should prove to be useful for solvng a varety of BVPs of ths type. Fnally, we note that another example, Example 5.3A, has been provded at the end of ths secton of notes to further llustrate the use of the bvpsh.m functon. Ths problem deals wth conducton heat transfer n a crcular fn arrangement and t represents a more practcal applcaton of the basc methodology. Fg. 5.3 The converged soluton for Case from Example 5.1. Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

14 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 14 Table 5.5 Lstng of Matlab fle bvpsh.m. BVPSH.M Ths functon fle solves a nd order BVP wth lnear BCs va the Shootng Method Ths method solves the BVP usng an IVP solver wth an ntal guess for the unknown ntal condtons. An teratve scheme automatcally modfes ths guess untl the boundary condtons at the second boundary pont are satsfed. Ths teratve technque s called the Shootng Method. A general nd order ODE can be wrtten n the form y'' + a*y' + b*y = f(t) where, n general, a and b can be functons of y and t. We can also wrte ths as a set of two 1st order equatons n so-called state space form as dz1/dt = z and dz/dt = f - a*z - b*z1 where z1 = y and z = y' Now, f we had a set of ntal condtons, zo = [y(to); y'(to)], then ths state space system could be easly solved as an IVP. However, snce ths s a BVP, we do not have a complete set of ntal condtons. Thus, the basc dea of the shootng method s to guess at the unknown varable at the ntal state so that the soluton of the resultng IVP gves the desred fnal state for the BVP. Ths s done teratvely by convergng on the free parameter, alf, that s ncluded as part of the ntal condton vector such that the desred fnal state s acheved. For the case of a nd order -pont BVP wth lnear BCs, a general way to wrte the boundary condtons s as follows: at p1: a1*y(p1) + b1*y'(p1) - w1 = 0 at p: a*y(p) + b*y'(p) - w = 0 The coeffcents n these expressons are nput to ths functon n the zbc matrx as: zbc = [a1 b1 w1; a b w]. Ths format essentally defnes the BCs for the nd order BVP wth lnear BCs (note that the equaton can be nonlnear -- but not the BCs). At the ntal boundary pont, p1, a check s made to determne the knd of boundary condton and thus the form of the ntal condton vector for the teratve IVP soluton: Drchlet BC: f b1 = 0, y(p1) = w1/a1 then zo = [w1/a1; alf] (guess ntal slope) Neumann BC: f a1 = 0, y'(p1) = w1/b1 then zo = [alf; w1/b1] (guess ntal value) Robn (mxed) BC: f both a1 and b1 are nonzero, then zo = [alf; (w1 - a1*alf)/b1] (guess ntal value) where alf s the unknown parameter whch wll be computed as part of the teratve soluton. alf s determned such that the second BC s satsfed to wthn some small tolerance. Note that the Neumann BC s just a subset of the Robn BC wth a1 = 0, and t s mplemented as such n ths routne. The nputs to ths functon are smlar to those used wth Matlab's ode3 IVP solver (n ts smplest mplementaton) except that the zbc matrx replaces the ntal state vector. Wth zbc known, the zo vector s computed nternally as descrbed above. Also, there s an opton to nput a guess for alf, f desred func - name of functon fle that evaluates the RHS of the state equatons tspan - vector that defnes the range for the ndependent varable zbc - matrx contanng the BC coeffcents (as descrbed above) optons - standard optons structure for use n ode3 (optonal) alfo - ntal guess for alf (optonal) The outputs are: t - column vector contanng the ndependent varable z - soluton matrx wth two columns wth column 1 contanng z1(t) and column contanng z(t) Note #1: Extra parameters that may be needed n the ode functon fle must be passed to the functon fle va a global statement n the man program and the functon fle. The current, relatvely smple mplementaton of the Shootng Method does not use the varable nput arguments (varargn) that are Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

15 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 15 often used n the ode3 routne. Ths s not overly restrctve, however, snce t s just as easy to pass needed varables nto the functon va the global statement. Note #: Ths routne assumes that you are ntegratng from boundary pont p1 to boundary pont p. Ths normally mples that p > p1, but ths s not absolutely essental. In some cases, t may be approprate to ntegrate 'backwards' -- just be careful wth the orderng of the BCs f you try ths... Note #3: Nonlnear problems are sometmes senstve to the ntal guess for the free varable, alf, n the ntal condton vector. Here we have smply set alfo = 1 as default. The user can overrde ths as needed n partcularly dffcult problems. A poor ntal guess usually just means that a few more teratons may be needed. If the system does not converge wthn 10-0 teratons, you may want to change alfo va the last entry n the nput argument lst to see f ths helps. Ths s not usually necessary, however... Fle prepared by J. R. Whte, UMass-Lowell (March 003) functon [t,z] = bvpsh(func,tspan,zbc,optons,alfo) check to see f the optons structure s avalable f nargn < 4, optons = []; end check to see f there s an ntal guess for alfo f nargn < 5, alfo = 1; end extract BC coeffcents (for convenence) a1 = zbc(1,1); b1 = zbc(1,); w1 = zbc(1,3); a = zbc(,1); b = zbc(,); w = zbc(,3); set some other teratve parameters err = 1e10; tol = 1e-6; cnt = 1; cntmax = 5; start teraton whle abs(err) > tol & cnt <= cntmax determne ntal condton vector based on structure of zbc matrx f b1 == 0 zo = [w1/a1; alfo]; else zo = [alfo; (w1 - a1*alfo)/b1]; end solve IVP wth current guess for ntal condtons [t,z] = ode3(func,tspan,zo,optons); evaluate error n second BC e1 = a*z(end,1) + b*z(end,) - w; err = e1; fprntf(1,' \n') fprntf(1,'for teraton # : \n',cnt) fprntf(1,' Intal condtons are: 13.5e 13.5e \n',zo) fprntf(1,' Error n nd BC s: 13.5e \n',err) fprntf(1,' \n') estmate new values for alf (f necessary) f abs(err) > tol alfp = 1.01*alfo; f b1 == 0 zo = [w1/a1; alfp]; else zo = [alfp; (w1 - a1*alfp)/b1]; end [t,z] = ode3(func,tspan,zo,optons); e = a*z(end,1) + b*z(end,) - w; deda = (e-e1)/(0.01*alfo); alfn = alfo-e1/deda; cnt = cnt+1; alfo = alfn; end end end of teraton loop f cnt >= cntmax fprntf(1,' WARNING -- Ht maxmum teraton lmt!!! \n'); end end of functon Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

16 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 16 Table 5.6 Lstng of Matlab fle shoota.m. SHOOTA.M Example of Shootng Method for Solvng -Pont BVPs (Automated Iteratve Procedure) Ths demo solves a partcular nd order ODE usng an teratve form of the shootng method. The varable ALF s chosen automatcally as part of the teratve procedure. Ths s dscussed as Example 5.1 Case Automated Iteraton n the course notes for Math Methods (10/4.539). The goal s to fnd the value of the free parameter, ALF = y'(0) whch, upon soluton of the IVP, satsfes the desred boundary condton at x = p. The automated algortthm for the Shootng Method s mlemented wthn the BVPSH.M fle. also see SHOOTF.M - contans descrpton of gven dfferental equaton y'' + 3xy' + 7y = cos(x) wth y(0) = 1 and y(p) = 0 also see related fles: SHOOTM1.M - solves same problem usng a manual teratve scheme SHOOTM.M - shows multple curves of y(x) for dfferent ALF (manual case) Fles prepared by J. R. Whte, UMass-Lowell (Aug. 003) gettng started clear all, close all set doman lmts xo = 0; xf = p; set coeffcents for BCs zbc = [ ; left BC --> y(xo) = ]; rght BC --> y(xf) = 0.0 soluton va Shootng Method (numercal approx) tol = 1e-6; optons = odeset('reltol',tol); set tght tolerance for ODE soln [xs,zs] = bvpsh('shootf',[xo xf],zbc,optons); plot fnal functon values plot(xs,zs(:,1),'lnewdth',),grd ttle('shoota: Shootng Method for ODEs (Case - Automated Iteraton)') xlabel('x values'),ylabel('y values') end demo Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

17 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 17 Basc Concepts The Fnte Dfference Method The Fnte Dfference (FD) method essentally converts the ODE nto a coupled set of algebrac equatons, wth one balance equaton for each fnte volume or node n the system. The general technque s to replace the contnuous dervatves wthn the ODE wth fnte dfference approxmatons on a grd of mesh ponts that spans the doman of nterest. The boundary nodes are treated as specal cases. The coupled set of equatons that results can then be solved by a varety of technques (see Secton VI - Numercal Soluton of Algebrac Equatons). A smple algorthm for the basc FD method (for lnear systems) s outlned as follows: 1. Convert contnuous varables to dscrete varables. Note that the mesh grd or nodal scheme for the ndependent varable may be evenly spaced (usually gves a relatvely smple formulaton) or set on an uneven grd (resultant equatons are usually slghtly more complex), as necessary.. Approxmate the dervatves at each pont usng formulae derved from a formal Taylor Seres expanson usng the most accurate approxmaton avalable that s consstent wth the gven problem. 3. Treat the boundary ponts separately, beng careful to get the best approxmaton as possble to the desred BCs. 4. Solve the resultant set of coupled equatons usng ether drect or teratve schemes as approprate for the problem. If the orgnal ODE s nonlnear the above procedure s stll vald, except an addtonal outer teraton s needed n the overall soluton strategy. Hghly nonlnear problems are often dffcult to converge, but mldly nonlnear or varable coeffcent problems are usually solvable usng a smple outer teraton scheme. Ths secton of notes frst revews the basc Taylor Seres and the development of several dervatve approxmatons, and then llustrates the FD method va an example. Dervatve Approxmatons Usng Taylor Seres A key step n the Fnte Dfference method s to replace the contnuous dervatves n the orgnal ODE wth approprate approxmatons n terms of the dependent varable evaluated at dfferent mesh ponts n the regon of nterest. The bass for dong ths s related to the Taylor Seres expanson for a functon n the vcnty of some dscrete pont, x. To formalze ths dscusson, let s start by defnng a dscrete notaton for both the ndependent and dependent varables. For the ndependent varable we smply evaluate the contnuous varable x at dscrete ponts x. If the doman of nterest s broken nto evenly spaced nodes, then x = x + h and x = x h where h = x (5.16) For the dependent varable, f(x), the dscrete representaton becomes f x f, f x + h f, f x h f, etc. (5.17) Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

18 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 18 Then, from the Taylor Seres we have 3 f''h f'''h + 1= (5.18) f f f 'h! 3! 3 f '' h f ''' h 1= + + (5.19) f f f 'h! 3! These two equatons can be used to derve several common dervatve approxmatons, as follows: Frst Dervatve Approxmatons Forward Dfference Approxmaton - use eqn. (5.18) drectly to gve f' f+ 1 f = + Oh (5.0) h Backward Dfference Approxmaton - use eqn. (5.19) drectly to gve f' f f h 1 = + Oh (5.1) Central Dfference Approxmaton - subtract eqn. (5.19) from eqn. (5.18) to gve 3 f'''h f+ 1 f 1 f 'h 3! = + + f or + 1 f f' 1 ( = + Oh) (5.) h where we notce that the central dervatve formula s more accurate, wth truncaton errors on the order of h [whch s denoted as O(h )]. Second Dervatve Approxmatons Central Dfference Approxmaton - add eqn. (5.19) to eqn. (5.18) gvng (4) 4 f h f+ 1 f 1 f f ''h 4! + = f or 1 f + f + f'' 1 ( = + Oh ) (5.3) h These frst and second dervatve approxmatons are the most common representatons used when convertng the contnuous ODE nto FD form. There are other formulae that are sometmes used (see the next subsecton), especally when nd order accuracy at the end ponts s desred. Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

19 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 19 Some Addtonal Dervatve Approxmatons Order x Approxmatons for Frst and Second Dervatves Forward Dfference Approxmatons: f' x f'' x f x = f ( x ) + 1 x + f x f x f x = x Backward Dfference Approxmatons: f' x f'' x f x = f ( x ) x 1 + f x f x f x 1 = x (5.4) (5.5) (5.6) (5.7) Order Forward Dfference Approxmatons: f' x f'' x x Approxmatons for Frst and Second Dervatves 3f x + 4f x f x = x f x 5f x 4f x f x = x Backward Dfference Approxmatons: f' x f'' x + 3f x 4f x f x = x f x 5f x 4f x f x 1 3 = x Central Dfference Approxmatons: f' x f'' x f x = f ( x ) x f x + f x + f x x 1 1 = The above dervatve approxmatons [eqns. (5.0) - (5.33)] represent a good nventory of formulae for use n the FD method. Many other formulae are also avalable, snce there are a varety of schemes and assumptons that can be used n the development of such formulae. (5.8) (5.9) (5.30) (5.31) (5.3) (5.33) As an example, let s derve the forward approxmaton for f wth error O(h ) as gven above n eqn. (5.8). We start wth Taylor Seres expansons for f +1 and f +, whch can be wrtten as Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

20 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 0 3 h h f+ 1= f + f ' h + f '' + f ''' + (5.34) 6 3 4h 8h + f = f+ f'h + f'' + f''' + (5.35) 6 Now let s elmnate the second dervatve term by multplyng eqn. (5.34) by 4 and subtractng eqn. (5.35) from the result, gvng 4 3 4f+ 1 f+ = 3f + f ' h f ''' h + (5.36) 6 Solvng ths expresson for f gves f' 3f + 4f f h = + Oh whch s the same result as gven above. Ths s only one example - however, many specal purpose formulae can be derved as needed followng the general scheme llustrated here. Example 5. llustrates the use of some of these dervatve formulae as appled to the same - pont BVP as gven n Example 5.1 (wth soluton based on the Shootng Method). Ths FD example also emphaszes the mportance of usng the best dervatve approxmaton avalable -- for most applcatons one should use the dervatve formulae that are accurate to second order (rather than a frst order approxmaton). A practcal problem that nvolves heat transfer n a crcular fn geometry s also gven n Example 5.3B. Ths problem s smply another example of the use of the Fnte Dfference method for lnear BVPs (see Example 5.3A for soluton of the same problem va the Shootng Method). Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

21 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 1 Problem Descrpton: Example 5. - The Fnte Dfference Method (Example 5.1 Revsted) Solve the followng -pont BVP usng the FD method: y'' + 3xy' + 7y= cos(x) wth y( 0) = 1 and y( π ) = 0 Problem Soluton: 1. Let s start by defnng the dscrete geometry of nterest and by dscretzng the dependent and ndependent varables usng a unform mesh grd, x x and x = x + x + 1 y(x) y x = y, y'(x) y' x = y', etc. Here we want to be sure to start numberng the nodal ponts at the frst unknown value, as llustrated n the sketch. Note that, n ths case, snce both endpont values, y(p 1 ) and y(p ), are known, the number of unknowns s one less than the number of mesh ntervals. If we let N be the number of unknowns n the problem (N = 4 n the sketch), then the spatal ncrement can be determned by xf x h = x = N+ 1 o Also, for ths case, we can easly set the vector of ndependent varables usng Matlab s colon operator as x = xo+dx:dx:xf-dx where, of course, dx would be the Matlab varable for x, xo means x o, etc... Wth a dscrete geometry and dscretzed varables, we then replace the dervatves at dscrete ponts wth fnte dfference approxmatons (from the Taylor Seres). Here one should always use the most accurate representaton that s approprate for the problem at hand. Ths pont s llustrated below by comparng two dfferent approxmatons for y (Case A uses a hgh order approxmaton and Case B uses a low order representaton). 3. Fnally, we put the equatons for each node or mesh n matrx form and solve usng some lnear equaton solver (drect or teratve method). In the examples below we use Matlab s standard equaton solver (va the backslash operator), whch s an mplementaton of an LU Decomposton method (a drect elmnaton scheme). Case A -- Hgh Order Approxmaton For ths case let s use the central FD approxmatons n Step for both y and y, or y y + y y y y'' = and y' = x x Therefore, substtutng these nto the dscrete form of the orgnal ODE, we have Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

22 Math Methods -- Secton V: General Boundary Value Problems (BVPs) y'' + 3xy' + 7y = cosx y 1 y+ y+ 1 y+ 1 y 1 + 3x + 7y = cos x x x Rearrangng the expresson, one has the followng relatonshp for each nteror node n the doman of nterest: ( x ) 3x x 3x x 1 y x y+ 1+ y+ 1= x cos Therefore, for the general nternal node (row corresponds to the balance equaton for the th node), we have 3x x ( ) = A, 1 1 = + = A, 7 x and b() x cos x 3x x ( + ) = + A, 1 1 where the A(, j) and b() notaton s consstent wth the matrx representaton used wthn the Matlab code. For the boundary nodes, we have to ncorporate specfc nformaton about the boundary condtons for the problem. Ths example s partcularly straghtforward snce the functon values at both endponts are specfed. Ths says that y 0 and y N+1 are known quanttes, where N represents the number of dscrete unknowns n the problem. Thus, the balance equaton for the frst and last nodal volumes can be wrtten as follows: Left Boundary: For = 1, y = y = yxo (n the code). Therefore, the balance equaton s wrtten as ( 1) Rght Boundary: For = N, 3x x 3x x = x y 1 y x cos x 1 yxo y = y = yxf (n code). Therefore, the balance equaton becomes + 1 N+ 1 3x N x 3x N x 1 yn x yn= x cos xn 1+ yxf Now, for the specfc case of N = 4, we can wrte out the resultant four explct equatons, as follows: 3x1 x 3x1 x + 7 x y1+ 1+ y = x cos x1 1 yxo for = 1: Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

23 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 3 3x x 3x x for = : 1 y + ( + 7 x ) y + 1+ y = x cos( x ) 1 3 3x x 3x x for = 3: 1 3 y + ( + 7 x ) y y = x cos( x ) 3 4 3x x 3x x + + = + for = 4: y3 7 x y4 x cos x4 1 yxf Fnally, these four coupled equatons wth four unknowns (or for the general case, N equatons and N unknowns) can be put nto matrx form and solved n Matlab. The fnal form of the equatons s Ay = b where y s the desred soluton vector. The Matlab fle fd.m mplements ths example and t also looks at the senstvty of the soluton to the number of mesh used (.e. mesh sze, x ). It also has a comparson to Case B, whch only uses a forward approxmaton to y. Case B -- Low Order Approxmaton Just to llustrate the strong dependence on the accuracy of the dervatve approxmatons used, we redevelop the above formulaton usng the forward dfference approxmaton for y whch s accurate to only frst order (nstead of the central approxmaton whch s accurate to second order). Thus, the dscrete representaton for y for ths case s y y' = y x + 1 Usng ths relaton, the dscrete form of the orgnal ODE becomes y-1 y+ y+ 1 y+ 1 y + 3x + 7y = cos x x x or ( + ) + ( + ) = ( y 3x x 7 x y 1 3x x y x cos x Also for the frst node, = 1, we have ( 1 ) 1 ( 1 ) ( 1) + 3x x 7 x y x x y = x cos x yxo and for the last node, = N, the balance equaton becomes ( N ) ( N) yn 1 + 3x x 7 x yn = x cos x 1 + 3x N x yxf These equatons are also mplemented nto Matlab fle fd.m and drect comparsons wth Case A are made. ) 3 Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

24 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 4 The Matlab Fles The above two FD formulatons for ths problem are mplemented nto Matlab fle fd.m. Ths fle s set up to loop over four dfferent values of N to evaluate the senstvty to mesh sze. For each N, both Cases A and B are solved, and the resultant soluton profles, y(x), are compared. The results for each value of N are plotted wthn one of four subplots. When complete, these four subplots represent a complete summary of the data for ths problem and they are dsplayed n a sngle Matlab plot n Fg 5.4. Fg. 5.4 Soluton profles for Case A and Case B for varous mesh structures. From the above fgure t s easy to see that the Case A and Case B results dffer, but they get progressvely closer as the number of mesh ntervals s ncreased ( x s decreased). Also t should be clear that Case A has essentally found the correct soluton wth about 40 mesh ponts, and that Case B s stll not exact wth 160 ponts. Ths should llustrate ncely the fact that the best approxmatons should always be used. In ths comparson, y has an approxmaton wth error O(h ) for Case A and O(h) for Case B, and clearly ths has a sgnfcant effect on the accuracy n the FD calculaton for a fxed mesh sze. The Matlab fles assocated wth ths example are gven n Tables 5.7 and 5.8. The base fd.m program s gven n Table 5.7 and the student s encouraged to study ths as an example of how to mplement the Fnte Dfference (FD) method wthn a Matlab scrpt fle. Also note that, n a typcal applcaton, only Case A would be mplemented and the loop over several dfferent values of N can be elmnated. Thus, wth only a few modfcatons, fd.m can be streamlned nto a very short and easy-to-follow example of the FD method n Matlab. Ths edtng has been done and Table 5.8 contans the resultant code wthn fle fds.m. The fnal soluton from fds.m for Case A wth 80 mesh ponts s plotted n Fg. 5.5, and ths s clearly the same soluton that Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

25 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 5 was obtaned va the Shootng Method (see Fg. 5.3 n the prevous subsecton). Ether Matlab fle, fd.m or fds.m, can be used as a typcal example of the Fnte Dfference Method appled to a second order non-homogeneous lnear BVP. The student s also referred to Example 5.3B whch represents another example of the fnte dfference method to lnear BVPs. Ths problem deals wth conducton heat transfer n a crcular fn arrangement. Fg. 5.5 Fnal soluton profle from fds.m for Case A wth 80 mesh. Table 5.7 Lstng of Matlab program fd.m. FD.M Example of Fnte Dfference Method for Solvng ODEs Ths demo uses the fnte dfference technque as the soluton method for a partcular ODE. The mesh nterval s constant. Two dfferent approxmatons for the frst dervatve are used. Ths comparson demonstrates that the best approxmaton for the dervatve terms leads to a more effcent numercal scheme. One should always use the best approxmaton avalable for the gven problem! The senstvty to mesh sze s also addressed by loopng over four dfferent values of N (number of unknowns n the problem). Descrpton of gven dfferental equaton y'' + 3xy' + 7y = cos(x) wth y(0) = 1 and y(p) = 0 A related Matlab fle, FDS.M, s also avalable (ths contans a smple verson of ths example - Case A only - wth no mesh senstvty study). Fle prepared by J. R. Whte, UMass-Lowell (Aug. 003). gettng started clear all, close all, nfg = 0; set doman lmts and boundary condtons Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

26 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 6 xo = 0; xf = p; yxo = 1; yxf = 0; loop over four values of N to evaluate senstvty to mesh sze NN = [ ]; for n = 1:4 N = NN(n); compute nterval sze and dscrete x vector dx = (xf-xo)/(n+1); dx = dx*dx; x = (xo+dx):dx:(xf-dx); Approxmatons: y'' = [y(-1) - y() + y(+1)]/(dx^) error => (dx^) (Case A) y' = [y(+1) - y(-1)]/(dx) error => (dx^) setup matrx eqns. (treat boundary terms as specal cases) a = zeros(n,n); b = zeros(n,1); for = :N-1 a(,-1) = 1-3*x()*dx/; a(,) = -+7*dx; a(,+1) = 1+3*x()*dx/; b() = dx*cos(*x()); end left boundary a(1,1) = -+7*dx; a(1,) = 1+3*x(1)*dx/; b(1) = dx*cos(*x(1))-(1-3*x(1)*dx/)*yxo; rght boundary a(n,n-1) = 1-3*x(N)*dx/; a(n,n) = -+7*dx; b(n) = dx*cos(*x(n))-(1+3*x(n)*dx/)*yxf; solve system of eqns y = a\b; add boundary ponts to soluton for plottng za = [yxo y' yxf]; xa = [xo x xf]; Approxmatons: y'' = [y(-1) - y() + y(+1)]/(dx^) error => (dx^) (Case B) y' = [y(+1) - y()]/(dx) error => (dx) setup matrx eqns. (treat boundary terms as specal cases) a = zeros(n,n); b = zeros(n,1); for = :N-1 a(,-1) = 1; a(,) = -(+3*x()*dx-7*dx); a(,+1) = 1+3*x()*dx; b() = dx*cos(*x()); end left boundary a(1,1) = -(+3*x(1)*dx-7*dx); a(1,) = 1+3*x(1)*dx; b(1) = dx*cos(*x(1))-yxo; rght boundary a(n,n-1) = 1; a(n,n) = -(+3*x(N)*dx-7*dx); b(n) = dx*cos(*x(n))-(1+3*x(n)*dx)*yxf; solve system of eqns y = a\b; add boundary ponts to soluton for plottng zb = [yxo y' yxf]; xb = [xo x xf]; plot results for both cases t = '0+n'; subplot(eval(t)),plot(xa,za,'r-',xb,zb,'g--','lnewdth',) axs([ ]); ttle(['fd: FD Method (',numstr(n),' pts)']) xlabel('x values'),ylabel('y values'),grd legend('case A','Case B') end end of demo Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

27 Math Methods -- Secton V: General Boundary Value Problems (BVPs) 7 Table 5.8 Lstng of Matlab program fds.m. FDS.M Example of Fnte Dfference Method for Solvng ODEs Ths demo uses the fnte dfference technque as the soluton method for a partcular ODE. The mesh nterval s constant. Descrpton of gven dfferental equaton y'' + 3xy' + 7y = cos(x) wth y(0) = 1 and y(p) = 0 A related Matlab fle, FD.M, s also avalable (ths contans a more detaled verson of ths example - compares two dfferent approxmatons for y' and performs a mesh senstvty study). Fle prepared by J. R. Whte, UMass-Lowell (Aug. 003). gettng started clear all, close all, nfg = 0; set doman lmts and boundary condtons xo = 0; xf = p; yxo = 1; yxf = 0; user defned number of unknowns n problem N = nput('input number of unknowns n problem (N): '); compute nterval sze and dscrete x vector dx = (xf-xo)/(n+1); dx = dx*dx; x = (xo+dx):dx:(xf-dx); Approxmatons: y'' = [y(-1) - y() + y(+1)]/(dx^) error => (dx^) (Case A) y' = [y(+1) - y(-1)]/(dx) error => (dx^) setup matrx eqns. (treat boundary terms as specal cases) a = zeros(n,n); b = zeros(n,1); for = :N-1 a(,-1) = 1-3*x()*dx/; a(,) = -+7*dx; a(,+1) = 1+3*x()*dx/; b() = dx*cos(*x()); end left boundary a(1,1) = -+7*dx; a(1,) = 1+3*x(1)*dx/; b(1) = dx*cos(*x(1))-(1-3*x(1)*dx/)*yxo; rght boundary a(n,n-1) = 1-3*x(N)*dx/; a(n,n) = -+7*dx; b(n) = dx*cos(*x(n))-(1+3*x(n)*dx/)*yxf; solve system of eqns y = a\b; add boundary ponts to soluton for plottng za = [yxo y' yxf]; xa = [xo x xf]; plot results nfg = nfg+1; fgure(nfg) plot(xa,za,'r-','lnewdth',) axs([ ]); ttle(['fds: FD Method for Case A (',numstr(n),' pts)']) xlabel('x values'),ylabel('y values'),grd end of demo Lecture Notes for Math Methods by Dr. John R. Whte, UMass-Lowell (updated Aug. 003)

NUMERICAL DIFFERENTIATION

NUMERICAL DIFFERENTIATION NUMERICAL DIFFERENTIATION 1 Introducton Dfferentaton s a method to compute the rate at whch a dependent output y changes wth respect to the change n the ndependent nput x. Ths rate of change s called the

More information

Chapter 12. Ordinary Differential Equation Boundary Value (BV) Problems

Chapter 12. Ordinary Differential Equation Boundary Value (BV) Problems Chapter. Ordnar Dfferental Equaton Boundar Value (BV) Problems In ths chapter we wll learn how to solve ODE boundar value problem. BV ODE s usuall gven wth x beng the ndependent space varable. p( x) q(

More information

Numerical Heat and Mass Transfer

Numerical Heat and Mass Transfer Master degree n Mechancal Engneerng Numercal Heat and Mass Transfer 06-Fnte-Dfference Method (One-dmensonal, steady state heat conducton) Fausto Arpno f.arpno@uncas.t Introducton Why we use models and

More information

CHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE

CHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE CHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE Analytcal soluton s usually not possble when exctaton vares arbtrarly wth tme or f the system s nonlnear. Such problems can be solved by numercal tmesteppng

More information

Chapter 5. Solution of System of Linear Equations. Module No. 6. Solution of Inconsistent and Ill Conditioned Systems

Chapter 5. Solution of System of Linear Equations. Module No. 6. Solution of Inconsistent and Ill Conditioned Systems Numercal Analyss by Dr. Anta Pal Assstant Professor Department of Mathematcs Natonal Insttute of Technology Durgapur Durgapur-713209 emal: anta.bue@gmal.com 1 . Chapter 5 Soluton of System of Lnear Equatons

More information

Lecture 21: Numerical methods for pricing American type derivatives

Lecture 21: Numerical methods for pricing American type derivatives Lecture 21: Numercal methods for prcng Amercan type dervatves Xaoguang Wang STAT 598W Aprl 10th, 2014 (STAT 598W) Lecture 21 1 / 26 Outlne 1 Fnte Dfference Method Explct Method Penalty Method (STAT 598W)

More information

NON-CENTRAL 7-POINT FORMULA IN THE METHOD OF LINES FOR PARABOLIC AND BURGERS' EQUATIONS

NON-CENTRAL 7-POINT FORMULA IN THE METHOD OF LINES FOR PARABOLIC AND BURGERS' EQUATIONS IJRRAS 8 (3 September 011 www.arpapress.com/volumes/vol8issue3/ijrras_8_3_08.pdf NON-CENTRAL 7-POINT FORMULA IN THE METHOD OF LINES FOR PARABOLIC AND BURGERS' EQUATIONS H.O. Bakodah Dept. of Mathematc

More information

Difference Equations

Difference Equations Dfference Equatons c Jan Vrbk 1 Bascs Suppose a sequence of numbers, say a 0,a 1,a,a 3,... s defned by a certan general relatonshp between, say, three consecutve values of the sequence, e.g. a + +3a +1

More information

EEE 241: Linear Systems

EEE 241: Linear Systems EEE : Lnear Systems Summary #: Backpropagaton BACKPROPAGATION The perceptron rule as well as the Wdrow Hoff learnng were desgned to tran sngle layer networks. They suffer from the same dsadvantage: they

More information

Module 3 LOSSY IMAGE COMPRESSION SYSTEMS. Version 2 ECE IIT, Kharagpur

Module 3 LOSSY IMAGE COMPRESSION SYSTEMS. Version 2 ECE IIT, Kharagpur Module 3 LOSSY IMAGE COMPRESSION SYSTEMS Verson ECE IIT, Kharagpur Lesson 6 Theory of Quantzaton Verson ECE IIT, Kharagpur Instructonal Objectves At the end of ths lesson, the students should be able to:

More information

Lecture 12: Discrete Laplacian

Lecture 12: Discrete Laplacian Lecture 12: Dscrete Laplacan Scrbe: Tanye Lu Our goal s to come up wth a dscrete verson of Laplacan operator for trangulated surfaces, so that we can use t n practce to solve related problems We are mostly

More information

Introduction to Vapor/Liquid Equilibrium, part 2. Raoult s Law:

Introduction to Vapor/Liquid Equilibrium, part 2. Raoult s Law: CE304, Sprng 2004 Lecture 4 Introducton to Vapor/Lqud Equlbrum, part 2 Raoult s Law: The smplest model that allows us do VLE calculatons s obtaned when we assume that the vapor phase s an deal gas, and

More information

Errors for Linear Systems

Errors for Linear Systems Errors for Lnear Systems When we solve a lnear system Ax b we often do not know A and b exactly, but have only approxmatons  and ˆb avalable. Then the best thng we can do s to solve ˆx ˆb exactly whch

More information

Lectures - Week 4 Matrix norms, Conditioning, Vector Spaces, Linear Independence, Spanning sets and Basis, Null space and Range of a Matrix

Lectures - Week 4 Matrix norms, Conditioning, Vector Spaces, Linear Independence, Spanning sets and Basis, Null space and Range of a Matrix Lectures - Week 4 Matrx norms, Condtonng, Vector Spaces, Lnear Independence, Spannng sets and Bass, Null space and Range of a Matrx Matrx Norms Now we turn to assocatng a number to each matrx. We could

More information

LINEAR REGRESSION ANALYSIS. MODULE IX Lecture Multicollinearity

LINEAR REGRESSION ANALYSIS. MODULE IX Lecture Multicollinearity LINEAR REGRESSION ANALYSIS MODULE IX Lecture - 30 Multcollnearty Dr. Shalabh Department of Mathematcs and Statstcs Indan Insttute of Technology Kanpur 2 Remedes for multcollnearty Varous technques have

More information

Structure and Drive Paul A. Jensen Copyright July 20, 2003

Structure and Drive Paul A. Jensen Copyright July 20, 2003 Structure and Drve Paul A. Jensen Copyrght July 20, 2003 A system s made up of several operatons wth flow passng between them. The structure of the system descrbes the flow paths from nputs to outputs.

More information

4DVAR, according to the name, is a four-dimensional variational method.

4DVAR, according to the name, is a four-dimensional variational method. 4D-Varatonal Data Assmlaton (4D-Var) 4DVAR, accordng to the name, s a four-dmensonal varatonal method. 4D-Var s actually a drect generalzaton of 3D-Var to handle observatons that are dstrbuted n tme. The

More information

MMA and GCMMA two methods for nonlinear optimization

MMA and GCMMA two methods for nonlinear optimization MMA and GCMMA two methods for nonlnear optmzaton Krster Svanberg Optmzaton and Systems Theory, KTH, Stockholm, Sweden. krlle@math.kth.se Ths note descrbes the algorthms used n the author s 2007 mplementatons

More information

ME 501A Seminar in Engineering Analysis Page 1

ME 501A Seminar in Engineering Analysis Page 1 umercal Solutons of oundary-value Problems n Os ovember 7, 7 umercal Solutons of oundary- Value Problems n Os Larry aretto Mechancal ngneerng 5 Semnar n ngneerng nalyss ovember 7, 7 Outlne Revew stff equaton

More information

More metrics on cartesian products

More metrics on cartesian products More metrcs on cartesan products If (X, d ) are metrc spaces for 1 n, then n Secton II4 of the lecture notes we defned three metrcs on X whose underlyng topologes are the product topology The purpose of

More information

Transfer Functions. Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: ( ) system

Transfer Functions. Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: ( ) system Transfer Functons Convenent representaton of a lnear, dynamc model. A transfer functon (TF) relates one nput and one output: x t X s y t system Y s The followng termnology s used: x y nput output forcng

More information

One-sided finite-difference approximations suitable for use with Richardson extrapolation

One-sided finite-difference approximations suitable for use with Richardson extrapolation Journal of Computatonal Physcs 219 (2006) 13 20 Short note One-sded fnte-dfference approxmatons sutable for use wth Rchardson extrapolaton Kumar Rahul, S.N. Bhattacharyya * Department of Mechancal Engneerng,

More information

Inner Product. Euclidean Space. Orthonormal Basis. Orthogonal

Inner Product. Euclidean Space. Orthonormal Basis. Orthogonal Inner Product Defnton 1 () A Eucldean space s a fnte-dmensonal vector space over the reals R, wth an nner product,. Defnton 2 (Inner Product) An nner product, on a real vector space X s a symmetrc, blnear,

More information

Kernel Methods and SVMs Extension

Kernel Methods and SVMs Extension Kernel Methods and SVMs Extenson The purpose of ths document s to revew materal covered n Machne Learnng 1 Supervsed Learnng regardng support vector machnes (SVMs). Ths document also provdes a general

More information

FTCS Solution to the Heat Equation

FTCS Solution to the Heat Equation FTCS Soluton to the Heat Equaton ME 448/548 Notes Gerald Recktenwald Portland State Unversty Department of Mechancal Engneerng gerry@pdx.edu ME 448/548: FTCS Soluton to the Heat Equaton Overvew 1. Use

More information

CSci 6974 and ECSE 6966 Math. Tech. for Vision, Graphics and Robotics Lecture 21, April 17, 2006 Estimating A Plane Homography

CSci 6974 and ECSE 6966 Math. Tech. for Vision, Graphics and Robotics Lecture 21, April 17, 2006 Estimating A Plane Homography CSc 6974 and ECSE 6966 Math. Tech. for Vson, Graphcs and Robotcs Lecture 21, Aprl 17, 2006 Estmatng A Plane Homography Overvew We contnue wth a dscusson of the major ssues, usng estmaton of plane projectve

More information

Linear Approximation with Regularization and Moving Least Squares

Linear Approximation with Regularization and Moving Least Squares Lnear Approxmaton wth Regularzaton and Movng Least Squares Igor Grešovn May 007 Revson 4.6 (Revson : March 004). 5 4 3 0.5 3 3.5 4 Contents: Lnear Fttng...4. Weghted Least Squares n Functon Approxmaton...

More information

2 Finite difference basics

2 Finite difference basics Numersche Methoden 1, WS 11/12 B.J.P. Kaus 2 Fnte dfference bascs Consder the one- The bascs of the fnte dfference method are best understood wth an example. dmensonal transent heat conducton equaton T

More information

Foundations of Arithmetic

Foundations of Arithmetic Foundatons of Arthmetc Notaton We shall denote the sum and product of numbers n the usual notaton as a 2 + a 2 + a 3 + + a = a, a 1 a 2 a 3 a = a The notaton a b means a dvdes b,.e. ac = b where c s an

More information

New Method for Solving Poisson Equation. on Irregular Domains

New Method for Solving Poisson Equation. on Irregular Domains Appled Mathematcal Scences Vol. 6 01 no. 8 369 380 New Method for Solvng Posson Equaton on Irregular Domans J. Izadan and N. Karamooz Department of Mathematcs Facult of Scences Mashhad BranchIslamc Azad

More information

DUE: WEDS FEB 21ST 2018

DUE: WEDS FEB 21ST 2018 HOMEWORK # 1: FINITE DIFFERENCES IN ONE DIMENSION DUE: WEDS FEB 21ST 2018 1. Theory Beam bendng s a classcal engneerng analyss. The tradtonal soluton technque makes smplfyng assumptons such as a constant

More information

The Multiple Classical Linear Regression Model (CLRM): Specification and Assumptions. 1. Introduction

The Multiple Classical Linear Regression Model (CLRM): Specification and Assumptions. 1. Introduction ECONOMICS 5* -- NOTE (Summary) ECON 5* -- NOTE The Multple Classcal Lnear Regresson Model (CLRM): Specfcaton and Assumptons. Introducton CLRM stands for the Classcal Lnear Regresson Model. The CLRM s also

More information

Econ107 Applied Econometrics Topic 3: Classical Model (Studenmund, Chapter 4)

Econ107 Applied Econometrics Topic 3: Classical Model (Studenmund, Chapter 4) I. Classcal Assumptons Econ7 Appled Econometrcs Topc 3: Classcal Model (Studenmund, Chapter 4) We have defned OLS and studed some algebrac propertes of OLS. In ths topc we wll study statstcal propertes

More information

Numerical Solution of Ordinary Differential Equations

Numerical Solution of Ordinary Differential Equations Numercal Methods (CENG 00) CHAPTER-VI Numercal Soluton of Ordnar Dfferental Equatons 6 Introducton Dfferental equatons are equatons composed of an unknown functon and ts dervatves The followng are examples

More information

The Finite Element Method

The Finite Element Method The Fnte Element Method GENERAL INTRODUCTION Read: Chapters 1 and 2 CONTENTS Engneerng and analyss Smulaton of a physcal process Examples mathematcal model development Approxmate solutons and methods of

More information

Appendix B. The Finite Difference Scheme

Appendix B. The Finite Difference Scheme 140 APPENDIXES Appendx B. The Fnte Dfference Scheme In ths appendx we present numercal technques whch are used to approxmate solutons of system 3.1 3.3. A comprehensve treatment of theoretcal and mplementaton

More information

Integrals and Invariants of Euler-Lagrange Equations

Integrals and Invariants of Euler-Lagrange Equations Lecture 16 Integrals and Invarants of Euler-Lagrange Equatons ME 256 at the Indan Insttute of Scence, Bengaluru Varatonal Methods and Structural Optmzaton G. K. Ananthasuresh Professor, Mechancal Engneerng,

More information

Consistency & Convergence

Consistency & Convergence /9/007 CHE 374 Computatonal Methods n Engneerng Ordnary Dfferental Equatons Consstency, Convergence, Stablty, Stffness and Adaptve and Implct Methods ODE s n MATLAB, etc Consstency & Convergence Consstency

More information

For now, let us focus on a specific model of neurons. These are simplified from reality but can achieve remarkable results.

For now, let us focus on a specific model of neurons. These are simplified from reality but can achieve remarkable results. Neural Networks : Dervaton compled by Alvn Wan from Professor Jtendra Malk s lecture Ths type of computaton s called deep learnng and s the most popular method for many problems, such as computer vson

More information

Linear Feature Engineering 11

Linear Feature Engineering 11 Lnear Feature Engneerng 11 2 Least-Squares 2.1 Smple least-squares Consder the followng dataset. We have a bunch of nputs x and correspondng outputs y. The partcular values n ths dataset are x y 0.23 0.19

More information

Note 10. Modeling and Simulation of Dynamic Systems

Note 10. Modeling and Simulation of Dynamic Systems Lecture Notes of ME 475: Introducton to Mechatroncs Note 0 Modelng and Smulaton of Dynamc Systems Department of Mechancal Engneerng, Unversty Of Saskatchewan, 57 Campus Drve, Saskatoon, SK S7N 5A9, Canada

More information

Canonical transformations

Canonical transformations Canoncal transformatons November 23, 2014 Recall that we have defned a symplectc transformaton to be any lnear transformaton M A B leavng the symplectc form nvarant, Ω AB M A CM B DΩ CD Coordnate transformatons,

More information

Finite Element Modelling of truss/cable structures

Finite Element Modelling of truss/cable structures Pet Schreurs Endhoven Unversty of echnology Department of Mechancal Engneerng Materals echnology November 3, 214 Fnte Element Modellng of truss/cable structures 1 Fnte Element Analyss of prestressed structures

More information

Additional Codes using Finite Difference Method. 1 HJB Equation for Consumption-Saving Problem Without Uncertainty

Additional Codes using Finite Difference Method. 1 HJB Equation for Consumption-Saving Problem Without Uncertainty Addtonal Codes usng Fnte Dfference Method Benamn Moll 1 HJB Equaton for Consumpton-Savng Problem Wthout Uncertanty Before consderng the case wth stochastc ncome n http://www.prnceton.edu/~moll/ HACTproect/HACT_Numercal_Appendx.pdf,

More information

3.1 Expectation of Functions of Several Random Variables. )' be a k-dimensional discrete or continuous random vector, with joint PMF p (, E X E X1 E X

3.1 Expectation of Functions of Several Random Variables. )' be a k-dimensional discrete or continuous random vector, with joint PMF p (, E X E X1 E X Statstcs 1: Probablty Theory II 37 3 EPECTATION OF SEVERAL RANDOM VARIABLES As n Probablty Theory I, the nterest n most stuatons les not on the actual dstrbuton of a random vector, but rather on a number

More information

Lecture Notes on Linear Regression

Lecture Notes on Linear Regression Lecture Notes on Lnear Regresson Feng L fl@sdueducn Shandong Unversty, Chna Lnear Regresson Problem In regresson problem, we am at predct a contnuous target value gven an nput feature vector We assume

More information

1 GSW Iterative Techniques for y = Ax

1 GSW Iterative Techniques for y = Ax 1 for y = A I m gong to cheat here. here are a lot of teratve technques that can be used to solve the general case of a set of smultaneous equatons (wrtten n the matr form as y = A), but ths chapter sn

More information

Psychology 282 Lecture #24 Outline Regression Diagnostics: Outliers

Psychology 282 Lecture #24 Outline Regression Diagnostics: Outliers Psychology 282 Lecture #24 Outlne Regresson Dagnostcs: Outlers In an earler lecture we studed the statstcal assumptons underlyng the regresson model, ncludng the followng ponts: Formal statement of assumptons.

More information

PHYS 705: Classical Mechanics. Calculus of Variations II

PHYS 705: Classical Mechanics. Calculus of Variations II 1 PHYS 705: Classcal Mechancs Calculus of Varatons II 2 Calculus of Varatons: Generalzaton (no constrant yet) Suppose now that F depends on several dependent varables : We need to fnd such that has a statonary

More information

Analytical Chemistry Calibration Curve Handout

Analytical Chemistry Calibration Curve Handout I. Quck-and Drty Excel Tutoral Analytcal Chemstry Calbraton Curve Handout For those of you wth lttle experence wth Excel, I ve provded some key technques that should help you use the program both for problem

More information

APPENDIX A Some Linear Algebra

APPENDIX A Some Linear Algebra APPENDIX A Some Lnear Algebra The collecton of m, n matrces A.1 Matrces a 1,1,..., a 1,n A = a m,1,..., a m,n wth real elements a,j s denoted by R m,n. If n = 1 then A s called a column vector. Smlarly,

More information

College of Computer & Information Science Fall 2009 Northeastern University 20 October 2009

College of Computer & Information Science Fall 2009 Northeastern University 20 October 2009 College of Computer & Informaton Scence Fall 2009 Northeastern Unversty 20 October 2009 CS7880: Algorthmc Power Tools Scrbe: Jan Wen and Laura Poplawsk Lecture Outlne: Prmal-dual schema Network Desgn:

More information

Generalized Linear Methods

Generalized Linear Methods Generalzed Lnear Methods 1 Introducton In the Ensemble Methods the general dea s that usng a combnaton of several weak learner one could make a better learner. More formally, assume that we have a set

More information

1 Matrix representations of canonical matrices

1 Matrix representations of canonical matrices 1 Matrx representatons of canoncal matrces 2-d rotaton around the orgn: ( ) cos θ sn θ R 0 = sn θ cos θ 3-d rotaton around the x-axs: R x = 1 0 0 0 cos θ sn θ 0 sn θ cos θ 3-d rotaton around the y-axs:

More information

THE CHINESE REMAINDER THEOREM. We should thank the Chinese for their wonderful remainder theorem. Glenn Stevens

THE CHINESE REMAINDER THEOREM. We should thank the Chinese for their wonderful remainder theorem. Glenn Stevens THE CHINESE REMAINDER THEOREM KEITH CONRAD We should thank the Chnese for ther wonderful remander theorem. Glenn Stevens 1. Introducton The Chnese remander theorem says we can unquely solve any par of

More information

Relaxation Methods for Iterative Solution to Linear Systems of Equations

Relaxation Methods for Iterative Solution to Linear Systems of Equations Relaxaton Methods for Iteratve Soluton to Lnear Systems of Equatons Gerald Recktenwald Portland State Unversty Mechancal Engneerng Department gerry@pdx.edu Overvew Techncal topcs Basc Concepts Statonary

More information

6.3.4 Modified Euler s method of integration

6.3.4 Modified Euler s method of integration 6.3.4 Modfed Euler s method of ntegraton Before dscussng the applcaton of Euler s method for solvng the swng equatons, let us frst revew the basc Euler s method of numercal ntegraton. Let the general from

More information

A New Refinement of Jacobi Method for Solution of Linear System Equations AX=b

A New Refinement of Jacobi Method for Solution of Linear System Equations AX=b Int J Contemp Math Scences, Vol 3, 28, no 17, 819-827 A New Refnement of Jacob Method for Soluton of Lnear System Equatons AX=b F Naem Dafchah Department of Mathematcs, Faculty of Scences Unversty of Gulan,

More information

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 16

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 16 STAT 39: MATHEMATICAL COMPUTATIONS I FALL 218 LECTURE 16 1 why teratve methods f we have a lnear system Ax = b where A s very, very large but s ether sparse or structured (eg, banded, Toepltz, banded plus

More information

Grover s Algorithm + Quantum Zeno Effect + Vaidman

Grover s Algorithm + Quantum Zeno Effect + Vaidman Grover s Algorthm + Quantum Zeno Effect + Vadman CS 294-2 Bomb 10/12/04 Fall 2004 Lecture 11 Grover s algorthm Recall that Grover s algorthm for searchng over a space of sze wors as follows: consder the

More information

Global Sensitivity. Tuesday 20 th February, 2018

Global Sensitivity. Tuesday 20 th February, 2018 Global Senstvty Tuesday 2 th February, 28 ) Local Senstvty Most senstvty analyses [] are based on local estmates of senstvty, typcally by expandng the response n a Taylor seres about some specfc values

More information

n α j x j = 0 j=1 has a nontrivial solution. Here A is the n k matrix whose jth column is the vector for all t j=0

n α j x j = 0 j=1 has a nontrivial solution. Here A is the n k matrix whose jth column is the vector for all t j=0 MODULE 2 Topcs: Lnear ndependence, bass and dmenson We have seen that f n a set of vectors one vector s a lnear combnaton of the remanng vectors n the set then the span of the set s unchanged f that vector

More information

Some modelling aspects for the Matlab implementation of MMA

Some modelling aspects for the Matlab implementation of MMA Some modellng aspects for the Matlab mplementaton of MMA Krster Svanberg krlle@math.kth.se Optmzaton and Systems Theory Department of Mathematcs KTH, SE 10044 Stockholm September 2004 1. Consdered optmzaton

More information

Lecture 13 APPROXIMATION OF SECOMD ORDER DERIVATIVES

Lecture 13 APPROXIMATION OF SECOMD ORDER DERIVATIVES COMPUTATIONAL FLUID DYNAMICS: FDM: Appromaton of Second Order Dervatves Lecture APPROXIMATION OF SECOMD ORDER DERIVATIVES. APPROXIMATION OF SECOND ORDER DERIVATIVES Second order dervatves appear n dffusve

More information

Problem Set 9 Solutions

Problem Set 9 Solutions Desgn and Analyss of Algorthms May 4, 2015 Massachusetts Insttute of Technology 6.046J/18.410J Profs. Erk Demane, Srn Devadas, and Nancy Lynch Problem Set 9 Solutons Problem Set 9 Solutons Ths problem

More information

Example: (13320, 22140) =? Solution #1: The divisors of are 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 27, 30, 36, 41,

Example: (13320, 22140) =? Solution #1: The divisors of are 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 27, 30, 36, 41, The greatest common dvsor of two ntegers a and b (not both zero) s the largest nteger whch s a common factor of both a and b. We denote ths number by gcd(a, b), or smply (a, b) when there s no confuson

More information

Formulas for the Determinant

Formulas for the Determinant page 224 224 CHAPTER 3 Determnants e t te t e 2t 38 A = e t 2te t e 2t e t te t 2e 2t 39 If 123 A = 345, 456 compute the matrx product A adj(a) What can you conclude about det(a)? For Problems 40 43, use

More information

Lecture 10 Support Vector Machines II

Lecture 10 Support Vector Machines II Lecture 10 Support Vector Machnes II 22 February 2016 Taylor B. Arnold Yale Statstcs STAT 365/665 1/28 Notes: Problem 3 s posted and due ths upcomng Frday There was an early bug n the fake-test data; fxed

More information

A Hybrid Variational Iteration Method for Blasius Equation

A Hybrid Variational Iteration Method for Blasius Equation Avalable at http://pvamu.edu/aam Appl. Appl. Math. ISSN: 1932-9466 Vol. 10, Issue 1 (June 2015), pp. 223-229 Applcatons and Appled Mathematcs: An Internatonal Journal (AAM) A Hybrd Varatonal Iteraton Method

More information

Bézier curves. Michael S. Floater. September 10, These notes provide an introduction to Bézier curves. i=0

Bézier curves. Michael S. Floater. September 10, These notes provide an introduction to Bézier curves. i=0 Bézer curves Mchael S. Floater September 1, 215 These notes provde an ntroducton to Bézer curves. 1 Bernsten polynomals Recall that a real polynomal of a real varable x R, wth degree n, s a functon of

More information

ALGORITHM FOR THE CALCULATION OF THE TWO VARIABLES CUBIC SPLINE FUNCTION

ALGORITHM FOR THE CALCULATION OF THE TWO VARIABLES CUBIC SPLINE FUNCTION ANALELE ŞTIINŢIFICE ALE UNIVERSITĂŢII AL.I. CUZA DIN IAŞI (S.N.) MATEMATICĂ, Tomul LIX, 013, f.1 DOI: 10.478/v10157-01-00-y ALGORITHM FOR THE CALCULATION OF THE TWO VARIABLES CUBIC SPLINE FUNCTION BY ION

More information

36.1 Why is it important to be able to find roots to systems of equations? Up to this point, we have discussed how to find the solution to

36.1 Why is it important to be able to find roots to systems of equations? Up to this point, we have discussed how to find the solution to ChE Lecture Notes - D. Keer, 5/9/98 Lecture 6,7,8 - Rootndng n systems o equatons (A) Theory (B) Problems (C) MATLAB Applcatons Tet: Supplementary notes rom Instructor 6. Why s t mportant to be able to

More information

Workshop: Approximating energies and wave functions Quantum aspects of physical chemistry

Workshop: Approximating energies and wave functions Quantum aspects of physical chemistry Workshop: Approxmatng energes and wave functons Quantum aspects of physcal chemstry http://quantum.bu.edu/pltl/6/6.pdf Last updated Thursday, November 7, 25 7:9:5-5: Copyrght 25 Dan Dll (dan@bu.edu) Department

More information

Limited Dependent Variables

Limited Dependent Variables Lmted Dependent Varables. What f the left-hand sde varable s not a contnuous thng spread from mnus nfnty to plus nfnty? That s, gven a model = f (, β, ε, where a. s bounded below at zero, such as wages

More information

Solving Nonlinear Differential Equations by a Neural Network Method

Solving Nonlinear Differential Equations by a Neural Network Method Solvng Nonlnear Dfferental Equatons by a Neural Network Method Luce P. Aarts and Peter Van der Veer Delft Unversty of Technology, Faculty of Cvlengneerng and Geoscences, Secton of Cvlengneerng Informatcs,

More information

Bezier curves. Michael S. Floater. August 25, These notes provide an introduction to Bezier curves. i=0

Bezier curves. Michael S. Floater. August 25, These notes provide an introduction to Bezier curves. i=0 Bezer curves Mchael S. Floater August 25, 211 These notes provde an ntroducton to Bezer curves. 1 Bernsten polynomals Recall that a real polynomal of a real varable x R, wth degree n, s a functon of the

More information

Implicit Integration Henyey Method

Implicit Integration Henyey Method Implct Integraton Henyey Method In realstc stellar evoluton codes nstead of a drect ntegraton usng for example the Runge-Kutta method one employs an teratve mplct technque. Ths s because the structure

More information

Hongyi Miao, College of Science, Nanjing Forestry University, Nanjing ,China. (Received 20 June 2013, accepted 11 March 2014) I)ϕ (k)

Hongyi Miao, College of Science, Nanjing Forestry University, Nanjing ,China. (Received 20 June 2013, accepted 11 March 2014) I)ϕ (k) ISSN 1749-3889 (prnt), 1749-3897 (onlne) Internatonal Journal of Nonlnear Scence Vol.17(2014) No.2,pp.188-192 Modfed Block Jacob-Davdson Method for Solvng Large Sparse Egenproblems Hongy Mao, College of

More information

THE SUMMATION NOTATION Ʃ

THE SUMMATION NOTATION Ʃ Sngle Subscrpt otaton THE SUMMATIO OTATIO Ʃ Most of the calculatons we perform n statstcs are repettve operatons on lsts of numbers. For example, we compute the sum of a set of numbers, or the sum of the

More information

Chapter - 2. Distribution System Power Flow Analysis

Chapter - 2. Distribution System Power Flow Analysis Chapter - 2 Dstrbuton System Power Flow Analyss CHAPTER - 2 Radal Dstrbuton System Load Flow 2.1 Introducton Load flow s an mportant tool [66] for analyzng electrcal power system network performance. Load

More information

x = , so that calculated

x = , so that calculated Stat 4, secton Sngle Factor ANOVA notes by Tm Plachowsk n chapter 8 we conducted hypothess tests n whch we compared a sngle sample s mean or proporton to some hypotheszed value Chapter 9 expanded ths to

More information

Singular Value Decomposition: Theory and Applications

Singular Value Decomposition: Theory and Applications Sngular Value Decomposton: Theory and Applcatons Danel Khashab Sprng 2015 Last Update: March 2, 2015 1 Introducton A = UDV where columns of U and V are orthonormal and matrx D s dagonal wth postve real

More information

Report on Image warping

Report on Image warping Report on Image warpng Xuan Ne, Dec. 20, 2004 Ths document summarzed the algorthms of our mage warpng soluton for further study, and there s a detaled descrpton about the mplementaton of these algorthms.

More information

Salmon: Lectures on partial differential equations. Consider the general linear, second-order PDE in the form. ,x 2

Salmon: Lectures on partial differential equations. Consider the general linear, second-order PDE in the form. ,x 2 Salmon: Lectures on partal dfferental equatons 5. Classfcaton of second-order equatons There are general methods for classfyng hgher-order partal dfferental equatons. One s very general (applyng even to

More information

= z 20 z n. (k 20) + 4 z k = 4

= z 20 z n. (k 20) + 4 z k = 4 Problem Set #7 solutons 7.2.. (a Fnd the coeffcent of z k n (z + z 5 + z 6 + z 7 + 5, k 20. We use the known seres expanson ( n+l ( z l l z n below: (z + z 5 + z 6 + z 7 + 5 (z 5 ( + z + z 2 + z + 5 5

More information

A new Approach for Solving Linear Ordinary Differential Equations

A new Approach for Solving Linear Ordinary Differential Equations , ISSN 974-57X (Onlne), ISSN 974-5718 (Prnt), Vol. ; Issue No. 1; Year 14, Copyrght 13-14 by CESER PUBLICATIONS A new Approach for Solvng Lnear Ordnary Dfferental Equatons Fawz Abdelwahd Department of

More information

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 13

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 13 CME 30: NUMERICAL LINEAR ALGEBRA FALL 005/06 LECTURE 13 GENE H GOLUB 1 Iteratve Methods Very large problems (naturally sparse, from applcatons): teratve methods Structured matrces (even sometmes dense,

More information

Chapter 3 Differentiation and Integration

Chapter 3 Differentiation and Integration MEE07 Computer Modelng Technques n Engneerng Chapter Derentaton and Integraton Reerence: An Introducton to Numercal Computatons, nd edton, S. yakowtz and F. zdarovsky, Mawell/Macmllan, 990. Derentaton

More information

Fundamental loop-current method using virtual voltage sources technique for special cases

Fundamental loop-current method using virtual voltage sources technique for special cases Fundamental loop-current method usng vrtual voltage sources technque for specal cases George E. Chatzaraks, 1 Marna D. Tortorel 1 and Anastasos D. Tzolas 1 Electrcal and Electroncs Engneerng Departments,

More information

Application of B-Spline to Numerical Solution of a System of Singularly Perturbed Problems

Application of B-Spline to Numerical Solution of a System of Singularly Perturbed Problems Mathematca Aeterna, Vol. 1, 011, no. 06, 405 415 Applcaton of B-Splne to Numercal Soluton of a System of Sngularly Perturbed Problems Yogesh Gupta Department of Mathematcs Unted College of Engneerng &

More information

Chapter 13: Multiple Regression

Chapter 13: Multiple Regression Chapter 13: Multple Regresson 13.1 Developng the multple-regresson Model The general model can be descrbed as: It smplfes for two ndependent varables: The sample ft parameter b 0, b 1, and b are used to

More information

Chapter Newton s Method

Chapter Newton s Method Chapter 9. Newton s Method After readng ths chapter, you should be able to:. Understand how Newton s method s dfferent from the Golden Secton Search method. Understand how Newton s method works 3. Solve

More information

Lecture 5 Decoding Binary BCH Codes

Lecture 5 Decoding Binary BCH Codes Lecture 5 Decodng Bnary BCH Codes In ths class, we wll ntroduce dfferent methods for decodng BCH codes 51 Decodng the [15, 7, 5] 2 -BCH Code Consder the [15, 7, 5] 2 -code C we ntroduced n the last lecture

More information

Some Comments on Accelerating Convergence of Iterative Sequences Using Direct Inversion of the Iterative Subspace (DIIS)

Some Comments on Accelerating Convergence of Iterative Sequences Using Direct Inversion of the Iterative Subspace (DIIS) Some Comments on Acceleratng Convergence of Iteratve Sequences Usng Drect Inverson of the Iteratve Subspace (DIIS) C. Davd Sherrll School of Chemstry and Bochemstry Georga Insttute of Technology May 1998

More information

2.3 Nilpotent endomorphisms

2.3 Nilpotent endomorphisms s a block dagonal matrx, wth A Mat dm U (C) In fact, we can assume that B = B 1 B k, wth B an ordered bass of U, and that A = [f U ] B, where f U : U U s the restrcton of f to U 40 23 Nlpotent endomorphsms

More information

Open Systems: Chemical Potential and Partial Molar Quantities Chemical Potential

Open Systems: Chemical Potential and Partial Molar Quantities Chemical Potential Open Systems: Chemcal Potental and Partal Molar Quanttes Chemcal Potental For closed systems, we have derved the followng relatonshps: du = TdS pdv dh = TdS + Vdp da = SdT pdv dg = VdP SdT For open systems,

More information

MATH 5630: Discrete Time-Space Model Hung Phan, UMass Lowell March 1, 2018

MATH 5630: Discrete Time-Space Model Hung Phan, UMass Lowell March 1, 2018 MATH 5630: Dscrete Tme-Space Model Hung Phan, UMass Lowell March, 08 Newton s Law of Coolng Consder the coolng of a well strred coffee so that the temperature does not depend on space Newton s law of collng

More information

Section 8.3 Polar Form of Complex Numbers

Section 8.3 Polar Form of Complex Numbers 80 Chapter 8 Secton 8 Polar Form of Complex Numbers From prevous classes, you may have encountered magnary numbers the square roots of negatve numbers and, more generally, complex numbers whch are the

More information

Chapter 6. Supplemental Text Material

Chapter 6. Supplemental Text Material Chapter 6. Supplemental Text Materal S6-. actor Effect Estmates are Least Squares Estmates We have gven heurstc or ntutve explanatons of how the estmates of the factor effects are obtaned n the textboo.

More information

Week 5: Neural Networks

Week 5: Neural Networks Week 5: Neural Networks Instructor: Sergey Levne Neural Networks Summary In the prevous lecture, we saw how we can construct neural networks by extendng logstc regresson. Neural networks consst of multple

More information