Numerical Methods Lecture 14 Differentiation-Continuous Functions

Slides:



Advertisements
Similar presentations
Roundoff and truncation errors
Advertisements

Computational Modeling for Engineering MECN 6040
3 Copyright © Cengage Learning. All rights reserved. Applications of Differentiation.
CISE301_Topic61 SE301: Numerical Methods Topic 6 Numerical Differentiation Lecture 23 KFUPM Read Chapter 23, Sections 1-2.
EE3561_Unit 6(c)AL-DHAIFALLAH14351 EE 3561 : Computational Methods Unit 6 Numerical Differentiation Dr. Mujahed AlDhaifallah ( Term 342)
Numerical Computation
2. Numerical differentiation. Approximate a derivative of a given function. Approximate a derivative of a function defined by discrete data at the discrete.
Lecture 18 - Numerical Differentiation
CE33500 – Computational Methods in Civil Engineering Differentiation Provided by : Shahab Afshari
Major: All Engineering Majors Author(s): Autar Kaw
SE301_14(c)AL-AMER20031 SE031Numerical Methods Topic 6 Numerical Differentiation Dr. Samir Al-Amer ( Term 053) Modified by Dr. Baroudi(072) Read chapter.
Computer-Aided Analysis on Energy and Thermofluid Sciences Y.C. Shih Fall 2011 Chapter 6: Basics of Finite Difference Chapter 6 Basics of Finite Difference.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series.
1 Chapter 6 NUMERICAL DIFFERENTIATION. 2 When we have to differentiate a function given by a set of tabulated values or when a complicated function is.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 23 Numerical Differentiation.
CSE 330 : Numerical Methods Lecture 17: Solution of Ordinary Differential Equations (a) Euler’s Method (b) Runge-Kutta Method Dr. S. M. Lutful Kabir Visiting.
8/15/ Differentiation-Discrete Functions Major: All Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati.
8/15/ Differentiation-Continuous Functions Major: All Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
Major: All Engineering Majors Author(s): Autar Kaw
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Simpson’s 1/3 rd Rule of Integration. What is Integration? Integration The process of measuring the area under a.
1 Simpson’s 1/3 rd Rule of Integration. 2 What is Integration? Integration The process of measuring the area under a curve. Where: f(x) is the integrand.
1 Trapezoidal Rule of Integration. What is Integration Integration: The process of measuring the area under a function.
1 Interpolation. 2 What is Interpolation ? Given (x 0,y 0 ), (x 1,y 1 ), …… (x n,y n ), find the value of ‘y’ at a.
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
Differentiation A Slippery Slope - Jerks You Around - Accelerates Your Mind
10/27/ Differentiation-Continuous Functions Computer Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati.
Differentiation A Slippery Slope - Jerks You Around - Accelerates Your Mind
Today’s class Numerical Differentiation Finite Difference Methods Numerical Methods Lecture 14 Prof. Jinbo Bi CSE, UConn 1.
MECN 3500 Inter - Bayamon Lecture Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Sensitivity derivatives Can obtain sensitivity derivatives of structural response at several levels Finite difference sensitivity (section 7.1) Analytical.
Engineering Analysis – Computational Fluid Dynamics –
CSE 330 : Numerical Methods Lecture 15: Numerical Integration - Trapezoidal Rule Dr. S. M. Lutful Kabir Visiting Professor, BRAC University & Professor.
Lecture 4 - Numerical Errors CVEN 302 June 10, 2002.
1 INTERPOLASI. Direct Method of Interpolation 3 What is Interpolation ? Given (x 0,y 0 ), (x 1,y 1 ), …… (x n,y n ), find the value of ‘y’ at a value.
5 INTEGRALS.
5. Interpolation 5.1 Definition of interpolation. 5.2 Formulas for Interpolation. 5.3 Formulas for Interpolation for unequal interval. 5.4 Applications.
NUMERICAL DIFFERENTIATION or DIFFERENCE APPROXIMATION Used to evaluate derivatives of a function using the functional values at grid points. They are.
CSE 330: Numerical Methods. Introduction The bisection and false position method require bracketing of the root by two guesses Such methods are called.
1 Numerical Differentiation. 2  First order derivatives  High order derivatives  Examples.
Differentiation – Continuous Functions. Forward Difference Approximation 2 f  x  Δx   f  x  Δx lim Δx  0 f  x   For a finite 'Δx' (we can not.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 21 Numerical Differentiation.
11/22/ Differentiation-Discrete Functions.
NUMERICAL DIFFERENTIATION Forward Difference Formula
High Accuracy Differentiation Formulas
Numerical Differentiation
1. 2 What is Integration? Integration The process of measuring the area under a curve. Where: f(x) is the integrand a= lower limit of integration b=
Interpolation.
Applied Numerical Methods
Differentiation-Continuous Functions
Numerical Differentiation
Differentiation-Discrete Functions
The taylor series and Numerical Differentiation
Central Divided Difference
Sec:4.1 THE TAYLOR SERIES.
Numerical Solutions of Ordinary Differential Equations
Various Symbols for the Derivative
Chapter 23.
Numerical Differentiation Chapter 23
Numerical Analysis Lecture 26.
INTERPOLASI.
Forward Divided Difference
Numerical Computation and Optimization
The taylor series and Numerical Differentiation
MATH 174: NUMERICAL ANALYSIS I
SKTN 2393 Numerical Methods for Nuclear Engineers
Numerical Computation and Optimization
Objectives Approximate a definite integral using the Trapezoidal Rule.
Forward Divided Difference
Presentation transcript:

Numerical Methods Lecture 14 Differentiation-Continuous Functions Dr. S. M. Lutful Kabir Visiting Professor, BRAC University & Professor (On-leave), BUET

Forward Difference Approximation For a finite

Forward Difference Approximation Figure 1 Graphical Representation of forward difference approximation of first derivative.

Derive the forward difference approximation from Taylor series Taylor’s theorem says that if you know the value of a function ‘f’ at a point xi and all its derivatives at that point, provided the derivatives are continuous between xi and xi+1, then Substituting for convenience

Derive the forward difference approximation from Taylor series (cont.) The term shows that the error in the approximation is of the order of Can you now derive from Taylor series the formula for backward divided difference approximation of the first derivative? It can be shown that both forward and backward divided difference approximation of the first derivative are accurate on the order of Can we get better approximation? Yes, another method to approximate the first derivative is called the Central difference approximation of the first derivative.

Backward Difference Approximation of the First Derivative We know For a finite If is chosen as a negative number,

Backward Difference Approximation of the First Derivative (continued) This is a backward difference approximation as you are taking a point backward from x. To find the value of at we may choose another point behind as This gives where,

Backward Difference Approximation of the First Derivative (continued) x-Δx f(x) Figure 2 Graphical Representation of backward difference approximation of first derivative

Derive the backward difference approximation from Taylor series Taylor’s theorem says that if you know the value of a function ‘f’ at a point xi and all its derivatives at that point, provided the derivatives are continuous between xi and xi-1, then Substituting for convenience

Derive the Central difference approximation from Taylor series (cont.) Subtracting equation (2) from the first (1),

Central Divided Difference Hence showing that we have obtained a more accurate formula as the error is of the order of . x f(x) x-Δx x x+Δx Figure 3 Graphical Representation of central difference approximation of first derivative

Example 1 The velocity of a rocket is given by where is given in m/s and is given in seconds. Use forward, backward and central divided difference approximation of the first derivative of to calculate the acceleration at . Use a step size of . Find the absolute relative true error for part (a).

Comparison of FDD, BDD, CDD The results from the three difference approximations are given in Table 1. Table 1 Summary of a (16) using different divided difference approximations Type of Difference Approximation Forward Backward Central 30.475 28.915 29.695 2.6967 2.5584 0.069157

Effect of step size on the accuracy %Error 2 1 0.5 0.25 0.125 28.915 29.289 29.480 29.577 29.625 1.2792 0.64787 0.32604 0.16355

Finite Difference Approximation of Higher Derivatives One can use Taylor series to approximate a higher order derivative. For example, to approximate , the Taylor series for (3) where (4) where

Finite Difference Approximation of Higher Derivatives (cont.) Subtracting 2 times equation (4) from equation (3) gives (5)

Higher order accuracy of higher order derivatives The formula given by equation (5) is a forward difference approximation of 2nd derivative and has error of the order of Can we get a formula that has a better accuracy? We can get the Central difference approximation of the second derivative. The Taylor series for (6) where

Higher order accuracy of higher order derivatives (cont.) (7) where Adding equations (6) and (7), gives

Example 2 The velocity of a rocket is given by Use central difference approximation of second derivative of at . Use a step size of .

Program clear all; clc; f=@(t)(10*exp(-t)-3); f1=@(t)(-10*exp(-t)); f2=@(t)(10*exp(-t)); t=1; delta=0.2; decrement=0.04; disp(' First Derivative') disp(' ------------------') disp( ' Delta Actual Forw Back Central %Err_F %Err_B %Err_C') disp( ' ----------------------------------------------------------------------------------')

Program (continued) for i=1:5 F1F=(f(t+delta)-f(t))/delta; F1B=(f(t)-f(t-delta))/delta; F1C=(f(t+delta)-f(t-delta))/(2*delta); F1A=f1(t); Y(1)=delta; Y(2)=F1A; Y(3)=F1F; Y(4)=F1B; Y(5)=F1C; Y(6)=abs((F1F-F1A)*100/F1A); Y(7)=abs((F1B-F1A)*100/F1A); Y(8)=abs((F1C-F1A)*100/F1A); disp(Y); delta=delta-decrement; end

Program (continued) delta=0.2; disp(' ‘); disp(' Second Derivative') disp( ' Delta Actual Forw Back Central %Err_F %Err_B %Err_C') disp( ' -----------------------------------------------------------------------------------')

Program (continued) for i=1:5 F2F=(f(t)-2*f(t+delta)+f(t+2*delta))/(delta^2); F2B=(f(t-2*delta)-2*f(t-delta)+f(t))/(delta^2); F2C=(f(t+delta)-2*f(t)+f(t-delta))/(delta^2); F2A=f2(t); Y(1)=delta; Y(2)=F2A; Y(3)=F2F; Y(4)=F2B; Y(5)=F2C; Y(6)=abs((F2F-F2A)*100/F2A); Y(7)=abs((F2B-F2A)*100/F2A); Y(8)=abs((F2C-F2A)*100/F2A); disp(Y); delta=delta-decrement; end

Thanks