Numerical Methods for Civil Engineers. Lecture 10 Ordinary Differential Equations. Ordinary Differential Equations. d x dx.

Σχετικά έγγραφα
ES440/ES911: CFD. Chapter 5. Solution of Linear Equation Systems

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

ΕΡΓΑΣΤΗΡΙΑΚΕΣ ΑΣΚΗΣΕΙΣ

High order interpolation function for surface contact problem

Homework 3 Solutions

Radiation Stress Concerned with the force (or momentum flux) exerted on the right hand side of a plane by water on the left hand side of the plane.

ECE570 Lecture 6: Rewrite Systems

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

The Spiral of Theodorus, Numerical Analysis, and Special Functions

D Alembert s Solution to the Wave Equation

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

HW 3 Solutions 1. a) I use the auto.arima R function to search over models using AIC and decide on an ARMA(3,1)

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1.

ΣΥΝΗΘΕΙΣ ΔΙΑΦΟΡΙΚΕΣ ΕΞΙΣΩΣΕΙΣ ΣΤΗ MATLAB

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

Statistics 104: Quantitative Methods for Economics Formula and Theorem Review

Summary of the model specified

- 1+x 2 - x 3 + 7x x x x x x 2 - x 3 - -

Second Order RLC Filters

Section 8.3 Trigonometric Equations

Aquinas College. Edexcel Mathematical formulae and statistics tables DO NOT WRITE ON THIS BOOKLET

Differential equations

Discontinuous Hermite Collocation and Diagonally Implicit RK3 for a Brain Tumour Invasion Model

GAUSS-LAGUERRE AND GAUSS-HERMITE QUADRATURE ON 64, 96 AND 128 NODES

6.3 Forecasting ARMA processes

RECIPROCATING COMPRESSOR CALCULATION SHEET ISOTHERMAL COMPRESSION Gas properties, flowrate and conditions. Compressor Calculation Sheet

Linearized Lifting Surface Theory Thin-Wing Theory

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

ΕΙΣΑΓΩΓΗ ΣΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ

Homework 8 Model Solution Section

Higher Derivative Gravity Theories

forms This gives Remark 1. How to remember the above formulas: Substituting these into the equation we obtain with

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Statistical Inference I Locally most powerful tests

Second Order Partial Differential Equations

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

Επιμέλεια απαντήσεων: Ιωάννης Λυχναρόπουλος

Computing the Macdonald function for complex orders

Description of the PX-HC algorithm

( y) Partial Differential Equations

Financial Risk Management

Elements of Information Theory

Risk! " #$%&'() *!'+,'''## -. / # $

Bessel functions. ν + 1 ; 1 = 0 for k = 0, 1, 2,..., n 1. Γ( n + k + 1) = ( 1) n J n (z). Γ(n + k + 1) k!

Review Test 3. MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Numerical Analysis FMN011

Discretization of Generalized Convection-Diffusion

(, ) (SEM) [4] ,,,, , Legendre. [6] Gauss-Lobatto-Legendre (GLL) Legendre. Dubiner ,,,, (TSEM) Vol. 34 No. 4 Dec. 2017

Συστήματα Διαχείρισης Βάσεων Δεδομένων

ΠΟΛΥΤΕΧΝΕΙΟ ΚΡΗΤΗΣ ΣΧΟΛΗ ΜΗΧΑΝΙΚΩΝ ΠΕΡΙΒΑΛΛΟΝΤΟΣ

VBA Microsoft Excel. J. Comput. Chem. Jpn., Vol. 5, No. 1, pp (2006)

Εισαγωγή στη Fortran. Μάθημα 3 ο. Ελευθερία Λιούκα

5269: Υπολογιστικές Μέθοδοι για Μηχανικούς Επανάληψη

5269: Υπολογιστικές Μέθοδοι για Μηχανικούς. Συνήθεις Διαφορικές Εξισώσεις Πρόβλημα Αρχικών τιμών (B)

DiracDelta. Notations. Primary definition. Specific values. General characteristics. Traditional name. Traditional notation

Stabilization of stock price prediction by cross entropy optimization

Keyframing can be tedious - especially to get realism Using physics to define the animation, Subset of procedural animation Provide the physical

C F E E E F FF E F B F F A EA C AEC

Exercises to Statistics of Material Fatigue No. 5

An Automatic Modulation Classifier using a Frequency Discriminator for Intelligent Software Defined Radio

t ts P ALEPlot t t P rt P ts r P ts t r P ts

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

ECE Spring Prof. David R. Jackson ECE Dept. Notes 2

Ηλεκτρονικοί Υπολογιστές IV

Chapter 6 BLM Answers

Queensland University of Technology Transport Data Analysis and Modeling Methodologies

Teor imov r. ta matem. statist. Vip. 94, 2016, stor

Lecture 34 Bootstrap confidence intervals

CORDIC Background (4A)

Notations. Primary definition. Specific values. General characteristics. Traditional name. Traditional notation. Mathematica StandardForm notation

CHINESE JOURNAL OF COMPUTATIONAL PHYSICS ] A. T e ) = ei ( T i - T e ) + er ( T r - T e ), T i ) = ei ( T e - T i ), T r ) = er ( T e - T r ),

(6,5 μονάδες) Θέμα 1 ο. Τμήμα Πολιτικών Μηχανικών Σχολή Τεχνολογικών Εφαρμογών Διεθνές Πανεπιστήμιο Ελλάδος ΟΝΟΜΑΤΕΠΩΝΥΜΟ

5269: Υπολογιστικές Μέθοδοι για Μηχανικούς Επανάληψη

Συστήματα Διαχείρισης Βάσεων Δεδομένων

5.4 The Poisson Distribution.

MSWD = 1.06, probability = 0.39

Παράδειγµα #11 ΠΡΟΒΛΗΜΑΤΑ ΑΡΧΙΚΩΝ ΤΙΜΩΝ Σ Ε ΕΠΙΜΕΛΕΙΑ: Ν. Βασιλειάδης

Supplementary Materials for Evolutionary Multiobjective Optimization Based Multimodal Optimization: Fitness Landscape Approximation and Peak Detection

*H31123A0228* 1. (a) Find the value of at the point where x = 2 on the curve with equation. y = x 2 (5x 1). (6)

Consolidated Drained

Probabilistic Approach to Robust Optimization

4.1 Αριθμητική Ολοκλήρωση Εξισώσεων Νεύτωνα

, Evaluation of a library against injection attacks

Inverse trigonometric functions & General Solution of Trigonometric Equations

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

CORDIC Background (2A)

Αριθμητική Επίλυση Συνήθων Διαφορίκών Εξισώσεων 3ο Εργαστήριο 27/03/2015 1

Example Sheet 3 Solutions

NMBTC.COM /

Finite difference method for 2-D heat equation

Κεφάλαιο 3: Κίνηση Σωματιδίου. Υπολογιστική Φυσική Ι. Αναγνωστόπουλος Κωνσταντίνος

PARTIAL NOTES for 6.1 Trigonometric Identities

BiCG CGS BiCGStab BiCG CGS 5),6) BiCGStab M Minimum esidual part CGS BiCGStab BiCGStab 2 PBiCG PCGS α β 3 BiCGStab PBiCGStab PBiCG 4 PBiCGStab 5 2. Bi

Introduction to the ML Estimation of ARMA processes

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

ΑΛΛΗΛΕΠΙ ΡΑΣΗ ΜΟΡΦΩΝ ΛΥΓΙΣΜΟΥ ΣΤΙΣ ΜΕΤΑΛΛΙΚΕΣ ΚΑΤΑΣΚΕΥΕΣ

ΓΡΑΜΜΙΚΟΣ & ΔΙΚΤΥΑΚΟΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ

The Negative Neumann Eigenvalues of Second Order Differential Equation with Two Turning Points

BMI/CS 776 Lecture #14: Multiple Alignment - MUSCLE. Colin Dewey

Solution to Review Problems for Midterm III

Transcript:

Numerical Metods for Civil Engineers Lecture Ordinar Differential Equations -Basic Ideas -Euler s Metod -Higer Order One-step Metods -Predictor-Corrector Approac -Runge-Kutta Metods -Adaptive Stepsize Algoritms S U R A N A R E E UNIVERSITY OF TECHNOLOGY Mongkol JIRAVACHARADET INSTITUTE OF ENGINEERING SCHOOL OF CIVIL ENGINEERING Ordinar Differential Equations Rate of cange of one variable wit respect to anoter. were d dt = t = independent variable =dependent variable f(, t ) Initial Condition (t )= k Example: Mass-spring sstem c m d x dx ma + cv + kx = m c kx dt + dt + = x

EULER S S METHOD From Talor series: ( t t) t () = t ( ) + ( t t) ( t) + ( t) +L! Retaining onl first derivative: t () = + f( t, ) were =(t -t ), = (t ),and f(t, )= (t ) t t Predict True New value =Old value +slope x step size t error = + f( t, ) = + f ( t, ) = + f( t, ) i i i i Example: Manual Calculation wit Euler smetod d t, () dt = = 5 4 t Exact solution: = ( t + e ) Set =. t i f (t i-, i- ) Euler i = i- + f (t i-, i- ) Exact Error...4.6 NA -() =-..-(.6) =-..4-(.4) =-.4 initial cond. =..+.(-.) =.6.6+.(-.) =.4.4+.(-.4) =.3..6879.57.465 -.879 -.7 -.65

Implementing Euler s Metod odeeuler.m function [t,] = odeeuler(diffeq,tn,,) % Input: diffeq = (string) name of m-file tat % evaluate rigt and side of ODE % tn = stopping value of independent variable % = stepsize % = initial condition at t= t = (::tn) ; n = lengt(t); = *ones(n,); for i=:n (i) = (i-)+*feval(diffeq,t(i-),(i-)); end d Example: t, (),. dt = = = rs.m function ddt = rs(t,) ddt = t-*; >> [t,] = odeeuler( rs,.6,.,.) t = =..4.6..6.4.3

Exact Solution : >> = (/4)*(*t-ones(size(t))+5*exp(-*t)) =..6879.57.465 >> t=:.:.6; >> = (/4)*(*t-ones(size(t))+5*exp(-*t)); >> plot(t,,t,) Improvements of Euler s Metod Heun s Metod: estimate slope from derivatives at te beginning and at te end of te interval. Euler: i = i- + k slope: k = f(t i, i) slope: k = f(t i-, i- ) t i- t i t

Average slope k + k f ( ti, i ) + f ( ti, = = i ) i = i k + k + Use slope: (k + k )/ t i- t i t Heun s Metod d f(, t ) k = f( t, ) i i dt = i k = f( t +, + k ) i i k = + i i + k Euler Heun True i- t i- t i

Predictor-Corrector Approac Heun smetod: k = f( t, ) i i k = f( t +, + k ) i i k = + i i + k Euler smetod: = + f( t, ) i i i i Predictor: i = i + f( ti, i ) Corrector: f t f t i = i + ( i, i ) + ( i, i ) Iterating te Corrector of Heun s Metod To improve te estimation i f t f t i + ( i, i ) + ( i, i )

Example: Use Heun smetod to integrate From x =to 4,step size = = e =.8x 4.5, () 4 = e e + e.3 Analtical solution: ( ) Predictor, i = i + f( ti, i ) = + (4e.5()) = 5.8 x.5 x.5 x Corrector, = + i i f t f t ( i, i ) + ( i, i ).8() (4e.5()) + (4e.5(5)) = + = 6.7 4.8().5().5() = e e + e = 6.946.3 True value: ( ) 6.946 6.7 Relative error, E t = % = 8.8% 6.946 nd Corrector, = + rd 3 Corrector,.8() (4e.5()) + (4e.5(6.7)) = 6.758, E =.3% t + = + = 6.38, E = 3.3% Error ma increases for large step sizes..8() (4e.5()) (4e.5(6.758)) t

Iteration using up-arrow in MATLAB >> = +*(4*exp()-.5*) % Predictor of = 5 >> = +(/)*((4*exp()-.5*)+(4*exp(.8*)-.5*)) = 6.7 % st Corrector of Press and Enter = 6.7 % nd Corrector of = 6.758 = 6.38 = 6.3555 % 3rd Corrector of % 4t Corrector of % 5t Corrector of = 6.369 % until no cange MATLAB s Implementation func.m function ddx = func(x,) ddx = 4*exp(.8*x)-.5*; odeheun.m function [x,] = odeheun(diffeq,xn,,,iter) % Input: iter = number of corrector iterations x = (::xn) ; n = lengt(x); = *ones(n,); for i=:n (i) = (i-)+*feval(diffeq,x(i-),(i-)); for j=:iter end end (i) = (i-)+*(feval(diffeq,x(i-),(i-))... + feval(diffeq,x(i),(i)))/;

For x =to 4,step size =, () =,Iteration =5 >> [x,] = odeheun( func,4,,,5) x = = 3 4. 6.369 5.3 34.7433 77.735 _true =. 6.946 4.8439 33.677 75.339 Et =..68 3.9 3.7 3.8 Compare wit Euler smetod: >> [x,] = odeeuler( func,4,,) x = = 3 4. 5..4 5.53 56.8493 Et =. 9.8 3.9 4.4 4.54

Comparison of True Solution wit Euler sand Heun s Metod >> xtrue = (:.:4) ; >> true =(4/.3)*(exp(.8*xtrue)-exp(-.5*xtrue))... + *exp(-.5*xtrue); >> [xeuler,euler] = odeeuler( func,4,,); >> [xeun,eun] = odeheun( func,4,,,5); >> plot(xtrue,true,xeuler,euler, o,xeun,eun, + ) 8 6 True Euler Heun 5 4 3 4 x RUNGE-KUTTA (RK) METHODS General Formula using Weigted Average of slopes m γ k = + i i l l l= For Heun smetod γ = γ =.5 Te weigts must satisf m l= γ l = Second-Order RK (Ralston s)metod: i = + k + k 3 3 k = f( x, ) i i i 3 3 k = f xi +, i + k 4 4

Tird-Order Runge-Kutta Metods were i = + k + k + k 6 k = f( x, ) i i ( 4 ) i 3 k = f xi +, i + k k = f x + k+ k (, ) 3 i i Fout-Order Runge-Kutta Metods Te most popular RK metods Classical 4t-order RK: were k = f( x, ) i i k = f xi +, i + k k3 = f xi +, i + k k = f x + + k (, ) 4 i i 3 i = + k + k + k + k 6 ( ) i 3 4

Example: Use 4t-order RK metod to integrate = e = From x =to 4,step size = Step : x =, =.8x 4.5, () k k k k 3 4 = e = 4.5() 3 = + = = + = = e + =.8(.5) 4e.5( 3 ) 4.73.8(.5) 4e.5( 4.73 ) 3.93.8() 4.5( 3.93 ) 5.9457 = + 3+ 4.73+ 3.93+ 5.9457 6 = 6. ( ) 4.8().5().5() = e e + e = 6.946.3 True value: ( ) 6.946 6. Relative error, E t = % =.38% 6.946

MATLAB s Implementation oderk4.m function [x,] = oderk4(diffeq,xn,,) x = (::xn) ; n = lengt(x); = *ones(n,); for i=:n k = feval(diffeq,x(i-),(i-)); k = feval(diffeq,x(i-)+/,(i-)+k*/); k3 = feval(diffeq,x(i-)+/,(i-)+k*/); k4 = feval(diffeq,x(i-)+,(i-)+k3*); (i) = (i-)+/6*(k+*k+*k3+k4); end For x =to 4,step size =, () =,Iteration =5 >> [x,] = oderk4( func,4,,) x = = 3 4. 6. 4.865 33.73 75.439 _true =. 6.946 4.8439 33.677 75.339 Et(%) =..38.5.39.38

Adaptive Stepsize Algoritms MATLAB s ode3 and ode45 Routines ode3 use second-and tird-order RK simultaneousl ode45 use fourt-and fift-order RK simultaneousl Example: For x =to 4, ()=.8x = 4e.5, () = func.m >> x = ; xn = 4; = ; >> [x45,45] = ode45( func,[x,xn],); >> xtrue = (:.:4) ; >> true =(4/.3)*(exp(.8*xtrue)... - exp(-.5*xtrue))+ *exp(-.5*xtrue); >> plot(xtrue,true,x45,45)