Numerical Methods for Civil Engineers. Numerical Differentiation

Similar documents
5 Numerical Differentiation

4.3 Lagrange Approximation

10.2 Series and Convergence

Using a table of derivatives

Roots of equation fx are the values of x which satisfy the above expression. Also referred to as the zeros of an equation

Section 3.7. Rolle s Theorem and the Mean Value Theorem. Difference Equations to Differential Equations

TOPIC 4: DERIVATIVES

1 if 1 x 0 1 if 0 x 1

Taylor and Maclaurin Series

An important theme in this book is to give constructive definitions of mathematical objects. Thus, for instance, if you needed to evaluate.

Objectives. Materials

Average rate of change of y = f(x) with respect to x as x changes from a to a + h:

1 Error in Euler s Method

Deflections. Question: What are Structural Deflections?

88 CHAPTER 2. VECTOR FUNCTIONS. . First, we need to compute T (s). a By definition, r (s) T (s) = 1 a sin s a. sin s a, cos s a

I. Pointwise convergence

Name: ID: Discussion Section:

Numerical Solution of Differential

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

POISSON AND LAPLACE EQUATIONS. Charles R. O Neill. School of Mechanical and Aerospace Engineering. Oklahoma State University. Stillwater, OK 74078

November 16, Interpolation, Extrapolation & Polynomial Approximation

Lectures 5-6: Taylor Series

6.4 Logarithmic Equations and Inequalities

Properties of sequences Since a sequence is a special kind of function it has analogous properties to functions:

Modeling, Computers, and Error Analysis Mathematical Modeling and Engineering Problem-Solving

Nonlinear Algebraic Equations Example

Homework 2 Solutions

Approximating functions by Taylor Polynomials.

14.1. Basic Concepts of Integration. Introduction. Prerequisites. Learning Outcomes. Learning Style

Limits and Continuity

Microeconomic Theory: Basic Math Concepts

Lecture 2. Marginal Functions, Average Functions, Elasticity, the Marginal Principle, and Constrained Optimization

x a x 2 (1 + x 2 ) n.

CS321. Introduction to Numerical Methods

CS 221. Tuesday 8 November 2011

SOLUTIONS. Would you like to know the solutions of some of the exercises?? Here you are

Integration of a fin experiment into the undergraduate heat transfer laboratory

CHAPTER 5 Round-off errors

Arithmetic Progression

Average rate of change

A power series about x = a is the series of the form

SOLUTIONS. f x = 6x 2 6xy 24x, f y = 3x 2 6y. To find the critical points, we solve

Nonlinear Algebraic Equations. Lectures INF2320 p. 1/88

Slope and Rate of Change

Lies My Calculator and Computer Told Me

EQUATIONS and INEQUALITIES

m i: is the mass of each particle

Differentiation and Integration

Chapter 9. Systems of Linear Equations

1. Then f has a relative maximum at x = c if f(c) f(x) for all values of x in some

100. In general, we can define this as if b x = a then x = log b

Roots of Equations (Chapters 5 and 6)

Numerical Matrix Analysis

Representation of functions as power series

15.1. Integration as the limit of a sum. Introduction. Prerequisites. Learning Outcomes. Learning Style

G.A. Pavliotis. Department of Mathematics. Imperial College London

Rolle s Theorem. q( x) = 1

ALGEBRA REVIEW LEARNING SKILLS CENTER. Exponents & Radicals

An Introduction to Partial Differential Equations

The Heat Equation. Lectures INF2320 p. 1/88

ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates

correct-choice plot f(x) and draw an approximate tangent line at x = a and use geometry to estimate its slope comment The choices were:

LINEAR EQUATIONS IN TWO VARIABLES

INTERPOLATION. Interpolation is a process of finding a formula (often a polynomial) whose graph will pass through a given set of points (x, y).

FINAL EXAM SECTIONS AND OBJECTIVES FOR COLLEGE ALGEBRA

Chapter 7. Continuity

GEOMETRIC SEQUENCES AND SERIES

LIES MY CALCULATOR AND COMPUTER TOLD ME

Sequences and Series

2 Integrating Both Sides

Vector and Matrix Norms

Exercises and Problems in Calculus. John M. Erdman Portland State University. Version August 1, 2013

Section 10.4 Vectors

Section 4.4. Using the Fundamental Theorem. Difference Equations to Differential Equations

1.7 Graphs of Functions

MA4001 Engineering Mathematics 1 Lecture 10 Limits and Continuity

BookTOC.txt. 1. Functions, Graphs, and Models. Algebra Toolbox. Sets. The Real Numbers. Inequalities and Intervals on the Real Number Line

1. First-order Ordinary Differential Equations

2013 MBA Jump Start Program

Structural Axial, Shear and Bending Moments

MATH 132: CALCULUS II SYLLABUS

WORKBOOK. MATH 30. PRE-CALCULUS MATHEMATICS.

DERIVATIVES AS MATRICES; CHAIN RULE

Microeconomics Sept. 16, 2010 NOTES ON CALCULUS AND UTILITY FUNCTIONS

1 Review of Newton Polynomials

5.1 Derivatives and Graphs

This unit will lay the groundwork for later units where the students will extend this knowledge to quadratic and exponential functions.

Course Notes for Math 162: Mathematical Statistics Approximation Methods in Statistics

CS 261 Fall 2011 Solutions to Assignment #4

Review of Fundamental Mathematics

Math 104A - Homework 2

Geometric Transformations

THE BANACH CONTRACTION PRINCIPLE. Contents

Math 120 Final Exam Practice Problems, Form: A

A three point formula for finding roots of equations by the method of least squares

What does the number m in y = mx + b measure? To find out, suppose (x 1, y 1 ) and (x 2, y 2 ) are two points on the graph of y = mx + b.

Practice with Proofs

Inner Product Spaces

To give it a definition, an implicit function of x and y is simply any relationship that takes the form:

Homework # 3 Solutions

Transcription:

Numerical Methods for Civil Engineers Lecture Notes CE 311K Daene C. McKinney Introduction to Computer Methods Department of Civil, Architectural and Environmental Engineering The University of Texas at Austin Introduction Taylor Series Numerical Differentiation The Taylor series expansion of a function f(x) in a region of x close to x = a is the infinite series If the Taylor series exists, then knowing f(x) and all of its derivatives at x = a, we can find the value of f(x) at some x different from a, as long as we remain sufficiently close to x = a. As the distance between x and a increases, we reach a point where the series expansion no longer converges to the correct value, and we are no longer sufficiently close to a. If the series converges, then the value of f(x) will be exact if an infinite number of terms are used in the series. Consider the situation shown in the following figure. We wish to find f(b) using information from point a. From the series expansion, we have CE311K 1 DCM 2/8/09

If only the first term of Equation (2) is used, then the function is assumed to be a constant, f(a), as shown in Figure a. If the first two terms are used, then the slope of f(x) at x=a is taken into account by using the straight line from f(a) with a slope of f (a) as shown in Figure b. Considering three terms allows the use of the curvature due to f (a) as shown in Figure c, etc. Each additional term improves the accuracy in the approximation for f(b). The error in the Taylor series for f(x) when the series is truncated after the term containing is not greater than where the subscript max denotes the maximum magnitude of the derivative on the interval from a to x. The error is said to be of the order of, and the notation is is commonly used to denote this. If the series expansion for f(x) is truncated after the first three terms, we say that f(x) is accurate to, since CE311K 2 DCM 2/8/09

Figure 1. Approximation resulting from truncating Taylor series. Example: Find the Taylor series expansion for sin(x) near x = 0. That is a = 0 and the Taylor series is Since sin(0) = 0 and cos(0) = 1, or Example: Use a Taylor series expansion to find the base point, we have. If we write the expansion with zero (0) as CE311K 3 DCM 2/8/09

or and, if x = 0.5 or, to order Now, the error in this approximation should not be greater than where max denotes the maximum magnitude on 0 x 0.5., so the error is no greater than The actual error is which lies within the error bound. Notice that in this case the error which was actually 0.0237 or about was Numerical Derivatives CE311K 4 DCM 2/8/09

The Taylor series expansion of the function f(x) in a small neighborhood around the point x (see Figure 2) is where. Solving this equation for f (x) we have where is the remainder term. Thus, we have found an expression for the first derivative of the function f(x) with respect to x which is accurate to within an error of h. So, the forward difference approximation of the first derivative f (x) is where a subscript notation has been used Figure 2. Forward, backward and central finite-difference approximations of the first derivative. CE311K 5 DCM 2/8/09

Graphically, the expression approximates the slope of the function f at the point x by the slope of the straight line passing through f(x+h) and f(x). We can also use the Taylor series expansion of f(x) about x to determine f(x-h): Solving for f (x) we have where So, the backward difference approximation of the first derivative f (x) is Graphically, the expression approximates the slope of the function f at the point x by the slope of the straight line passing through f(x-h) and f(x). We can derive a more accurate estimate of the first derivative by using the forward and backward Taylor series expansions about x and Subtracting the second equation from the first, we see that the terms involving even powers of h cancel, leaving CE311K 6 DCM 2/8/09

or, solving for f (x) where Employing the subscript notation, we have a central difference approximation of the first derivative, and it is accurate to or second order An expression for the second derivative is obtained by adding the previous Taylor series expressions to get Solving for f (x) So, the central difference approximation of the second derivative accurate to order, is, or second Example: Consider the function with its first three derivatives,, and Forward, backward and central finite difference formulas for the first derivative are Approximation Formula Error CE311K 7 DCM 2/8/09

Forward Backward Central Let x = 1.0 and compare the results of using these finite difference formulas to compute the first derivative with the exact value for the conditions x = 0.1, 0.05, 0.025, and 0.0125. x Forward Error Backward Error Centered Error 0.1 4.88E-01-1.25E-02 5.13E-01 1.25E-02 5.01E-01-6.25E-04 0.05 4.94E-01-6.25E-03 5.06E-01 6.25E-03 5.00E-01-1.56E-04 0.025 4.97E-01-3.13E-03 5.03E-01 3.13E-03 5.00E-01-3.91E-05 Exercises 1. Use first- through fourth-order Taylor series expansions to predict f(3) for f(x) = ln(x) using a base point at x = 1. Compute the percent relative error for each approximation. Discuss the meaning of the results. 2. Consider a uniform beam 1 m long which is simply supported at both ends, the bending moment is given my the following equation where y(x) is the deflection, M(x) is the bending moment, and EI is the flexural rigidity. Calculate the bending moment at each grid point along the beam, including the two end points, using the following deflection distribution. CE311K 8 DCM 2/8/09

i x i y i 0 0 0.000 1 0.2 7.780 2 0.4 10.68 3 0.6 8.370 4 0.8 3.970 5 1.0 0.000 3. Calculate the first derivative of at x = 1.0 by the three finite difference methods outlined in class: forward, backward and central approximation using x = 0.1, 0.05, and 0.02. For each approximation, calculate the percent error in the approximation by comparing with the exact value. 4. What is the advantage of using a "central" finite-difference approximation for the first derivative of a function rather than using a "backward" finite-difference approximation? 5. Use zero- through third-order Taylor series expansions to predict f(3) for using a base point at x = 2. Compute the true percent relative error for each approximation. 6. Use forward and backward difference approximations of O(h) and a central difference approximation of O(h 2 ) to estimate the first derivative of the function Evaluate the derivative at x = 2.5 using a step size of h = 0.25. Compare your results with the true value of the derivative at x = 2.5. 7. The rate of cooling of a body can be expressed as where T is the temperature of the body ( o C), T a is the temperature of the surrounding medium CE311K 9 DCM 2/8/09

( o C), and k is the proportionality constant (per minute). Suppose a body is heated to 90 o C and dropped into water that is held constant at T a = 25 o C, the temperature of the body changes, as in t, time (minutes) T, Temperature ( o C) 0 90 5 49.9 10 33.8 15 28.4 20 26.2 25 25.4 Utilize numerical differentiation to determine dt/dt at each value of time. Use the most accurate differentiation formulas you can at each time. 8. (adapted from Chapra and Canale Prob. 3.11) Use forward and backward difference approximations of O(h) and a central difference approximation of O(h 2 ) to estimate the first derivative of the function examined in part (b). Evaluate the derivative at x = 2.5 using a step size of h = 0.25. Compare your results with the true value of the derivative at x = 2.5. 9. Given the following function and point: (a) For a central difference approximation of the first derivative of f that is accurate to fourdecimal-places, what is the size of x that is needed. Estimate the error at that x. (b) Approximate the first derivative of f at the indicated point. (c) Compare the approximate derivative with the actual value of the derivative. 10. Given the function CE311K 10 DCM 2/8/09

f (x) = tan(40x), (a) Find f (x) at x = 0.175 analytically. (b) Find f (x) at x = 0.175 using a backward finite-difference representation of the first derivative with x = 0.075. (c) Do your answers for parts (a) and (b) agree? If not, why not. Which one is correct? 11. (a) Find the Taylor series expansion about x = 0 for (b) f(x) = ln(1 - x) where ln( ) is the natural logarithm function. Using the results of part (a), obtain the geometric series expansion for g(x) = 1 1 - x, x < 1 Hint: If ln(1 - x) = -(x + x2 2 + x3 3 + x4 4 + ) Differentiate both sides of this series. 12. Evaluate the accuracy (% error) gained by using a central finite difference representation of [ ] ( x) 2 (second-order) as compared to a forward finite difference representation of [ ( x ) ] (first-order) in evaluating f (x) at x = 1 using x = 0.1 where f(x) = e x 13. Starting from x = 25, use the first three terms of a Taylor s series to find the value of at x = 27. 14. The following table gives the values of a function. Using finite difference approximations, fill in the table for. Find the approximate error,, in your calculation. CE311K 11 DCM 2/8/09

2.00 7.3891 2.05 7.7679 2.10 8.1662 2.15 8.5849 15. Calculate the first derivative of at x = 1.0 by the three finite difference methods: forward, backward and central approximation using x = 0.1, and 0.05. For each approximation, calculate the percent error in the approximation by comparing with the exact value. CE311K 12 DCM 2/8/09