In [2]:
import math

In [3]:
R=6371

In [4]:
anu_location=[-35.2802179,149.1114782]

In [5]:
home_location=[-35.1598966, 149.1033091]

In [10]:
def cal_distance(loc1,loc2):
    lat1=loc1[0]*math.pi/180
    lat2=loc2[0]*math.pi/180
    log1=loc1[1]*math.pi/180
    log2=loc2[1]*math.pi/180
    #sin(MLatA)*sin(MLatB)*cos(MLonA-MLonB) + cos(MLatA)*cos(MLatB)
    C=math.sin(lat1)*math.sin(lat2)*math.cos(log1-log2)+math.cos(lat1)*math.cos(lat2)
    d=6371*math.acos(C)
    return d

In [11]:
d=cal_distance(anu_location,home_location)
d


Out[11]:
13.38937041780438

In [8]:
help(math.asin)


Help on built-in function asin in module math:

asin(...)
    asin(x)
    
    Return the arc sine (measured in radians) of x.


In [9]:
math.sin(3.1415/6)


Out[9]:
0.49998662654663256

In [ ]: