1 / 37

Numerical Analysis

Numerical Analysis. Intro to Scientific Computing. Numerical Methods. Numerical Methods: Algorithms that are used to obtain numerical solutions of a mathematical problem. Why do we need them? 1. No analytical solution exists, 2. An analytical solution is difficult to obtain

egallagher
Download Presentation

Numerical Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Numerical Analysis Intro to Scientific Computing

  2. Numerical Methods Numerical Methods: Algorithms that are used to obtain numerical solutions of a mathematical problem. Why do we need them? 1. No analytical solution exists, 2. An analytical solution is difficult to obtain or not practical.

  3. Why use Numerical Methods? • To solve problems that cannot be solved exactly

  4. Introduction 1. Introduction to numerical methods for engineering as a general and fundamental tool for all engineering disciplines. We plan to cover (almost) the main topics of numerical analysis. 2. We will use commercial software widely used in science and engineering: MATLAB and Excel. 3. We will illustrate and discuss how numerical methods are used in practice. We will consider examples from Engineering.

  5. Our choice for this course: Matlab • Matlab: numerical development environment. • Easy and fast programming • data types (vectors, matrices, complex numbers) • Complete functionality • Powerful toolkits • Campus license (from home: need Internet conn.) • But: €xpensive! • Alternatives: • Matlab student license (without toolkits) • Octave (free, Windows, Linux): www.octave.org • SciLab (free, Windows, Linux): www.scilab.org

  6. Matlab basics • Variables are just assigned (no typedef needed) a=42 s= 'test' • basic operators ( + - * / \ ^) 5/2 ans = 2.5000ans is a system variable • functions (help elfun) sqrt(3), sin(pi), cos(0) pi is a system variable • display & clear variables disp(a), disp('hello') display value of a , “hello” who, whosshow all defined variables clear aclear variable a clearclear all variablesarrow up/down keys recall your last commands

  7. Matlab examples • Variables & Operatorsa=5*(2/3)+3^2 result is showna=2/4 + 4\2 ; result is not showna value of a is shown • Elementary functions overview: doc elfunabs(-1), sqrt(2) tan(0), cos(0), acos(1) … exp(2), log(1), log10(1) … • Roundinground(2.3), round(2.5) 2 3 • floor(5.7), floor(-1.2) 5 -2 towards smallerceil (1.1), ceil(-2.7) 2 -2 towards largerfix(1.7), fix (-2,7) 1 -2 towards 0 • Complex numbers(2+3i) * (1i) -3+2inorm(1+1i) 1.4142

  8. Modelling in Industry: Automobiles

  9. Example of Solving an Engineering Problem http://numericalmethods.eng.usf.edu

  10. Modelling in Industry: Aerospace

  11. Modelling in Industry: Electronics

  12. Course overview • Finding roots of functions of one variable • Approximation, errors, and precision. • System of linear equations • Numerical integration and differentiation.

  13. Introduction Why are Numerical Methods so widely used in Engineering? • Engineers use mathematical modeling (equations and data) to describe and predict the behavior of systems. • Closed-form (analytical) solutions are only possible and complete for simple problems (geometry, properties, etc.). • Computers are widely available, powerful, and (relatively) cheap. • Powerful software packages are available (special or general purpose).

  14. Applications of Numerical Methods in Engineering • Communication/power • Network simulation • Train and traffic networks • Computational Fluid Dynamics (CFD): • Weather prediction • Groundwater & pollutant movement

  15. Electronic Communication by e-mail • Computer assignments will be submitted as attachments via e-mail: • y.fouad@alexu.edu.eg • Text files, Excel & MATLAB documents as attachments. • documents will be distributed via the AAST web page.

  16. Useful info • Course website: • MATLAB instructions: http://math.gmu.edu/introtomatlab.htm • Mathworks, the creator of MATLAB: http://www.mathworks.com • OCTAVE = free MATLAB clone Available for download at http://octave.sourceforge.net/

  17. Mathematical modeling Computational problems:attack strategy • Develop mathematical model (usually requires a combination of math skills and some a priori knowledge of the system) • Come up with numerical algorithm (numerical analysis skills) • Implement the algorithm (software skills) • Run, debug, test the software • Visualize the results • Interpret and validate the results

  18. Computational problems:well-posedness • The problem is well-posed, if (a) solution exists (b) it is unique (c) it depends continuously on problem data Simplification strategies: Infinite finite Nonlinear linear High-order low-order Only approximate solution can be obtained this way!

  19. Sources of numerical errors • Before computation • modeling approximations • empirical measurements, human errors • previous computations • During computation • truncation or discretization • Rounding errors • Perturbations during computation may be amplified by algorithm Abs_error = approx_value – true_value Rel_error = abs_error/true_value Approx_value = (true_value)x(1+rel_error) Cannot be controlled Can be controlled through error analysis

  20. Representing Real Numbers • You are familiar with the decimal system: • Decimal System: Base = 10 , Digits (0,1,…,9) • Standard Representations:

  21. Normalized Floating Point Representation • Normalized Floating Point Representation: • Scientific Notation: Exactly one non-zero digit appears before decimal point. • Advantage:Efficient in representing very small or very large numbers.

  22. Binary System • Binary System: Base = 2, Digits {0,1}

  23. S Exponent8 Fraction23 S Exponent11 Fraction52 (continued) IEEE 754 Floating-Point Standard • Single Precision (32-bit representation) • 1-bit Sign + 8-bit Exponent + 23-bit Fraction • Double Precision (64-bit representation) • 1-bit Sign + 11-bit Exponent + 52-bit Fraction

  24. Machine precision

  25. Calculator Example • Suppose you want to compute: 3.578 * 2.139 using a calculator with two-digit fractions 3.57 * 2.13 = 7.60 7.653342 True answer:

  26. Stability • Algorithm is stable if result produced is relatively insensitive to perturbations during computation • Stability of algorithms is analogous to conditioning of problems • For stable algorithm, effect of computational error is no worse than effect of small data error in input

  27. Accuracy • Accuracy : closeness of computed solution to true solution of problem • Accuracy depends on conditioning of problem as well as stability of algorithm

  28. 48.9 Significant Digits - Example

  29. Rounding and Chopping • Rounding: Replace the number by the nearest machine number. • Chopping: Throw all extra digits.

  30. Error Definitions – True Error Can be computed if the true value is known:

  31. Notation We say that the estimate is correct to n decimal digits if: We say that the estimate is correct to n decimal digits rounded if:

  32. Solution of Nonlinear Equations • Some simple equations can be solved analytically: • Many other equations have no analytical solution:

  33. Methods for Solving Nonlinear Equations • Bisection Method • Newton-Raphson Method • Secant Method

  34. Solution of Systems of Linear Equations

  35. Methods for Solving Systems of Linear Equations • Gaussian Elimination • Gaussian Elimination with Scaled Partial Pivoting • Gauss- Jordan

  36. Integration • Some functions can be integrated analytically:

  37. Methods for Numerical Integration • Trapezoid Method • Simpson Method • Mid-point method

More Related