Posts Tagged ‘ recursion ’

the large half now

October 28, 2012
By
the large half now

The little half puzzle proposed a “dumb’ solution in that players play a minimax strategy. There are 34 starting values less than 100 guaranteeing a sure win to dumb players. If instead the players maximise their choice at each step, the R code looks like this: and there are now 66 (=100-34, indeed!) starting values

Read more »

Cross validated question

February 19, 2012
By
Cross validated question

Another problem generated by X’validated (on which I spent much too much time!): given an unbiased coin that produced M heads in the first M tosses, what is the expected number of additional tosses needed to get N (N>M) consecutive heads? Consider the preliminary question of getting a sequence of N heads out of k

Read more »

ultimate R recursion

January 31, 2012
By
ultimate R recursion

One of my students wrote the following code for his R exam, trying to do accept-reject simulation (of a Rayleigh distribution) and constant approximation at the same time: which I find remarkable if alas doomed to fail! I wonder if there exists a (real as opposed to fantasy) computer language where you could introduce constants

Read more »

More Recursion in R

May 26, 2009
By

I found another gem in R today. Earlier I commented about how R could do recursion, something that I love. I write some pretty complicated recursion functions in my research, but I also have a bad habit of compulsively reorganizing things. Now I've c...

Read more »