Showing posts with label Earth’s radius. Show all posts
Showing posts with label Earth’s radius. Show all posts

Saturday, September 5, 2026

Python – Earth’s Radius and Gravity in US Units

Python – Earth’s Radius and Gravity in US Units



Introduction



The following script, gravus2.py, estimates the Earth’s gravity in ft/sec^2 given:



1. The observer’s latitude on Earth (North or South; you don’t have to enter negative numbers for South)

2. The elevation where the observer is in feet.



The Python script is made with a TI-84 Evo, but it should work with all platforms with Python.



Equation Used: With Everything Converted to U.S. Units:



Calculating g_0 at sea level with latitude φ:

g_0 = 32.17192 – 0.08530 * cos(2 * φ°) = 32.17192 – 0.08530 * cos(2 * φ * π ÷ 180)



Calculating g_h with height h:

g_h = g_0 * (erad ÷ (erad + h ÷ 5280))^2



Where (Earth’s radius at latitude φ):

erad = √((a^4 + b^4 * tan(φ)^2) ÷ (a^2+ b^2 * tan(φ)^2)) 



a = 3963.1905919

b = 3949.90276423189



Code: gravus2.py


'''

Earth's Gravity in US Units

EWS 05/26/2026

'''


from math import *


# title screen

print("Earth's Gravity")

print("Given Latitude and Elevation")

print("U.S./Imperial Units")

print("-----------------")


# angles must be converted to radians


print("Latitude in DMS:")

l1=eval(input("Whole Degrees? "))

l2=eval(input("Whole Minutes? "))

l3=eval(input("Seconds? "))

langle=l1+l2/60+l3/3600

# convert to radians

langle*=pi/180

# elevation

elev=eval(input("Elevation in feet? "))

# calculate radius 

a=3963.1905919

b=3949.90276423189

erad=(a**4+b**4*(tan(langle))**2)

erad/=(a**2+b**2*(tan(langle))**2)

erad=sqrt(erad)

# calculation

g=32.17192-0.08530*cos(2*langle)

g*=(erad/(erad+elev/5280))**2

print("Earth's radius: {0:.5f} mi".format(erad))

print("Estimated Gravity: {0:.5f} ft/s**2".format(g))



Examples (Results are rounded to five decimal places)



Latitude (φ)

Height (h ft)

Earth’s Radius (mi)

g_h (ft/s^2)

34°03’00”

500

3959.04875

32.13857

64°11’27”

1650

3952.43868

32.21979

10°57’00”

395

3962.71501

32.09156





Source



Grainger Engineering Office of Marketing and Communications. (answer written by Rebecca H.) (2016, November 21). “How gravitational force varies at different locations on Earth.” Illinois. https://van.physics.illinois.edu/ask/listing/64061. Retrieved March 10, 2026.

Planetcalc. “Earth Radius by Latitude (WGS 84)” Timur. 2021. https://planetcalc.com/7721/ Retrieved March 22, 2026.



Eddie


All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Saturday, July 25, 2026

Earth's Radius by Latitude

Earth's Radius by Latitude




Introduction: Calculating the Earth’s Radius



In quick, general calculations, we assume that the shape of the Earth approximates the shape of sphere, with the radius to generally be approximated as 6371 km. However, the shape of the Earth is closer to an oblate ellipsoid. The Earth is flattened at the poles and bulges the greatest at the Equator.



There are several calculations to estimate the Earth’s radius given the latitude (degrees North or South from the Equator), this blog is working with the WGS 84 formula (see Source):



R = √[ ((a² * cos(φ))² + (b² * sin(φ))²) ÷ ((a * cos(φ))² + (b * sin(φ))²) ]



Which is simplified from:



R = √[ (a^4 + b^4 * tan²(φ)) ÷ (a² + b² * tan²(φ))



where:

φ: latitude (in degrees)

a: semi-major axis: 6378.137 km

b: semi-minor axis: 6356.7523142 km

R: radius of kilometers



HP 15C Code: Earth’s Radius by Latitude

Step; Key; Key Code

001: LBL E; 42, 21, 15

002: DEG; 43, 7

003: →H; 43, 2

004: TAN; 25

005: x²; 43, 11

006: STO 1; 44, 1

007: 6; 6

008: 3; 3

009: 7; 7

010: 8; 8

011: . ; 48

012: 1; 1

013: 3; 3

014: 7; 7

015: STO 2; 44, 2

016: 4; 4

017: 14; y^x

018: 6; 6

019: 3; 3

020: 5; 5

021: 6; 6

022: . ; 48

023: 7; 7

024: 5; 5

025: 2; 2

026: 3; 3

027: 1; 1

028: 4; 4

029: 2; 2

030: STO 3; 44, 3

031: 4; 4

032: y^x; 14

033: RCL 1; 45, 1

034: ×; 20

035: +; 40

036: RCL 2; 45, 2

037: x²; 43, 11

038: RCL 3; 45, 3

039: x²; 43, 11

040: RCL 1; 45, 1

041: ×; 20

042: +; 40

043: ÷; 10

044: √; 11

045: RTN; 43, 32



TI-60 Code: Earth’s Radius by Latitude

Step; Key; Key Code



Set degrees mode before beginning.



00: DMS-DD; 39

01: TAN; 34

02: x²; 96

03: STO; 61

04: 1; 01

05: ( ; 53

06: 6; 06

07: 3; 03

08: 7; 07

09: 8; 08

10: . ; 93

11: 1; 01

12: 3; 03

13: 7; 07

14: STO; 61

15: 2; 02

16: y^x; 45

17: 4; 04

18: +; 85

19: 6; 06

20: 3; 03

21: 5; 05

22: 6; 06

23: . ; 93

24: 7; 07

25: 5; 05

26: 2; 02

27: 3; 03

28: 1; 01

29: 4; 04

30: 2; 02

31: STO; 61

32: 3; 03

33: y^x; 45

34: 4; 04

35: ×; 25

36: RCL; 71

37: 1; 01

38: ) ; 54

39: ÷; 55

40: ( ; 53

41: RCL; 71

42: 2; 02

43: x²; 96

44: +; 85

45: RCL; 71

46: 3; 03

47: x²; 96

48: ×; 65

49: RCL; 71

50: 1; 01

51: ) ; 54

52: = ; 95

53: √; 86

54: R/S; 13

55: RST; 22



Examples



Latitude: 80° 00’; Radius (km): 6357.402412

Latitude: 57° 24’; Radius (km): 6362.996788

Latitude: 43° 40’; Radius (km): 6367.986902

Latitude: 9° 15’; Radius (km): 6377.588959

Latitude: 2° 56’; Radius (km): 6378.081467


Source


Planetcalc. “Earth Radius by Latitude (WGS 84)” Timur. 2021. https://planetcalc.com/7721/ Retrieved March 22, 2026.



Eddie


All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Python – Earth’s Radius and Gravity in US Units

Python – Earth’s Radius and Gravity in US Units Introduction The following script, gravus2.py, estimates the Earth’s gravity i...