Message Boards Message Boards

0
|
5624 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Monte Carlo Sampling - Roulette Problem - Help Needed

Posted 9 years ago

Hello everyone!

I have been tasked with the following problem and don't have an idea of how to start writing the language for the problem: Here is the problem: https://gyazo.com/20ff0189689c153ca9f978d62837adaa

In our class, we were given an example of Monte Carlo Sampling which was based around finding the values of Pi. The notebook of said example will be attached.

Any assistance will be greatly appreciated!

Attachments:
POSTED BY: Jesus Pelayo
2 Replies
bankroll = 100;
wager = 10;
payoff = 1;
odds = 1/38;
Print[{0, bankroll}]
Do[
 bankroll -= wager;
 bankroll += wager*payoff*RandomVariate@BernoulliDistribution[odds];
 Print[{i, bankroll}];
 If[bankroll == 0, Break[]],
 {i, 20}]

Sample output:

{0,100}
{1,90}
{2,90}
{3,80}
{4,70}
{5,60}
{6,50}
{7,40}
{8,30}
{9,20}
{10,10}
{11,0}

Good luck! Be careful with Roulette :-)

POSTED BY: Alexey Golyshev
Posted 9 years ago

Thank you!

POSTED BY: Jesus Pelayo
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract