Category Riddle of the day

Geometric mean

Here is my riddle of the day for you. Explain why the following piece of Matlab code returns the following >>blog1(10,3) x=5.477226, y=5.477226 sqrt(x0y0)=5.477226 Here is the piece of code: %lasting gemsfunction function blog1(x0,y0) x=x0; y=y0; for i = 1 : 100000 tmp=x; x = (x+y)/2; y = 2*tmp*y/(tmp+y); end fprintf(‘x=%f, y=%f\n’,x,y); fprintf(‘sqrt(x0y0)=%f\n’,sqrt(x0*y0)); Also, generalize […]

Quantifying confusion

When a European goes to USA or when a US citizen goes to Europe, he or she may be confused by the different way a date is written down. Specifically, the day “7th November 2011”  is written in USA as 11/7/2011 which is the day of 11th of July in Europe. Well, imagine that you […]