Dear colleagues,
Im converting a code from Python to STATA that is used for coordinates transformation between two datums. I'm stuck at the point when have to apply the iterative procedure. Cannot find the way to write the loop, so that it includes the initial value and then swap the pointers.
Has any of you got any experience with that and could share some wisdom with me?
Here is this bit of the code:
#Lat is obtained by an iterative proceedure:
lat = arctan2(z_2,(p*(1-e2_2))) #Initial value
latold = 2*pi
while abs(lat - latold)>10**-16:
lat, latold = latold, lat
nu_2 = a_2/sqrt(1-e2_2*sin(latold)**2)
lat = arctan2(z_2+e2_2*nu_2*sin(latold), p)
Would appreciate any suggestions greatly,
Many thanks in advance!
De
Im converting a code from Python to STATA that is used for coordinates transformation between two datums. I'm stuck at the point when have to apply the iterative procedure. Cannot find the way to write the loop, so that it includes the initial value and then swap the pointers.
Has any of you got any experience with that and could share some wisdom with me?
Here is this bit of the code:
#Lat is obtained by an iterative proceedure:
lat = arctan2(z_2,(p*(1-e2_2))) #Initial value
latold = 2*pi
while abs(lat - latold)>10**-16:
lat, latold = latold, lat
nu_2 = a_2/sqrt(1-e2_2*sin(latold)**2)
lat = arctan2(z_2+e2_2*nu_2*sin(latold), p)
Would appreciate any suggestions greatly,
Many thanks in advance!
De
Comment