![Welcome to the NavList Message Boards.](../sx1.jpg)
NavList:
A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
From: Frank Reed
Date: 2023 Apr 10, 08:35 -0700
Bill Lionheart, you wrote:
"It is many years since I wrote any javascript and I understand it has improved a lot."
It's not so much javascript that has improved. Coders came to love this exotic language, kicking and screaming. Javascript is a world-class language. If you could learn just one coding language, javascript would be an excellent choice, combining modern oop style, immense practicality, and a very reasonable learning curve. One can do just about anything using javascript. It's interesting to note that the language itself was shockingly powerful right from the very beginning. The completely inappropriate name, javascript, will always cause confusion (the language has no relation to java, and it's certainly not a "scripting" subset of some more complete language). Its reputation as a language just for "script kiddies" is now history, even "ancient history" by the very short time horizons of internet technologies. In addition, the idea that it is "uncompiled" --an "interpreted" language, like some cheap cousin of line-numbered "basic"-- is only rarely seen as important anymore given the rise of highly efficient JIT compilers like the Google-sponsored V8 compiler.
And:
"Not wanting to reinvent the wheel I looked for javascript ephemerides (is that the plural?).
That is the plural, and if you want to pretend you're a Renaissance scholar (this is actually important in some small circles of geekdom/greekdom), you should pronounce that plural as if "ef-ah-MARE-ah-deez". But I won't kick anyone who says "e-FEM-er-ides". :)
And you wrote:
"Since Steve Moshier's original there have been many forks of his code."
Moshier's code and descendant forks may be more than you need. I understand you don't want to re-invent the wheel, but on the other hand, learning something about positional astronomy is part of the fun when you're building something like this. Here's a lesser known "tutorial" by Paul Schlyter which I still find useful now and then: Computing planetary positions. You should also look at Henning Umland's old online calculator here, and if you learn how to view source on his web page, maybe you're done in minutes?
If you really want to be "one of us", you should acquire a copy of a very old book by Jean Meeus (for a moment I thought I would have to look up the title online, but wait... here it is! within arm's reach ...that's a good measure of value; how often is a book itself "closer" than a peek at Google?!): Astronomical Formulae for Calculators. It's a little paperback from the 1980s, the most dog-eared book that I own, and I notice on the cover it says there's a foreword by Roger Sinnott. :)
You should strongly consider a decidedly more modern approach. You now have access to what is probably the best coding tutor of all time. It is not human, though it is backed up by occasional human guidance. Yes, chatGPT. It's really good at this! Although its performance on arithmetic is laughable and although it can be talked into discussions about how it would manipulate human genetics for the betterment of mankind at the drop of a hat (Khaaan!), it genuinely excels at writing specialized software code on-demand. To demonstrate, I asked it just now to produce some javascript code for this project. It instantly obliged though I didn't wait to see the final result or test it out. I've attached a screen capture of its initial work.
Of your watch, you wrote:
"The device only has 256kB RAM, 1MB on-chip flash"
You could build a celestial navigation engine for a starship in 256kB! That's plenty. :)
You wrote:
"By the way Frank told me his app uses tables and interpolation, and I am a happy antispoof user, but I wanted to see if this device could do the calculation... thinking it should as one can do it on a programable calculator!"
At some point, we're always doing interpolation. When you get right down to it, the vast number of computation cycles expended re-calculating the position of the Sun in the next century (and retroactively back a few centuries) is just wasted energy. The Sun's not going anywhere, setting aside the minor issue of delta-T and related "earth orientation parameters". Apart from testing some variant of the latest JPL numerical integration, there is no reason to re-calculate the position of the Sun or Moon, planets, stars (not JPL integrations but similar argument). Just tabulate and go. But where's the fun in that? That's why I suggest the links above by Paul Schlyter and Henning Umland and the book(s) by Jean Meeus.
Frank Reed
Clockwork Mapping / ReedNavigation.com
Conanicut Island USA