TCHS 4O 2000 [4o's nonsense] alvinny [2] - csq - edchong jenming - joseph - law meepok - mingqi - pea pengkian [2] - qwergopot - woof xinghao - zhengyu HCJC 01S60 [understated sixzero] andy - edwin - jack jiaqi - peter - rex serena SAF 21SA khenghui - jiaming - jinrui [2] ritchie - vicknesh - zhenhao Others Lwei [2] - shaowei - website links - Alien Loves Predator BloggerSG Cute Overload! Cyanide and Happiness Daily Bunny Hamleto Hattrick Magic: The Gathering The Onion The Order of the Stick Perry Bible Fellowship PvP Online Soccernet Sluggy Freelance The Students' Sketchpad Talk Rock Talking Cock.com Tom the Dancing Bug Wikipedia Wulffmorgenthaler |
bert's blog v1.21 Powered by glolg Programmed with Perl 5.6.1 on Apache/1.3.27 (Red Hat Linux) best viewed at 1024 x 768 resolution on Internet Explorer 6.0+ or Mozilla Firefox 1.5+ entry views: 35 today's page views: 191 (43 mobile) all-time page views: 3207917 most viewed entry: 18739 views most commented entry: 14 comments number of entries: 1203 page created Sun Jan 19, 2025 17:00:38 |
- tagcloud - academics [70] art [8] changelog [49] current events [36] cute stuff [12] gaming [11] music [8] outings [16] philosophy [10] poetry [4] programming [15] rants [5] reviews [8] sport [37] travel [19] work [3] miscellaneous [75] |
- category tags - academics art changelog current events cute stuff gaming miscellaneous music outings philosophy poetry programming rants reviews sport travel work tags in total: 386 |
|
- programming - (Source: xkcd) I was about to continue salvaging my FYP, when I came across the above comic that piqued my curiosity. Oh well, I suppose an hour or two wouldn't make a difference...
We consider the given formula: r = sqrt(2/(πPdXfXd)) where r - average distance within which somebody is doing FYP (tee, hee) π - still approximately 3.14159265, last I checked Pd - regional population density Xf - average person's frequency of doing FYP Xd - average duration of doing FYP X - Xf multiplied by Xd should be the probability of an average person doing FYP at any point in time. We shall just call it X for simplicity. Now, a bit of manipulation of the given formula gives: Area within radius r = πr2 = 2/(PdXfXd) It is easy to imagine that Pd, Xf and Xd are all in inverse relation to the radius/area within which one would expect to find others doing FYP (i.e. Obviously if there were more people in the area [Pd increases], the radius expected would be smaller. Similarly, if people did FYP more often, or did FYP for longer periods of time each time they did it [Xf or Xd increases], the radius expected would be smaller). What I was not so sure of was the constant 2 (and why the inverse relation would be just through division). Intuitively it would be because it usually takes two to do a FYP (ahem), assuming no larger group projects (cough cough - and no, solo FYP shouldn't count, right?). On second thought, Xf and Xd are defined for individuals, so why there should be a constant factor of 2 is not immediately clear. WHY? WHY TWO? With my math being what it is, and due to very real time constraints, I was unable to derive the constant. I did manage to argue something for the special case X = XfXd = 1, i.e. everybody does FYP all the time (wow!) - in that case, the average distance within which somebody is doing FYP (i.e. r) would just be the expected distance of the closest person. In that special case, the probability of a particular person being within some smaller radius rs would be (rs/r)2, from random distribution over area. Then, the probability that he is not within that smaller radius is just 1 - (rs/r)2, and the probability that P such (independently distributed) people are all not within that smaller radius would be [1 - (rs/r)2]P. Then the expected distance of the closest person would be just rs where [1 - (rs/r)2]P = 0.5. Of course, we must be careful here to normalize the population from a square to circular area if needed. Now being unwilling to devote more time for now to unraveling the theoretical mysteries of THE CONSTANT TWO, I fell back on simulation, and wrote a simple script that would generate P points within a square of sides 2R (and thus area 4R2). The population density would then be P/(4R2). These P points (people) could then be sorted in order of increasing distance from the middle of the area, and for each person, the question of whether he was currently doing FYP (snicker) could then be simulated given X (as again, if X=1, just take the nearest person). We continue until we find a person doing FYP (of course it may be that none of the P people have the luck to be doing FYP, but if P and X are relatively large, this is astronomically unlikely). The whole process is then repeated for many more times to get the average. The strange thing was, my simulation did not agree with the given formula closely, being about 60% off in general. Empirically, the formula r = sqrt(1/(4*PdXfXd)) appears to match simulation results much more closely. It is also rather closer to the derived formula r = R*sqrt(1-(0.5^(1/P))) for the special case where X = 1, though does not quite match it. It may very well be a problem with my logic or programming, in which case the first to point it (them) out, or alternatively explain the derivation of the original equation to my satisfaction, will be awarded an AAAAA! Finally, what's the expected distance at which somebody is doing FYP from me now? Using the original formula, and a stated population density in Singapore of 6814/km2 scaled to an adult density of 5179/km2, an FYP frequency of 73 times per annum (0.2) and estimating a duration of 30 minutes each time (i.e. each adult person spends an average of 0.4% of his time doing FYP), we get: r = sqrt(2/(3.141*5179*0.2*0.02)) = 0.175km which is an overestimate if my simulations are accurate, as then r = sqrt(1/(4*5179*0.2*0.02)) = 0.110km Really, FYP isn't such a rare burden after all. Next: Slaaaaaaaaaaaaaack
edison csq said... u know what is the definition of FYP?
anonymous said... fark your prof
lwei said... i din really go thru the formulae very thoroughly, but i surmise the 'constant 2' is likely due to the fact that the formula takes into account the fact that 'doing fyp' involves 2 pple. therefore to obtain the distance of the closest person from you that is 'doing fyp' , you have to multiply the distance by 2. not sure abt the square root, tho.
anonymous said... As population density increases, the difference between R_1 in bounding the closest person and R_2 in bounding the closest 2 persons reduces, such that mod(R_1-R_2) approaches 0. However, both R also approaches zero? i.e. infinite density, you will always BE the person doing fyp, for R = 0. As such, the fractional error in disregarding bounding 2 persons instead remains significant regardless of density regime.
Ham G. Bacon said... Thanks to the incisive analysis of the indefatigable anonymoustpk (and also the insight by lwei), it seems as if the requirement for two to tango is indeed significant. Ballpark figures for the discrepancy from the updated simulation script are between R_2 and R_1 are from 30% to 90% depending on which R_ one takes as the denominator in computing percentage change, so for it to make up the difference of ~60% seems reasonable. This happily also seems to explain the fit of r = sqrt(1/(4*PdXfXd)), since it was approximately R_1 = sqrt(1/(π*PdXfXd)) [and generalizes to R_A = sqrt(A/(π*PdXfXd)?] However it would appear that the simulation has myraid other flaws. A minor one in the code of not properly normalizing the population area, for example (a square isn't that bad, but imagine if the area were instead a rectangle with length ten times the breadth - the distances would be rather skewed). Other than that, issues such as whether two individuals have to be within a minimum proximity to do FYP, and simulating such that they fulfil these requirements while adhering to the given parameter of X, and also the relatively low number of points/simulations executable on my web host lest the hosting company clamp down, also have to be considered. Till next time...
Linkback by LwEi's World
Trackback by hero action camera
Trackback by Joe Pantel
|
||||||||||||||||||||||||||
Copyright © 2006-2025 GLYS. All Rights Reserved. |