Commit Graph

16 Commits

Author SHA1 Message Date
Don Cross
efc59ae6fc Refactored demo tests.
I refactored the unit tests for all the demo programs
to follow a different pattern that makes it simpler
to add more demo tests in the future.

The main thing is that correct output and generated
output are now in separate directories `correct` and `test`.
I have moved the test scripts from `test/test` to `./demotest`
in all the langauge demo directories.

This makes it simpler to clean up any stale generated
files before each test run by `rm -f test/*.txt`.

I stumbled across this while making the Java demo tests,
and it was a better solution, so now all the other languages
are consistent with the Java demo tests.

In the C demo tests, I also decided to compile all the
binary executables into a subdirectory `bin` that can
be cleaned out before each run, to make sure there are
no stale executables from an earlier run.
2022-04-30 21:01:11 -04:00
Don Cross
0d24433db3 Fixed #187 - Seasons() failed for distant years.
For years before 1582 or years after 3668, the Seasons functions
were unable to find many equinoxes and/or solstices.
The problem was that over time, the Earth's axis precesses
enough that the calendar dates of these events drifts outside
the fixed search ranges I had provided for them.

I expanded the search ranges so all season changes can be found
for a much wider range of years, as verified by unit tests:

    C/C++:      -2000..9999
    C#:             1..9999
    JavaScript: -2000..9999
    Python:         1..9999
    Kotlin:         1..9999

Note: C#, Python, and Kotlin currently do not allow
years values below +1. In fact, I discovered we were not
noticing when an invalid year was passed into the Kotlin code.
I updated that code to throw an exception when the year does
not match what was expected. It is disturbing that the
GregorianCalendar class silently ignores invalid years!

Constricted the search tolerance from 1 second to 0.01
seconds for the seasons search, to ensure more consistent
behavior.

Fixed a bug in the Kotlin search() function's
quadratic interpolation that was causing the convergence
to be slower than it should have been.
2022-04-08 16:51:09 -04:00
Don Cross
4e6cb282f5 Use original Pluto gravsim with finer time steps.
I'm getting much better accuracy sticking with my original
gravity simulator, just with smaller time increments, than
I was with the Runge-Kutta 4 method. The PlutoStateTable
gets a bit larger (51 state vectors instead of 41), but the
accuracy is so much higher.

Removed the Runge-Kutta code because I won't be going back to it.
2021-11-12 16:22:14 -05:00
Don Cross
7db556046b Calendar demo: planet constellations. 2021-05-16 13:32:19 -04:00
Don Cross
d5fb13d35c I forgot to check in updated calendar output. 2021-05-16 13:18:00 -04:00
Don Cross
d950eaaa55 Calendar demo: planet perihelion and aphelion. 2021-05-16 12:15:24 -04:00
Don Cross
d87a42446f Calendar demo: added lunar apogee and perigee. 2021-05-16 12:04:18 -04:00
Don Cross
08247921b5 Calendar demo: include transits of Mercury and Venus. 2021-05-15 20:45:30 -04:00
Don Cross
3220fb030d Calendar demo: include local solar eclipse predictions. 2021-05-15 20:32:29 -04:00
Don Cross
51235fbffd Calendar demo: include lunar eclipse predictions. 2021-05-15 20:00:55 -04:00
Don Cross
37c35737af Calendar enumerator demo: find times when Venus appears brightest. 2021-05-13 20:22:44 -04:00
Don Cross
629317e9ff Calendar enumerator demo: max elongations of Mercury and Venus.
Added event enumerators for when Mercury and Venus appear
at the maximum angle from the Sun as seen from the Earth.
2021-05-13 20:06:39 -04:00
Don Cross
31b71ac97f Calendar enumerator: added planetary conjunctions and oppositions.
The calendar enumerator demo now includes inferior and superior
conjunctions of the inner planets (Mercury and Venus), along
with the conjunctions and oppositions of the outer planets
(Mars ... Pluto).
2021-05-13 19:32:03 -04:00
Don Cross
953ffef7a8 Calendar demo: added a moon quarter enumerator.
Added MoonQuarterEnumerator, which finds new moon, first quarter,
full moon, and third quarter events.
Changed the calendar start date to May 2021, so it is
more relevant to the time I'm testing it.
2021-05-12 19:54:09 -04:00
Don Cross
04ebd129dd Calendar demo now includes seasons. Also goes for 10 years instead of 1.
Generate solstices and equinoxes in the calendar event enumerator.
Generate 10 years of data instead of 1, to better test the seasons.
2021-05-12 19:37:34 -04:00
Don Cross
03f4e91bb9 Rough demo for how calendar enumerator will work.
This is an example of how multiple enumerators can be combined
into an EventCollator. The collator does the minimum amount
of work to keep searching for one event at a time, while always
emitting them in chronological order.
2021-05-12 19:00:21 -04:00