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

Similar documents
DUE: WEDS FEB 21ST 2018

PART 8. Partial Differential Equations PDEs

2 Finite difference basics

Numerical Solution of Ordinary Differential Equations

NUMERICAL DIFFERENTIATION

Differentiating Gaussian Processes

EEE 241: Linear Systems

CHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE

Chapter Newton s Method

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

Lecture 21: Numerical methods for pricing American type derivatives

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

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

New Method for Solving Poisson Equation. on Irregular Domains

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

Numerical Heat and Mass Transfer

Solution of Linear System of Equations and Matrix Inversion Gauss Seidel Iteration Method

FUZZY FINITE ELEMENT METHOD

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

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

The Expectation-Maximization Algorithm

UNIVERSITY OF BOLTON RAK ACADEMIC CENTRE BENG(HONS) MECHANICAL ENGINEERING SEMESTER TWO EXAMINATION 2017/2018 FINITE ELEMENT AND DIFFERENCE SOLUTIONS

MMA and GCMMA two methods for nonlinear optimization

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

ME 501A Seminar in Engineering Analysis Page 1

Chapter 4: Root Finding

Lecture 12: Discrete Laplacian

A Hybrid Variational Iteration Method for Blasius Equation

Implicit Integration Henyey Method

Formal solvers of the RT equation

Lecture Notes on Linear Regression

6.3.4 Modified Euler s method of integration

FTCS Solution to the Heat Equation

Lecture 2: Numerical Methods for Differentiations and Integrations

Lecture 10 Support Vector Machines II

Summary with Examples for Root finding Methods -Bisection -Newton Raphson -Secant

Lecture 2 Solution of Nonlinear Equations ( Root Finding Problems )

MAE140 - Linear Circuits - Winter 16 Midterm, February 5

1 GSW Iterative Techniques for y = Ax

Grid Generation around a Cylinder by Complex Potential Functions

Modelli Clamfim Equazione del Calore Lezione ottobre 2014

ANSWERS. Problem 1. and the moment generating function (mgf) by. defined for any real t. Use this to show that E( U) var( U)

THE SMOOTH INDENTATION OF A CYLINDRICAL INDENTOR AND ANGLE-PLY LAMINATES

Appendix B. The Finite Difference Scheme

Lecture 13 APPROXIMATION OF SECOMD ORDER DERIVATIVES

Numerical Transient Heat Conduction Experiment

Math1110 (Spring 2009) Prelim 3 - Solutions

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

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

e i is a random error

Boundary Value Problems. Lecture Objectives. Ch. 27

November 5, 2002 SE 180: Earthquake Engineering SE 180. Final Project

% & 5.3 PRACTICAL APPLICATIONS. Given system, (49) , determine the Boolean Function, , in such a way that we always have expression: " Y1 = Y2

: Numerical Analysis Topic 2: Solution of Nonlinear Equations Lectures 5-11:

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

Iterative General Dynamic Model for Serial-Link Manipulators

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

A MODIFIED METHOD FOR SOLVING SYSTEM OF NONLINEAR EQUATIONS

Linear Approximation with Regularization and Moving Least Squares

Calculus of Variations Basics

Review of Taylor Series. Read Section 1.2

MAE140 - Linear Circuits - Fall 10 Midterm, October 28

Chapter - 2. Distribution System Power Flow Analysis

MATH 829: Introduction to Data Mining and Analysis The EM algorithm (part 2)

Module 3: Element Properties Lecture 1: Natural Coordinates

Difference Equations

PHYS 705: Classical Mechanics. Calculus of Variations II

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

PHYS 705: Classical Mechanics. Canonical Transformation II

Finite Difference Method

UNIVERSITY OF TORONTO Faculty of Arts and Science. December 2005 Examinations STA437H1F/STA1005HF. Duration - 3 hours

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

MAE140 - Linear Circuits - Winter 16 Final, March 16, 2016

Chapter 4 The Wave Equation

ELE B7 Power Systems Engineering. Power Flow- Introduction

Lecture Note 3. Eshelby s Inclusion II

Errors for Linear Systems

Newton s Method for One - Dimensional Optimization - Theory

Consistency & Convergence

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

APPENDIX A Some Linear Algebra

2.29 Numerical Fluid Mechanics

(Online First)A Lattice Boltzmann Scheme for Diffusion Equation in Spherical Coordinate

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

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

SOLVING NON-LINEAR SYSTEMS BY NEWTON s METHOD USING SPREADSHEET EXCEL Tay Kim Gaik Universiti Tun Hussein Onn Malaysia

The Exact Formulation of the Inverse of the Tridiagonal Matrix for Solving the 1D Poisson Equation with the Finite Difference Method

THE VIBRATIONS OF MOLECULES II THE CARBON DIOXIDE MOLECULE Student Instructions

Integrals and Invariants of Euler-Lagrange Equations

Key Words: Hamiltonian systems, canonical integrators, symplectic integrators, Runge-Kutta-Nyström methods.

CHAPTER 14 GENERAL PERTURBATION THEORY

Report on Image warping

Some modelling aspects for the Matlab implementation of MMA

Moments of Inertia. and reminds us of the analogous equation for linear momentum p= mv, which is of the form. The kinetic energy of the body is.

1 Matrix representations of canonical matrices

C/CS/Phy191 Problem Set 3 Solutions Out: Oct 1, 2008., where ( 00. ), so the overall state of the system is ) ( ( ( ( 00 ± 11 ), Φ ± = 1

Analysis of Discrete Time Queues (Section 4.6)

(1) The saturation vapor pressure as a function of temperature, often given by the Antoine equation:

COSC 4397 Parallel Computation

Solutions to Homework 7, Mathematics 1. 1 x. (arccos x) (arccos x) 1

Transcription:

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( x) f ( x) a x b (a) and the boundar condtons (BC) are gven at both end of the doman e.g. (a) = and (b) =. The are generall fxed boundar condtons or Drchlet Boundar Condton but can also be subject to other tpes of BC e.g. Neumann BC or Robn BC. 4. LINEAR FINITE DIFFERENCE (FD) METHOD Fnte dfference method converts an ODE problem from calculus problem nto algebrac problem. In FD, and are expressed as the dfference between adjacent values, for example, (x h) (x h) (x) h () whch are derved from the Talor seres expanson, (x+h) = (x) + h (x) + (h /) (x) + () (x h) = (x) h (x) + (h /) (x) + (3) Kosash Chapter ODE Boundar Value Problems

If () s added to (3) and neglectng the hgher order term (O (h 3 )), we wll get (x h) (x) (x h) (x) (4) h The dfference Eqs. () and (4) can be mplemented n [x = a, x n = b] (see Fgure) f few fnte ponts n are defned and dvdng doman [a,b] nto n ntervals of h whch s defned xn x h x x (5) n - [x,x n ] doman dvded nto n ntervals. FD method gves dervatve of values at pont, as follow (x ) (x) (x-) h (6) (x ) (x ) (x ) (x ) h (7) Substtutng (6) & (7) nto (a), we get - h q(x ) (x ) h p(x ) (x ) h f(x ) h p(x ) (x ) (8) or can be smplfed to, - h q(x ) h p(x ) h f(x ) h p(x ) (9) Eq. (9) s then appled to each of the nternal nodes, =,,n. Ths wll produce a sstem of lnear equatons of tr dagonal form. The sstem of lnear equatons can then be solved usng the Thomas algorthm (but we wll solve usng sparse matrx technque). Kosash Chapter ODE Boundar Value Problems

Example Solve the followng nd order ODE, 7 3 for [,] wth Drchlet boundar condton, () = and () =, usng FD wth h =. (Note n ths example p(x) = 7, q(x) = 3 and f(x) = ). The dfference equaton (9) for ths problem s, ( 3.5h) ( - 3h ) ( 3.5h) h for h =.,.65.97 +.35 + =. (C ) The dfference equaton s appled to the nternal nodes ( = ), Applng (C ) at =, we obtan the followng sstem of lnear equatons Note that nodes = & are end nodes, whch have specfed values and the do not appear n the sstem. The above sstem of lnear equatons can be wrtten n tr Kosash Chapter ODE Boundar Value Problems 3

dagonal matrx form, whch can be solved usng Thomas algorthm but we wll solve usng sparse technque..97.65.35.97.65.35.97.65.35.97.65.35.97.65.35.97.65.35.97.65.35.97.65.35.97 3 4 5 6 7 8 9......... 34 The soluton of the above sstem s T = [, 3, 4, 5, 6, 7, 8, 9, ] = [.64,.9443,.76,.33,.84,.3,.885,.598,.99] Note that the dfference equatons at nodes = and = n = are slghtl modfed b the end nodes, () = - h q(x ) h p(x ) 3 h f(x ) - h p(x ) = h p(x ) 9 - h q(x ) h f(x ) - h p(x ) 9 () The sample MATLAB code (Example.m) I developed to solve ths problem s shown below. %*************************************************************************** % Program to solve lnear ODE boundar value problems wth FD % Both ends are subjected to Drchlet boundar condtons % nputs : % a,b are startng and endng ponts % alfa,beta are the values at the startng and endng ponts % n s the number of nterval Kosash Chapter ODE Boundar Value Problems 4

% outputs : % are the values of at node ponts %*************************************************************************** clear;clf; %********** INPUT ******************************************************* a = nput(ʹenter the startng x >ʹ); b = nput(ʹenter the endng x >ʹ); alfa = nput(ʹenter the value at startng x >ʹ); beta = nput(ʹenter the value at endng x >ʹ); n = nput(ʹenter the number of dvsons >ʹ); pfunc = nput(ʹenter the functon p(x) please: ʹ,ʹsʹ); qfunc = nput(ʹenter the functon q(x) please: ʹ,ʹsʹ); ffunc = nput(ʹenter the functon f(x) please: ʹ,ʹsʹ); p = nlne(pfunc); q = nlne(qfunc); f = nlne(ffunc); %*********** Constants ************ h = (b a)/n; % the nterval sze x = lnspace(a,b,n+); %************ Elements of the matrx A A(:n,:n ) =.; % ntalze matrx A for = :n % ths loop calculate element for nodes to n % n the dagram but n the % matrx t s from = to n f == A(,)= (. q(x(+)) * h*h); A(,+) = +.5 * p(x(+)) * h; ff() = f(x(+)) * h*h (. p(x(+)) *.5 * h) * alfa; elsef == n A(, ) =. p(x(+)) *.5 * h; A(,) = (. q(x(+)) * h*h); ff() = f(x(+)) * h*h ( +.5 * p(x(+)) * h) * beta; else A(, ) =. p(x(+)) *.5 * h; A(,) = (. q(x(+)) * h*h); A(,+) = +.5 * p(x(+)) * h; Kosash Chapter ODE Boundar Value Problems 5

ff() = f(x(+)) * h*h; end end %************ Solve the sstem of lnear equatons usng sparse matrx ASparse = sparse(a); = ASparse\ffʹ; %*********** PLOT OF RESULT ******** plot(x,[alfa;;beta],ʹb ʹ) xlabel(ʹxʹ),label(ʹʹ); legend(ʹnumercal resultsʹ) Enter the startng x > Enter the endng x > Enter the value at startng x > Enter the value at endng x > Enter the number of dvsons > Enter the functon fle of p(x) please: 7. Enter the functon fle of q(x) please: 3. Enter the functon fle of f(x) please:..4. numercal results.8.6.4....3.4.5.6.7.8.9 x Now suppose the ODE Eq. () Kosash Chapter ODE Boundar Value Problems 6

p( x) q( x) f ( x) a x b () s now subject to boundar condtons (a) = and (b) =. The boundar at b s a dervatve boundar condton or Neumann Boundar Condton. For the problem the value of (b) must be calculated (part of the soluton) so dfference equatons must be wrtten for =,,,n. For =,,,,,n accordng to the FD equaton (9) s but for = n t s dfferent as (b) needs (x n +h) as shown below. (xn h) (xn ) (xn h) n n n- (xn ) h h () It s clear from () that (b+h) s needed, and ths s outsde the doman as shown n the fgure below. To calculate n+, we wll make use of the gven (xn ) and followng (6), n n n (3) h So, n n h n (4) If (4) s substtuted nto () hn - n n n (5) h and substtutng (5) and n- h q(x ) h f(xn ) n n n nto (), we get h h p(x n ) (6) Kosash Chapter ODE Boundar Value Problems 7

Eq. (6) s the FD equaton appled at node = n. Example Solve the followng nd order ODE, 5 4 For [,] and boundar condtons () = and (). Use h =., n ths problem p(x) = 5, q(x) = 4 and f(x) =.. The FD equatons are gven b (9), (.5h) ( - 4h ) (.5h) h For h =.,.75.96 +.5 + =. (C ) (C ) s applcable for =, but for =, (6) s used 9.96. (C ) The sstem of lnear equatons to be solved s.96 3.75 4 5 6 7 8 9.5 3.96 3.75 3.5 4.96 4.75 4.5 5.96 5.75 5.5 6.96 6.75 6.5 7.96 7.75 7.5 8.96 8.75 8.5 9.96 9.75 9.5.96..75.........5..96 In matrx form, Kosash Chapter ODE Boundar Value Problems 8

.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.5.96 3 4 5 6 7 8 9.74......... The soluton vector s T = [.75,.536,.393,.38,.68,.39,.55,.6,.,.] As a practce, modf the code used n Example to solve ths one. Another possble boundar condton s Robn Boundar Condton. In ths case the BC s expressed as an expresson, A n + B n = (7) Usng backward dfference to express n, A n + B n n = (8) h Or, n βh Bn (A h B ) (9) Example 3 Solve the followng nd order ODE, 5 4 Kosash Chapter ODE Boundar Value Problems 9

For [,] and boundar condtons: ()= and ().5ʹ()=.5. Use FD method wth h =.. For = the FD equatons are the same as prevous example, but for = the FD equaton s calculated (9) wth A =, B =.5 dan =.5. =.5 + =.5 The formed sstem of lnear equatons s.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.75.5.96.5.5 3 4 5 6 7 8 9..........5 The soluton s T = [.98,.3446,.465,.4543,.474,.473,.4675,.457,.4444,.435] As a practce, modf the code used n Example to solve ths one. 4. NON LINEAR FINITE DIFFERENCE (FD) METHOD The soluton of non lnear ODE usng FD method s smlar to the lnear FD except for non lnear ODE the solutons s obtaned teratvel. In non lnear problem p(x,) and q(x,) are functon of x and or dervatves of, so at each teraton k th, p(x,) and q(x,) are calculated usng the values at (k ) th teraton. In other words we lnearze the ODE nto, ( k ) (k ) p(x, ) q(x, ) f(x) () As n an teratve technques, we must start from an ntal estmate (). The values of the ntal estmate can affect the rate of convergence, so we must prudentl guess (). The smplest technque s to assume lnear (x) as shown n the followng fgure. Kosash Chapter ODE Boundar Value Problems

Then teratons are done untl the left sde dffer wthn a certan tolerance from the rght sde. The above method nvolves solvng lnear FD equatons agan and agan. A more explct technque can also be obtaned, we start b wrtng the ODE agan, f(x) - p(x, ) q(x, ) () After expressng and usng (6) and (7) and substtutng them nto (), h h f(x ) p(x, ) q(x, ) () Rearrangng (), can be explctl expressed as h f(x ) h p(x, ) h q(x, ) (3) Note that can be calculated teratvel f all s on the rght hand sde are the known from the prevous calculaton or ntall assumed at the begnnng of the teraton. Kosash Chapter ODE Boundar Value Problems

4 (k ) - h f(x ) h p(x, )( - ) h q(x, ) (4) Fausett suggested that convergence can be accelerated f we add to both sde of (3), 4( ω) 4ω h f(x ) h p(x, )( ) h q(x, ) (5) And s calculated teratvel, 4( ω) 4ω - h f(x ) hp(x, )( - ) h q(x, The teraton process s stopped when a specfed convergence crtera has been reached. An acceptable convergence crtera s (6) ) k k (7) Example 4 Solve the followng non lnear ODE, ( ) ( ) For [,] and boundar condtons () = and () =. p(x,) = q(x,) = + and f(x) =. Use the explct method wth h =. and ntal estmate for = whch assumed lnear () = [.,.,.3,.4,.5,.6,.7,.8,.9]. The explct form of (Eq. 6) for ths example s, 4( ω) 4ω - h h( )( - ) h ( ) 4( ω) 4ω -..( )( - ).( ) The result s shown n Fgure below. () Kosash Chapter ODE Boundar Value Problems

4. 3 Tutoral Questons. Fnd the temperature profle nsde the tube wall. Hot flud flows nsde the tube such that the nsde temperature s C. The dfferental equaton for the temperature dstrbuton s gven b d T dt dr r dr The boundar condtons are T() = C and T(5) = C. Ths s a lnear nd order lnear ODE wth Drchlet boundar condtons, so use lnear FD technque wth h =. Hot flud flowng nsde a tube.. Deflecton of prsmatc smpl supported beam shown below Kosash Chapter ODE Boundar Value Problems 3

s gven b the followng equaton. d qlx qx EI dx Where V s unforml dstrbuted load, L s the length of the beam, I s the moment of nerta of the beam cross secton (I = wh 3 /, w s wdth and h s heght of the beam) and E s the modulus of elastct of the beam. For the case n hand E = GPa, L =.m, w = 5.cm, h =.cm, V = 5N/m and I = 4.66x 6 m 4, Fnd (x). It s clear from the problem that the boundar condtons are Drchlet.e., () = () =., Rewrte the governng equaton Vx EI x - L.8x(x ) From the above, p(x) =, q(x) = and f(x) =.8 x (x.). Dvde the beam nto nterval gvng h =. and generate plot of the beam deflecton. 3. Use lnear shootng method and lnear Fnte Dfference Method to fnd the soluton of Kosash Chapter ODE Boundar Value Problems 4

ODE Range Boundar condtons Analtcal soluton h = 4 ( x) [,] () = () = (x) = e x x.5 ( e e ) x 4 e 4. Use FD method (Neumann Boundar condtons) to fnd the soluton of ODE Range Boundar condtons h = -5 4 + [,] () =.5 () = 5. Use FD method (Robn Boundar condtons) to fnd the soluton of ODE Range Boundar condtons h = -4 6.5 + e x [,] () =.5 ().5 () =.5 6. Use non lnear FD method to fnd the soluton of ODE Range Boundar condtons Analtcal soluton h = 3 [,] () = () = 3 (x) = x.5 Comment on the use of dfferent sa from.5.5. Adopt the followng convergence crtera k k Kosash Chapter ODE Boundar Value Problems 5