ps1 Solutions 2012 - Massachusetts Institute of Technology
Transcript of ps1 Solutions 2012 - Massachusetts Institute of Technology
PS 1 2012 Solutions
Estimation Exercise E1-1 Rate of human hair growth
Using closest Wolfram»Alpha interpretation: hair growing
More interpretations: growth
Input interpretation:
growth rate of human scalp hair
Result:
0.4mmêday Hmillimeters per dayL
Unit conversions:
º 5 µ 10-9 mês Hmeters per secondL
º 150mmêyr Hmillimeters per yearL
Comparisons as speed:
º (2 to 10) µ typical continental drift speed H3 µ 10-10 to 3 µ 10-9 mês L
º 4 µMoon-Earth average relative recession speed Hº1.3 µ 10-9 mês L
Corresponding quantities:
Time to travel 1 meter from t ‡ dêv:2.16 µ 108 seconds3.6 µ 106 minutes60 000 hours2500 days357 weeks82months6.8 years
Time to travel 1 kilometer from t ‡ dêv:2.16 µ 1011 seconds6849 years
ü This wolfram alpha query gets 5 10^(-9) meters/second for scalp hair growth rateü http://www.census.gov/main/www/popclock.html estimates current world population at 7 10^(9)
peopleü Google searches consistently estimate 100 000 hairs per human head
Thus, 35 10^6 meters per second is an estimate which is about 1/100 the speed of light.
Individual Exercise I1-1ü part i
I’ll do this three ways: method 1 calls a table inside a tablelistListRandom = Table@Table@RandomReal@D, 8i, 1, j<D, 8j, 1, 10<D
880.952707<, 80.390942, 0.0418543<,80.657384, 0.539391, 0.109746<, 80.650962, 0.936312, 0.710895, 0.996032<,80.949339, 0.776241, 0.143766, 0.147384, 0.83501<,80.230589, 0.800606, 0.756102, 0.177976, 0.641354, 0.342235<,80.809261, 0.977451, 0.934216, 0.950344, 0.246799, 0.752152, 0.442456<,80.018052, 0.47664, 0.360543, 0.619801, 0.716939, 0.844246, 0.400928, 0.814969<,80.13189, 0.256292, 0.203939, 0.648271, 0.609436, 0.599307, 0.212177, 0.906567, 0.272519<,80.735505, 0.947902, 0.142594, 0.565916, 0.51594,0.868529, 0.97108, 0.66353, 0.439527, 0.637776<<
TableForm@listListRandomD
0.9527070.390942 0.04185430.657384 0.539391 0.1097460.650962 0.936312 0.710895 0.9960320.949339 0.776241 0.143766 0.147384 0.835010.230589 0.800606 0.756102 0.177976 0.641354 0.3422350.809261 0.977451 0.934216 0.950344 0.246799 0.752152 0.4424560.018052 0.47664 0.360543 0.619801 0.716939 0.844246 0.400928 0.8149690.13189 0.256292 0.203939 0.648271 0.609436 0.599307 0.212177 0.9065670.735505 0.947902 0.142594 0.565916 0.51594 0.868529 0.97108 0.66353
method 2 calls table with two iterators (note the order of the iterator arguments)listListRandom = Table@RandomReal@D, 8j, 1, 10<, 8i, 1, j<D
880.0246239<, 80.207339, 0.808835<,80.234104, 0.520552, 0.441187<, 80.300903, 0.0131674, 0.403992, 0.460441<,80.608984, 0.992358, 0.322675, 0.199237, 0.59705<,80.83726, 0.0233306, 0.12981, 0.190588, 0.495381, 0.578922<,80.0152738, 0.313043, 0.349991, 0.768705, 0.845001, 0.409027, 0.342527<,80.266712, 0.390946, 0.428078, 0.221822, 0.688549, 0.924687, 0.819243, 0.074179<,80.081931, 0.989583, 0.557819, 0.145544, 0.983857, 0.956526, 0.600004, 0.439116, 0.965318<,80.739997, 0.685332, 0.838946, 0.561434, 0.105422,0.0516813, 0.359351, 0.962087, 0.771105, 0.578688<<
2 ps1_Solutions_2012.nb
TableForm@listListRandomD
0.02462390.207339 0.8088350.234104 0.520552 0.4411870.300903 0.0131674 0.403992 0.4604410.608984 0.992358 0.322675 0.199237 0.597050.83726 0.0233306 0.12981 0.190588 0.495381 0.5789220.0152738 0.313043 0.349991 0.768705 0.845001 0.409027 0.3425270.266712 0.390946 0.428078 0.221822 0.688549 0.924687 0.819243 0.0741790.081931 0.989583 0.557819 0.145544 0.983857 0.956526 0.600004 0.4391160.739997 0.685332 0.838946 0.561434 0.105422 0.0516813 0.359351 0.962087
method 3 uses an extra agument on RandomReal)listListRandom = Table@RandomReal@80, 1<, jD, 8j, 1, 10<D
880.841487<, 80.426393, 0.247967<,80.330521, 0.631433, 0.373273<, 80.578645, 0.470113, 0.489843, 0.825914<,80.947732, 0.0882232, 0.712546, 0.571823, 0.22024<,80.206546, 0.537881, 0.495882, 0.649997, 0.832185, 0.639765<,80.117978, 0.927907, 0.204082, 0.367704, 0.447266, 0.103634, 0.480428<,80.569795, 0.593881, 0.220767, 0.311421, 0.242909, 0.460242, 0.884189, 0.365036<,80.733238, 0.750023, 0.0440028, 0.397806, 0.504303, 0.754037, 0.136541, 0.0141459, 0.5158<,80.145621, 0.498408, 0.286283, 0.308395, 0.717634,0.262903, 0.285739, 0.686997, 0.419629, 0.724434<<
TableForm@listListRandomD
0.8414870.426393 0.2479670.330521 0.631433 0.3732730.578645 0.470113 0.489843 0.8259140.947732 0.0882232 0.712546 0.571823 0.220240.206546 0.537881 0.495882 0.649997 0.832185 0.6397650.117978 0.927907 0.204082 0.367704 0.447266 0.103634 0.4804280.569795 0.593881 0.220767 0.311421 0.242909 0.460242 0.884189 0.3650360.733238 0.750023 0.0440028 0.397806 0.504303 0.754037 0.136541 0.01414590.145621 0.498408 0.286283 0.308395 0.717634 0.262903 0.285739 0.686997
ü part iiApply the function Mean (the function Map would be useful here, but let’s stick with the most straightforwardtechniques for beginning of this course)Table@Mean@listListRandom@@iDDD, 8i, 1, Length@listListRandomD<D
80.841487, 0.33718, 0.445075, 0.591128,0.508113, 0.560376, 0.378429, 0.45603, 0.427766, 0.433604<
ü part iii1. Modify the third method in part i above to produce a list of averageslistRandomAverages = Table@Mean@RandomReal@80, 1<, jDD, 8j, 1, 10<D
80.498429, 0.817227, 0.125302, 0.333164,0.676041, 0.616702, 0.475095, 0.368412, 0.523396, 0.608829<
2. Generalize to an arbitrary length, let’s pick 100000 as an example, and we will use the semicolon to supress output.This takes about two minutes on my MacBook.listRandomAverages = Table@Mean@RandomReal@80, 1<, jDD, 8j, 1, 100 000<D;
Here we see how long it takes to do such a calculation, using Timing
ps1_Solutions_2012.nb 3
Timing@listRandomAverages = Table@Mean@RandomReal@80, 1<, jDD, 8j, 1, 100 000<D;D
8263.746, Null<
3. Plot the mean against number of random numbers in the averageListPlot@listRandomAverages,PlotLabel Ø "Average of n random numbers\n uniformly distributed in H0,1L",FrameLabel Ø 8"n", "Mean"<, ImageSize Ø Large,PlotRange Ø 80.45, 0.55<, BaseStyle Ø Large, Frame Ø TrueD
4 ps1_Solutions_2012.nb
ü we have set the plot range so that we can see more of the range of solutions for small n.
Here’s a clever visulaization trick using Opacity. We can visualize the density by the intensity of color.
ListPlot@listRandomAverages, PlotStyle Ø [email protected], Red, [email protected]<,PlotLabel Ø "Average of n random numbers\n uniformly distributed in H0,1L",FrameLabel Ø 8"n", "Mean"<, ImageSize Ø Large,PlotRange Ø 80.45, 0.55<, BaseStyle Ø Large, Frame Ø TrueD
An important thing to notice in this plot is that the width of the distribution decreases with increasing n. We can get a better sense of this by plotting the standard deviations
listStandardDeviations = Table@StandardDeviation@RandomReal@80, 1<, jDD, 8j, 2, 10 000<D;
ps1_Solutions_2012.nb 5
ListPlot@listStandardDeviations,PlotLabel Ø "Standard Deviation of n random numbers\n uniformly distributed in H0,1L",FrameLabel Ø 8"n", "Standard Deviation"<,ImageSize Ø Large, BaseStyle Ø Large, Frame Ø TrueD
6 ps1_Solutions_2012.nb