Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numerical Analysis Intro to Scientific Computing.

Similar presentations


Presentation on theme: "Numerical Analysis Intro to Scientific Computing."— 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.orgwww.octave.org SciLab (free, Windows, Linux): www.scilab.orgwww.scilab.org

6 Matlab basics Variables are just assigned (no typedef needed) a=42 s= 'test' basic operators ( + - * / \ ^) 5/2 ans = 2.5000 ans 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, whos show all defined variables clear a clear variable a clear clear all variables arrow up/down keys recall your last commands

7 Matlab examples Variables & Operators a=5*(2/3)+3^2 result is shown a=2/4 + 4\2 ; result is not shown a value of a is shown Elementary functions overview: doc elfun abs(-1), sqrt(2) tan(0), cos(0), acos(1) … exp(2), log(1), log10(1) … Rounding round(2.3), round(2.5) 2 3 floor(5.7), floor(-1.2) 5-2towards smaller ceil (1.1), ceil(-2.7) 2-2towards larger fix(1.7), fix (-2,7) 1-2towards 0 Complex numbers (2+3i) * (1i) -3+2i norm(1+1i) 1.4142

8 8 Modelling in Industry: Automobiles

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

10 10 Modelling in Industry: Aerospace

11 11 Modelling in Industry: Electronics

12 Course overview 1.Finding roots of functions of one variable 2.Approximation, errors, and precision. 3.System of linear equations 4.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 http://www.mathworks.com OCTAVE = free MATLAB clone Available for download at http://octave.sourceforge.net/ http://octave.sourceforge.net/

17 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 Computational problems: attack strategy Mathematical modeling

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) Can be controlled through error analysis Cannot be controlled

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 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 SExponent 8 Fraction 23 SExponent 11 Fraction 52 (continued)

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.137.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 Can be computed if the true value is known: Error Definitions – True Error

31 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: Notation

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 o Bisection Method o Newton-Raphson Method o Secant Method

34 Solution of Systems of Linear Equations

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

36 Integration Some functions can be integrated analytically:

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


Download ppt "Numerical Analysis Intro to Scientific Computing."

Similar presentations


Ads by Google