# Copyright 2005 by yshong 1 Engineering

8d3d98882c15b8c6df022b52b6116ca7.ppt

- Количество слайдов: 86

Copyright © 2005 by yshong 1

Engineering Applications with Computers I (Aspect in Numerical Methods) Instructor: YUNG-SHAN HONG, Ph. D. , PE. Office: E 723 Tel: 26215656 ext. 3260 Copyright © 2005 by yshong 2

Objective: This course covers a variety of numerical methods and their applications in various engineering problems. Emphasis is placed on the solution of solving nonlinear equation, matrix analysis of linear and nonlinear equations, eigen-value problems, curve fitting, numerical integration and differentiations as well as interpolation methods. Pre-knowledge of Engineering Mathematics and programming skills with computer language (s) are strongly required. Copyright © 2005 by yshong 3

Outline and Schedule: u Introduction (2 hrs) u Mathematical modeling and engineering problem solving (2 hrs) u Error and definition (2 hrs) u Roots of equations (1) - bracketing methods (2 hrs) u Roots of equations (2) - open methods (2 hr) u Systems of nonlinear equations (2 hrs) u Linear algebraic equations - mathematical and numerical method (3 hrs) u Eigenvalue problems (3 hrs) Copyright © 2005 by yshong 4

Outline and Schedule: u Least squares regression (2 hrs) u Interpolation - Lagrange and Newton approach (2 hr) u Interpolation - spline function (2 hrs) u Numerical integration - general (2 hrs) u Numerical integration - double integral (2 hrs) u Numerical solution of ordinary differential equations (2 hrs) u Numerical solution of partial differential equations (2 hrs) Copyright © 2005 by yshong 5

Grading: u Ordinarily expression 20% u Homework (3~4 times) 20% u Mid term exam 30% u Final term exam 30% Copyright © 2005 by yshong 6

Textbook: Chapra, S. C. and Canale, R. P. (2002), “Numerical methods for engineers – with programming and software applications”, Fourth Edition, Mc. GRAW-Hill. Reference: u Gerad, C. F. and Wheatley, P. O. (1999), “Applied numerical analysis”, Sixth Edition, Addison-Wesley. u Schilling, R. J. and Harris, S. L. (1999), “Applied numerical methods for engineers – using Matlab and C”, Brooks/Cole. u 林聰悟、林佳慧 (1997), “數值方法與程式 ”, 圖文技術服 務。 Copyright © 2005 by yshong 7

About the authors: Steve Chapra teaches in the Civil and Environmental Engineering Department at Tufts University. Dr. Chapra received engineering degrees from Manhattan College and the University of Michigan. Before joining the faculty at Tufts, he worked for the Environmental Protection Agency and the National Oceanic and Atmospheric Administration, and taught at Texas A&M University and the University of Colorado. His general research interests focus on surface water-quality modeling and advanced computer applications in environmental engineering. Copyright © 2005 by yshong 8

About the co-authors: Raymond P. Canale is an emeritus professor at the University of Michigan. During his over 20 -year career at the university, he taught numerous courses in the area of computers, numerical methods, and environmental engineering. He also directed extensive research programs in the area of mathematical and computer modeling of aquatic ecosystems. He has authored or coauthored several books and has published over 100 scientific papers and reports. Copyright © 2005 by yshong 9

Why you should study numerical methods ? u Numerical methods are extremely powerful problemsolving tools. They are capable of handling large systems of equations, nonlinearities, and complicated geometries that are not uncommon in engineering practice and often impossible to solve analytically. u During your careers, you may often have occasion to use commercially available prepackaged that involve numerical methods. The intelligent use these programs is often predicated on knowledge of the basic theory underlying the methods. Copyright © 2005 by yshong 10

u Many problems cannot be approached using prepackaged programs. If you are conversant with numerical methods and are adept at computer programming, you can design your own programs to solve problems without having to buy expensive software. u Numerical methods are an efficient vehicle for learning to use computers. Because numerical methods are for the most part designed for implementation on computers, they are ideal for this purpose. You will also learn to control the errors of approximation that are part of large-scale numerical calculations. u Numerical methods provide a vehicle for you to reinforce your understanding of mathematics. Because one function of numerical methods is to reduce higher mathematics to basic arithmetic operations. Copyright © 2005 by yshong 11

INTRODUCTION Solutions of the problem in engineering: u Analytical solution: (closed form solution) Ex. Determine sinx ? 1 at x=0 0 90 let x=0 x(o) P Ex. Determine d Copyright © 2005 by yshong 12

u Numerical solution: (approximation solution) Ex. Determine at x=10 let f(x) 1 10 Copyright © 2005 by yshong ? x 13

Numerical method: Data + Mathematical theory + computer program Approximation Copyright © 2005 by yshong 14

Types of the problem: (a) Solution of nonlinear equation (roots of equation) Ex. let f(x) x Copyright © 2005 by yshong 15

(b) Matrix analysis (solution of linear algebratic eqs. ) Ex. u 2 Ex. Copyright © 2005 by yshong u 1 16

(c) System of nonlinear eqs. Ex. x 2 x 1 Copyright © 2005 by yshong 17

(d) Curve fitting u Regression – Least squares regression u Interpolation & Extrapolation y y x Regression Copyright © 2005 by yshong x Interpolation & Extrapolation 18

(e) Integration technique p(w) f(x ) I a b x ½ space Copyright © 2005 by yshong 19

(f) Ordinary differential equation (ODE) Because many physical laws are couched in terms of the rate of change of a quantity rather than the magnitude of the quantity itself. Ex. Difference scheme viewpoint Solve y as a function of t y y. Ri+1 f(t, y) yi+1 yi Δt ti Copyright © 2005 by yshong t ti+1 20

(f) Ordinary differential equation (ODE) Additional data must be given: u Initial value problem u Boundary value problem f(x 1) ? x 1 x ? f(x 2) x 1 Copyright © 2005 by yshong f(x 1) x x 2 21

(g) Partial differential equation (PDE) The behavior of a physical quantity is couched in terms of its rate of change with respect to two or more independent variables. u Elliptic – solid mech. , flow mech. potential Laplace eqs. (滲流控制方程式 ) Copyright © 2005 by yshong 22

(g) Partial differential equation (PDE) u Parabolic – consolidation, heat… Analytical sol. u Hyperbolic – wave eqs. Copyright © 2005 by yshong 23

Motivation: Numerical methods are techniques by which mathematical problems are formulated so that they can be solved with arithmetic operations. Although there are many kinds of numerical methods, they have one common characteristic: they invariably involve large numbers of tedious arithmetic calculations. It is little wonder that with the development of fast, efficient digital computers, the role of numerical methods in engineering problem solving has increased dramatically in recent years. Copyright © 2005 by yshong 24

Non-computer methods: (1) Solutions were derived for some problems using analytical, or exact method. Exact sol. Ex. Exact sol. Copyright © 2005 by yshong ? 25

(2) Graphical solutions were used to characterize the behavior of systems. Ex. x …. y …. 1 y 2 x The results are not very precise. Graphical techniques are often limited to problems that can be described using three or fewer dimensions. (3) Calculators and slide rules were used to implement numerical method manually. The method used to simple engineering problems. Copyright © 2005 by yshong 26

Complex engineering problems: Numerical method: Data + Mathematical theory + computer program Approximation Copyright © 2005 by yshong 27

The engineering problemsolving process : Problem definition Theory Mathematical model Data Problem-solving tools: Computers, statistics, Numerical methods, graphics, etc. Numeric or graphic results Societal interfaces: Scheduling, optimization, communication, public interaction, ect. Implementation Copyright © 2005 by yshong 28

CHAPTER 1 A SIMPLE MATHEMATICAL MODEL A mathematical model can be broadly defined as a formulation or equation that expresses the essential features of a physical system or process in mathematical terms. In a very general sense, it can be represented as a functional relationship of the form: Dependent variable = f (independent variables, parameters, forcing functions)…………. . (1. 1) Copyright © 2005 by yshong 29

Dependent variable = f (independent variables, parameters, forcing functions)…………. . (1. 1) Where the dependent variable is a characteristic that usually reflects the behavior or state of the system; the independent variables are usually dimensions, such as time and space, along which the system’s behavior is being determined; the parameters are reflective of the system’s properties or composition; and the forcing functions are external influences acting upon it. d: dependent variable P: forcing functions A, E, L: parameters Copyright © 2005 by yshong 30

The following illustrates a physical problem how to represent by a mathematical model. According Newton second law, ……………(1. 2) Where F = net force acting on the body (N or kg-m/sec 2) m = mass of object (kg) a = its acceleration (m/sec 2) Copyright © 2005 by yshong 31

(1. 2): ……………(1. 3) Where a = the dependent variable reflecting the system’s behavior F = the forcing function (net froce) m = a parameter represent a property of the system Note: this simple case there is no independent variable because we are not yet predicting how acceleration varies in time or space. Copyright © 2005 by yshong 32

To illustrate a more complex model of this kind, Newton’s second law can be used to determine the terminal velocity of a free-falling body near the earth’s surface. The falling body will be a parachutist. (Fig. 1. 2) ………. (1. 4) Fu +: the object will accelerate F: net force -: the object will decelerate Fd 0: the object will remain at a constant level Copyright © 2005 by yshong 33

………. (1. 5) FD: the downward pull of gravity FU: the upward force of air resistance ………. (1. 6) ………. (1. 7) g: the gravitational constant ≈ 9. 8 m/s 2 c: drag coefficient = f(shape, surface roughness, …. ) Copyright © 2005 by yshong 34

From eqs. (1. 4) through (1. 7) combined: ………. (1. 8) or Type of eq. ? ODE ………. (1. 9) Eq. (1. 9) is a differential equation that relates the acceleration of a falling object to the forces acting on it. What type of problem ? If the parachutist is initially at rest (v=0 at t=0), that is a initial value problem. Solve eq. (1. 9) for Copyright © 2005 by yshong 35

………. (1. 10) Note : v(t): the dependent variable t= the independent variable c, m= parameters g= the forcing function The following will illustrate the analytical solution and the numerical solution, respectively. Copyright © 2005 by yshong 36

Ex 1. 1 analytical solution Known: mass=68. 1 kg, c=12. 5 kg/s Eq. (1. 10) then v(m/s) terminal velocity 53. 39 exact sol. t(s) Eq. (1. 10) is called an analytical, or exact solution because it exactly satisfies the original differential equation. Unfortunately, there are many mathematical models that cannot be solved exactly. In many of these cases, the only alternative is to develop a numerical solution that approximates the exact solution. Copyright © 2005 by yshong 37

Ex 1. 2 numerical solution ………. (1. 11) ………. (1. 9) So eq. (1. 9): Copyright © 2005 by yshong 38

When t=0, v=0, if step size (time step)=2 i=0 m/s i=1 m/s v(t=6), v(t=8), …………. . Copyright © 2005 by yshong 39

terminal velocity v (m/s) numerical sol. exact sol. 0 2 Copyright © 2005 by yshong 4 6 8 t (s) 40

Homework : Problems 1. 3, 1. 4 and 1. 5 (p. 22) Due : One week Copyright © 2005 by yshong 41

CHAPTER 2 PROGRAMMING AND SOFTWARE pp. 25 -49 Copyright © 2005 by yshong 42

CHAPTER 3 APPROXIMATIONS AND ROUND-OFF ERRORS How much error is present in our calculations and is it tolerable ? Two major forms of numerical error: Round-off error Truncation error Inherent error Copyright © 2005 by yshong 43

The concept of a significant figure. See Fig. 3. 1 (p. 51) Accuracy and precision Accuracy refers to how closely a computed or measured value agrees with the true value. True value = 2. 83 Precision refers to how closely individual computed or measured values agree with each other. Copyright © 2005 by yshong 44

Fig. 3. 2 Increasing precision Increasing accuracy (a) (c) Copyright © 2005 by yshong (b) (d) 45

Numerical methods should be sufficiently accurate or unbiased to meet the requirements of particular engineering problem. They also should be precise enough for adequate engineering design. Copyright © 2005 by yshong 46

Error definitions (1) True error Et (absolute error) Et = true value - approximation Ex. Two approaches to measure length of the two objects. Approach (a) : Object (a) true length=1 m, measured error=1 cm Approach (b) : Object (b) true length= 0. 1 m, measured error=1 cm What is better approach ? Copyright © 2005 by yshong 47

(2) Relative error et Ex. Two approaches to measure length of the two objects. Approach (a) : Object (a) true length=1 m, measured error=1 cm Approach (b) : Object (b) true length= 0. 1 m, measured error=1 cm Approach (a) : et=1% Approach (b) : et=10% Copyright © 2005 by yshong 48

value Iterative approach characteristic Cal. number (3) The approximation percent relative error ea ………. (3. 5) m : iteration number i : point, position Copyright © 2005 by yshong 49

Truncation error (Chapter 4) Truncation errors are those that result from using an approximation in place of an exact mathematical procedure. For example, in Chap. 1 we approximated the derivative of velocity of a falling parachutist by a finite-divided-difference eq. of the form. ………. (4. 1) Copyright © 2005 by yshong 50

A truncation error was introduced into the numerical solution because the difference eq. only approximates the true value of the derivative. In order to gain insight into the properties of such errors, we now turn to a mathematical formulation that is used widely in numerical methods to express functions in an approximate fashion – the Taylor series. Copyright © 2005 by yshong 51

Taylor series c is between [a, b], nth-order derivatives are existence for f(x), then f(x) at c can be to express following eq. using Taylor series. Rn(x) = remainder term Copyright © 2005 by yshong 52

If c=0, f(x) series expressing to call Maclaurin’s series, If (n-1)th-oder approximate, then Rn(x) refers to truncation error Copyright © 2005 by yshong 53

Ex. Use fourth-order Maclaurin series expansions to approximate the function Predict the function’s value at x=1. Sol: let f(x)=ex, f’(x)=f’’’(x)=f(4)(x)=ex, ∴ f(0)=1, f’(x)=f’’’(x)=f(4)(x)=1 ∵Maclaurin expansion series: Copyright © 2005 by yshong 54

Expressing to fourth-order But ∴ truncation error= 2. 71828 -2. 70833= 0. 00995 Copyright © 2005 by yshong 55

In a similar manner, the complete Taylor series expansion: ………. . (4. 5) If we simplify the Taylor series, Refer to first-order approximation …… Refer to second-order approximation xi+1 -xi=h refer to step size Copyright © 2005 by yshong 56

Ex. 4. 1 Use zero ~ fourth-order Taylor series expansions to approximate the function: from xi=0 with h=1. That is, predict the function’s value at xi+1=1 Sol: true value f(1)=0. 2 zero-order: Truncation error=0. 2 -1. 2=-1 first-order: ∵ Truncation error=0. 2 -0. 95=-0. 75 Copyright © 2005 by yshong 57

second-order: Truncation error=0. 2 -0. 45=-0. 25 f(x) f(xi) Zero order 1. 2 0. 95 first order 0. 45 second order xi=0 f(xi+1) xi+1=1 x How order Taylor series expansion can be no truncation error ? Copyright © 2005 by yshong 58

In general, the nth-order Taylor series expansion will be exact for an nth-order polynomial. For other differentiable and continuous functions, such as exponentials and sinusoids, a finite number of terms will not yield an exact estimate. Each additional term will contribute some improvement, to the approximation. Only if an infinite number of terms are added will the series yield an exact result. EX. 4. 2 Copyright © 2005 by yshong 59

Round-off error (Chapter 3) Round-off errors originate from the fact that computers retain only a fixed number of significant figures during a calculation. Number such as p, e, or cannot be expressed by a fixed number of significant figures. Therefore, they cannot represented exactly by the computer. In addition, because computers use a base-2 representation, they cannot precisely represent certain exact base-10 numbers. The discrepancy introduced by this omission of significant figures is called round-off error. Copyright © 2005 by yshong 60

Base-2: 00 01 10 11 100 101 110 111 1000 1001 Base-10: 0 1 2 3 4 5 6 7 8 9 Ex. 3253 is represented base-10: Ex. 110. 11 is represented base-2: Copyright © 2005 by yshong 61

But, ex. (0. 2)10 8 numbers represented: To get a decimal point at sixth number Round-off error = 0. 2 - 0. 199219 = 0. 000781 Copyright © 2005 by yshong 62

ROOTS OF EQUATIONS (Part 2, p. 105) Ex. Such as f(x) cannot be solved analytically. In such instance, the only alternative is an approximate solution technique. One method to obtain an approximate solution is to plot the function and determine where it crosses the x axis. This point, which represents the x value for which f(x) = 0, is the root. f(x) root x Copyright © 2005 by yshong 63

Although graphical method are useful for obtaining rough estimates of roots, they are limited because of their lack of precision. An alternative approach is to use trial and error. This “technique” consists of guessing a value of x and evaluating whether f(x) is zero. Such this methods are obviously inefficient and inadequate for the requirements of engineering practice. Copyright © 2005 by yshong 64

Ex. Such computations can be performed directly because v is expressed explicitly as a function of time. However, suppose we had to determine the drag coefficient for a parachutist of a given mass to attain a prescribed velocity in a set time period. Ex. There is no way to rearrange the equation so that c is isolated on one side of the equal sign. In such cases, c is said to be implicit. Copyright © 2005 by yshong 65

Approach of Nonlinear equation solution: Bracketing method (chap. 5) – bisection, false position Open method (chap. 6) – one-point iteration, Newton. Raphson, secant method Roots of polynomials (chap. 7) – Müller’s methos, Bairstow’s method Copyright © 2005 by yshong 66

Roots within the interval Assumption a nonlinear equation f(x)=0 is a continue function. Two points are “a” and “b” on x-axis, then f(x) is whether solutions between a and b. According to follow as, (1) If f(a)*f(b)=0, then f(x) has a solution. (2) If f(a)*f(b)<0, then f(x) has a solution x=r between “a” and “b” to satisfy f(x)=0. (3) If f(a)*f(b)>0, then ? Ref. pp. 114~115. fig. 5. 2 ~ fig. 5. 4. Copyright © 2005 by yshong 67

CHAPTER 5 BRACKETING METHODS Bi-section method f(a ) x 3 a x 1 b x 2 f(b ) Copyright © 2005 by yshong 68

False position method (linear interpolation method) f(a ) x 3 x 2 x 1 b a f(b ) Copyright © 2005 by yshong 69

CHAPTER 6 OPEN METHODS For the bracketing methods in the previous chapter, the root is located within an interval prescribed by a lower and an upper bound. Repeated application of these methods always results in closer estimates of the true value of the root. Such methods are said to be convergent because they move closer to the truth as the computation progresses. In contrast, the open methods described in this chapter are based on formulas that require only a single starting value of x or two starting values that do not necessarily bracket the root. As such, they sometimes diverge or move away from the true root as the computation progresses. However, when the open methods converge, they usually do so much quickly than the bracketing methods. Copyright © 2005 by yshong 70

Secant method (ref. chap. 6. 3) y x r 0 r 1 r 2 r 3 f(x) Copyright © 2005 by yshong 71

Newton-Raphson method (ref. chap. 6. 2) y f(x) x x 2 Copyright © 2005 by yshong x 1 x 0 72

Fixed-point iteration (ref. chap. 6. 1) f(x)=0, x=g(x) y 1=x Rewrite, y 1=x, y 2=g(x) y y 2=g(x) x x 0 Copyright © 2005 by yshong x 1 x 2 73

CHAPTER 6. 5 SYSTEMS OF NONLINEAR EQUATIONS Ex. ü Fixed-point iteration ü Newton-Raphson method Copyright © 2005 by yshong 74

LINEAR ALGEBRAIC EQUATIONS Matrix form: Copyright © 2005 by yshong 75

Mathematical background (ref. pp. 219~230) u Diagonal matrix u Unit matrix u Upper triangular matrix u Lower triangular matrix u Transpose matrix u Symmetrical matrix Copyright © 2005 by yshong 76

Mathematical approach: ü Inverse matrix method ü Cramer’s method ü Gauss elimination method ü Gauss-Jordan elimination method ü LU decomposition method Numerical approach: ü Jacobi’s iteration method ü Gauss-Seidel iteration method Copyright © 2005 by yshong 77

EIGENVALUE PROBLEMS (ref. chapter 27) Engineering analysis: Ø Steady state (static equilibrium) Ø Eigenvalue problems (vibration, oscillating system, …) Ø Propagation problems (wave propagation, transient involve a lot of frequencies) Copyright © 2005 by yshong 78

Steady state (static equilibrium)Single frequency Ex. K: stiffness U: displacement P: force ü Solve the system of algebraic ü The equation is nonhomogeneous Copyright © 2005 by yshong 79

Eigenvalue problems (vibration, oscillating system, …) ü Solve the system of algebraic ü The equation is homogeneous, and the U solution is not unique. (for P=0) Copyright © 2005 by yshong 80

CURVE FITTING, LEASTSQUARE REGRESSION (ref. chapter 17) Copyright © 2005 by yshong 81

INTERPOLATION (ref. chapter 18) Ø Lagrange interpolation polynomial Ø Newton’s interpolation method Ø Spline interpolation (Spline function) Copyright © 2005 by yshong 82

NUMERICAL INTEGRATION (ref. pp. 569 ~ 612) Ø Rectangle integration Ø Trapezoidal integration Ø Simpson’s integration Ø Newton-cotes integration Ø Romberg integration Ø Double integral Copyright © 2005 by yshong 83

NUMERICAL DIFFERENTIATION (ref. chapter 23, pp. 632 ~ 666) Difference scheme Ø Forward difference Ø Backward difference Ø Central difference Copyright © 2005 by yshong 84

…………………… Copyright © 2005 by yshong 85

Thank for your attention Copyright © 2005 by yshong 86

Мы удаляем страницу по первому запросу с достаточным набором данных, указывающих на ваше авторство. Мы также можем оставить страницу, явно указав ваше авторство (страницы полезны всем пользователям рунета и не несут цели нарушения авторских прав). Если такой вариант возможен, пожалуйста, укажите об этом.