O'Reilly logo

Digital Dice by Paul J. Nahin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Solutionimage

image

14. Parrondo’s Paradox

The code gameb.m simulates game B. The logic is pretty straightforward, but in a few places the code does take elementary advantage of MATLAB’s vector capabilities. After line 01 establishes the value of , line 02 creates the row vector Mtotal of length 100, with all of its elements initially equal to zero. Mtotal(k) will be, when gameb.m ends, the total capital of all 10,000 sequences at the end of k games, 1 ≤ k ≤ 100. (Line 26 divides Mtotal by 10,000 at the completion of gameb.m to finish the calculation of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required