Post Reply 
Little explorations with HP calculators (no Prime)
03-27-2017, 08:36 PM (This post was last modified: 03-27-2017 09:00 PM by Han.)
Post: #47
RE: Little explorations with the HP calculators
(03-27-2017 08:14 PM)pier4r Wrote:  
(03-27-2017 08:01 PM)Han Wrote:  Some multivariate calculus and probability theory will get you:

\[ \frac{2+\sqrt{2}+5\ln(1+\sqrt{2})}{15} \approx 0.521405433164720678330982356607243974914031567779008341796 \]

This formula comes out from? I suppose a double integral (for x and y?)

Since the distance between two points \( x_1 , y_1 \) and \( x_2, y_2\) is
\[ d = \sqrt{ (x_2 - x_1)^2 + (y_2 - y_1)^2}, \]
I took the approach of looking at the probability density function for the distance between each of the coordinates: \( |x_2 - x_1| \) and \( |y_2 - y_1| \). Since they are independent and identically distributed, just consider the probability density of \( x=|x_2 - x_1| \). Once I got the probability distribution function (it's a triangular distribution with \( 0\le x \le 1 \) ), the integral I ended up with was indeed a double integral. EDIT: there were two of them; one for find the PDF and the other to compute the expected value. (I had to pull out my calculus textbook because the second one is quite a tedious computation to do by hand. I started with a double integral in x and y, but had to convert over to polar coordinates.)

Quote:On a side note: by chance could you tell me why my algorithm screws up so many digits? Did I make a mistake somewhere or is it again a problem of precision?

My suspicion is that it is due to precision. This is just a hunch, though. Here is my thought process. For 1000000 iterations, the sum must be close to 520000 so that the average comes out to be about .52. However, the small distances that are added into the running average (that appear the most frequently) would be very close to zero (but sufficiently many occurrences to add up to a significant value if there was enough precision). Each incremental sum, however, would likely be computed as adding 0 once the partial sum has reached a large enough magnitude.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Little explorations with the HP calculators - Han - 03-27-2017 08:36 PM



User(s) browsing this thread: 2 Guest(s)