Calculating & Simulating Heights in Gaussian Distribution: Composite Simpson Rule, Assignments of Mathematics

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

Pre 2010

Uploaded on 08/27/2009

koofers-user-4b1-1
koofers-user-4b1-1 🇺🇸

8 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
M348
Homework #7
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 xof a randomly chosen individual
lies in an interval (a,b) is given by
P{a < x < b}=1
σ2πZb
a
e(xµ)2/2σ2dx.
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}=1
2πZ(bµ)
(aµ)
eu2/2du.
Moreover, show that P{µ < x < µ +}is independent of µand σand depends only on c.
(b) Write a C++ program to approximate RB
Af(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 Aand B, an initial number of subintervals n(even) and a tolerance parameter tol . The
program should compute approximations with larger and larger nuntil the difference between two
consecutive approximations is less than t ol 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 105.

Partial preview of the text

Download Calculating & Simulating Heights in Gaussian Distribution: Composite Simpson Rule and more Assignments Mathematics in PDF only on Docsity!

M

Homework

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

∫ B

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.