Sep-04-2022, 05:45 PM
(Sep-04-2022, 05:15 PM)Skaperen Wrote: i don't understand lines 19 and up to know how to confine the curve to where i need it to be.lines 17 and up are only additional code that allow scipy to deduce graphically a density curve from a set of experimental data. You don't need these lines.
The
sleeping_time()
function is the useful function that generates the data. It simply uses a bell curve (mathematically called a gaussian function) to generate the points, and it confines the curve where it need to be simply by rejecting the values that are below the min or above the max. It amounts to simply truncating the bell curve.To describe the rejection method, the average height of american males is about 175.3 cm according to Wikipedia. We take a random US citizen, if his height is between 160 and 190 cm we accept the value, otherwise we take another citizen until we find one in that range. It is a very simple idea.