1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gambler's ruin

  1. Apr 8, 2016 #1
    1. The problem statement, all variables and given/known data
    I ask for help in solving the exercises in this project on applied linear algebra. The problem outlined in the project is one in which we are tasked with modeling the demise of a gambler.

    I need help solving exercise 1 (in red) on page 6. I have pasted the exercise text into the text body below, in block quotes.

    Using the equations discussed above, evaluate numerically U(l) as a function of the initial gambler position l. Use e.g. M = 100 or similar. This is the code that I have written

    M = 100;

    X = ones(M,1); A = diag(-2*X,0); clear X X = ones(M-1,1); B = diag(X,1); C = diag(X,-1); T = A+B+C;

    tau = 1; N = -(inv(T)/tau)*n0 n0 = eye;

    numeric::int(N, l = 0..infinity)

    2. Relevant equations


    3. The attempt at a solution
     
  2. jcsd
  3. Apr 8, 2016 #2

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    There's no attachment or image pasted into the OP. The details of the problem are not clear.
     
  4. Apr 8, 2016 #3
    Thanks for pointing it out!

    https://onedrive.live.com/redir?resid=6AFDD76B502B7B9C!4262&authkey=!AM2th-5i26TrCcI&ithint=file%2Cpdf [Broken]
     
    Last edited by a moderator: May 7, 2017
  5. Apr 9, 2016 #4
    Progress (and bump)

    clear
    M=10;
    X = ones(M,1);
    A = diag(-2*X,0);

    clear X
    X = ones(M-1,1);
    B = diag(X,1);
    C = diag(X,-1);
    T = A+B+C;
    clear X B C; % remove these matrices from memory

    n0 = randi([1 M-1],1); % Initial gambler position, determined using a random seed generator

    tau = 365

    N = -inv(T)/tau * n0 % The ultimate probability of Gambler's ruin. R(l) = N(l)
     
    Last edited: Apr 9, 2016
  6. Apr 10, 2016 #5
    I can't make sense of what I must do to solve the exercise
     
  7. Apr 10, 2016 #6

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    I can't make sense of the gambler's ruin problem as presented in the pdf file you attached. I know the gambler's ruin problem, and none f the versions I have seen have involved continuous time systems and differential equations. It seems like the author of the pdf wants you to treat the time between gambles as exponentially-distributed random variables, so you get a differential equation for the probability of "position" as a function of time. However, that is not involved with computing the probability of ruin.
     
  8. Apr 11, 2016 #7

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    No, the model is small gambles at very short equal intervals, making it effectively a continuous process.
     
  9. Jul 26, 2016 #8
    Yes thay's correct.

    Should I be getting a greater than 1 chance of gambler's ruin occurring as a function of initial position?

    I'm talking about this exercise:
    • Using the equations discussed above, evaluate numerically U(l) as a function of the initial gambler position l. Use e.g. M = 100 or similar

    My code
    clear
    M=4;
    X = ones(M,1);
    A = diag(-2*X,0);
    clear X
    X = ones(M-1,1);
    B = diag(X,1);
    C = diag(X,-1);
    T = A+B+C;

    tau=1; %For simplicity, we take tau = 1
    n0=zeros(1,M)';
    n0(1)=1; % Initial position is taken to be 1
    ulP=-(inv(T)/tau)*n0;
    plot(ulP,'r*');
     
  10. Jul 26, 2016 #9

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    No, you should never, ever, get a probability > 1 for anything, ruin or otherwise. Sometimes, though, when you use approximate solution techniques and finite-wordlength floating-point computations you can have probabilities that exceed 1 slightly.

    I do not understand your code, so have no way of assessing what you have done and where the errors (if any) arise. You do not even tell use what software you are using!
     
  11. Jul 26, 2016 #10
    I should mention that I use matlab.
     
  12. Jul 26, 2016 #11

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Is that valid? The file you attached does not explain what tau is, but it smells like a normalisation factor, i.e. its function is to ensure the probabilities of all the mutually exclusive events add up to 1.
     
  13. Jul 26, 2016 #12
    Tau determines the rate at which ultimate ruin is reached. It can be of any magnitude, i.e. seconds, months or years.
     
  14. Jul 26, 2016 #13

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Then shouldn't its value affect the elements of T?
    As a check, try varying tau. If I read your code correctly, the calculated probability will vary inversely. That would clearly indicate a problem.
     
  15. Jul 27, 2016 #14
    Varying tau varies the calculated probability inversely.
     
  16. Jul 27, 2016 #15

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Right, so you cannot arbitrarily plug in tau=1. I would think there is a relationship between tau and T.
     
  17. Jul 27, 2016 #16
    The project description doesn't mention anything about the relationship. By the way, I was informed that tau is a purely mathematical construct, which governs the rate at which gambler's ruin occurs. Thus, the value of tau can be completely arbitrary.
     
  18. Jul 27, 2016 #17

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    But in that case the matrix T must depend on its value, no?
    One approach is to sum the probabilities that should add to 1 then set tau in such a way that they do.
     
  19. Jul 28, 2016 #18
    Agreed.

    The professor suggest that I set the value of tau equal to 1.

    With tau = 1, I get the following column matrix:

    ulP =

    0.8000
    0.6000
    0.4000
    0.2000

    While sum(ulP) = 2.0000.

    Now, none of the probabilites are greater than 1 on their own. Not even when I set the size of the matrix equal to 100.

    What do you think each row represents?
     
  20. Jul 28, 2016 #19

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    I don't think the sum of these is interesting. It's hard to know what they mean.
     
  21. Jul 28, 2016 #20
    I'm not even sure what significance the column vector for the ultimate probability has.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Gambler's ruin
Loading...