#๐ monte carlo simulation
19 messages ยท Page 1 of 1 (latest)
@primal notch
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
what's the issue?
what is the code, and what issue you're having? please don't say that we should provide all of them without you trying. if yes, then at least try solving the question.
we can give you a few hints tho.
ok i gotta go to sleep im sorry
https://www.pythondiscord.com/pages/guides/pydis-guides/asking-good-questions/
look at this.
Share your code, explain what thing does not work and how it is excpected to work
A guide for how to ask good questions in our community.
i solved first but not able to to come up with logic for second and how to start it
logic and how to start
What is the first, and what is the second?
edited , there were 2 questions got answer for 1st
A table has a chessboard integrated into the centre of the table. A round coin fits exactly inside of a square on a chessboard. The coin is dropped to land flat on the table, with at least a part of the coin on the chessboard. Using Monte Carlo simulation, what is the probability that the coin covers the corner of four chessboard squares?
#chess board = 8x8
#board across the chess board = 0.5 away from the edge
#circle radius = 0.5 (half of edge of sqaure)
import random as ra
area_of_circle = (22/7)0.50.5
Area_of_possible_area = (99)-(11)+((22/7)0.50.5)
count = 0
n_trails = 100000
for i in range(n_trails):
x = ra.uniform(0,Area_of_possible_area)
if x >= 0 and x<= (49*area_of_circle):
count+=1
else:
pass
probability = count/n_trails
print(probability)
!code
the purpose of a monte carlo simulation is to complete a set of actions step by step many times (e.g. millions) and then use the outcome of each set of actions to determine the probability of something happening. In Liam's case, he has 16 squares, let's say 8 white, 8 black. One by one, populate a 4x4 grid with either a black or a white square and once the board is complete, compare it against a valid checkerboard to see if your combination is valid. Repeat many times and count how many valid vs invalid boards there are and their ratio is the probability you're after
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
๐ monte carlo simulation