this post was submitted on 02 May 2024
145 points (91.0% liked)

Humor

7457 readers
3 users here now

"Laugh-a-Palooza: Unleash Your Inner Chuckle!"

Rules


Read Full Rules Here!


Rule 1: Keep it light-hearted. This community is dedicated to humor and laughter, so let’s keep the tone light and positive.


Rule 2: Respectful Engagement. Keep it civil!


Rule 3: No spamming!


Rule 4: No explicit or NSFW content.


Rule 5: Stay on topic. Keep your posts relevant to humor-related topics.


Rule 6: Moderators Discretion. The moderators retain the right to remove any content, ban users/bots if deemed necessary.


Please report any violation of rules!


Warning: Strict compliance with all the rules is imperative. Failure to read and adhere to them will not be tolerated. Violations may result in immediate removal of your content and a permanent ban from the community.


We retain the discretion to modify the rules as we deem necessary.


founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 6 months ago (2 children)

10,152 Km between Atlanta and Tbilisi, and ChatGPT gave the pseudocode below as an explanation, which I didn't double check before making this comment!


# Coordinates for Atlanta, Georgia, USA
atlanta_coords = (33.7490, -84.3880)

# Coordinates for Tbilisi, Georgia (country)
tbilisi_coords = (41.7151, 44.8271)

# Calculate the straight line distance through the Earth
geopy.distance.great_circle(atlanta_coords, tbilisi_coords).km```
[–] [email protected] 4 points 6 months ago

That's wrong, it calculates the surface distance not the distance through the earth, while claiming otherwise. From the geopy.distance.great_circle documentation:

Use spherical geometry to calculate the surface distance between points.

This would be a correct calculation, using the formula for the chord length from here:

from math import *

# Coordinates for Atlanta, West Georgia
atlanta_coords = (33.7490, -84.3880)
# Coordinates for Tbilisi, Georgia
tbilisi_coords = (41.7151, 44.8271)

# Convert from degrees to radians
phi = (radians(atlanta_coords[0]), radians(tbilisi_coords[0]))
lambd = (radians(atlanta_coords[1]), radians(tbilisi_coords[1]))

# Spherical law of cosines
central_angle = acos(sin(phi[0]) * sin(phi[1]) + cos(phi[0]) * cos(phi[1]) * cos(lambd[1] - lambd[0]))
chord_length = 2 * sin(central_angle/2)

earth_radius = 6335.439 #km
print(f"Tunnel length: {chord_length * earth_radius:.3f}km")

A straight tunnel from Atlanta to Tbilisi would be 9060.898km long.

[–] [email protected] 3 points 6 months ago* (last edited 6 months ago)

Depends what the great circle function does. But chances are it gives you the arc length between the two points, which would give you the shortest distsnce between them on the surface of the earth.

If you wanted the distance through the earth you would need to work put the central angle of that arc, then use that to work out the remaining edge of the triangle formed between the two cities and the centre of the earth.