Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write mathematic formula in python

Tags:

python

math

I try to write these formulas in python but with no luck

enter image description here


I have no errors in code but I know that calculation gives incorrect result so I guess I have
something wrong in implementation of formulas.


    import math
   lat = 54.5917455423
   lon = 17.2078876198

B = math.radians(lat)
L = math.radians(lon)
h = 55.889
pi = math.pi
a = 6378137
b = 6356752.3141
f = 1/298.257222101
ba = 1 - f# should be b/a = 1 - f

e = 0.006694380036
Da = 108
Df = - 4.80812 * 10 **-7
m = 0.000004848#one second in radians

dX = -23.74
dY = +123.83
dZ = +81.81
sin = math.sin
cos = math.cos
Rn = a/ math.sqrt(1-e**2 * math.sin(B)**2)
Rm = a*(1-e**2)/(1-e**2 * sin(B)**2)**(3/2)
vc = (Rm+h)*sin(m)

dB = (-dX*sin(B)*cos(L) - dY*sin(L) + dZ*cos(B) + Da*(Rn * e**2*sin(B)*cos(B)/a+Df)*(Rm*(a/b)+Rn*ba)*sin(B)*cos(B))*vc**-1
dL = (-dX * sin(L) + dY * cos(L) ) * ((Rn + h) * cos(B) * sin(m))**-1

a = dB * 180/pi + B
b = dL *180/pi + L

print a
print b

like image 390
daikini Avatar asked Mar 11 '26 17:03

daikini


1 Answers

This isn't Python:

b/a = 1 - f
like image 155
Ned Batchelder Avatar answered Mar 14 '26 07:03

Ned Batchelder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!