how to get the distance between to points on earth in Swift?

What is the average distance between two points of the Earth?

  • The Earth is a ball, not a sphere

  • Answer:

    The answer is 36/35 of radius, and I will further assume that radius is equal to one. Average value of spherically symmetric function v(r) inside sphere is given by <v> = 3∫v(r) r² dr Lets denote by R(r) average distance from point r to random point ρ inside the sphere. Average distance between two points inside sphere is <R(r)> = 3∫R(r) r² dr. Before calculating R(r), lets find average distance from the center R(0) = 3∫r r² dr = 3/4, and average inverse distance from the center Rinv(0) = 3∫1/r r² dr = 3/2. ******* ******** ********* R(r) can be found as average by volume R(r) = 3/4π ∫|r-ρ| (dρ)³ taken inside sphere ρ<1. Direct calculation of such integral is troublesome, so instead of integration, lets differentiate. Namely lets apply Laplace operator Δ to both sides of the equation ΔR(r) = 3/4π ∫Δ|r-ρ| (dρ)³ Spherically symmetric Laplace operator is given by Δ = 1/r² ∂/∂r [ r² ∂/∂r[ ]] and expression for R(r) becomes ΔR(r) = 3/4π ∫2/|r-ρ| (dρ)³ The intregral on the RHS is gravitaion potential of spherically symmetric and uniform planet, but what the heck, lets apply Laplace operator one more time: ΔΔR(r) = 3/4π ∫2 Δ1/|r-ρ| (dρ)³ ΔΔR(r) = 3/4π ∫2 [-4π δ(r-ρ)] (dρ)³ And finally we see that >>>>> ΔΔR(r) = -6 <<<<< ******************** Now we can integrate back: 1/r² ∂/∂r [ r² ∂/∂r[ ΔR(r) ]] = -6 ΔR(r) = 2Rinv(0) - r² = 3-r² 1/r² ∂/∂r [ r² ∂/∂r[ R(r) ]] = 3-r² R(r) = r^2/2 - r^4/20 + R(0) = 3/4 + r^2/2 - r^4/20 FInally average distance: <R(r)> = 3∫[3/4 + r^2/2 - r^4/20]r² dr <R(r)> = 3(1/4 + 1/10 - 1/140) <R(r)> = 36/35

Zo Maar at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

5/9 of the radius of the Earth. This is assuming that points are chosen randomly according to the following algorithm: We take a cube which precisely encloses the Earth and choose points uniformly from within that cube. If the point chosen is outside the Earth, it is rejected and this process is repeated until a point inside or on the Earth is chosen. This is the first point. This procedure is repeated in the same way to select the second point.

ksoileau

~ 10,000 km. Take any point on the earth. Draw a line to a point over the earth's surface exactly opposite your starting point. Now look at the midpoint of your line. For every point on one side of the midpoint, there is a second point on the other side. exactly the same distance away. Therefore, a random point on that line, would, on average, be at the mid point. Now spin that line around the globe using your two points as an axis. For every line you draw between your two points, the mid-point will represent the average. This is 1/4 of the way around the earth. The distance of 1/4 of the way around the earth is pi r /2 or ~10,000 km. ......................................… You change the problem! I was thinking of one of those inflatable beach balls -- just worried about the surface. Well, for those that follow, the answer according to my quickie spreadsheet is _________. * Edit: I made a mistake on my spreadsheet. I am coming out now with ~ 1.024 r ........................... Just to confirm the results of others, 1.024 ≈ 36/35 = 1.0286. And, given the limited number of points I ran, well within the expected deviation.

Frst Grade Rocks! Ω

6R/5 is incorrect. This is the average distance between a point on the surface of a sphere with radius R and an interior point, found from: ∫∫∫ r³sin(θ) dv / ∫∫∫ r²sin(θ) dv = 6R/5 But we can use this to find the required average. I don't remember what it is called but there is a theorem that relates the average distance between a point on the surface of a figure and an interior point to the average distance between points inside a figure. If D is the latter average distance and C the former, V is the volume of the figure and A the area, then: D = (2 * C * V * A dR) / V² So here we have: D = (2 * (4πR³/3) * (4πR²) * 6R/5 dR) / (4πR³/3)² now integrating we get: D = (∫ (64/5) * π² * R^6 dR) / (4πR³/3)² D = ((64/35) * π² * R^7) / (4πR³/3)² = 36R/35 What is that relation called??? I have it in my notes from "Advanced Calculus," class, but I didn't write down the theorem. The book is packed up in the garage. Given a radius of 6367.4 km, the average distance is 6549.4 km. The following short Matlab code returns the same result when a million points are used. --------------------------------------… ----------------------------------------… function [meandist] = distance_sphere(n) % Find the mean distance between points % in a unit sphere. n is the number of points to check. A = ones(2,3); % Store coords here. tf = normer(A); dst = 0; for ii = 1:n while tf A = -1 + (2).*rand(2,3); tf = normer(A); end dst = dst + sqrt(sum(diff(A).^2)); A = -1 + (2).*rand(2,3); tf = normer(A); end meandist = dst/n; function [tf] = normer(A) % Checks if points are in unit sphere. nrms = sqrt(sum(A.^2,2)); tf = ~all(nrms <=1); --------------------------------------… ----------------------------------------… We also can do a brute force solution using Maple, which I did and posted here: http://i217.photobucket.com/albums/cc229/spamanon/sphere_distance.jpg

A ball is the same thing as a sphere.

Jestr Rulz

Two points on the surface, or anywhere within the solid?

Renny B

=1.178*R

(Φ)kaksi_guy

jeez i dont know what u mean but u can look it up here http://geography.about.com/od/learnabouttheearth/a/earthfacts.htm

mathuritaly

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.