Two points are chosen randomly inside a square with side length 1. What is the average distance between the two points?
Round your answer to 3 decimal places.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
@Steven Chase
OMG this was the same question which I also posted 1 month ago sir.
I didn't know that this question is already posted by someone 4 years ago.
Since the problem is in computer science category, let me provide the "computer solution". Below is the simple Python snippet which gives the required value. It is helpful to run this several times just to make sure that the answer doesn't change up to the third decimal. I got 0 . 5 2 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
We can place the square in the coordinate plane. From there we can use the distance formula and set the x and y values to random values. Then we set up a loop to compute the distance a certain number of times, and store those values to a list, in which we take the mean of. Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
This returns approximately 0 . 5 2 1 . You can run the code here .
Could you add details so that people can look at your solution and understand how to approach it? Thanks!
Well, this isn't my solution; the way I solved it was with a computer program. I didn't understand all of the solution in the video...
So I can't provide a more detailed solution than the video... sorry about that.
Log in to reply
Can you add your CS approach to the solution? Thanks!
Problem Loading...
Note Loading...
Set Loading...
Here's my Python code. It runs 10 times to check for consistent results. Average distance is 0.521.