All problems

Margin of Error for a Known-Variance Sample

easyPythonConfidence Intervals

Ridgeline Instruments calibrates pressure sensors for hospital ventilators. Every sensor leaves the lab with a certificate, and the certificate has to say more than what the lab measured: a hospital needs to know how much slack sits around that figure before it will accept the part.

A sensor is read a number of times on a reference rig. Each rig's own measurement noise has been characterised over years of use and is treated as a known quantity. The confidence level a customer asks for arrives as its critical value, already looked up - 1.96 for the usual 95% two-sided certificate, 1.645 for a 90% one, 2.576 for 99%.

Task: Print the margin of error for the certificate, rounded to 2 decimals. The conventions: this is the half-width of the interval, the amount added on one side and taken off the other, not the total span; the rig's spread is known rather than estimated from the readings, so the supplied normal critical value applies rather than a t value; and rounding happens once, on the final value.

Input

Three lines: how many times the sensor was read, the rig's known population standard deviation, and the critical value for the confidence level being certified. The count is a whole number of at least 1; the other two are positive decimals.

Output

One line holding the margin of error, rounded to 2 decimals and printed the way Python prints a float - 3.92, and 3.29 rather than 3.290.

Example:

Input:
49
14
1.96

Output:
3.92

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…