
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for a programming mini-project aimed at calculating the probability of an individual's height falling within a certain range based on a gaussian distribution. The project involves using the composite simpson rule to approximate the integral and writing a c++ program to perform the calculations. The document also includes exercises for finding the probabilities of heights falling within specific standard deviations of the mean.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Burden and Faires. Section 4.3 (#16, 20). Section 4.4 (#2a, 4a, 6a, 12a). Section 4.5 (#2a).
Ortega and Grimshaw. Chapter 14: #14.3, 14.6, 14.13∗. *Omit the declaration const in the template definition.
Programming mini-project. Suppose the heights of individuals in a population are described by a Gaussian distribution with mean μ and standard deviation σ > 0. Then the probability that the height x of a randomly chosen individual lies in an interval (a, b) is given by
P {a < x < b} = (^) σ√^12 π
∫ (^) b a e−(x−μ)^2 /^2 σ^2 dx.
Here we use a composite integration rule to approximate this probability for different intervals. (a) Use the change of variable u = (x − μ)/σ in the above integral to show that
P {a < x < b} = √^12 π
∫ (^) (b−μ)/σ (a−μ)/σ e−u^2 /^2 du.
Moreover, show that P {μ − cσ < x < μ + cσ} is independent of μ and σ and depends only on c. (b) Write a C++ program to approximate
A f^ (u)^ du^ using the Composite Simpson Rule, where^ f^ (u) may be any user-defined function. For a given f (u), your program should accept the interval parameters A and B, an initial number of subintervals n (even) and a tolerance parameter tol. The program should compute approximations with larger and larger n until the difference between two consecutive approximations is less than tol in absolute value. (c) Use your program to compute the probabilities P {μ − σ < x < μ + σ}, P {μ − 2 σ < x < μ + 2σ} and P {μ − 3 σ < x < μ + 3σ}, each to within 10−^5.