Download presentation

Presentation is loading. Please wait.

Published byAlyssa Verity Modified over 4 years ago

1
1 Copyright © 2005 by yshong

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

3
3 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

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

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

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

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

8
8 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

9
9 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

10
10 Why you should study numerical methods ? Numerical methods are extremely powerful problem- solving 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. 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

11
11 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. 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. 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

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

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

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

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

16
16 (b) Matrix analysis (solution of linear algebratic eqs.) Ex. u1u1 u2u2 Copyright © 2005 by yshong

17
17 (c) System of nonlinear eqs. Ex. x1x1 x2x2 Copyright © 2005 by yshong

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

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

20
20 (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 t f(t,y) y i+1 yiyi y R i+1 titi t i+1 Δt Copyright © 2005 by yshong

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

22
22 (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. Elliptic – solid mech., flow mech.potential Laplace eqs. ( 滲流控制方程式 ) Copyright © 2005 by yshong

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

24
24 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

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

26
26 (2) Graphical solutions were used to characterize the behavior of systems. Ex. 1 2 x y x …. y …. x …. y …. 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

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

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

29
29 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

30
30 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. : dependent variable P: forcing functions A,E,L: parameters Copyright © 2005 by yshong

31
31 The following illustrates a physical problem how to represent by a mathematical model. According Newton second law, 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 ) …………………………(1.2) Copyright © 2005 by yshong

32
32 (1.2): 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 …………………………(1.3) 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

33
33 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) FuFu FdFd F: net force +: the object will accelerate -: the object will decelerate 0: the object will remain at a constant level Copyright © 2005 by yshong

34
34 ……….(1.5) F D : the downward pull of gravity F U : 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

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

36
36 ……….(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

37
37 Ex 1.1 analytical solution Known: mass=68.1 kg, c=12.5 kg/s Eq.(1.10) then terminal velocity 53.39 exact sol. t(s) v(m/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

38
38 Ex 1.2 numerical solution ……….(1.11) ……….(1.9) So eq.(1.9): Copyright © 2005 by yshong

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

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

41
41 Homework : Problems 1.3, 1.4 and 1.5 (p.22) Due : One week Copyright © 2005 by yshong

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

43
43 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

44
44 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

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

46
46 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

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

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

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

50
50 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

51
51 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

52
52 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. R n ( x ) = remainder term Copyright © 2005 by yshong

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

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

55
55 Expressing to fourth-order But ∴ truncation error= 2.71828-2.70833= 0.00995 Copyright © 2005 by yshong

56
56 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 …… x i+1 -x i =h refer to step size Copyright © 2005 by yshong

57
57 Ex. 4.1 Use zero ~ fourth-order Taylor series expansions to approximate the function: from x i =0 with h=1. That is, predict the function’s value at x i+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

58
58 second-order: Truncation error=0.2-0.45=-0.25 f(x) x Zero order first order second order x i =0 x i+1 =1 1.2 0.95 0.45 f(x i+1 ) f(xi)f(xi) How order Taylor series expansion can be no truncation error ? Copyright © 2005 by yshong

59
59 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

60
60 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

61
61 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

62
62 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

63
63 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) x root Copyright © 2005 by yshong

64
64 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

65
65 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

66
66 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

67
67 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

68
68 CHAPTER 5 BRACKETING METHODS Bi-section method a b f(a) f(b) x1 x2 x3 Copyright © 2005 by yshong

69
69 False position method (linear interpolation method) a b f(a) f(b) x1x2 x3 Copyright © 2005 by yshong

70
70 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

71
71 Secant method (ref. chap.6.3) r0 r2r1r3 x y f(x) Copyright © 2005 by yshong

72
72 Newton-Raphson method (ref. chap.6.2) x y f(x) x0 x2x1 Copyright © 2005 by yshong

73
73 Fixed-point iteration (ref. chap.6.1) f(x)=0, x=g(x) Rewrite, y1=x, y2=g(x) x y y1=x y2=g(x) x0x1x2 Copyright © 2005 by yshong

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

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

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

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

78
78 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

79
79 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

80
80 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

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

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

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

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

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

86
86 Thank for your attention Copyright © 2005 by yshong

Similar presentations

OK

EE 3561_Unit_1(c)Al-Dhaifallah 14351 EE 3561 : - Computational Methods in Electrical Engineering Unit 1: Introduction to Computational Methods and Taylor.

EE 3561_Unit_1(c)Al-Dhaifallah 14351 EE 3561 : - Computational Methods in Electrical Engineering Unit 1: Introduction to Computational Methods and Taylor.

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google