Commit Graph

1683 Commits

Author SHA1 Message Date
Don Cross
b9db79c6fd JS gravsim: partial completion of unit tests
Implemented half of the GravitySimulator unit tests.
Fixed a bug in the GravitySimulator constructor.

Did some refactoring of test.js:

- Wrote Debug() function as shortcut for conditional output.
- Created generic JPL Horizons state file reader.
2022-05-18 21:14:49 -04:00
Don Cross
26575066fc JS gravsim: work in progress.
Mostly coded, but unit tests not written yet.
2022-05-18 19:52:11 -04:00
Don Cross
f014d13910 C# gravsim: finished implementation.
Unit tests are complete and verified for the C# gravity simulator.
I found and fixed one bug in the GravitySimulator constructor.
2022-05-17 17:20:30 -04:00
Don Cross
019a8f51d4 C# gravsim: first draft of GravitySimulator.Update
Wrote the C# version of GravitySimulator.Update.
Not yet tested.
2022-05-17 15:12:53 -04:00
Don Cross
6a5d04b825 C# gravsim: work in progress
Starting the C# version of class GravitySimulator.
There are no unit tests for it yet.

Added a fix to the C# markdown generator `csdown`
to show `void` as a function return type.
This is the first time I have had any function
in the C# version of Astronomy Engine that has
a void return type!

Fixed and improved documentation in the Kotlin version
of the gravity simulator. Fixed some comments too.
2022-05-17 10:31:42 -04:00
Don Cross
f40b96c237 Kotlin gravsim: finished unit tests.
The Kotlin version of class GravitySimulator is working.
Finished the same unit tests that are present in the C
version of the gravity simulator.
2022-05-15 21:44:22 -04:00
Don Cross
28698cdd6b Kotlin gravsim: some unit tests passing. 2022-05-15 21:08:04 -04:00
Don Cross
b30a54587f Kotlin gravsim: more work in progress.
Added the function GravitySimulator.update().
Not yet tested.
2022-05-15 17:28:18 -04:00
Don Cross
efb59436c1 Kotlin gravsim: work in progress
Started implementing class GravitySimulator,
but it is not finished yet.
2022-05-15 05:02:38 -04:00
Don Cross
026d558fe5 C gravsim: minor code cleanup 2022-05-13 20:17:03 -04:00
Don Cross
636c4196bb C gravsim: added more functions
Added the following functions:

    GravSimTime
    GravSimNumBodies
    GravSimOrigin
    GravSimSwap

The GravSimSwap function allows an instantaneous "undo"
of a simulation step, which required refactoring the internal
data structures of the simulator. I did this because I realized
I needed a way to undo exploration of time steps near a fixed
current time. This will make it easier to implement a
light travel time solver.
2022-05-13 13:38:25 -04:00
Don Cross
7c87cc9e11 C gravsim: unit test Halley's comet. 2022-05-12 21:46:05 -04:00
Don Cross
a76ce48de9 C gravsim: test Bennu orbit. 2022-05-12 21:35:00 -04:00
Don Cross
9aa4e90cc8 Added unit test for Astronomy_GravSimBodyState. 2022-05-12 21:14:58 -04:00
Don Cross
707e35381f C gravsim: unit test was slightly sloppy with time
I was using a UT calculation where I should have used TT.
All of the JPL Horizons state vector input files are
expressed in TT. I found I was a few microseconds off,
which has no measurable effect, but I thought I would
do the time calculations the absolutely correct way.
2022-05-12 20:03:27 -04:00
Don Cross
d250d17a9f C gravsim: more accurate SSB.
Replaced the piecemeal calculation of solar system
bodies with a unified approach that accounts for
all planets in the SSB calculation. This does improve
accuracy noticeably:

$ ./ctest -v gravsim
C GravSimFile(barystate/Ceres.txt   ): PASS (count = 731, pos error =  0.6640 arcmin, vel error =  0.6225 arcmin)
C GravSimFile(barystate/Pallas.txt  ): PASS (count = 731, pos error =  0.4687 arcmin, vel error =  0.3474 arcmin)
C GravSimFile(barystate/Vesta.txt   ): PASS (count = 731, pos error =  0.5806 arcmin, vel error =  0.5462 arcmin)
C GravSimFile(barystate/Juno.txt    ): PASS (count = 731, pos error =  0.6760 arcmin, vel error =  0.5749 arcmin)
C GravSimFile(heliostate/Ceres.txt  ): PASS (count = 731, pos error =  0.0444 arcmin, vel error =  0.0355 arcmin)
C GravSimFile(heliostate/Pallas.txt ): PASS (count = 731, pos error =  0.1062 arcmin, vel error =  0.0853 arcmin)
C GravSimFile(heliostate/Vesta.txt  ): PASS (count = 731, pos error =  0.1432 arcmin, vel error =  0.1308 arcmin)
C GravSimFile(heliostate/Juno.txt   ): PASS (count = 731, pos error =  0.1553 arcmin, vel error =  0.1328 arcmin)
C GravSimFile(geostate/Ceres.txt    ): PASS (count = 731, pos error =  6.5689 arcmin, vel error =  6.4797 arcmin)
C GravSimFile(geostate/Pallas.txt   ): PASS (count = 731, pos error =  9.3287 arcmin, vel error =  7.3532 arcmin)
C GravSimFile(geostate/Vesta.txt    ): PASS (count = 731, pos error =  3.2980 arcmin, vel error =  3.8862 arcmin)
C GravSimFile(geostate/Juno.txt     ): PASS (count = 731, pos error =  6.0961 arcmin, vel error =  7.7147 arcmin)
C GravitySimulatorTest: PASS (pos score = 9.3287 arcmin, vel score = 7.7147 arcmin)

One curious thing: I don't understand why the heliocentric errors are so small
compared to the barycentric errors. I would have expected the opposite.
This deserves further attention!
2022-05-12 17:39:01 -04:00
Don Cross
f6ae31c619 C gravsim: removed option parameter.
I have decided the ability to select different
collections of gravitating bodies causes far
more complexity in the code than it is worth.

So now the gravity simulator always calculates
the Sun and all planets except Pluto.
This greatly simplifies the core code, gets
a good balance between efficiency and accuracy,
and makes the test matrix much simpler.
2022-05-12 13:35:13 -04:00
Don Cross
3b534bcac1 C gravsim: more efficient GravSimOriginState.
The GravSimOriginState function was doing too
much work for bodies that weren't already calculated
and cached. Instead of always calling Astronomy_BaryState,
it is possible to do a lot less work for most bodies
by recycling the SSB calculation that has already
been done.

Other minor code cleanup -- mostly stuff that makes
the code easier to read and understand.
2022-05-11 13:21:03 -04:00
Don Cross
b2c69ddcfd C gravsim: bug fixes, flexible origin body.
Added an extra parameter `originBody` when creating
a new gravity simulator. This defines the
body center used as a coordinate origin for
both input state vectors and output state vectors.
This allows the caller to do everything in barycentric,
heliocentric, geocentric, or planetocentric coordinates.
This is important to avoid redundant calculations,
since we already have to calculate most/all of the
Solar System bodies anyway.

Fixed a bug: the unit tests were not using the `option`
parameter that was supposed to be passed to
Astronomy_GravSimInit. It was always using the GRAVSIM_ALL_PLANETS
option, which is why the tests always calculated the same answers.

The way I was measuring error was a little dodgy.
I reworked it to work without assuming anything about
the struct layout of astro_state_vector_t in memory.
I also always made it measure relative error converted
into arcminutes, so it is easier for me to understand
the numbers.

There are still excessively large calculation errors
that need to be debugged, so this is a work in progress.

$ ./ctest gravsim
C GravSimFile(0 : barystate/Ceres.txt   ): PASS (count = 731, pos error =  1.8348 arcmin, vel error =  1.7127 arcmin)
C GravSimFile(0 : barystate/Pallas.txt  ): PASS (count = 731, pos error =  1.7055 arcmin, vel error =  1.3432 arcmin)
C GravSimFile(0 : barystate/Vesta.txt   ): PASS (count = 731, pos error =  1.5655 arcmin, vel error =  1.4338 arcmin)
C GravSimFile(0 : barystate/Juno.txt    ): PASS (count = 731, pos error =  1.1724 arcmin, vel error =  0.8732 arcmin)
C GravSimFile(1 : barystate/Ceres.txt   ): PASS (count = 731, pos error =  0.5821 arcmin, vel error =  0.5398 arcmin)
C GravSimFile(1 : barystate/Pallas.txt  ): PASS (count = 731, pos error =  0.4566 arcmin, vel error =  0.3327 arcmin)
C GravSimFile(1 : barystate/Vesta.txt   ): PASS (count = 731, pos error =  0.8185 arcmin, vel error =  0.7616 arcmin)
C GravSimFile(1 : barystate/Juno.txt    ): PASS (count = 731, pos error =  0.3206 arcmin, vel error =  0.2692 arcmin)
C GravSimFile(2 : barystate/Ceres.txt   ): PASS (count = 731, pos error =  0.5821 arcmin, vel error =  0.5398 arcmin)
C GravSimFile(2 : barystate/Pallas.txt  ): PASS (count = 731, pos error =  0.4566 arcmin, vel error =  0.3327 arcmin)
C GravSimFile(2 : barystate/Vesta.txt   ): PASS (count = 731, pos error =  0.8185 arcmin, vel error =  0.7616 arcmin)
C GravSimFile(2 : barystate/Juno.txt    ): PASS (count = 731, pos error =  0.3206 arcmin, vel error =  0.2692 arcmin)
C GravSimFile(0 : heliostate/Ceres.txt  ): PASS (count = 731, pos error =  0.0692 arcmin, vel error =  0.0659 arcmin)
C GravSimFile(0 : heliostate/Pallas.txt ): PASS (count = 731, pos error =  1.0762 arcmin, vel error =  0.8765 arcmin)
C GravSimFile(0 : heliostate/Vesta.txt  ): PASS (count = 731, pos error =  4.6165 arcmin, vel error =  4.2126 arcmin)
C GravSimFile(0 : heliostate/Juno.txt   ): PASS (count = 731, pos error =  1.0013 arcmin, vel error =  0.7634 arcmin)
C GravSimFile(1 : heliostate/Ceres.txt  ): PASS (count = 731, pos error =  1.2524 arcmin, vel error =  1.1585 arcmin)
C GravSimFile(1 : heliostate/Pallas.txt ): PASS (count = 731, pos error =  2.3224 arcmin, vel error =  1.8889 arcmin)
C GravSimFile(1 : heliostate/Vesta.txt  ): PASS (count = 731, pos error =  2.2375 arcmin, vel error =  2.0198 arcmin)
C GravSimFile(1 : heliostate/Juno.txt   ): PASS (count = 731, pos error =  0.4975 arcmin, vel error =  0.4193 arcmin)
C GravSimFile(2 : heliostate/Ceres.txt  ): PASS (count = 731, pos error =  1.2524 arcmin, vel error =  1.1585 arcmin)
C GravSimFile(2 : heliostate/Pallas.txt ): PASS (count = 731, pos error =  2.3224 arcmin, vel error =  1.8889 arcmin)
C GravSimFile(2 : heliostate/Vesta.txt  ): PASS (count = 731, pos error =  2.2375 arcmin, vel error =  2.0198 arcmin)
C GravSimFile(2 : heliostate/Juno.txt   ): PASS (count = 731, pos error =  0.4975 arcmin, vel error =  0.4192 arcmin)
C GravSimFile(0 : geostate/Ceres.txt    ): PASS (count = 731, pos error =  6.5958 arcmin, vel error =  6.5102 arcmin)
C GravSimFile(0 : geostate/Pallas.txt   ): PASS (count = 731, pos error = 11.1674 arcmin, vel error =  8.7643 arcmin)
C GravSimFile(0 : geostate/Vesta.txt    ): PASS (count = 731, pos error = 10.6710 arcmin, vel error = 12.7938 arcmin)
C GravSimFile(0 : geostate/Juno.txt     ): PASS (count = 731, pos error =  7.3953 arcmin, vel error =  9.4322 arcmin)
C GravSimFile(1 : geostate/Ceres.txt    ): PASS (count = 731, pos error =  8.5754 arcmin, vel error =  8.4810 arcmin)
C GravSimFile(1 : geostate/Pallas.txt   ): PASS (count = 731, pos error = 13.2944 arcmin, vel error = 10.4513 arcmin)
C GravSimFile(1 : geostate/Vesta.txt    ): PASS (count = 731, pos error =  7.1130 arcmin, vel error =  8.4571 arcmin)
C GravSimFile(1 : geostate/Juno.txt     ): PASS (count = 731, pos error =  5.5835 arcmin, vel error =  7.0996 arcmin)
C GravSimFile(2 : geostate/Ceres.txt    ): PASS (count = 731, pos error =  8.5754 arcmin, vel error =  8.4810 arcmin)
C GravSimFile(2 : geostate/Pallas.txt   ): PASS (count = 731, pos error = 13.2944 arcmin, vel error = 10.4513 arcmin)
C GravSimFile(2 : geostate/Vesta.txt    ): PASS (count = 731, pos error =  7.1130 arcmin, vel error =  8.4571 arcmin)
C GravSimFile(2 : geostate/Juno.txt     ): PASS (count = 731, pos error =  5.5835 arcmin, vel error =  7.0996 arcmin)
C GravitySimulatorTest: PASS (pos score = 13.2944 arcmin, vel score = 12.7938 arcmin)
2022-05-10 21:20:05 -04:00
Don Cross
26be8028ef C gravsim test: fixed memory leak. 2022-05-09 22:03:35 -04:00
Don Cross
49bb9bfbfa C gravsim: test all options, more asteroids
Now testing all 4 major asteroids:
Ceres, Pallas, Vesta, Juno.

Test all 3 simulation options.
Interestingly, it doesn't seem to matter much
whether I include the 4 inner planets or not.
I guess they are too small and too far away
from the asteroid belt.

Asteroids are probably difficult to calculate accurately
over long time spans, so I generated replacement
test data from JPL Horizons. Instead of trying to
cover the years 1800..2200, I cover the much smaller
range 2020..2040.

C GravSimFile(0 : barystate/Ceres.txt ): PASS (max_rdiff = 4.347e-04, max_vdiff = 1.733e-06)
C GravSimFile(0 : barystate/Pallas.txt): PASS (max_rdiff = 2.826e-04, max_vdiff = 1.263e-06)
C GravSimFile(0 : barystate/Vesta.txt ): PASS (max_rdiff = 5.201e-04, max_vdiff = 2.703e-06)
C GravSimFile(0 : barystate/Juno.txt  ): PASS (max_rdiff = 2.162e-04, max_vdiff = 1.063e-06)
C GravSimFile(1 : barystate/Ceres.txt ): PASS (max_rdiff = 4.347e-04, max_vdiff = 1.733e-06)
C GravSimFile(1 : barystate/Pallas.txt): PASS (max_rdiff = 2.826e-04, max_vdiff = 1.263e-06)
C GravSimFile(1 : barystate/Vesta.txt ): PASS (max_rdiff = 5.201e-04, max_vdiff = 2.703e-06)
C GravSimFile(1 : barystate/Juno.txt  ): PASS (max_rdiff = 2.162e-04, max_vdiff = 1.063e-06)
C GravSimFile(2 : barystate/Ceres.txt ): PASS (max_rdiff = 4.347e-04, max_vdiff = 1.733e-06)
C GravSimFile(2 : barystate/Pallas.txt): PASS (max_rdiff = 2.826e-04, max_vdiff = 1.263e-06)
C GravSimFile(2 : barystate/Vesta.txt ): PASS (max_rdiff = 5.201e-04, max_vdiff = 2.703e-06)
C GravSimFile(2 : barystate/Juno.txt  ): PASS (max_rdiff = 2.162e-04, max_vdiff = 1.063e-06)
C GravitySimulatorTest: PASS
2022-05-09 21:08:18 -04:00
Don Cross
b31a66eba8 C gravity simulator: work in progress
Starting implementation of a generalized gravity simulator.
Already calculating the movement of Ceres, but with less
accuracy than I had hoped. I don't know if the lack of modeling
pull of the other asteroids has a larger effect than I expected,
or there is just something wrong with the implementation.
2022-05-09 17:13:51 -04:00
Don Cross
415fed6562 Added JPL Horizon data for asteroids and comets.
I'm preparing to create a generalized gravity simulator
for small bodies moving through the Solar System
under the influence of the Sun and planets.

Adding JPL Horizons data for 1 comet and 5 asteroids:

    Comet 1P/Halley
    Ceres
    Juno
    Pallas
    Vesta
    101955 Bennu

Halley was chosen as an object with a highly eccentric orbit.

Bennu was chosen as a member of the inner solar system, where
Earth and Mars are likely to have strong effects.

The remaining 4 major asteroids were chosen as typical members
of the asteroid belt between Mars and Jupiter.
2022-05-08 16:37:41 -04:00
Don Cross
6abce518f6 C#: added iterator helper functions
Added the following iterator functions that wrap
search/next pairs of functions:

    GlobalSolarEclipsesAfter
    LocalSolarEclipsesAfter
    LunarApsidesAfter
    LunarEclipsesAfter
    MoonNodesAfter
    MoonQuartersAfter
    PlanetApsidesAfter
    TransitsAfter

I updated the following C# demos:

    moonphase.cs     ==> MoonQuartersAfter
    lunar_eclipse.cs ==> LunarEclipsesAfter

Fixed an issue in the C# Markdown generator
so that it can now handle generic types like
`IEnumerable<MoonQuarterInfo>`.
2022-05-07 13:02:42 -04:00
Don Cross
c9b6f76761 Windows doxygen was updated from v1.9.3 to v1.9.4.
Doxygen 1.9.3 binary for Windows is no longer available,
but 1.9.4 is available. This resolves broken build for Windows (I hope).
2022-05-06 22:03:17 -04:00
Don Cross
5676049596 Kotlin: added iterator helper functions
Added the following iterator functions that wrap
search/next pairs of functions:

    globalSolarEclipsesAfter
    localSolarEclipsesAfter
    lunarApsidesAfter
    lunarEclipsesAfter
    moonNodesAfter
    moonQuartersAfter
    planetApsidesAfter
    transitsAfter

I updated the following Kotlin demos:

    MoonPhase.kt    ==> moonQuartersAfter
    LunarEclipse.kt ==> lunarEclipsesAfter

However, I have not yet figured out how to use these
functions in the corresponding Java demos.
2022-05-06 21:52:27 -04:00
Don Cross
6add6b877a JS: Added enum ApsisKind to replace integers. 2022-05-05 17:11:41 -04:00
Don Cross
5ad71cb702 JS: Replace strings with new enum EclipseKind. 2022-05-05 16:39:51 -04:00
Don Cross
ac7bc9c919 Kotlin: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 13:01:19 -04:00
Don Cross
66eeb3e0a0 Python: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.

Also added operator overloads for adding and
subtracting StateVector, just like we already had
for Vector.
2022-05-05 12:39:39 -04:00
Don Cross
af63d1520f JavaScript: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 12:10:33 -04:00
Don Cross
50c4099184 C#: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 11:38:55 -04:00
Don Cross
2247084943 C/C++: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 10:26:25 -04:00
Don Cross
0151df1b83 Update Kotlin main README, insert version.
Automatically copy the version number from the gradle
settings file into the README. Cleaned up the README.
2022-05-04 21:14:49 -04:00
Don Cross
bdb28eee2e Kotlin demo: rise/set/culmination
Added Kotlin demo to search for rise/set/culmination
of the Sun and Moon.

Enhanced the Time class to allow it to be
directly compared and sorted.
2022-05-03 21:09:56 -04:00
Don Cross
1e84f4940f Demo jupiter_moons for Kotlin, Java.
Added Kotlin and Java demos for calculating Jupiter's moons.
Illustrates correcting for light travel time.
I added named getters for the 4 moons in `JupiterMoonsInfo`,
because in Java it was really ugly to write
`jm.getMoon()[0]`, etc.
2022-05-02 15:45:10 -04:00
Don Cross
f670ae2127 Added Kotlin demo: jupiter_moons.
I had to add a new method `Vector.withTime` to work around
the error checking that throws an exception if vectors
from different times are added.

Also made Kotlin constants public:

    MINUTES_PER_DAY
    SECONDS_PER_DAY
    MILLISECONDS_PER_DAY
2022-05-02 14:57:16 -04:00
Don Cross
90aa6ed369 Cleaned up GitHub Actions configuration.
Deleted the do-nothing placeholders for installing
the Kotlin Native compiler. We are not going to support
Kotlin Native for now.

Removed redundant installation of pylint from the
Windows commit_hook.bat.

Other batch file cleanup, now that I know "||" works in Windows.
2022-05-02 12:30:23 -04:00
Don Cross
eac8582418 Test Kotlin demos in Windows. 2022-05-01 19:48:18 -04:00
Don Cross
5cb273ceed Starting to add Kotlin demos.
Just like we have Java demos that use the Kotlin
version of Astronomy Engine, I want equivalent
demos in Kotlin.
2022-05-01 16:39:14 -04:00
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
Ebrahim Byagowi
962b9c7c9c kotlin: Revert and use arrayOf directly
Direct use of arrayOf can be a bit more efficient than calling map and toTypedArray.

It could be faster if JupiterMoonsInfo was holding a list but better to use direct
typed array initializer for more efficiency.
2022-04-28 19:10:35 +04:30
Ebrahim Byagowi
abd48a3e2b kotlin: Use hashMapOf instead mutableMapOf
mutableMapOf guarantees order of insertion and hashMapOf don't and
as it doesn't matter here let's use that instead.
2022-04-28 18:58:39 +04:30
Don Cross
462f172e6d Kotlin: restored original series calculations.
Changing series calculations to use `sumOf` caused
test failures for Jupiter's moons, compared to the other
languages. I don't understand why, but it is losing about
5 decimal places of accuracy:

    First  file: temp/c_check.txt
    Second file: temp/k_check.txt
    Tolerance = 6.700e-15

                lnum                 a_value                 b_value     factor       diff  name
      OK       59558 -3.7992709399390907e-04 -3.7992709399390658e-04  411.52263  1.026e-15  helio_x
      OK       70088 -1.2672603312645981e-03 -1.2672603312646005e-03  411.52263  9.816e-16  helio_y
      OK      122819  1.0937502621531685e-04  1.0937502621531790e-04  411.52263  4.294e-16  helio_z
      OK        2427  2.0269124415104024e+01  2.0269124415104031e+01    0.01730  1.229e-16  sky_j2000_ra
      OK       96711 -1.3269907232295576e+01 -1.3269907232295552e+01    0.00556  1.382e-16  sky_j2000_dec
      OK      321094  1.9426425943521761e+00  1.9426425943521755e+00    2.61780  1.744e-15  sky_j2000_dist
      OK      302748  3.5388201408771312e+02  3.5388201408771533e+02    0.00275  6.086e-15  sky_hor_az
      OK      121119 -2.2454039277279009e+01 -2.2454039277279151e+01    0.00556  7.895e-16  sky_hor_alt
    FAIL      462886  3.2838700693197847e-05  3.2838701021405780e-05  354.60993  1.164e-10  jm_x
    FAIL       18898  4.1298198258838197e-05  4.1298197961707834e-05  354.60993  1.054e-10  jm_y
    FAIL       18898  6.5401658638156675e-05  6.5401658496812707e-05  354.60993  5.012e-11  jm_z
    FAIL       18898 -1.9369714715980919e-04 -1.9369714599049137e-04  100.00000  1.169e-10  jm_vx
    FAIL      462886  2.0741129523130840e-04  2.0741129628185288e-04  100.00000  1.051e-10  jm_vy
    FAIL      462886 -7.0200557604537683e-05 -7.0200557103467577e-05  100.00000  5.011e-11  jm_vz

    Score = 1.169e-10
    ctest(Diff): EXCEEDED ERROR TOLERANCE.

Restored the original loop logic and now it is back within tolerance:

    First  file: temp/c_check.txt
    Second file: temp/k_check.txt
    Tolerance = 6.700e-15

                lnum                 a_value                 b_value     factor       diff  name
      OK       59558 -3.7992709399390907e-04 -3.7992709399390658e-04  411.52263  1.026e-15  helio_x
      OK       70088 -1.2672603312645981e-03 -1.2672603312646005e-03  411.52263  9.816e-16  helio_y
      OK      122819  1.0937502621531685e-04  1.0937502621531790e-04  411.52263  4.294e-16  helio_z
      OK        2427  2.0269124415104024e+01  2.0269124415104031e+01    0.01730  1.229e-16  sky_j2000_ra
      OK       96711 -1.3269907232295576e+01 -1.3269907232295552e+01    0.00556  1.382e-16  sky_j2000_dec
      OK      321094  1.9426425943521761e+00  1.9426425943521755e+00    2.61780  1.744e-15  sky_j2000_dist
      OK      302748  3.5388201408771312e+02  3.5388201408771533e+02    0.00275  6.086e-15  sky_hor_az
      OK      121119 -2.2454039277279009e+01 -2.2454039277279151e+01    0.00556  7.895e-16  sky_hor_alt
      OK       92717  4.1268347083494783e-03  4.1268347083494774e-03  223.21429  1.936e-16  jm_x
      OK       45091 -8.0149190392649894e-03 -8.0149190392649929e-03   79.42812  2.756e-16  jm_y
      OK      135377  1.5470777280065808e-03  1.5470777280065804e-03  223.21429  9.680e-17  jm_z
      OK      216836  4.5725777238332412e-03  4.5725777238332394e-03  126.58228  2.196e-16  jm_vx
      OK      351647  5.1351566793199944e-03  5.1351566793199962e-03  126.58228  2.196e-16  jm_vy
      OK      351647  2.5217607180929289e-03  2.5217607180929298e-03  126.58228  1.098e-16  jm_vz

    Score = 6.086e-15
2022-04-27 21:18:29 -04:00
Ebrahim Byagowi
7ab343e7d4 kotlin: Avoide code duplication in jupiterMoons by using map 2022-04-28 03:42:01 +04:30
Ebrahim Byagowi
474cffccac kotlin: Use sumOf where possible
As sumOf is inline in Kotlin it supposed to have the same performance.
2022-04-28 02:42:23 +04:30
Ebrahim Byagowi
6789c64343 kotlin: Use idiomatic way to create mutable objects 2022-04-28 01:57:38 +04:30
Ebrahim Byagowi
2fe4c8abf4 kotlin: Use single format instead multiple calls 2022-04-28 01:37:35 +04:30
Ebrahim Byagowi
d2485392c3 kotlin: Use getOrPut to facilitate use of cache 2022-04-28 01:19:36 +04:30
Don Cross
53f5540f09 Kotlin: cleanup of code and documentation.
Used IntelliJ IDEA's linter to perform code cleanup.
There were unused variables, `var` that could be replaced with `val`,
and other minor code style issues.

While doing this, I also discovered that a lot of documentation
links were broken. The fix is to stop intenting the text after
a `@param`.
2022-04-27 14:04:42 -04:00