Distance between two uncertain points using haversine?

In summary, the conversation discussed finding the distance and uncertainty between two points on the surface of the earth represented in spherical coordinates. The distance was calculated using the haversine formula and the uncertainty of the points was given. The conversation explored different methods for finding the uncertainty of the distance, including using the Taylor series for trigonometric functions and using the formula for approximating the variance of a function. It was determined that there is no closed form solution and the solution would require taking partial derivatives and substituting the given values. The conversation ended with a suggestion for the listener to try the solution on their own.
  • #1
Frank Einstein
170
1
TL;DR Summary
I have two points which represent geographical positions whose coordinates are given in spherical coordinates and also have an associated uncertainty. I can calculate the distance between said points in cartesian coordinates, but I don't know how to translate the uncertainty.
Hello everyone.

I have two points in space (on the surface of the earth) represented using spherical coordinates (in this case there is no z axis since both are assumed to be at the same height). These points have an associated standard deviation in lambda and in phi, which are longitude and latitude respectively. I can calculate the distance between the mean position of both points using the haversine asζ=sin^2[(φ1-φ2)/2]+cos(φ1)cos(φ2)sin^2[(λ1-λ2)/2] and thend=2*R*atan2(√ζ, √1-ζ) where R is the Earth radius and d is the distance in meters between the points defined by (λi,φi) where i=1,2.

However, I have no idea on how to find out the uncertainty of d. I have a standard deviation for the values of (λi,φi), I was wondering if someone can tell me how to incorporate this data to the haversine to be able to calculate the standard deviation of the distance d.

Can someone please tell me of a way to do this?

Any help is appreciated.
Regards.
Frank.
 
Physics news on Phys.org
  • #2
What do you mean by uncertainty? If e.g. you have a circle of uncertainty around each point, then uncertainty of distance is plus, minus twice the radius of said circle.
 
  • #3
fresh_42 said:
What do you mean by uncertainty? If e.g. you have a circle of uncertainty around each point, then uncertainty of distance is plus, minus twice the radius of said circle.
Thanks for the answer. I want to calculate the standard deviation of the variable d knowing the standard deviations of φ1, φ2, λ1 and λ2
 
  • #4
So you have the random variable ##X=d(\varphi_1,\varphi_2,\lambda_1,\lambda_2 )## where the variables themselves are random variables, and the function is composed of many trigonometric functions. I don't think there is a reasonable closed form for this problem. So you can try to use the Taylor series for the trigonometric functions, which still will leave you with a complicated integral, or you abbreviate this step by the formula given in
https://en.wikipedia.org/wiki/Variance#Approximating_the_variance_of_a_function
or you use one of the formulas in here:
https://en.wikipedia.org/wiki/Distance_correlation

I think it is already difficult to calculate the mean value for the normal distribution function, which I assume is relevant here.
 
  • Like
Likes DaveE and Frank Einstein
  • #5
fresh_42 said:
I think it is already difficult to calculate the mean value for the normal distribution function, which I assume is relevant here.

I don't see the difficulty here . This is standard propagation of error for nonlinear system. You just use the partial derivative.

https://en.wikipedia.org/wiki/Propagation_of_uncertainty

Am I missing something?
 
  • Like
Likes DaveE and fresh_42
  • #6
fresh_42 said:
So you have the random variable ##X=d(\varphi_1,\varphi_2,\lambda_1,\lambda_2 )## where the variables themselves are random variables, and the function is composed of many trigonometric functions. I don't think there is a reasonable closed form for this problem. So you can try to use the Taylor series for the trigonometric functions, which still will leave you with a complicated integral, or you abbreviate this step by the formula given in
https://en.wikipedia.org/wiki/Variance#Approximating_the_variance_of_a_function
or you use one of the formulas in here:
https://en.wikipedia.org/wiki/Distance_correlation

I think it is already difficult to calculate the mean value for the normal distribution function, which I assume is relevant here.
Thanks again for the answer. That's what I feared, no closed loop form. I don't know if this is relevant, but I am working in Matlab, where I have calculated the aforementioned quantities as

Distance calculation:
haversine_angle=(sin((phiMeanA-phiMeanB)/2)).^2+cos(lammdaMeanA).*cos(lammdaMeanB).*(sin((lammdaMeanA-lammdaMeanB)/2)).^2;
haversine_sqrt=(haversine_angle).^0.5;
haversine_sqrt2=1.-haversine_sqrt;haversine_mean_distance =RT.*atan2(haversine_sqrt, haversine_sqrt2);
and the standard deviations are in different variables. The values of the standard deviations are

phiStdA=6.608673643811970e-08

phiStdB=7.548195779015499e-08

lambdaStdA= 7.757704741906700e-09

lambdaStdB=9.494186140546169e-09

and the values of the position of the mean of both points is

phiMeanA=0.879103498447014

phiMeanB=0.856643114991405

lammdaMeanA=0.007900824598177

lammdaMeanB=0.007461768949733

haversine_mean_distance=7.244901394376239e+04

RT=6378000
 
  • #7
hutchphd said:
I don't see the difficulty here . This is standard propagation of error for nonlinear system. You just use the partial derivative.

https://en.wikipedia.org/wiki/Propagation_of_uncertainty

Am I missing something?
Probably I am the one missing something here. I don't know how to implement what you are providing since I only have numerical values as you can see in my previous message
 
  • #9
hutchphd said:
Yes, but there is nothing in said page which explains how to find the standard deviation ong the distance d having the uncertainty of both points expressed in spherical coordiantes.
 
  • #10
Did you read the other page about errors propagation?
1612036873018.png
 
  • Like
Likes Frank Einstein
  • #11
hutchphd said:
Did you read the other page about errors propagation?View attachment 277152
So, if I understand you correctly, I have to manually derivate atan2(√ζ, √1-ζ) respect to φ and then respect to λ and then substitute the values in the point as
phiStdA=6.608673643811970e-08

phiStdB=7.548195779015499e-08

lambdaStdA= 7.757704741906700e-09

lambdaStdB=9.494186140546169e-09

and the values of the position of the mean of both points is

phiMeanA=0.879103498447014

phiMeanB=0.856643114991405

lammdaMeanA=0.007900824598177

lammdaMeanB=0.007461768949733

Is this it? I thought that I could not calculate that with at least two points to have a value of the derivative. I don't know what I was thinking.

Thanks.
Regards.
Frank.

Please, confirm me that I have the right idea.
 
  • #12
Yes you have to take the relevant derivatives and put in the numbers. I will leave the details to you for now. Give it a try.
 
  • Like
Likes Frank Einstein
  • #13
hutchphd said:
Yes you have to take the relevant derivatives and put in the numbers. I will leave the details to you for now. Give it a try.
Thanks.
 

1. What is the haversine formula used for?

The haversine formula is used to calculate the distance between two points on a sphere, such as the Earth, given their latitude and longitude coordinates.

2. How accurate is the haversine formula?

The haversine formula is considered to be accurate within 0.5% of the true distance between two points, making it a reliable method for calculating distances.

3. Can the haversine formula be used for any two points on Earth?

Yes, the haversine formula can be used for any two points on Earth as long as their latitude and longitude coordinates are known.

4. What are the units of measurement used in the haversine formula?

The units of measurement used in the haversine formula are typically in kilometers, but can also be used in miles or nautical miles depending on the desired output.

5. Are there any limitations to using the haversine formula?

The haversine formula assumes a perfect spherical shape for the Earth, which may not be entirely accurate. It also does not take into account factors such as altitude or terrain, which can affect the actual distance between two points.

Similar threads

Replies
18
Views
3K
Replies
3
Views
604
Replies
1
Views
1K
Replies
8
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
20
Views
2K
  • Calculus and Beyond Homework Help
Replies
9
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • Introductory Physics Homework Help
Replies
2
Views
609
Back
Top