Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lets say your robot is at 0(zero) position of X axis you robot either take only one step at a time.
- either left or right
- what will be probability that robot is at 0 position after 1000 steps.
- brute force
- loop 0 to 1000
- math.random move left, move right
- 50% chance move left, 50% move right
- simulation
- method
- loop 0 to 1000
- run method 1000, 1000000x then calculate stats
- what is probability that robot is at 0 position after 4 steps
- after 1 step 0%
- robot at -1, 1 total possibilties=2
- after 2 steps
- robot at -2,0,0,2 total possibilties=4
- 50%
- after 3 steps
- robot at -3,-1,-1, 1, -1, 1, 1, 3 -> 0 probability total possibilties=8
- i
- after 4 steps
- robot at -4,-2, -2,0, -2,0,0,2, -2,0, 0,2, 0,2,0, 2,4 total possibilties=16
- 1 2 3 4 5 5 7
- Hint:
- 1 0 4 0 6 0 4 0 1 step 4
- 0 1 0 3 0 3 0 1 0 step 3
- 0 0 1 0 2 0 1 0 0 step 2
- 0 0 0 1 0 1 0 0 0 step 1 ->
- 0 0 0 0 1 0 0 0 0 step 0 ->
- -4 -3 -2 -1 0 1 2 3 4
- 0 1 2 (2 steps) 3 4 (4 steps)
- 100 0 50 0 50?
- combinatorics, stats, math
- combinatorics - google - math cool question - assume that
- - how to use computer science/
Add Comment
Please, Sign In to add comment