3 ms·
> Your Python program is incomprehensible to me, probably due to the lack of meaningful variable names I agree with this criticism, so I replaced the program:
by lutusp 14y ago
> Your Python program is incomprehensible to me, probably due to the lack of meaningful variable names
I agree with this criticism, so I replaced the program:
https://www.dropbox.com/s/7m8hq9yzcu5nztx/prime_reproduction_test.py https://www.dropbox.com/s/7m8hq9yzcu5nztx/prime_reproduction...
> I am just setting the starting offset (not the starting year!) between the cicada and the predators to something other than zero.
But if you change the offset of the predator's cycle, you've changed nothing unless the total years of test is a very small number. This is an easy claim to verify using my Python program -- you can arbitrarily change the starting point for the predator reproductive cycle, or the year, or any number of combinations -- but it doesn't change the outcome. The reason is that what's being measured is the number of collisions between a particular predator reproductive cycle over time, and a valid result merits a long time (I usually use 1000 years). This fact prevents the starting point from influencing the outcome.
Also, since the basic test is to count how often the predators hatch out in synchrony with the cicadas for a given cicada cycle number, and since that requires using modulo arithmetic, it's not obvious how you could change the result by adding an offset to either the chosen predator reproductive cycle or the year (or both) -- especially since I test the survival value of each cicada cycle against a large range of predator cycles.
The basic idea is that the cicadas evolve toward prime-numbered reproductive cycles by being tested in an environment filled with predators that use any number of other cycles, so a fair test requires me to compare a given cicada cycle with all plausible predator cycles and sum the results. Because I'm summing results for all predator cycles, adding a bias value to the predator cycle doesn't really change anything. That was why I was so sure this idea wouldn't hold up, but I tested it anyway.
> No, I even think the problem is more widespread than psychology alone (though in psychology it is particularly severe), having seen first hand how science is conducted in other areas.
Of course I agree. My focusing on psychology is not because their "science" is better or worse than, say, sociology, only that psychologists have clinics and patients -- people who deserve treatment driven by science, not anecdote.
I apologize for my tone earlier. I've been receiving a lot of rather emotional defenses of psychology lately, including a valiant effort by psychologists and fans of psychology to delete my Wikipedia page (an effort that will eventually probably succeed).
- jules 14y ago> I agree with this criticism, so I replaced the program: That makes more sense, but I still don't understand the expression a % ((cc % b)+1) == 0 If I change it to something that would make sense to me, I get vastly different results: for a in range(2,24): total = 0 for b in range(1,30): for c in range(1,1000): cc = c + start_offset cicada_hatch = (cc % a == 0) predators_hatch = (cc % b == 0) if cicada_hatch and predators_hatch: total += 1 print ' %2d = %6d %s' % (a,total, '*' * (total/320)) But now the fast cycles get large bars. What we want to know is how often the cicada mate vs how often they are eaten: (written overly verbosely to make sure it's readable) for a in range(2,24): total_cicada_hatchings = 0 total_predator_feasts = 0 for b in range(1,30): for c in range(1,1000): cc = c + start_offset cicada_hatch = (cc % a == 0) predators_hatch = (cc % b == 0) if cicada_hatch: total_cicada_hatchings += 1 if cicada_hatch and predators_hatch: total_predator_feasts += 1 efficiency = float(total_cicada_hatchings) / float(total_predator_feasts) print ' %2d = %6d %s' % (a,efficiency, '*' * int(efficiency * 5)) With this code indeed the prime numbers show up. But this code has the problem I described: both the predator cycle and the cicada cycle start synchronized. Here is the fix: initial_cicada_cycle_year = 1 # arbitrary number initial_predator_cycle_year = 0 # another arbitrary number for a in range(2,24): total_cicada_hatchings = 0 total_predator_feasts = 0 for b in range(1,30): # cicada_cycle_year will have a value in the range {0..a-1} cicada_cycle_year = initial_cicada_cycle_year % a # predator_cycle_year will have a value in the range {0..b-1} predator_cycle_year = initial_predator_cycle_year % b for c in range(1,1000): cicada_hatch = cicada_cycle_year == 0 predators_hatch = predator_cycle_year == 0 if cicada_hatch: total_cicada_hatchings += 1 if cicada_hatch and predators_hatch: total_predator_feasts += 1 # move the cycle forward by 1 year cicada_cycle_year = (cicada_cycle_year + 1) % a predator_cycle_year = (predator_cycle_year + 1) % b efficiency = float(total_cicada_hatchings) / float(total_predator_feasts) print ' %2d = %6d %s' % (a,efficiency, '*' * int(efficiency * 5)) If you set initial_cicada_cycle_year equal to initial_predator_cycle_year then you'll get the prime numbers to show up. Otherwise you get something else. > The reason is that what's being measured is the number of collisions between a particular predator reproductive cycle over time, and a valid result merits a long time (I usually use 1000 years). This fact prevents the starting point from influencing the outcome. Suppose that the predator cycle is 3 and the cicada cycle is 3. Then if at year 0 the cycles coincide, they will in the future coincide every 3 years because you have this pattern: year 0123456789 ... cicada X X X X ... predator X X X X ... If at the start year 0 the cycles do not coincide, they will never coincide in the future, no matter for how many years you run the simulation: year 0123456789 ... cicada X X X X ... predator X X X ... So the starting offset between the cycles is highly important! > including a valiant effort by psychologists and fans of psychology to delete my Wikipedia page (an effort that will eventually probably succeed) Haha that is so funny...and sad. Also my apologies for the tone in my original post. The reference to psychology was unnecessary and mean..