Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator by Craig John Clark

Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator by Craig John Clark

Author:Craig, John Clark [Craig, John Clark]
Language: eng
Format: epub, pdf
Publisher: Books To Believe In
Published: 2021-08-22T00:00:00+00:00


from math import *

def nav(pt1,pt2):

la1=radians(pt1[0])

lo1=radians(pt1[1])

la2=radians(pt2[0])

lo2=radians(pt2[1])

r=6371

t1=sin(la1)*sin(la2)

t2=cos(la1)*cos(la2)*cos(lo2-lo1)

km=acos(t1+t2)*r

t1=cos(la1)*sin(la2)

t2=sin(la1)*cos(la2)*cos(lo2-lo1)

x=t1-t2

y=sin(lo2-lo1)*cos(la2)

b=degrees(atan2(y,x))

return [b,km]

# Dulce, NM

pt1=(36.9336,-106.9989)

# Taos, NM

pt2=(36.4072,-105.5731)

# Distance and bearing

b,km=nav(pt1,pt2)

print("pt1: ",pt1)

print("pt2: ",pt2)

print("km: ",km)

print("miles: ",km*.621371)

print("bearing: ",b)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.