400 likes | 515 Views
CEE 3704 Statistical and Numerical Analysis Fall 2003 Dr. David W. Dinehart. Lecture Outline. Overview of the second half of the course Identify expectations Define and identify Numerical Methods Topics to be covered Identify the necessary steps of creating a program
E N D
CEE 3704Statistical and Numerical AnalysisFall 2003Dr. David W. Dinehart
Lecture Outline • Overview of the second half of the course • Identify expectations • Define and identify Numerical Methods • Topics to be covered • Identify the necessary steps of creating a program • Identify Different Types and Measures of Error • Review of Excel
Learning Outcomes • Identify the necessary steps of creating a program, using either flowcharts, algorithms or pseudocode • Identify and define different types and measures of error • Use Excel to solve a numerical problem
Course Overview • Attendance and Punctuality • Come on time • Do not walk out mid-lecture • Room • Nice facility • PowerPoint – White Board – Computer Examples
Performed on Engineering Paper or Computer Include problem statement Figure/Sketch (use straight edge) Equations Units Significant Figures Stapled Group work No late homework No inferior homework Solutions posted on website Homework Requirements
What are Numerical Methods? • Numerical Methods are a class of methods for solving a wide variety of mathematical problems/engineering systems • In our case, these mathematical problems will be representing engineering systems
Flow in a Stream Load on a Beam Mathematical Representation of a Physical System
Topics to be Covered • Formulation and Error • Finding Roots of an Equation • Linear Algebra - Matrices • Numerical Integration • Numerical Derivatives
Numerical Methods • Numerical methods only employ arithmetic operations and logic; therefore, they are ideally suited for computer application We won’t be doing a lot of “programming”; we will be using Excel extensively.
Applicability of Numerical Methods • In this course we want to understand the various types of numerical methods so that we know their capabilities and limitations
Important Limitations 1. No complex physical situation can be exactly simulated mathematically 2. No numerical method is trouble-free in all situations 3. No numerical method is completely error-free 4. No numerical method is optimal for all situations
Important Limitations • Number 1 is very important, but beyond our focus • There is a lot of overlap between 2, 3, and 4 • This is where we will focus • You will see and apply various numerical methods in your other courses
Computers and Software Numerical Derivative What is the slope of the line?
Programming • Any engineering equation can be expressed as a function • The second half of this course will allow us to solve these functions • Numerical analysis techniques lend themselves to computer programming Where do we start?
Revisions/Improvements Your plan of attack (includes equations) Nuts and bolts *VERY IMPORTANT*
Fundamental Control Structures 1. Sequence 2. Selection 3. Repetition *Any program can be constructed using only these three operations
Types of Error • Human Error • Data Error • Example: How tall is he/she? As accuracy increases, the number of significant figures increases and the “costs” increase. In general, increasing accuracy and precision increases “costs”.
Types of Error - Continued • Example of Precision vs. Cost • Consider the distance from the football stadium to the entrance of CEER. The “cost” will depend on the accuracy and precision. • Use a map with a scale to keep the “cost” low, but sacrifice precision • Use a survey crew to gain precision, but the “cost” goes up • Round-off Error • Computer Software • Truncation Error • Equations • Numerical Methods
Significant Figures • The significant digits of a number are those that can be used with confidence • How many significant digits does 5,000 have? • 1 - 2 - 3 - 4 ? • It depends on the confidence • How can we show the confidence? • Scientific Notation • 5 x103 - 1 significant digit • 5.00 x 103 - 3 significant digits
Significant Figures - Continued • How many significant figures do the following have • 0.00562 • 0.0000562 • 0.000000562 • Each of the above has 3 significant digits. The zeros are just used to locate the decimal point • What is p? 3.14159265… • Engineers and computers can only retain a finite number of significant figures. The omission of the remaining figures is round-off error.
Significant Figures - Continued • Example Add the following measures of weight 10.34 kg 6.1 kg 25.21 kg 13 kg 54.65 kg 55 kg We can’t say 54.65 kg because we don’t know whether or not 13 is 13.00 kg or 13.45 kg Don’t give answers to more significant figures than you know (especially in Excel)!
Accuracy and Precision • Accuracy - how close a measured value agrees with a true value • Precision - how close measured values agree with each other • Testing concrete cylinders • Cement + Sand + Water + Rock = Concrete • Experimental work – making and breaking concrete cylinders to measure strength • Concrete has many non-uniformities - strength increases as time increases • Design strength = 4,000 psi at 28 days (true value)
Definition of Error • Relationship between the exact (or true) result and approximate result is … True Value = Approximation + Error Rewriting… Et = True Value - Approximation Et = Exact Value of the Error t - “True” Error This measure does not account for the magnitude of error relative to the magnitude we are interested in.
Definition of Error - Continued Is this good? Et = 2.0” It’s great for measuring distance from stadium to CEER It’s not so good for measuring someone’s height One method to account for the magnitudes of the quantities being evaluated is to normalize the error to the true value. True Error True Fractional Relative Error = True Value
Definition of Error - Continued True Error True Percent Relative Error = Et = x 100% True Value What is the problem with these measures of error? In real world applications we usually don’t know the True Value In these cases what do we do? We can normalize to our best approximation Approximate Error x 100% Ea = Approximation ‘a’ denotes we are normalizing to an approximate value
Definition of Error - Continued One of the challenges of using numerical methods is determining error estimates without knowing the True Value A lot of numerical methods use an iterative approach. A current approximation is made based on a previous approximation. For these cases the percent relative error is... Current Approximation - Previous Approximation Ea = x 100% Current Approximation Note ‘E’ can be positive or negative. We are usually not interested in the sign. For an iterative approach, we use Ea as a stopping criteria
Round-off Error • Definition: the discrepancy introduced by the omission of significant figures • Computers retain a fixed number of significant figures during a calculation; therefore, numbers like p and e cannot be expressed exactly. • Computers use a Base-2 representation so they cannot precisely represent certain exact Base-10 numbers • We are most familiar with Base-10 - 10 digits 5214 = 5x103 + 2x102 + 1x101 + 4x100 4 x 1 = 4 1 x 10 = 10 2 x100 = 200 5 x 1000 = 5000 5,214
Chopping vs. Rounding p = 3.14159265358 If we need to store this number in Base-10 carrying 7 significant figures... One method of approximation is chopping - chop off anything beyond 7 figures 3.141592 Et = True - Approx. = 0.00000065 An alternative method is rounding - if the last discarded digit is 5 we round up 3.141593 Et = -0.00000035 Rounding reduces the error… in this case almost by 50%
Truncation Error & Taylor Series • Truncation errors occur when we replace an exact mathematical procedure with an approximation • Taylor Series • Used to predict a value of a function at one point based on the value of the function and its derivatives at another point f(xi+1) = f(xi) + f ’(xi)h + f ’’(xi)h2 + f ’’’(xi)h3 + … + f(n)(xi)hn + Rn 2! 3! n! h = Step Size = xi+1 - xi Rn = Remainder Term = f (n+1)(x)hn+1 (n+1) Rn accounts for all terms from n+1 to h x = Value between xi and xi+1
Taylor Series - Continued Zero-Order Approximation - 1st Term Value of the new point is approximately equal to the value of the old point (This is true for a constant function) f(xi+1) = f(xi) If the function changes over the interval (h), we need more terms To increase the accuracy of our approximation we can… 1. Increase the number of terms 2. Decrease our step size, h
Roundoff vs. Truncation Let’s look at Excel
Homework #1 • Review my Excel example • Create your weekly schedule in Excel • Borders/Shading • Fonts • Color • Column Width
Homework #1 • Review my Excel example • Create your weekly schedule in Excel • “Program” problem 3-13 from structural analysis in Excel (solution is on the course homepage) • Include the figure • Calculations and commentary • Answers (forces and reactions) boxed and highlighted • Use multiple worksheets as necessary • Setup the spreadsheet so that it can solve for the member forces and reactions for various horizontal and vertical lengths and loadings • Due next Thursday