Outline. Review Numerical Approach. Schedule for April and May. Review Simple Methods. Review Notation and Order

Similar documents
ORDINARY DIFFERENTIAL EQUATIONS EULER S METHOD

Numerical Solution of Ordinary Differential Equations

On Pfaff s solution of the Pfaff problem

Rectilinear motion. Lecture 2: Kinematics of Particles. External motion is known, find force. External forces are known, find motion

Numerical Solution of Ordinary Differential Equations

System in Weibull Distribution

1.3 Hence, calculate a formula for the force required to break the bond (i.e. the maximum value of F)

ME 501A Seminar in Engineering Analysis Page 1

Outline. Remaining Course Schedule. Review Systems of ODEs. Example. Example Continued. Other Algorithms for Ordinary Differential Equations

Boundary Value Problems. Lecture Objectives. Ch. 27

Applied Mathematics Letters

Least Squares Fitting of Data

6.3.4 Modified Euler s method of integration

E91: Dynamics. E91: Dynamics. Numerical Integration & State Space Representation

PART 8. Partial Differential Equations PDEs

XII.3 The EM (Expectation-Maximization) Algorithm

Solution for singularly perturbed problems via cubic spline in tension

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

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

LECTURE :FACTOR ANALYSIS

Lecture 21: Numerical methods for pricing American type derivatives

Denote the function derivatives f(x) in given points. x a b. Using relationships (1.2), polynomials (1.1) are written in the form

Appendix B. The Finite Difference Scheme

PHYS 342L NOTES ON ANALYZING DATA. Spring Semester 2002

Our focus will be on linear systems. A system is linear if it obeys the principle of superposition and homogenity, i.e.

Elastic Collisions. Definition: two point masses on which no external forces act collide without losing any energy.

What is LP? LP is an optimization technique that allocates limited resources among competing activities in the best possible manner.

Solving Fuzzy Linear Programming Problem With Fuzzy Relational Equation Constraint

Xiangwen Li. March 8th and March 13th, 2001

COS 511: Theoretical Machine Learning

1 GSW Iterative Techniques for y = Ax

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

Shuai Dong. Isaac Newton. Gottfried Leibniz

Introduction to groundwater flow modeling: finite difference methods. Tyson Strand

Lecture 10: Euler s Equations for Multivariable

lecture 35: Linear Multistep Mehods: Truncation Error

Linear Momentum. Center of Mass.

Consistency & Convergence

NUMERICAL DIFFERENTIATION

Problem Set 9 Solutions

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

Limit Cycle Bifurcations in a Class of Cubic System near a Nilpotent Center *

Lecture 2: Numerical Methods for Differentiations and Integrations

1 Proving the Fundamental Theorem of Statistical Learning

Physics 3A: Linear Momentum. Physics 3A: Linear Momentum. Physics 3A: Linear Momentum. Physics 3A: Linear Momentum

Linear Feature Engineering 11

Numerical Simulation of One-Dimensional Wave Equation by Non-Polynomial Quintic Spline

Lecture 26 Finite Differences and Boundary Value Problems

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

Excess Error, Approximation Error, and Estimation Error

Computational and Statistical Learning theory Assignment 4

BAYESIAN CURVE FITTING USING PIECEWISE POLYNOMIALS. Dariusz Biskup

Main components of the above cycle are: 1) Boiler (steam generator) heat exchanger 2) Turbine generates work 3) Condenser heat exchanger 4) Pump

Chapter Newton s Method

Multivariate Ratio Estimator of the Population Total under Stratified Random Sampling

COMP4630: λ-calculus

DEMO #8 - GAUSSIAN ELIMINATION USING MATHEMATICA. 1. Matrices in Mathematica

Least Squares Fitting of Data

Several generation methods of multinomial distributed random number Tian Lei 1, a,linxihe 1,b,Zhigang Zhang 1,c

Slobodan Lakić. Communicated by R. Van Keer

CHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE

,..., k N. , k 2. ,..., k i. The derivative with respect to temperature T is calculated by using the chain rule: & ( (5) dj j dt = "J j. k i.

Final Exam Solutions, 1998

Lecture 13 APPROXIMATION OF SECOMD ORDER DERIVATIVES

9 Derivation of Rate Equations from Single-Cell Conductance (Hodgkin-Huxley-like) Equations

Note 10. Modeling and Simulation of Dynamic Systems

CENTROID (AĞIRLIK MERKEZİ )

12. The Hamilton-Jacobi Equation Michael Fowler

Description of the Force Method Procedure. Indeterminate Analysis Force Method 1. Force Method con t. Force Method con t

total If no external forces act, the total linear momentum of the system is conserved. This occurs in collisions and explosions.

Implicit Integration Henyey Method

A Hybrid Variational Iteration Method for Blasius Equation

Image classification. Given the bag-of-features representations of images from different classes, how do we learn a model for distinguishing i them?

Stanford University CS254: Computational Complexity Notes 7 Luca Trevisan January 29, Notes for Lecture 7

Basic Concepts in Numerical Analysis November 6, 2017

Linear Approximation with Regularization and Moving Least Squares

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

5 The Laplace Equation in a convex polygon

CENTROID (AĞIRLIK MERKEZİ )

Finite Vector Space Representations Ross Bannister Data Assimilation Research Centre, Reading, UK Last updated: 2nd August 2003

PHYS 705: Classical Mechanics. Newtonian Mechanics

Numerical Methods. ME Mechanical Lab I. Mechanical Engineering ME Lab I

ME 501A Seminar in Engineering Analysis Page 1

Revision: December 13, E Main Suite D Pullman, WA (509) Voice and Fax

Multipoint Analysis for Sibling Pairs. Biostatistics 666 Lecture 18

1 Review From Last Time

Finite Difference Method

Infinite Length MMSE Decision Feedback Equalization

EEE 241: Linear Systems

8 Derivation of Network Rate Equations from Single- Cell Conductance Equations

A New Recursive Method for Solving State Equations Using Taylor Series

Trees and Order Conditions

Digital Signal Processing

Department of Economics, Niigata Sangyo University, Niigata, Japan

A new Approach for Solving Linear Ordinary Differential Equations

The Finite Element Method: A Short Introduction

COMP th April, 2007 Clement Pang

SE Story Shear Frame. Final Project. 2 Story Bending Beam. m 2. u 2. m 1. u 1. m 3. u 3 L 3. Given: L 1 L 2. EI ω 1 ω 2 Solve for m 2.

8 Derivation of Network Rate Equations from Single- Cell Conductance Equations

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

Transcription:

Sstes of Ordnar Dfferental Equatons Aprl, Solvng Sstes of Ordnar Dfferental Equatons Larr Caretto Mecancal Engneerng 9 Nuercal Analss of Engneerng Sstes Aprl, Outlne Revew bascs of nuercal solutons of ordnar dfferental equatons Error control n sple etods dscussed prevousl Sstes of dfferental equatons Reducng ger-order equatons nto a sste of frst-order equatons Wrtng and usng software for solvng sstes of ordnar dfferental equatons Scedule for Aprl and Ma Monda Tuesda Wednesda Tursda Frda Sprng Brea 5 Quz 7 & PA5 7 5 8 PA 9 Quz 8 Ma 5 PA 7 7 Prog Ea Fnal 8 9 Revew Nuercal Approac Solve ntal value proble d/ = f(,) (nown equaton) wt ( ) = Use a fnte dfference grd: + = Replace dervatve b fnte-dfference approaton: d/ ( + ) / ( + ) = ( + ) / Derve a forula to copute f avg te average value of f(,) between and + Replace d/ = f(,) b ( + ) / = f avg Repeatedl copute + = + f avg Revew Notaton and Order s ndependent varable s nuercal soluton at = f s dervatve found fro : f = f(, ) ( ) s te eact value of at = f(,( )) s te eact dervatve e = ( ) = local truncaton error E = ( ) s global truncaton error If e s O( n ), ten E s O( n- ) 5 Revew Sple Metods Euler: + = + f = + f(, ) Huen s etod f (, ) f (, ) f (, ) f (, ) Modfed Euler etod (, ) f f (, ) ME 9 Nuercal Analss of Engneerng Sstes

Sstes of Ordnar Dfferental Equatons Aprl, Revew t Order Runge-Kutta Uses four dervatve evaluatons per step f (, ) f f f (,,, ) Error (at = ) versus step sze for ODE solvers Error.E+.E-.E-.E-.E-.E-5.E-.E-7.E-8.E-9.E- Error versus Step Sze for Sple ODE Solvers d e -- wt at Euler Huen Modfed Euler Runge-Kutta.E-.E-.E-.E-.E-5.E-.E-7.E-.E-5.E-.E-.E-.E- Step sze, 7 8 Error Error Propagaton n Solutons of ODEs.E+.E-.E-.E-.E-.E-5.E-.E-7.E-8.E-9.E-.E-.E-.E-.E-....8 Euler (N = ) Euler (N = ) Euler N =,) Huen (N =) Huen (N = ) Huen (N =,) RK (H = ) RK (N = ) 9 Error Control How do we coose to antan desred accurac? Want to obtan a result wt soe desred sall global error Can ust repeat calculatons wt saller untl two results are suffcentl close Can use algorts tat estate error and adust step sze durng te calculaton based on te error Runge-Kutta Error Control Tae step wt two forulas of dfferent orders usng te sae functon evaluatons n eac forula Use te dfference between te two forulas as an estate of te error Use te error estate to control te step sze based on a user-nput desred error Soe etods n fnal sldes not sown Dorand-Prnce Metod Uses fourt- and fft-order epressons to fnd error estate Modfes step sze b coparng error estate wt desred error Used n MATLAB solver ode5 wc s n net prograng assgnent Algort equatons sown on net two sldes v. of ode5 code at ttp://users.powernet.co.u/enzle/octave/ atcopat/scrpts/ode_v./ode5. ME 9 Nuercal Analss of Engneerng Sstes

Sstes of Ordnar Dfferental Equatons Aprl, Dorand-Prnce Equatons 5 5 5 + 9 8 + = 5 = 5 = 5 Dorand-Prnce Metod II e s desred error per step opt s optu step sze Tosnor Kura, On Dorand-Prnce Metod ttp://depa.fqu.una./ad/arcvero/dorandprnce_985.pdf Tosnor Kura, On Dorand-Prnce Metod ttp://depa.fqu.una./ad/arcvero/dorandprnce_985.pdf Net Steps We ave sown soe algorts for solvng te ntal value proble d/ = f(,) wt = at = Need to solve ger order equatons Can sow tan an n t -order equaton can be epressed as a sste of n frstorder equatons Ten ave to consder solvng sstes of frst order equatons 5 Basc Idea An n t order ODE can be wrtten as a sste of n frst-order ODEs For a sste of two or ore ODEs wt varng orders: Brea te t ODE wt order n nto n frstorder ODEs; repeat for all equatons Te result wll be a sste of frst order ODEs Te total nuber of ODEs wll be n + n + = te su of te orders of eac orgnal ODE Hger order equatons Loo at sprng-ass-daper equaton as eaple: d / + Cd/ + = F F s appled force wc a be a nown functon of t, and d/ (a ave F = ) Defne a veloct, v = d/ dv/ = d / Our second order equaton becoes dv/ + Cv + = F gvng two ODEs dv C F - v - fvt,, v d v f t,, v 7 dv f Hger Order Equatons II d t,, v f t, v v, d General Notaton d ft, f t, Te two frst order equatons we found loo le our ntal value proble Ts assues tat we ave an ntal conon for veloct, v Wll cover stuatons were ts s not true (nown as boundar value probles) later We can appl all algorts developed for sngle frst-order equatons to an sste of sultaneous frst-order equatons 8 N ME 9 Nuercal Analss of Engneerng Sstes

Sstes of Ordnar Dfferental Equatons Aprl, Solvng Sultaneous ODEs Appl sae algorts used for sngle ODEs Must appl eac part of eac algort step to all equatons n sste before gong on to net step Ke s avng consstent and values n deternaton of f (,) All values n ust be avalable at te sae pont wen coputng te f E.g., n Runge-Kutta we ust evaluate Runge-Kutta for ODE Sste (n) s vector of dependent varables at = n (), (), (), and (), are vectors contanng nteredate Runge-Kutta results f s a vector contanng te dervatves () = f = f( n, (n) ) () = f( n + /, (n) + () /) () = f( n + /, (n) + () /) () = f( n +, (n) + () ) (n+) = ( () + () + () + () )/ for all equatons before fndng 9 ODE Sste b RK d/ = + z and dz/ = z wt () = and z() = - wt =. Detals of frst step fro to () = [- + z] =.[- + (-)] = -. ()z = [ - z] =.[ - (-)] =. () = [-(+ () /) + z + ()z /] =.[ -( + -./) + (- +./)] = -.8 ()z = [(+ () /) (z + ()z /)] =.[( + -.)/ - (- +./)] =.8 ODE Sste b RK II () = [-(+ () /) + z + ()z /] =.[ -( + -.8/) + (- +.8/)] = -.8 ()z = [(+ () /) (z + ()z /)] =.[( + -.8)/ - (- +.8/)] =.8 () = [-(+ () ) + z + ()z ] =.[ -( + -.8) + (- +.8)] = -. ()z = [(+ () ) (z + ()z )] =.[ ( + -.8) - (- +.8)] =. ODE Sste b RK III + = + ( () + () + () + () )/ = + [ (.) + (.8) + (.8) + (.)]/ =.887 (ere = ) z + = z + ( ()z + ()z + ()z + ()z )/ = + [(.) + (.8) + (.8) + (.)]/ =.887 Contnue n ts fason untl desred fnal value s reaced Note all coputed before an + No dependence for f n ts eaple Nuercal Software for ODEs Usuall wrtten to solve a sste of N equatons, but wll wor for N = User as to code a subroutne or functon to copute te f arra Input varables are and ; f s output Soe codes ave one densonal paraeter arra to pass adonal nforaton fro an progra nto te functon tat coputes dervatves ME 9 Nuercal Analss of Engneerng Sstes

Sstes of Ordnar Dfferental Equatons Aprl, Dervatve Subroutne Eaple Vsual Basc sub code for sste of ODEs at rgt s sown below d - d - - e - Sub fsub( as Double, () as Double, _ f() as Double ) f() = -() + Sqr(()) - ()*Ep(*) f() = - * ()^ f() = - * () * () End Sub 5 d Dervatve Functon Eaple d Vsual Basc - - e functon code for d d sste of ODEs - - Functon ff( As Double, () As Double, _ N As Long) As Varant D fd() As Double; red fd( to N) fd() = -() + Sqr(()) - ()*Ep(*) fd() = - * ()^ fd() = - * () * () : ff = fd End Functon In an progra use f = ff(,,n) were f s an arra of sae sze Dervatve Subroutne Eaple MATLAB functon for sste of ODEs at rgt s sown below d - d - - e - functon f = test(, ) f = zeros(,); f() =-() +Sqrt(()) - ()*Ep(*); f() = - * ()^; f() = - * () * (); end %secolons prevent output d 7 Dervatve Subroutne Eaple C++ code for sste of ODEs at rgt s sown below d - d - - e - vod fsub(double, double [], double f[]) { f[] = -[] + sqrt([]) - []*ep(*); f[] = - * [] * []; f[] = - * [] * []; } 8 d Dervatve Subroutne Eaple Fortran code for sste of ODEs at rgt s sown below d - d - - e - subroutne fsub(,, f ) real(kind=8), (:), f(:) f() = -() + sqrt(()) -()*ep(*) f() = - * ()** f() = - * () * () end subroutne fsub d 9 Assgnent Seven and Last Wrte routne n MATLAB and n VBA to solve general sste of N ODEs wt followng for: d / = f (t,), =, N Appl to N = sste wt nown eact solutons sae as on prevous sldes d - d - - e d - e e -t e -t -t ME 9 Nuercal Analss of Engneerng Sstes 5

Sstes of Ordnar Dfferental Equatons Aprl, Assgnent Seven Algorts Code Huen algort n MATLAB Modfed Euler algort n VBA f ( t, ) t t f ( t, ) f ( t, ) f ( t, t t Use MATLAB functon ode5 for solvng sae set of equatons and copare wor for sae accurac ) Runge-Kutta Error Control Followng sldes not sown n class Present oter approac to error control n Runge-Kutta algorts Older etod: Copare results for two steps at step sze wt one step of Requres dervatve functon evaluatons over bot steps Runge-Kutta-Felberg: earl etod to use algorts of dfferent order wt sae functon evaluatons Runge-Kutta Error Control Control error b dong ntegraton wt and all along ntegraton Integraton wt step requres adonal functon evaluatons per steps Analze local truncaton error, wc s O( 5 ), for bot steps 5 ( ) A B ( ) - A 5 B 5 5 - A O( ) Runge-Kutta Error Control II = D s easure of truncaton error User specfes D D, te desred error Man was to specf ts, sngle value, relatve values, relatve to ncreents for n one step Snce error scales as 5, we can adust step sze suc tat new = old D D /D /5 Tpcall use safet factor to avod ang new too large Runge-Kutta-Felberg Uses two equatons to copute n+, one as O( 5 ), te oter O( ) error Requres s dervatve evaluatons per step (sae evaluatons used for bot equatons) Te error estate can be used for step sze control based on an overall 5 t order error Cas-Karp verson and Runge-Kutta- Verner use sae dea 5 Runge-Kutta-Felberg II See page n Rao tet for algort Tpcal forula coponents below n+ = n + ( /5 + 5 /85 = f( n + /8, n + / + 9 /) Error = / - 8 /75 new = old old E Desred /Error / E Desred s set b user RKF5 code b Watts and Sapne ME 9 Nuercal Analss of Engneerng Sstes

Sstes of Ordnar Dfferental Equatons Aprl, Increents,, for RKF f, f, 9 f, 8 9-7 79 f, 97 9 8 85 5 f, -8-5 8 5 859 5 f, - - - 7 55 7 Fnal RKF Step Results Proposed value of + s 5 85 95-5 85 5 55 Estated error s 5 85 95 e - 5 85 5 55 If e n < e + < e a accept + ; eep If e + < e n accept + and get new If e + > e a get new and redo step new = old (ε* old / e + )¼ ε* = desred error 8 ME 9 Nuercal Analss of Engneerng Sstes 7