Numerical Methods Lecture 1 PDF
Document Details
Uploaded by CleanerMiracle5963
AIS Cairo
Osama Abdel Raouf
Tags
Summary
This document is a lecture on numerical methods, covering topics like introduction to numerical methods and their applications, convergence, and error analysis of numerical methods, and practical experience with implementing numerical methods and assessing resulting errors. It details the grade distribution, course contents, non-computer methods (analytical, graphical, and calculator solutions), and overall motivations in recent years.
Full Transcript
Numerical Methods Prof. Osama Abdel Raouf Lecture 1 1 Main Textbook: Numerical Methods for Engineers by: Steven C. Chapra, Raymond P. Canal. McGraw-Hill 3 Course Description This course provides an introduction t...
Numerical Methods Prof. Osama Abdel Raouf Lecture 1 1 Main Textbook: Numerical Methods for Engineers by: Steven C. Chapra, Raymond P. Canal. McGraw-Hill 3 Course Description This course provides an introduction to numerical methods and their applications to solve science and engineering problems. I convergence and error analysis of numerical methods is covered. practical experience with implementing numerical methods and assessing resulting errors will be acquired through a number of programming assignments. 4 Contents of the Course 1. Understand numerical methods and errors of computers 2. Analyze errors and error propagation 3. Compute roots of equations of one variable 4. Solve a system of Linear equations 5. Apply numerical differentiation 6. Apply numerical integration, 7. Use interpolation 8. Use regression 5 Grade Distribution 7th Week Assessment (30%): Exam (30%) 12th Week Assessment (20%): Quiz (5%), + Homework Assignment (10%) Attendance and Discussions (5%) Final Exam (50%) 7 Noncomputer Methods: In the pre-computer era, there were generally three different ways in which engineers approached problem solving: 1. Analytical methods. 2. Graphical solutions 3. Calculators 8 Analytical Methods It is used for solving some problems. solutions were often useful and provided excellent insight into the behavior of some systems. Disadvantages: analytical solutions can be derived for only a limited class of problems. These include those that can be approximated with linear models and those that have simple geometry and low dimensionality. Since, most real problems are nonlinear and involve complex shapes and processes ➔ Analytical solutions fails.. 9 Graphical solutions Graphical solutions were used to characterize the behavior of systems. These graphical solutions usually took the form of plots or nomographs. Disadvantages: Although graphical techniques can often be used to solve complex problems, the results are not very precise. Graphical solutions (without the aid of computers) are extremely tedious and difficult to implement. Graphical techniques are often limited to problems that can be described using three or fewer dimensions. Since, most problems are described using more than three dimensions, ➔ Graphical solutions fails. 10 Calculator solutions Calculators is used to implement numerical methods manually. Although in theory such approaches should be perfectly adequate for solving complex problems, in actuality several difficulties are encountered. Disadvantages: Manual calculations are slow and tedious. 11 pre-computer era Vs computer era During the pre-computer era, significant amounts of energy were expended on the solution technique itself, rather than on problem definition and interpretation (Fig. PT1.1a). This unfortunate situation existed because so much time were required to obtain numerical answers using pre- computer techniques. 12 Numerical Methods and Engineering Practice Since the late 1940s the widespread availability of digital computers has led to a veritable explosion in the use and development of numerical methods. At first, this growth was somewhat limited by the cost of access to large mainframe computers, and, consequently, many engineers continued to use simple analytical approaches in a significant portion of their work. The recent evolution of inexpensive personal computers has given us ready access to powerful computational capabilities. ➔ It is time to use numerical methods Wait, There are several additional reasons why you should study numerical methods: 13 Numerical Methods Advantages 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 that are often impossible to solve analytically. As such, they greatly enhance your problem-solving skills. During your careers, you may often have occasion to use commercially available prepackaged, or “canned,” computer programs that involve numerical methods. The intelligent use of these programs is often predicated on knowledge of the basic theory underlying the methods. 14 Numerical Methods Advantages Cont. 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 or commission expensive software. learn programming reinforce your understanding of mathematics. 15 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. 16 MATHEMATICAL BACKGROUND Roots of Equations. These problems are concerned with the value of a variable or a parameter that satisfies a single nonlinear equation. These problems are especially valuable in engineering design contexts where it is often impossible to explicitly solve design equations for parameters. 17 MATHEMATICAL BACKGROUND Systems of Linear Algebraic Equations. These problems are similar to roots of equations in the sense that they are concerned with values that satisfy equations. However, in contrast to satisfying a single equation, a set of values is sought that simultaneously satisfies a set of linear algebraic equations. 18 MATHEMATICAL BACKGROUND Optimization. These problems involve determining a value or values of an independent variable that correspond to a “best” or optimal value of a function. optimization involves identifying maxima and minima. Such problems occur routinely in engineering design contexts. 19 MATHEMATICAL BACKGROUND Curve Fitting (Fig. PT1.2d). You will often have occasion to fit curves to data points. The techniques developed for this purpose can be divided into two general categories: Regression and interpolation. Regression is employed where there is a significant degree of error associated with the data. Experimental results are often of this kind. For these situations, the strategy is to derive a single curve that represents the general trend of the data without necessarily matching any individual points. In contrast, Interpolation is used where the objective is to determine intermediate values between relatively error-free data points. Such is usually the case for tabulated information. For these situations, the strategy is to fit a curve directly through the data points and use the curve to predict the intermediate values. 20 MATHEMATICAL BACKGROUND Integration a physical interpretation of numerical integration is the determination of the area under a curve. In addition, numerical integration formulas play an important role in the solution of differential equations 21 MATHEMATICAL BACKGROUND Ordinary differential equations are of great significance in engineering practice. This is because many physical laws are couched in terms of the rate of change of a quantity rather than the magnitude of the quantity itself. Examples range from population forecasting models (rate of change of population) to the acceleration of a falling body (rate of change of velocity). 22 Partial Differential Equations Partial differential equations are used to characterize engineering systems where the behavior of a physical quantity is couched in terms of its rate of change with respect to two or more independent variables. Examples include the steady-state distribution of temperature on a heated plate (two spatial dimensions) or the time-variable temperature of a heated rod (time and one spatial dimension). finite difference methods is used for solving solve partial differential equations numerically. 23 Approximations and Round-Off Errors Understanding the concept of error is so important to the effective use of numerical methods. Analytical → Exact solutions Numerical → estimates solutions that were close to the exact analytical solution We have to calculate the error. For many applied engineering problems, we cannot obtain analytical solutions. Therefore, we cannot compute exactly the errors associated with our numerical methods. In these cases, we must settle for approximations or estimates of the errors. 24 ACCURACY AND PRECISION The errors associated with both calculations and measurements can be characterized with regard to their accuracy and precision Accuracy: refers to how closely a computed or measured value agrees with the true value. Accuracy= (True Value – Approximate Value) Precision refers to how closely individual computed or measured values agree with each other. Precision = present approx. – pervious approx. 25 26 Errors Numerical methods should be sufficiently accurate or unbiased to meet the requirements of a particular engineering problem. They also should be precise enough for adequate engineering design. In this course, we will use the collective term error to represent both the inaccuracy and the imprecision of our predictions. ➔ How do we calculate errors? 27 ERROR DEFINITIONS Numerical errors arise from the use of approximations to represent exact mathematical operations and quantities. These include truncation errors, round-off errors truncation errors which result when approximations are used to represent exact mathematical procedures, and round-off errors, which result when numbers having limited significant figures are used to represent exact numbers. For both types, the relationship between the exact result (true) and the approximation can be formulated as the following ERROR Types: 28 Types of Error 1. True Error (Accuracy) It is defined as the difference between the true value in a calculation and the approximate value found for the same calculation by using a numerical method. True Error (Et)= True Value – Approximate Value 2. Relative True Error It is defined as the ratio between the true error and the true value Relative True Error = True Error / True Value percent relative error εt = True Error / True Value *100% 29 Types of Error 3. Approximate Error (Precision) It is defined as the difference between the present approximation and the pervious approximation. Approximate Error = present approx. – pervious approx. 4. Relative Approximate Error It is defined as the ratio between the approximate error and the approximate value Relative Approximate Error = Approx. Error / Approx. Value Relative Approximate Error εa = current approximation − previous approximation approximation 100% 30 Problem Statement. Suppose that you have the task of measuring the lengths of a bridge and a rivet and come up with 9999 and 9 cm, respectively. If the true values are 10,000 and 10 cm, respectively compute (a) the true error and (b) the true percent relative error for each case. Solution. a) The error for measuring the bridge is Et = 10,000 − 9999 = 1 cm (bridge) Et = 10 − 9 = 1 cm (rivet) b) The percent relative error for the bridge is εt = 1/ 10,000 * 100% = 0.01% εt = 1/ 10 * 100% = 10% Thus, although both measurements have an error of 1 cm, the relative error for the rivet is much greater. We would conclude that we have done an adequate job of measuring the bridge, whereas our estimate for the rivet leaves something to be desired. 31 Exercise (Implement it) 32