Download presentation
Presentation is loading. Please wait.
Published byEthan Ross Modified over 9 years ago
1
Chapter 9 Numerical Integration Numerical Integration Application: Normal Distributions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
2
Review: Numerical Integration When evaluating a definite integral, remember that we are simply finding the area under the curve between the lower and upper limits This can be done numerically by approximating the area with a series of trapezoids Engineering Computation: An Introduction Using MATLAB and Excel
3
Review: Trapezoid Area A trapezoidal area is formed: Engineering Computation: An Introduction Using MATLAB and Excel
4
Other Numerical Integration Methods Higher-order functions allow fewer intervals to be used for similar accuracy For example, Simpson’s Rule uses 2 nd order polynomial approximations to determine the area With the speed of modern computers, using these more efficient algorithms is usually not necessary – the trapezoid method with more intervals is sufficient Engineering Computation: An Introduction Using MATLAB and Excel
5
Application – Normal Distribution The standard deviation is a commonly-used measure of the variability of a data population or sample A higher standard deviation means that there is greater variability If we assume that the population or standard is distributed as a normal distribution, then we can obtain a lot of useful information about probabilities Engineering Computation: An Introduction Using MATLAB and Excel
6
Normal Distribution Many numerical populations can be approximated very closely by a normal distribution Examples: – Human heights and weights – Manufacturing tolerances – Measurement errors in scientific experiments The population is characterized by its mean and standard deviation Engineering Computation: An Introduction Using MATLAB and Excel
7
Normal Distribution The probability density function of the normal distribution can show a graphical view of how the population is distributed The probability density function (pdf) is given by this equation: Engineering Computation: An Introduction Using MATLAB and Excel
8
Example Consider a population with a mean of 10 and a standard deviation of 1. Here is the pdf: Engineering Computation: An Introduction Using MATLAB and Excel Frequency values approach zero for x- values far away from the mean Peak occurs at mean value of x (10)
9
Effect of Standard Deviation What if the standard deviation is 1.5 instead of 1? Here is the new pdf, compared with the original: Engineering Computation: An Introduction Using MATLAB and Excel σ = 1.0 σ = 1.5 Note the “wider” shape, as values are more spread out from the mean when the standard deviation is greater
10
Notes About the Probability Density Function The curve is symmetric about the mean Although the curve theoretically extends to infinity in both directions, the function’s values approach zero and can be ignored for x-values far away from the mean The area under the curve is equal to one – this corresponds to 100% of the population having x- values greater than - and less than + The percentage of the population between other limits can be computed by integrating the function between those limits Engineering Computation: An Introduction Using MATLAB and Excel
11
The Standard Normal Distribution The pdf can be standardized by introducing a new variable Z, the standard normal random variable: The Z-value is simply the number of standard deviations from the mean. Negative values indicate that the data point is below the mean, positive values indicate that the data point is above the mean Engineering Computation: An Introduction Using MATLAB and Excel
12
Examples For a population with a mean of 30 and a standard deviation of 2, what is the Z-value for: 1.x = 27 Z = -1.5 (1.5 standard deviations below the mean) 2.x = 34 Z = +2.0 (2.0 standard deviations above the mean) 3.x = 30 Z = 0 Engineering Computation: An Introduction Using MATLAB and Excel
13
Standard Normal Distribution Using the Z-values, we can write the equation for the probability density function as: This form is especially useful in that the same probability density graph applies to all normal distributions (next slide) Engineering Computation: An Introduction Using MATLAB and Excel
14
Standard Normal Distribution Engineering Computation: An Introduction Using MATLAB and Excel
15
Integration of Standard Normal Distribution Function As we have stated, the area under the curve from - to + is equal to one Often, we want to find the area from - to a specific value of Z For example, suppose we want to find the percentage of values that are less than one standard deviation above the mean This will be Engineering Computation: An Introduction Using MATLAB and Excel
16
Integration of Standard Normal Distribution Function This integral is known as the cumulative standard normal distribution This integral does not have a closed-form solution, and must be evaluated numerically There are tables of the results in most statistics books Engineering Computation: An Introduction Using MATLAB and Excel
17
Typical Table of Integral Values Engineering Computation: An Introduction Using MATLAB and Excel Z-value to one decimal place Second decimal place of Z-value
18
Integral Value for Z = 1.00 Integral = 0.841 This means that 84.1% of all values will be less than (mean + 1 standard deviation) Engineering Computation: An Introduction Using MATLAB and Excel
19
Graphical Interpretation of Answer Engineering Computation: An Introduction Using MATLAB and Excel
20
In-Class Exercises Consider a sample of concrete test specimens with a mean compressive strength of 4.56 ksi and a standard deviation of 0.482 ksi Using tables of the cumulative standard normal distribution, find: 1.The percentage of tests with strength values less than 3.50 ksi 2.The percentage of tests with strength values greater than 5.0 ksi 3.The strength value that 99.9% of tests will exceed Engineering Computation: An Introduction Using MATLAB and Excel
21
1. Percentage of Values Less Than 3.5 ksi Z = (3.5 – 4.56)/0.482 = -2.199 (round to -2.20) From table: 0.0139, or 1.4% of values are less than 3.5 ksi. Engineering Computation: An Introduction Using MATLAB and Excel
22
2. Percentage of Values Greater Than 5 ksi Z = (5.0 – 4.56)/0.482 = 0.913 (round to 0.91) From table: 0.8186 of the total values are less than 5 ksi, so 1 - 0.8186 = 0.1814, or 18.1% of values are greater than 3.5 ksi. Engineering Computation: An Introduction Using MATLAB and Excel
23
2. Percentage of Values Greater Than 5 ksi Note that Z = 0.913. Rather than rounding off, we can get a slightly more accurate answer by linear interpolation of the table values: Cumulative density = Engineering Computation: An Introduction Using MATLAB and Excel
24
3. Strength Value That 99.9% of Tests Will Exceed We want to find a value that 0.1% (0.001) of tests are below From the table, find the Z-value corresponding to a cumulative density of 0.001 Z is approximately -3.10 (note that to 4 decimal places, Z = -3.08 and Z = -3.09 have the same value of 0.0010) Engineering Computation: An Introduction Using MATLAB and Excel
25
3. Strength Value That 99.9% of Tests Will Exceed Z = -3.10 So the value that 99.9% of tests will exceed is 3.10 standard deviations below the mean: Therefore, 99.9% of tests will exceed a value of 3.07 ksi. If we set this value as the lower limit, then an average of one of every 1000 batches of concrete will not meet the specification Engineering Computation: An Introduction Using MATLAB and Excel
26
Application with MATLAB Calculating the integral directly will eliminate the need to use the tables Since we cannot begin our integration at - , what value of lower limit should we use? How many intervals do we need to use to get acceptable precision for our answers? We will experiment with different values for the lower limit and number of intervals Engineering Computation: An Introduction Using MATLAB and Excel
27
Function normdist function SUM = normdist(limit, k) lower = -limit; upper = limit; inc = (upper-lower)/k; SUM = 0; x(1) = lower; y(1) = 1/sqrt(2*pi)*exp(-x(1)^2/2); for i = 2:(k+1) x(i) = x(i-1)+inc; y(i) = 1/sqrt(2*pi)*exp(-x(i)^2/2); SUM = SUM +.5*(y(i) + y(i-1))*(x(i) -x(i-1)); end Engineering Computation: An Introduction Using MATLAB and Excel Making “limit” an argument of the function allows us to examine the effect of using different values k = number of increments
28
Evaluation of Limits, Number of Increments >> format long >> normdist(3,100) ans = 0.997292229481189 >> normdist(3,1000) ans = 0.997300124163755 >> normdist(6,1000) ans = 0.999999998025951 >> normdist(6,10000) ans = 0.999999998026819 >> normdist(6,100) ans = 0.999999997940018 >> normdist(5,100) ans = 0.999999414352763 Engineering Computation: An Introduction Using MATLAB and Excel
29
Conclusions Limit = 6 (6 standard deviations) gives accuracy to eight decimal places Number of increments less important: similar results for 100, 1000, and 10000 increments Use lower limit of -6 standard deviations, 1000 increments Engineering Computation: An Introduction Using MATLAB and Excel
30
Modified Function normdist function SUM = normdist(Z) % Calculates the % of population with values less than Z lower = -6; upper = Z; k = 1000; inc = (upper-lower)/k; SUM = 0; x(1) = lower; y(1) = 1/sqrt(2*pi)*exp(-x(1)^2/2); for i = 2:(k+1) x(i) = x(i-1)+inc; y(i) = 1/sqrt(2*pi)*exp(-x(i)^2/2); SUM = SUM +.5*(y(i) + y(i-1))*(x(i) -x(i-1)); end Engineering Computation: An Introduction Using MATLAB and Excel
31
Check >> normdist(0) ans = 0.5000 Should be 0.50 since curve is symmetric >> normdist(1) ans = 0.8412 Checks with value from table Engineering Computation: An Introduction Using MATLAB and Excel
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.