Dr. Jie Zou PHY 33201 Chapter 7 Numerical Differentiation: 1 Lecture (I) 1 Ref: “Applied Numerical Methods with MATLAB for Engineers and Scientists”, Steven.
Published byModified over 4 years ago
Presentation on theme: "Dr. Jie Zou PHY 33201 Chapter 7 Numerical Differentiation: 1 Lecture (I) 1 Ref: “Applied Numerical Methods with MATLAB for Engineers and Scientists”, Steven."— Presentation transcript:
Dr. Jie Zou PHY 33201 Chapter 7 Numerical Differentiation: 1 Lecture (I) 1 Ref: “Applied Numerical Methods with MATLAB for Engineers and Scientists”, Steven Chapra, 2 nd ed., McGraw Hill, 2008.
Dr. Jie Zou PHY 33202 Outline Engineering and scientific applications Definition of the derivative-a review of calculus Numerical differentiation (1) Basic finite-difference approximations for both the 1 st and 2 nd derivatives (I) Forward difference (II) Backward difference (III) Centered difference (2) Higher-accuracy finite-difference approximations (Lecture II)
Dr. Jie Zou PHY 33203 Engineering and scientific applications The mathematical models of most engineering and science problems involve differentiation. Examples: Mechanics: Newton’s 2 nd law (1D), F = md 2 x/dt 2. Heat conduction: Fourier’s law (1D), q = - kdT/dx. Electrical conduction: Ohm’s law (1D), J = - dV/dx. When do we need apply methods of numerical differentiation? When it is difficult to differentiate analytically; When the function is unknown and defined only by measurement at discrete points. Heat flow and temperature gradient (Ref. Fig. 19.2)
4 Definition of the derivative (First) derivative: The rate of change of a dependent variable, such as y, with respect to an independent variable, such as x. Graphical representation Difference approximation Definition of the derivative
Dr. Jie Zou PHY 33205 Definition of the derivative (cont.) Second derivative: The derivative of the first derivative. Mathematical definition: The 1 st derivative tells us the slope of the tangent to the curve at a given point. The 2 nd derivative tells us how fast the slope is changing. It is also called the curvature. Partial derivatives of f(x, y):
Dr. Jie Zou PHY 33206 Basic finite-difference approximations Taylor series expansion of f(x) about a point x i : Evaluating f(x) at point x i+1, we have: Truncating the series after the first derivative term, we have: Forward difference approx. of the 1 st derivative: h: The step size - the length of the interval over which the approximation is made; h = x i+1 – x i.
7 Basic finite-difference approximations (cont.) Backward difference approx. of the 1 st derivative: Centered difference approx. of the 1 st derivative: Note: The truncation error in the Centered difference approx. is of the order of h 2 ; the truncation error in the Forward and Backward difference approx. is of the order of h. Centered difference approx. is more accurate than the Forward or Backward difference approx.
Dr. Jie Zou PHY 33208 Basic finite-difference approximations (cont.) Finite-difference approximations of the 2 nd derivatives: Second forward finite difference: Second backward finite difference: Second centered finite difference:
Dr. Jie Zou PHY 33209 Example (Ref. example 4.4) Use a forward, backward, and centered difference approximation to estimate the 1 st derivative of f(x) = -0.1x 4 – 0.15x 3 – 0.5x 2 – 0.25x + 1.2 at x = 0.5 using a step size h = 0.5. Repeat the computation using h = 0.25. Find the percent error of the estimation relative to the true value.