Nerds of YBW

Nerdy question incoming...

Haversine formula or Vincenty algorithm?
Neither .... Karney’s algorithm ... until recently, I thought Pythons were snakes, but I got an AI to write the Python code from Greenwich to JFK ... obviously, substituting current position for lat1, lon1 and a waypoint for lat2, lon2 would enable it to work for current position to a waypoint. Karney's is very accurate, even over short distances, and uses the WGS-84 ellipsoid model of the earth.

from geographiclib.geodesic import Geodesic

# Coordinates (degrees)
lat1, lon1 = 51.4778, -0.0014 # Greenwich
lat2, lon2 = 40.6413, -73.7781 # JFK

result = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2)

distance_m = result["s12"] # meters
initial_bearing = result["azi1"] # degrees
final_bearing = result["azi2"] # degrees

print("Distance (m):", distance_m)
print("Initial Bearing (°):", initial_bearing)
print("Final Bearing (°):", final_bearing)
 
Last edited:
All a bit technical for me, though I did once develop a formula for working out how much of a bottle of wine you had to drink so that it achieved its maximum stability. This was important at the time when we had our evening meal on our mooring. I can change the joker valve on a Jabsco head. Does that count?
 
Never heard of them - I did it the hard way, from first principles, but I was playing, so the time didn't matter. Since I retired, I don't think I've used VBA more than a couple of times, and the last one, I really struggled with, even though it should have been simple.
I too always do it from first principles, using the cosine and sine rules. Haversines etc. are only a means of simplifying the arithmetic, and are of no real value in a computer program.

The real difficulty is in trapping "edge cases" where you end up losing significance by taking the difference between two large but similar numbers. Professional software has to take care of that but because I knew my problems weren't likely to encounter that problem I never bothered.
 
Took standard house telephone cables / plugs and sockets to create a Navigation network .. the NMEA and power via the multi core cable .. on my 25ft Motor Sailer ... then later removed it all .. once over-counter gear became available.

I had Garmin 50 _ Jornado PC ... Acer PC .... VHF ... all linked ... (note this was years ago when people were still arguing about Decca vs GPS) ..
 
The real difficulty is in trapping "edge cases" where you end up losing significance by taking the difference between two large but similar numbers. Professional software has to take care of that but because I knew my problems weren't likely to encounter that problem I never bothered.
I wasn't looking for accuracy better than 1%, so I didn't worry about rounding errors. Also, since I hadn't used anything more complicated than Pythagoras since I left Uni, calculating for an oblate spheroid was way above my capabilities, so I assumed the earth was a sphere. Thinking about it, the only maths I did at uni was to bring me up to roughly A level standard, so it would most likely have been way above my skill level back then, too.
 
I wasn't looking for accuracy better than 1%, so I didn't worry about rounding errors. Also, since I hadn't used anything more complicated than Pythagoras since I left Uni, calculating for an oblate spheroid was way above my capabilities, so I assumed the earth was a sphere. Thinking about it, the only maths I did at uni was to bring me up to roughly A level standard, so it would most likely have been way above my skill level back then, too.
There are situations where you can get complete loss of significance; its not rounding errors but what happens when you subtract 0.99999998 from 0.99999999. Although both input numbers have 8 significant figures, the result only has 1. The loss of significance cascades through subsequent calculations.
 
lots of ESP32s on board, all feeding into signalK. An M5stack tough is my NMEA repeater. I have ESPs with ultrasonic transducers checking levels in both tanks. And with a hall sensor as a chain counter. Oh and doing GPS receiving duties when the plotter is off. I also have a pi with a TV stick sniffing weather station comms and feeding that into nodered to format it in a way signalk can make use of.
Using tailscale means everything is accessible from my phone, securely.
this sounds really cool. what kinda tranducers are you using? is your TV stick RTL-SDR? i was looking at that for grabbing AIS data.

i've just picked up a BNO085 from aliexpress to replace a BMX60 for inertial measurement - should be interesting to see eular angles instead of raw sensor data.
for GPS i've used both the GEP-M10-DQ (£22) & NEO6MV2 GPS (£2.40) modules into esp32 with external LCD (LVGL) for display.

also picked up a Waveshare ESP32-S3 4.3inch Display Development Board from aliexpress (£30). a little hacking in ESP-IDF and it will have native NMEA 2000/0183, I2C and all the other usual ESP32-S3 goodies, but requires 3d printing a case and a bunch of cable management. also has an indepedant connection for a 3.7v lipo battery for backup.

the m5stack tough looks awesome, definitely going to use this next. also tailscale solves a problem i haven't got to yet, so thanks for that!
 
Wrote a QBasic program for a Psion Organiser Mk1 that gave me bearing and distance between any two waypoints. It could store hundreds of waypoints.
Sometime in the late '80s or early '90s (?) PBO published an article containing an astronav program for a scientific calculator. I adapted the program for a Psion Organiser MkII and, once you input date, time, assumed position and sextant altitude, it spat out your intercept. Clunky
Took the same program and adapted it for Excel running under Windows'98. I could now produce ephemeris for an entire year and print it out.
Using Excel under WinXP started producing my Sun Almanac and Sight Reduction Tables. Used them while I was expat in Tunisia, both sailing and in the desert.
Nobody seemed to offer free almanacs or sight reduction tables to download, so I started uploading my Sun Almanac and Sight Reduction tables to my website backbearing.com.
Now migrated to a PC running Linux Mint and Libre Office. Although my spreadsheets under LibreCalc 'worked' some changes were required.
There are now several websites where you can download almanacs giving ephemeris for stars, planets, the Moon and the Sun. My simple Sun Almanac still gets several hundred downloads a year, though I doubt very much if many of them are used in anger.
FYI. The Sun Almanac and Sight Reduction Table spreadsheets are ~25Mb and 15Mb respectively.
I also host Andrew Evan's Sextant User's Guide in my opinion still the best introduction to using a sextant, almanac and sight reduction tables.
Currently working on an astronav method using Mike Pepperday's S Tables 'A Complete Sight Reduction method for all bodies IN NINE PAGES' (true, but only in a very small font)
So there you have it. Three decades of tinkering with astro on computers.
Does that make me a nerd.

Note to self: Time to upload the Sun Almanac for 2026
 
I am so jealous of the applications of maths. I was top of the physics class at school but near bottom at maths. I can see physically but my head goes numb when numbers are involved.

There must be a word for that?
 
I am so jealous of the applications of maths. I was top of the physics class at school but near bottom at maths. I can see physically but my head goes numb when numbers are involved.

There must be a word for that?

I was like that at college. Mechanical science fairly easy, maths no hope !

I aced physics, bottomed in maths. Why? Because the teachers never gave us any practical examples for trig, algebra, quadratic equations, etc. etc. It was all abstract aphabetical nonsense.
 
Physics student friends said to me, do the logic and philosophy of science course. Easy! they said. Ha. Only exam I had to repeat.

It was a science/social science course. The scientists averaged 100% on the logic part. The arts and social scientists got about 5%.

I think it is the brain, although I agree teachers made it hard to understand purpose or reason.

Edit: just remembered logic was an important part of my PhD. Not doing it - just undermining the idea around then that logic could provide a sound foundation for reasoning (AI) and "knowledge representation". Prolog was seen as the bees knees.
 
Last edited:
I am so jealous of the applications of maths. I was top of the physics class at school but near bottom at maths. I can see physically but my head goes numb when numbers are involved.
I used to teach engineering maths at university. I tried to use a visual approach wherever possible using computer graphics. Spectrum analysis is a good example of its use. The students often saw the light for the first time using this approach where they had been blinded by algebra of the traditional approach and books.
 
this sounds really cool. what kinda tranducers are you using? is your TV stick RTL-SDR? i was looking at that for grabbing AIS data.

i've just picked up a BNO085 from aliexpress to replace a BMX60 for inertial measurement - should be interesting to see eular angles instead of raw sensor data.
for GPS i've used both the GEP-M10-DQ (£22) & NEO6MV2 GPS (£2.40) modules into esp32 with external LCD (LVGL) for display.

also picked up a Waveshare ESP32-S3 4.3inch Display Development Board from aliexpress (£30). a little hacking in ESP-IDF and it will have native NMEA 2000/0183, I2C and all the other usual ESP32-S3 goodies, but requires 3d printing a case and a bunch of cable management. also has an indepedant connection for a 3.7v lipo battery for backup.

the m5stack tough looks awesome, definitely going to use this next. also tailscale solves a problem i haven't got to yet, so thanks for that!
The ultrasonics are DS1603L probes. There is a helpful GitHub repo where someone has already put together all the sensesp code for this exact use case, wish I had found it earlier! - GitHub - SV-Krishna/Ultrasonic-Liquid-Level-Sensor-SenseEsp: An ESP32 from AZ Delivery using SenseESP, SignalK and an Ultrasonic level sensor DS1603L

The TV stick is just a cheap one from amazon. I do have an RTL-SDR v4 which I use to pick up weather fax etc, but it seemed a waste to use such a capable bit of kit just to pick up 868mhz!
 
Back in the early 1970s a friend of the skipper asked us to assess his digital compass.It was installed in the wheelhouse but had quite small numbers so difficult to use as a steering device but what it was good for was being in the galley making tea and toast it could be seen through the serving hatch so a eye could be kept on the course……I belive digital compasses have gone onto greaterthings
 
Wrote a QBasic program for a Psion Organiser Mk1 that gave me bearing and distance between any two waypoints. It could store hundreds of waypoints.
Sometime in the late '80s or early '90s (?) PBO published an article containing an astronav program for a scientific calculator. I adapted the program for a Psion Organiser MkII and, once you input date, time, assumed position and sextant altitude, it spat out your intercept. Clunky
Took the same program and adapted it for Excel running under Windows'98. I could now produce ephemeris for an entire year and print it out.
Using Excel under WinXP started producing my Sun Almanac and Sight Reduction Tables. Used them while I was expat in Tunisia, both sailing and in the desert.
Nobody seemed to offer free almanacs or sight reduction tables to download, so I started uploading my Sun Almanac and Sight Reduction tables to my website backbearing.com.
Now migrated to a PC running Linux Mint and Libre Office. Although my spreadsheets under LibreCalc 'worked' some changes were required.
There are now several websites where you can download almanacs giving ephemeris for stars, planets, the Moon and the Sun. My simple Sun Almanac still gets several hundred downloads a year, though I doubt very much if many of them are used in anger.
FYI. The Sun Almanac and Sight Reduction Table spreadsheets are ~25Mb and 15Mb respectively.
I also host Andrew Evan's Sextant User's Guide in my opinion still the best introduction to using a sextant, almanac and sight reduction tables.
Currently working on an astronav method using Mike Pepperday's S Tables 'A Complete Sight Reduction method for all bodies IN NINE PAGES' (true, but only in a very small font)
So there you have it. Three decades of tinkering with astro on computers.
Does that make me a nerd.

Note to self: Time to upload the Sun Almanac for 2026

Years ago .. I transposed the mathematics of a Texas Ti59 Nav Module calculator to Quick Basic ... then I swapped to a Casio Fx850 and had that do the job ...

The Texas Ti59 still works ... but battery pack is shot .. so needs to be powered by external ... makes it too awkward then.
 
All a bit technical for me, though I did once develop a formula for working out how much of a bottle of wine you had to drink so that it achieved its maximum stability. This was important at the time when we had our evening meal on our mooring. I can change the joker valve on a Jabsco head. Does that count?
And you could change the valve before or after the wine test?
 
Top