φ l g m Figure 1: Homework 2 Problem 1 Consider a game between player A (dealer) and player B ( a student) (called “blackjack”). First, player B draws cards from the infinite decks of 36 cards, until he gets 17 or higher. (a deck contains 52 cards, where all pictures are counted as 10 and Ace as 11). If player B gets more than 21, then he loses, if player B get 21 he wins, if player B gets anything between 17 and 21 (21 not including), then player A takes turn and follows the same procedure. Player A loses if A gets more than 21; wins if A gets 21. If player A gets something between 17 and 21 then scores of A and B are compared. The one with larger score wins. If scores are equal nobody wins. i) Simulate this game using acceptance-rejection method to draw a card. Play 10000 games and report net win (which can be negative) = wins - losses. ii) Find and simulate more refined strategies for the player B using the information about the last drawn card. Hint. You will need to make the threshold (which is 17 in part (i)) as a function of the last drawn card. Problem 2 1) Use dimensional analysis to determine the period of the pendulum as a function of the length of the pendulum (l), mass (m), gravity (g) and φmax (see Figure 1). 2) Simplify the relation from 1) for small values of φmax . 3) If a pendulum has a period of 4 seconds on the earth, what would its period be if it were placed on Mars? (use gmars /gearth = 1/3). Assume same φmax . Problem 3 1 We recall a few basic concepts from finance. If some principal investment P is invested for t years at interest rate r, then if the interest is compounded annually, the return is Rt = P (1 + r)t . If the interest is compounded twice a year the return is Rt = P (1 + r/2)2t . If the interest is compounded n times a year, then Rt = P (1 + r/n)nt . Recalling that limn→∞ (1 + 1/n)n = e, we see that continuously compounded interest will yield a return governed by Rt = P ert . 1) Write a matlab function (*.m file) that takes as input t years, r interest rate, and P principal P and returns Rt for the three plans described above. Run your function for two different set of r, t, and P . 2