Graduate Distance between two uncertain points using haversine?

  • Thread starter Thread starter Frank Einstein
  • Start date Start date
  • Tags Tags
    Points Variance
Click For Summary
SUMMARY

The discussion focuses on calculating the uncertainty in distance between two points on Earth using the Haversine formula, given their associated standard deviations in latitude (φ) and longitude (λ). The formula for distance is defined as d = 2 * R * atan2(√ζ, √1-ζ), where ζ is derived from the spherical coordinates. Participants suggest using the propagation of uncertainty method, specifically through partial derivatives, to compute the standard deviation of the distance d based on the standard deviations of φ1, φ2, λ1, and λ2. The conversation emphasizes the complexity of deriving a closed-form solution and the necessity of numerical methods or Taylor series approximations.

PREREQUISITES
  • Understanding of Haversine formula for distance calculation
  • Knowledge of spherical coordinates and their application in geospatial contexts
  • Familiarity with propagation of uncertainty and error analysis
  • Basic proficiency in MATLAB for numerical computations
NEXT STEPS
  • Study the propagation of uncertainty in nonlinear systems using partial derivatives
  • Learn how to implement the Haversine formula in MATLAB for geospatial calculations
  • Explore Taylor series expansions for approximating functions in error analysis
  • Investigate variance approximation methods for functions of random variables
USEFUL FOR

This discussion is beneficial for geospatial analysts, data scientists, and engineers working with location-based data who need to quantify uncertainty in distance measurements between geographical points.

Frank Einstein
Messages
166
Reaction score
1
TL;DR
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
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.
 
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
 
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
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
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

[CODE lang="matlab" title="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);
[/CODE]
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
 
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
 
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.
 

Similar threads

  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
8
Views
3K
Replies
8
Views
3K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
9
Views
4K
Replies
20
Views
4K