Re: Monte Carlo probability calculation in Python

2015-02-10 Thread Paul Moore
On Monday, 9 February 2015 21:57:51 UTC, Paul Moore wrote: > On Friday, 6 February 2015 23:49:51 UTC, Steven D'Aprano wrote: > > Very nice! Care to share the code? > > Will do. Here's the code I used for the Monopoly calculations. import numpy as np def monopoly(samples): # 2d6 x 3 n

Re: Monte Carlo probability calculation in Python

2015-02-09 Thread Paul Moore
On Friday, 6 February 2015 23:49:51 UTC, Steven D'Aprano wrote: > > Just a quick status update, in case you're interested. With relatively > > little work (considering I started not knowing much about numpy) I managed > > to put together solutions for a couple of my friend's problems which ran > >

Re: Monte Carlo probability calculation in Python

2015-02-07 Thread Sturla Molden
Paul Moore wrote: > > Yes. And a number of other variations. None gave anything that seemed to > relate. It's quite likely though that I'm simply not understanding how > things like pymc (which came up in the searches) might help me, or how to > convert my problem into a Monte Carlo integration

Re: Monte Carlo probability calculation in Python

2015-02-06 Thread Steven D'Aprano
Paul Moore wrote: > On Thursday, 5 February 2015 23:02:42 UTC, Paul Moore wrote: >> Nice! Thanks both of you. I start to see how to think about these >> things now. I'll play around with some of the other examples I've got, >> and see how far I get. > > Just a quick status update, in case you'

Re: Monte Carlo probability calculation in Python

2015-02-06 Thread Paul Moore
On Thursday, 5 February 2015 23:02:42 UTC, Paul Moore wrote: > Nice! Thanks both of you. I start to see how to think about these > things now. I'll play around with some of the other examples I've got, > and see how far I get. Just a quick status update, in case you're interested. With relativel

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Paul Moore
On Thursday, 5 February 2015 21:01:21 UTC, Ian wrote: > Building on Rob's example: > > def monopoly(throws, per=2, rerolls=3, sides=6): > all_dice = np.random.randint(1, sides+1, size=(throws, rerolls, per)) > doubles = all_dice[...,0] == all_dice[...,1] > three_doubles = doubles[:,0]

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Ian Kelly
On Thu, Feb 5, 2015 at 12:25 PM, Paul Moore wrote: > On Thursday, 5 February 2015 16:57:07 UTC, Rob Gaddi wrote: >> You don't need the whole scipy stack, numpy will let you do everything >> you want. The trick to working in numpy is to parallelize your problem; >> you don't do a thing a thousan

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Rob Gaddi
On Thu, 05 Feb 2015 11:25:42 -0800, Paul Moore wrote: > On Thursday, 5 February 2015 16:57:07 UTC, Rob Gaddi wrote: >> You don't need the whole scipy stack, numpy will let you do everything >> you want. The trick to working in numpy is to parallelize your >> problem; >> you don't do a thing a t

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Paul Moore
On Thursday, 5 February 2015 16:57:07 UTC, Rob Gaddi wrote: > You don't need the whole scipy stack, numpy will let you do everything > you want. The trick to working in numpy is to parallelize your problem; > you don't do a thing a thousand times; you do it on a thousand-length > array. For e

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Rob Gaddi
On Thu, 05 Feb 2015 08:20:41 -0800, Paul Moore wrote: > I'm interested in prototyping a Monte Carlo type simulation algorithm in > Python. The background is that a friend has written a similar program in > C++, and I'm interested in seeing if I can achieve something comparable > in a much better

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Paul Moore
On Thursday, 5 February 2015 16:28:07 UTC, Joel Goldstick wrote: > have you googled "python monte carlo"? Yes. And a number of other variations. None gave anything that seemed to relate. It's quite likely though that I'm simply not understanding how things like pymc (which came up in the search

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Joel Goldstick
On Thu, Feb 5, 2015 at 11:20 AM, Paul Moore wrote: > I'm interested in prototyping a Monte Carlo type simulation algorithm in > Python. The background is that a friend has written a similar program in > C++, and I'm interested in seeing if I can achieve something comparable in > a much better lan

Monte Carlo probability calculation in Python

2015-02-05 Thread Paul Moore
I'm interested in prototyping a Monte Carlo type simulation algorithm in Python. The background is that a friend has written a similar program in C++, and I'm interested in seeing if I can achieve something comparable in a much better language :-) The basic job of the program will be to simulat