| Programming does definetly helps me when i do not understand an idea. For exmaple: I did not understood why in the Monty Hall problem [1] do i have 2/3 chance of winning if i do change the door instead of 1/2 that my intuition tells me until i wrote it as two functions. function change() {return random(3) != random(3);} // 2/3 chance function not_change() {return random(3) == random(3);} // 1/3 chance Then i also saw that i do get that 1/2 chance of winning if i choose between changing the door and not at random. function random_change() {if (random(2) == 1) {return change();} else {return not_change();}}
// (1/3)/2 + (2/3)/2 = 1/2 chance This was so much more convincing than math and theory and even explanations with cards and drawings because i could run it in a loop a 1000 times and see the results be close to the prediction. 1 - https://en.wikipedia.org/wiki/Monty_Hall_problem |