engineering numerical analysis lecture-1

44
ID-302 Engineering Numerical Analysis Engr. Abdul Khaliq Department of Irrigation and Drainage Faculty of Agricultural Engineering & Technology University of Agriculture Faisalabad Engr Abdul Khaliq 1 10/30/2022

Upload: muhammad-waqas

Post on 09-May-2015

550 views

Category:

Education


0 download

DESCRIPTION

Subject Title: Engineering Numerical Analysis Subject Code: ID-302 Contents of this chapter: Mathematical preliminaries, Solution of equations in one variable, Interpolation and polynomial Approximation, Numerical differentiation and integration, Initial value problems for ordinary differential equations, Direct methods for solving linear systems, Iterative techniques in Matrix algebra, Solution of non-linear equations. Approximation theory; Eigen values and vector;

TRANSCRIPT

  • 1.Engr. Abdul Khaliq Department of Irrigation and Drainage Faculty of Agricultural Engineering & Technology University of Agriculture Faisalabad Engr Abdul Khaliq 13/10/2014

2. Objectives: In this course, students will be able to demonstrate programming proficiency using structured programming techniques to implement numerical methods for solutions using computer-based programming techniques. Engr Abdul Khaliq 23/10/2014 3. Course OutlineTheory: Mathematical preliminaries, Solution of equations in one variable, Interpolation and polynomial Approximation, Numerical differentiation and integration, Initial value problems for ordinary differential equations, Direct methods for solving linear systems, Iterative techniques in Matrix algebra, Solution of non-linear equations. Approximation theory; Eigen values and vector; Practical: Programming of different numerical techniques, direct methods, iterative techniques, Eigen values and vectors. Suggested Readings: 1. Burden, R. L. and J. D. Faires, 2011. Numerical Analysis. PW Publishing Company, Boston, USA. 2. Chapra, S. C., and Canal, R.P., 2 010.,Numerical Methods for Engineers, 6th Edition, McGraw Hill Inc. 3. Mumtaz Khan 2008 Numerical Methods for Engineering Science and Mathematics, 2nd Edition.. Engr Abdul Khaliq 33/10/2014 4. NUMERICAL APPROXIMATIONS Numerical methods is an area of study in mathematics that discusses the solutions to various mathematical problems involving differential equations, curve fittings, integrals, eigenvalues, and root findings through approximations rather than exact solutions. Engr Abdul Khaliq 43/10/2014 5. Mathematical Preliminaries and Error Analysis In beginning chemistry courses, the ideal gas law, PV = NRT, Suppose two experiments are conducted to test this law, using the same gas in each case. In the first experiment, P = 1.00 atm, V = 0.100 m3, N = 0.00420 mol, R = 0.08206. The ideal gas law predicts the temperature of the gas to be When we measure the temperature of the gas however, we find that the true temperature is 15C. Engr Abdul Khaliq 5 CKT RT PV T 1715.291 )082460.0)(00420.0( )100.0)(00.1( 3/10/2014 6. Mathematical Preliminaries and Error Analysis (continued) Engr Abdul Khaliq 6 We then repeat the experiment using the same values of R and N, but increase the pressure by a factor of two and reduce the volume by the same factor. The product PV remains the same, so the predicted temperature is still 17C. But now we find that the actual temperature of the gas is 19 C. 3/10/2014 7. Review of Calculus To solve problems that cannot be solved exactly due x u 2 2 2 1 Engr Abdul Khaliq 73/10/2014 8. Review of Calculus Differentiability Engr Abdul Khaliq 83/10/2014 9. Review of Calculus Engr Abdul Khaliq 93/10/2014 10. 10 Propagation of Errors In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate through the calculations? Engr Abdul Khaliq3/10/2014 11. Engr Abdul Khaliq 11 Example 1: Find the bounds for the propagation in adding two numbers. For example if one is calculating X +Y where X = 1.5 0.05 Y = 3.4 0.04 Solution Maximum possible value of X = 1.55 and Y = 3.44 Maximum possible value of X + Y = 1.55 + 3.44 = 4.99 Minimum possible value of X = 1.45 and Y = 3.36. Minimum possible value of X + Y = 1.45 + 3.36 = 4.81 Hence 4.81 X + Y 4.99. 3/10/2014 12. Engr Abdul Khaliq 12 Propagation of Errors In Formulas f nn XXXXX ,,.......,,, 1321 f n n n n X X f X X f X X f X X f f 1 1 2 2 1 1 ....... If is a function of several variables then the maximum possible value of the error in is 3/10/2014 13. Engr Abdul Khaliq 13 Example 2: The strain in an axial member of a square cross- section is given by Given Find the maximum possible error in the measured strain. Eh F 2 N9.072F mm1.04h GPa5.170E 3/10/2014 14. 14 )1070()104( 72 923 6 10286.64 286.64 E E h h F F Solution Engr Abdul Khaliq3/10/2014 15. 15 EhF 2 1 Eh F h 3 2 22 Eh F E E Eh F h Eh F F Eh E 2232 21 9 2923 933923 105.1 )1070()104( 72 0001.0 )1070()104( 722 9.0 )1070()104( 1 3955.5 Thus Hence )3955.5286.64( Engr Abdul Khaliq3/10/2014 16. Example 3: Subtraction of numbers that are nearly equal can create unwanted inaccuracies. Using the formula for error propagation, show that this is true. Solution Let Then So the relative change is yxz y y z x x z z yx )1()1( yx yx yx z z Engr Abdul Khaliq 163/10/2014 17. Example 3: For example if 001.02x 001.0003.2y |003.22| 001.0001.0 z z = 0.6667 = 66.67% Engr Abdul Khaliq 173/10/2014 18. Sources of Error Engr Abdul Khaliq 18 Two sources of numerical error 1) Round off error 2) Truncation error The error that is produced when a calculator or computer is used to perform real-number calculations is called round-off error. 3/10/2014 19. 19 Round off Error Caused by representing a number approximately 333333.0 3 1 ...4142.12 Engr Abdul Khaliq3/10/2014 20. 20 Problems created by round off error Drown attack miss the target .Why? Engr Abdul Khaliq3/10/2014 21. 21 Problem with Patriot missile Clock cycle of 1/10 seconds was represented in 24-bit fixed point register created an error of 9.5 x 10-8 seconds. The battery was on for 100 consecutive hours, thus causing an inaccuracy of 1hr 3600s 100hr 0.1s s 109.5 8 s342.0 Engr Abdul Khaliq3/10/2014 22. 22 Problem (cont.) The shift calculated in the ranging system of the missile was 687 meters. The target was considered to be out of range at a distance greater than 137 meters. Engr Abdul Khaliq3/10/2014 23. 23 Effect of Carrying Significant Digits in Calculations Engr Abdul Khaliq 3/10/2014 24. 24 Truncation error Error caused by truncating or approximating a mathematical procedure. Engr Abdul Khaliq3/10/2014 25. 25 Example of Truncation Error Taking only a few terms of a Maclaurin series to approximate .................... !3!2 1 32 xx xex x e If only 3 terms are used, !2 1 2 x xeErrorTruncation x Engr Abdul Khaliq3/10/2014 26. 26 Another Example of Truncation Error Using a finite x to approximate )(xf x xfxxf xf )()( )( P Q secant line tangent line Figure 1. Approximate derivative using finite x Engr Abdul Khaliq3/10/2014 27. 27 Another Example of Truncation Error Using finite rectangles to approximate an integral. y = x 2 0 30 60 90 0 1.5 3 4.5 6 7.5 9 10.5 12 y x Engr Abdul Khaliq3/10/2014 28. 28 Example 1 Maclaurin series Calculate the value of 2.1 e with an absolute relative approximate error of less than 1%. ................... !3 2.1 !2 2.1 2.11 32 2.1 e n 1 1 __ ___ 2 2.2 1.2 54.545 3 2.92 0.72 24.658 4 3.208 0.288 8.9776 5 3.2944 0.0864 2.6226 6 3.3151 0.020736 0.62550 aE %a 2.1 e 6 terms are required. How many are required to get at least 1 significant digit correct in your answer? Engr Abdul Khaliq3/10/2014 29. 29 Example 2 Differentiation Find )3(f for 2 )( xxf using x xfxxf xf )()( )( and 2.0x 2.0 )3()2.03( )3(' ff f 2.0 )3()2.3( ff 2.0 32.3 22 2.0 924.10 2.0 24.1 2.6 The actual value is ,2)(' xxf 632)3(' f Truncation error is then, 2.02.66 Can you find the truncation error with 1.0xEngr Abdul Khaliq3/10/2014 30. 30 Example 3 Integration Use two rectangles of equal width to approximate the area under the curve for 2 )( xxf over the interval ]9,3[ y = x 2 0 30 60 90 0 3 6 9 12 y x 9 3 2 dxx Engr Abdul Khaliq3/10/2014 31. 31 Integration example (cont.) )69()()36()( 6 2 3 2 9 3 2 xx xxdxx 3)6(3)3( 22 13510827 Choosing a width of 3, we have Actual value is given by 9 3 2 dxx 9 3 3 3 x 234 3 39 33 Truncation error is then 99135234 Can you find the truncation error with 4 rectangles?Engr Abdul Khaliq3/10/2014 32. Steps in Solving an Engineering Problem Engr Abdul Khaliq 323/10/2014 33. How do we solve an engineering problem? Engr Abdul Khaliq 33 Problem Description Mathematical Model Solution of Mathematical Model Using the Solution 3/10/2014 34. Mathematical Procedures Nonlinear Equations Differentiation Simultaneous Linear Equations Curve Fitting Interpolation Regression Integration Ordinary Differential Equations Other Advanced Mathematical Procedures: Partial Differential Equations Optimization Fast Fourier Transforms Engr Abdul Khaliq 343/10/2014 35. Nonlinear Equations Engr Abdul Khaliq 35 How much of the floating ball is under water? 010993.3165.0 423 xx Diameter=0.11m Specific Gravity=0.6 3/10/2014 36. Nonlinear Equations Engr Abdul Khaliq 36 How much of the floating ball is under the water? 010993.3165.0)( 423 xxxf 3/10/2014 37. Differentiation t. t v(t) 89 50001016 1016 ln2200 4 4 Engr Abdul Khaliq 37 What is the acceleration at t=7 seconds? dt dv a 3/10/2014 38. Differentiation Time (s) 5 8 12 Vel (m/s) 106 177 600 dt dv a Engr Abdul Khaliq 38 What is the acceleration at t=7 seconds? 3/10/2014 39. Simultaneous Linear Equations Time (s) 5 8 12 Vel (m/s) 106 177 600 Engr Abdul Khaliq 39 Find the velocity profile, given ,)( 2 cbtattv Three simultaneous linear equations 106525 cba 125 t 177864 cba 60012144 cba 3/10/2014 40. Interpolation Time (s) 5 8 12 Vel (m/s) 106 177 600 Engr Abdul Khaliq 40 What is the velocity of the rocket at t=7 seconds? 3/10/2014 41. Regression Engr Abdul Khaliq 41 Thermal expansion coefficient data for cast steel 3/10/2014 42. Regression (cont) Engr Abdul Khaliq 423/10/2014 43. Integration Engr Abdul Khaliq 43 fluid room T T dTDD Finding the diametric contraction in a steel shaft when dipped in liquid nitrogen. 3/10/2014 44. Reading Engr Abdul Khaliq 44 1. Burden, R. L. and J. D. Faires, 2011. Numerical Analysis. PW Publishing Company, Boston, USA. 2. Chapra, S. C., and Canal, R.P., 2 010.,Numerical Methods for Engineers, 6th Edition, McGraw Hill Inc. 3. Mumtaz Khan 2008 Numerical Methods for Engineering Science and Mathematics, 2nd Edition.. THE END 3/10/2014